示例#1
0
<?php

$I = new WebGuy($scenario);
$I->wantTo('ensure that home page works');
$I->amOnPage(Yii::$app->homeUrl);
$I->see('My Company');
$I->seeLink('About');
$I->click('About');
$I->see('This is the About page.');
<?php

$I = new WebGuy($scenario);
$I->wantTo('install component/module/plugin');
// Direct install URL call
$I->amOnPage('/administrator/index.php?option=com_installer');
// Login first
$I->fillField("#mod-login-username", 'TestAdmin');
$I->fillField("#mod-login-password", 'PassAdmin');
$I->click('Log in');
// Where i want to be
$I->see('Extension Manager: Install');
// Move "directory tab" into foreground
$I->seeLink('Install from Directory');
$I->click('Install from Directory');
// -> find input button (Can be found twice)
// <div id="directory"
//     <fieldset class="uploadform">
//         <div class="form-actions">
//             <input class="btn btn-primary" type="button" onclick="Joomla.submitbutton3()" value="Install">
$I->seeElement('#directory > fieldset > div > input');
$I->click('#directory > fieldset > div > input');
$I->see('was successful');
<?php

$I = new WebGuy($scenario);
$I->wantTo('find facebook/php-webdriver on GitHub');
$I->amOnPage('/');
$I->fillField('.js-site-search-focus', 'php-webdriver');
$I->pressKey('.js-site-search-focus', WebDriverKeys::ENTER);
$I->seeLink('facebook', '/facebook/php-webdriver');
示例#4
0
<?php

$I = new WebGuy($scenario);
use Codeception\Util\Locator;
$I->wantTo('sing in google');
$I->amOnPage('/');
$I->see('Увійти');
$I->click('Увійти');
$I->appendField('#Email', 'anton.sylantiev');
$I->seeInField('#Email', 'anton.sylantiev');
$I->see('Один обліковий запис. Усі сервіси Google.');
$I->see('Один обліковий запис Google для всіх служб Google');
$I->seeLink('Потрібна допомога?');
$I->see('Створити обліковий запис');
$I->seeElement("//*[@id='next']");
$I->click('Далі');
$I->seeCheckboxIsChecked('#PersistentCookie');
$I->see('Забули пароль?');
include 'const.php';
$I->fillField('Пароль', $pass);
$I->see('Увійти');
$I->click('Увійти');
$I->see('Anton');
$I->click(".//*[@id='gbw']/div/div/div[2]/div[4]/div[1]/a/span");
$I->see('Anton Sylantiev');
$I->see('*****@*****.**');