diff --git a/tests/codeception/_support/AcceptanceTester.php b/tests/codeception/_support/AcceptanceTester.php new file mode 100644 index 0000000..4c7dcbb --- /dev/null +++ b/tests/codeception/_support/AcceptanceTester.php @@ -0,0 +1,26 @@ +wantTo('ensure that about works'); -AboutPage::openBy($I); -$I->see('About', 'h1'); diff --git a/tests/codeception/acceptance/AboutCest.php b/tests/codeception/acceptance/AboutCest.php new file mode 100644 index 0000000..a3cbef6 --- /dev/null +++ b/tests/codeception/acceptance/AboutCest.php @@ -0,0 +1,11 @@ +amOnPage(['site/about']); + $I->amOnPage('index.php?r=site%2Fabout'); + $I->see('About', 'h1'); + } +} diff --git a/tests/codeception/acceptance/HomeCept.php b/tests/codeception/acceptance/HomeCept.php deleted file mode 100644 index 1f93535..0000000 --- a/tests/codeception/acceptance/HomeCept.php +++ /dev/null @@ -1,11 +0,0 @@ -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.'); diff --git a/tests/codeception/acceptance/HomeCest.php b/tests/codeception/acceptance/HomeCest.php new file mode 100644 index 0000000..cd7b224 --- /dev/null +++ b/tests/codeception/acceptance/HomeCest.php @@ -0,0 +1,16 @@ +amOnPage(Yii::$app->homeUrl); + $I->amOnPage('index.php?r=site%2Findex'); + $I->see('My Company'); + + $I->seeLink('About'); + $I->click('About'); + + $I->see('This is the About page.'); + } +} diff --git a/tests/codeception/acceptance/LoginCept.php b/tests/codeception/acceptance/LoginCept.php deleted file mode 100644 index 90d0635..0000000 --- a/tests/codeception/acceptance/LoginCept.php +++ /dev/null @@ -1,37 +0,0 @@ -wantTo('ensure that login works'); - -$loginPage = LoginPage::openBy($I); - -$I->see('Login', 'h1'); - -$I->amGoingTo('try to login with empty credentials'); -$loginPage->login('', ''); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->expectTo('see validations errors'); -$I->see('Username cannot be blank.'); -$I->see('Password cannot be blank.'); - -$I->amGoingTo('try to login with wrong credentials'); -$loginPage->login('admin', 'wrong'); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->expectTo('see validations errors'); -$I->see('Incorrect username or password.'); - -$I->amGoingTo('try to login with correct credentials'); -$loginPage->login('admin', 'admin'); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->expectTo('see user info'); -$I->see('Logout (admin)'); diff --git a/tests/codeception/acceptance/LoginCest.php b/tests/codeception/acceptance/LoginCest.php new file mode 100644 index 0000000..97f3980 --- /dev/null +++ b/tests/codeception/acceptance/LoginCest.php @@ -0,0 +1,19 @@ +amOnPage(['site/login']); + $I->amOnPage('index.php?r=site%2Flogin'); + $I->see('Login', 'h1'); + + $I->amGoingTo('try to login with correct credentials'); + $I->fillField('input[name="LoginForm[username]"]', 'admin'); + $I->fillField('input[name="LoginForm[password]"]', 'admin'); + $I->click('login-button'); + + $I->expectTo('see user info'); + $I->see('Logout (admin)'); + } +}