示例#1
0
<?php

$I = new TestGuy($scenario);
$I->wantTo('ensure that home page works');
$I->amOnPage('');
$I->see('My Company');
$I->seeLink('About');
$I->click('About');
$I->see('This is the About page.');
示例#2
0
<?php

use Codeception\Util\Fixtures;
/** @type \Codeception\Scenario $scenario */
$scenario->groups('internals', 'content', 'update');
\Yii::app()->fixtureManager->prepare();
$I = new TestGuy($scenario);
$I->am('Dr. Jan Itor');
$I->wantTo('Update my nickname and see fancy cascade of nickname update in ' . 'previous comments');
$login = Fixtures::get('data:users[0]:login');
$password = Fixtures::get('data:users[0]:password');
$I->amOnPage(\LoginPage::$url);
$I->submitForm(\LoginPage::$formSelector, array(\LoginPage::$loginField => $login, \LoginPage::$passwordField => $password));
$I->amOnPage(\BlogFeedPage::$url);
$I->click(\BlogFeedPage::$postTitleSelector);
$url = $I->grabFromCurrentUrl();
$I->submitForm(\PostPage::$commentForm, array(\PostPage::$commentTextArea => 'sample comment'));
$newUsername = md5(microtime());
$I->amOnPage(\ProfilePage::$url);
$I->submitForm(\ProfilePage::$usernameUpdateFormSelector, array(\ProfilePage::$usernameField => $newUsername));
$I->see('profile.usernameUpdate.success');
$I->amOnPage($url);
$I->seeLink('@' . $newUsername);
\Yii::app()->fixtureManager->prepare();
示例#3
0
<?php

$I = new TestGuy($scenario);
$I->wantTo('保证site/index页面正常工作');
$I->amOnPage(Yii::$app->homeUrl);
$I->seeLink('Yii2 Blog');
$I->seeLink('首页');
$I->seeLink('yii2-blog说明');
$I->click('yii2-blog说明');
$I->see('yii2-blog说明');
示例#4
0
<?php

$I = new TestGuy($scenario);
$I->wantTo('ensure that home page works');
$I->amOnPage(Yii::$app->homeUrl);
$I->seeLink('Sllite.ru');
$I->seeLink('Home');
$I->seeLink('Blog');
$I->seeLink('Contact');
$I->seeLink('Login');
$I->seeLink('Signup');
$I->click('About');
$I->see('This is the About page.');