LoginCept.php 713 B

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