LoginCept.php 756 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. use tests\codeception\_pages\LoginPage;
  3. /* @var $scenario Codeception\Scenario */
  4. $I = new FunctionalTester($scenario);
  5. $I->wantTo('ensure that login works');
  6. $loginPage = LoginPage::openBy($I);
  7. $I->see('Login', 'h1');
  8. $I->amGoingTo('try to login with empty credentials');
  9. $loginPage->login('', '');
  10. $I->expectTo('see validations errors');
  11. $I->see('Username cannot be blank.');
  12. $I->see('Password cannot be blank.');
  13. $I->amGoingTo('try to login with wrong credentials');
  14. $loginPage->login('admin', 'wrong');
  15. $I->expectTo('see validations errors');
  16. $I->see('Incorrect username or password.');
  17. $I->amGoingTo('try to login with correct credentials');
  18. $loginPage->login('admin', 'admin');
  19. $I->expectTo('see user info');
  20. $I->see('Logout (admin)');