LoginCest.php 565 B

123456789101112131415161718192021
  1. <?php
  2. use yii\helpers\Url;
  3. class LoginCest
  4. {
  5. public function ensureThatLoginWorks(AcceptanceTester $I)
  6. {
  7. $I->amOnPage(Url::toRoute('/site/login'));
  8. $I->see('Login', 'h1');
  9. $I->amGoingTo('try to login with correct credentials');
  10. $I->fillField('input[name="LoginForm[username]"]', 'admin');
  11. $I->fillField('input[name="LoginForm[password]"]', 'admin');
  12. $I->click('login-button');
  13. $I->wait(2); // wait for button to be clicked
  14. $I->expectTo('see user info');
  15. $I->see('Logout');
  16. }
  17. }