<?php use tests\codeception\_steps\CommonSteps; use tests\codeception\_pages\word\UpdatePage; $I = new CommonSteps($scenario); $I->wantTo('ensure that update works'); UpdatePage::openBy($I, ['id' => 20]); $I->login(); $I->amGoingTo('verify update word form'); $I->seeElement(UpdatePage::$en); $I->seeElement(UpdatePage::$ja); $I->fillField(UpdatePage::$en, ''); $I->fillField(UpdatePage::$ja, ''); $I->click('更新する'); $I->wait(1); $I->see('英単語が入力されていません。', '.help-block'); $I->see('日本語訳が入力されていません。', '.help-block'); $I->fillField(UpdatePage::$en, 'hello'); $I->fillField(UpdatePage::$ja, 'こんにちは'); $I->click('更新する'); $I->wait(1); $I->seeInCurrentUrl('word/index'); $I->see('英単語の更新が完了いたしました。'); $I->amGoingTo('verify updated word'); $I->click(['link' => 'h']); $I->wait(1); $I->see('hello', UpdatePage::$word); $I->amGoingTo('verify action link'); UpdatePage::openBy($I, ['id' => 20]); $I->moveMouseover(UpdatePage::$actionButton); $I->click('Home');
<?php use tests\codeception\_steps\CommonSteps; use tests\codeception\_pages\word\CreatePage; $I = new CommonSteps($scenario); $I->wantTo('ensure that create works'); CreatePage::openBy($I); $I->login(); $I->amGoingTo('verify word form element'); $I->seeElement(CreatePage::$en); $I->seeElement(CreatePage::$ja); $I->amGoingTo('verify word insert form'); $I->click('登録する'); $I->wait(1); $I->see('英単語が入力されていません。', '.help-block'); $I->see('日本語訳が入力されていません。', '.help-block'); $I->fillField(CreatePage::$en, 'hello'); $I->fillField(CreatePage::$ja, 'こんにちは'); $I->click('登録する'); $I->wait(1); $I->seeInCurrentUrl('word/index'); $I->see('英単語の追加が完了いたしました。'); $I->amGoingTo('verify inserted word'); $I->click(['link' => 'Home']); $I->see('hello', CreatePage::$word); $I->moveMouseover(CreatePage::$word); $I->see('こんにちは'); $I->amGoingTo('verify action link'); CreatePage::openBy($I); $I->moveMouseover(CreatePage::$actionButton); $I->click('Home');
<?php use tests\codeception\_steps\CommonSteps; use tests\codeception\_pages\word\DeletePage; $I = new CommonSteps($scenario); $I->wantTo('ensure that delete works'); DeletePage::openBy($I, ['id' => 99999]); $I->login(); $I->amGoingTo('verify 405 error'); $I->see('不正なリクエストです。');
<?php use tests\codeception\_steps\CommonSteps; use tests\codeception\_pages\word\IndexPage; $I = new CommonSteps($scenario); $I->wantTo('ensure that index works'); IndexPage::openBy($I); $I->login(); $I->amGoingTo('verify word'); $I->seeElement(IndexPage::$word); $I->amGoingTo('verify pagination'); $I->click('.pagination .next a'); $I->wait(1); $I->seeInCurrentUrl('word/index?page=2'); $I->seeElement(IndexPage::$word); $I->amGoingTo('verify sort link'); $I->click(['link' => 'a']); $I->seeInCurrentUrl('word/index?sort=a'); $I->wait(1); $I->seeElement(IndexPage::$word); $I->amGoingTo('verify search form'); $I->fillField(['name' => 'search'], 'ab'); $I->click(IndexPage::$search); $I->wait(1); $I->seeInField(['name' => 'search'], 'ab'); $I->seeInCurrentUrl('word/index?search=ab'); $I->amGoingTo('verify update link'); IndexPage::openBy($I); $I->click(['link' => 'Update']); $I->seeInCurrentUrl('word/update'); $I->seeElement(IndexPage::$en);