Blame view

app/tests/codeception/acceptance/LoginCept.php 932 Bytes
bf807468   Alex Savenko   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  <?php
  
  use tests\codeception\_pages\LoginPage;
  
  $I = new AcceptanceTester($scenario);
  $I->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)');