/** * @param FunctionalTester $I */ public function testView(FunctionalTester $I) { $I->wantTo('ensure that post view works'); $I->amOnPage(Url::to(['/post/view', 'id' => 1])); $I->see('Sample Post', 'h1'); $I->amOnPage(Url::to(['/post/view', 'slug' => 'sample-post'])); $I->see('Sample Post', 'h1'); }
public function testArticleView(FunctionalTester $I) { $I->amOnPage(['article/view', 'slug' => 'test-article-1']); $I->canSee('Test Article 1', 'h1'); $I->canSee('Lorem ipsum'); $I->canSeeElement("//a[contains(@href,'attachment-download')]"); $I->amOnPage(['article/view', 'slug' => 'unknown-article']); $I->canSee('404'); }
public function testArticleView(FunctionalTester $I) { $I->amOnPage(['article/view', 'slug' => 'test-article-1']); $I->canSee('Test Article 1', 'h1'); $I->canSee('Lorem ipsum'); $I->canSeeLink('Test File', 'http://example.org/test-file.png'); $I->amOnPage(['article/view', 'slug' => 'unknown-article']); $I->canSee('404'); }
/** * @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'); }
<?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.');
/** * @param FunctionalTester $I */ public function testSearch(FunctionalTester $I) { $I->wantTo('ensure that search page works'); $I->amOnPage(\Yii::$app->homeUrl); $I->submitForm('#sidebar .form-search', ['s' => 'test12345qwerty']); if (method_exists($I, 'wait')) { $I->wait(3); } $I->see('Not Found (#404)', 'h1'); $I->submitForm('#sidebar .form-search', ['s' => 'sample post']); if (method_exists($I, 'wait')) { $I->wait(3); } $I->seeLink('Sample Post'); }