/** * @param FunctionalTester $I */ public function testIndex(FunctionalTester $I) { $I->wantTo('ensure that home works'); $I->amOnPage(\Yii::$app->homeUrl); $I->seeLink('Sample Post'); $I->seeLink('Sample Page'); }
/** * @param FunctionalTester $I */ public function testView(FunctionalTester $I) { $I->wantTo('ensure that term view page works'); $I->amOnPage(Url::to(['/term/view', 'id' => 1])); $I->see('Category: Sample Category', 'h1'); $I->seeLink('Sample Post'); $I->amOnPage(Url::to(['/term/view', 'termslug' => 'sample-category'])); $I->see('Category: Sample Category', 'h1'); $I->seeLink('Sample Post'); }
/** * @param FunctionalTester $I */ public function testView(FunctionalTester $I) { $I->wantTo('ensure that user view page works'); $I->amOnPage(Url::to(['/user/view', 'id' => 1])); $I->see('All Posts By Super Administrator', 'h1'); $I->seeLink('Sample Post'); $I->amOnPage(Url::to(['/user/view', 'user' => 'superadmin'])); $I->see('All Posts By Super Administrator', 'h1'); $I->seeLink('Sample Post'); }
/** * @param FunctionalTester $I */ public function testView(FunctionalTester $I) { $I->wantTo('ensure that view media works'); $I->amOnPage(Url::to(['/media/view', 'id' => 1])); $I->see('Test Media', 'h1'); $I->seeLink('Test Media'); $I->amOnPage(Url::to(['/media/view', 'slug' => 'test-media'])); $I->see('Test Media', 'h1'); $I->seeLink('Test Media'); }
/** * @param FunctionalTester $I */ public function testIndex(FunctionalTester $I) { $I->wantTo('ensure that index post works'); $I->amOnPage(Url::to(['/post/index', 'id' => '1'])); $I->seeLink('Sample Post'); $I->click('Sample Post'); $I->see('Sample Post', 'h1'); }
<?php use tests\codeception\frontend\FunctionalTester; $I = new FunctionalTester($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 use tests\codeception\frontend\FunctionalTester; /* @var $scenario Codeception\Scenario */ $I = new FunctionalTester($scenario); $I->wantTo('ensure that home page works'); $I->amOnPage(Yii::$app->homeUrl); $I->see('My Yii Application'); $I->seeLink('Sing in'); $I->click('Sing in'); $I->see('Sign in to start your session');
<?php use tests\codeception\frontend\FunctionalTester; /* @var $scenario Codeception\Scenario */ $I = new FunctionalTester($scenario); $I->wantTo('ensure that home page works'); $I->amOnPage(Yii::$app->homeUrl); $I->see('Реклама'); $I->seeLink('Вход'); $I->click('Вход'); $I->see('Авторизация');