Exemplo n.º 1
0
 /**
  * @before loginAsAdmin
  */
 public function testPasswordChange(AcceptanceTester $I)
 {
     $I->wantTo('ensure that login works');
     $requestPage = PasswordChangePage::openBy($I);
     $I->seeInTitle('Change password');
     $I->amGoingTo('try to request with empty credentials');
     $requestPage->send(['currentPassword' => '', 'newPassword' => '', 'newPasswordRepeat' => '']);
     if (method_exists($I, 'wait')) {
         $I->wait(1);
         // only for selenium
     }
     $I->expectTo('see validations errors');
     $I->see('Current Password cannot be blank.');
     $I->see('New Password cannot be blank.');
     $I->amGoingTo('try to request with wrong new password');
     $requestPage->send(['currentPassword' => 'wrong-password', 'newPassword' => 'sda', 'newPasswordRepeat' => 'asd']);
     if (method_exists($I, 'wait')) {
         $I->wait(1);
         // only for selenium
     }
     $I->expectTo('see validations errors');
     $I->see('New password should contain at least 6 characters.');
     $I->see('Repeat new password must be repeated exactly.');
     $I->amGoingTo('try to request with wrong current password');
     $requestPage->send(['currentPassword' => 'wrong-password', 'newPassword' => 'new-password', 'newPasswordRepeat' => 'new-password']);
     if (method_exists($I, 'wait')) {
         $I->wait(1);
         // only for selenium
     }
     $I->expectTo('see validations errors');
     $I->see('Wrong current password.');
     $I->amGoingTo('try to request with correct credentials');
     $requestPage->send(['currentPassword' => 'adminpass', 'newPassword' => 'new-password', 'newPasswordRepeat' => 'new-password']);
     if (method_exists($I, 'wait')) {
         $I->wait(3);
         // only for selenium
     }
     $I->expectTo('see user info');
     $I->see('Your passwords is changed.', '.alert-success');
 }
Exemplo n.º 2
0
 /**
  * @after logout
  */
 public function testPasswordChange(FunctionalTester $I)
 {
     $I->wantTo('ensure that password change works');
     $this->login($I, 'admin', 'adminpass');
     $requestPage = PasswordChangePage::openBy($I);
     $I->seeInTitle('Change password');
     $I->amGoingTo('try to request with empty credentials');
     $requestPage->send(['currentPassword' => '', 'newPassword' => '', 'newPasswordRepeat' => '']);
     $I->expectTo('see validations errors');
     $I->see('Current Password cannot be blank.');
     $I->see('New Password cannot be blank.');
     $I->amGoingTo('try to request with wrong credentials');
     $requestPage->send(['currentPassword' => 'wrong-password', 'newPassword' => 'sda', 'newPasswordRepeat' => 'asd']);
     $I->expectTo('see validations errors');
     $I->see('Wrong current password.');
     $I->see('New password should contain at least 6 characters.');
     $I->see('Repeat new password must be equal');
     $I->amGoingTo('try to request with correct credentials');
     $requestPage->send(['currentPassword' => 'adminpass', 'newPassword' => 'new-password', 'newPasswordRepeat' => 'new-password']);
     $I->expectTo('see user info');
     $I->see('Your passwords is changed.', '.alert-success');
 }