You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.3KB

  1. <?php
  2. use tests\codeception\backend\AcceptanceTester;
  3. use tests\codeception\common\_pages\LoginPage;
  4. /* @var $scenario Codeception\Scenario */
  5. $I = new AcceptanceTester($scenario);
  6. $I->wantTo('ensure login page works');
  7. $loginPage = LoginPage::openBy($I);
  8. $I->amGoingTo('submit login form with no data');
  9. $loginPage->login('', '');
  10. if (method_exists($I, 'wait')) {
  11. $I->wait(3); // only for selenium
  12. }
  13. $I->expectTo('see validations errors');
  14. $I->see('Username cannot be blank.', '.help-block');
  15. $I->see('Password cannot be blank.', '.help-block');
  16. $I->amGoingTo('try to login with wrong credentials');
  17. $I->expectTo('see validations errors');
  18. $loginPage->login('admin', 'wrong');
  19. if (method_exists($I, 'wait')) {
  20. $I->wait(3); // only for selenium
  21. }
  22. $I->expectTo('see validations errors');
  23. $I->see('Incorrect username or password.', '.help-block');
  24. $I->amGoingTo('try to login with correct credentials');
  25. $loginPage->login('erau', 'password_0');
  26. if (method_exists($I, 'wait')) {
  27. $I->wait(3); // only for selenium
  28. }
  29. $I->expectTo('see that user is logged');
  30. $I->seeLink('Logout (erau)');
  31. $I->dontSeeLink('Login');
  32. $I->dontSeeLink('Signup');
  33. /** Uncomment if using WebDriver
  34. * $I->click('Logout (erau)');
  35. * $I->dontSeeLink('Logout (erau)');
  36. * $I->seeLink('Login');
  37. */