Добавлен action для формы восстановления пароля

This commit is contained in:
ErickSkrauch
2016-05-10 23:25:04 +03:00
parent a29cb76cbf
commit c6547b6540
8 changed files with 166 additions and 12 deletions

View File

@@ -4,7 +4,7 @@ namespace tests\codeception\api\functional;
use Codeception\Specify;
use common\models\Account;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\_pages\LoginRoute;
use tests\codeception\api\_pages\AuthenticationRoute;
use tests\codeception\api\FunctionalTester;
class AccountsChangePasswordCest {
@@ -38,7 +38,7 @@ class AccountsChangePasswordCest {
$I->notLoggedIn();
$loginRoute = new LoginRoute($I);
$loginRoute = new AuthenticationRoute($I);
$loginRoute->login('Admin', 'new-password');
$I->canSeeResponseCodeIs(200);
$I->canSeeResponseContainsJson([

View File

@@ -0,0 +1,49 @@
<?php
namespace codeception\api\functional;
use tests\codeception\api\_pages\AuthenticationRoute;
use tests\codeception\api\FunctionalTester;
class ForgotPasswordCest {
public function testForgotPasswordByEmail(FunctionalTester $I) {
$route = new AuthenticationRoute($I);
$I->wantTo('create new password recover request by passing email');
$route->forgotPassword('admin@ely.by');
$I->canSeeResponseContainsJson([
'success' => true,
]);
$I->canSeeResponseJsonMatchesJsonPath('$.data.canRepeatIn');
$I->canSeeResponseJsonMatchesJsonPath('$.data.repeatFrequency');
}
public function testForgotPasswordByUsername(FunctionalTester $I) {
$route = new AuthenticationRoute($I);
$I->wantTo('create new password recover request by passing username');
$route->forgotPassword('Admin');
$I->canSeeResponseContainsJson([
'success' => true,
]);
$I->canSeeResponseJsonMatchesJsonPath('$.data.canRepeatIn');
$I->canSeeResponseJsonMatchesJsonPath('$.data.repeatFrequency');
$I->canSeeResponseJsonMatchesJsonPath('$.data.emailMask');
}
public function testDataForFrequencyError(FunctionalTester $I) {
$route = new AuthenticationRoute($I);
$I->wantTo('get info about time to repeat recover password request');
$route->forgotPassword('Notch');
$I->canSeeResponseContainsJson([
'success' => false,
'errors' => [
'login' => 'error.email_frequency',
],
]);
$I->canSeeResponseJsonMatchesJsonPath('$.data.canRepeatIn');
$I->canSeeResponseJsonMatchesJsonPath('$.data.repeatFrequency');
}
}

View File

@@ -1,12 +1,12 @@
<?php
namespace tests\codeception\api;
use tests\codeception\api\_pages\LoginRoute;
use tests\codeception\api\_pages\AuthenticationRoute;
class LoginCest {
public function testLoginEmailOrUsername(FunctionalTester $I) {
$route = new LoginRoute($I);
$route = new AuthenticationRoute($I);
$I->wantTo('see error.login_required expected if login is not set');
$route->login();
@@ -61,7 +61,7 @@ class LoginCest {
}
public function testLoginPassword(FunctionalTester $I) {
$route = new LoginRoute($I);
$route = new AuthenticationRoute($I);
$I->wantTo('see password doesn\'t have errors if email or username not set');
$route->login();
@@ -104,7 +104,7 @@ class LoginCest {
}
public function testLoginByUsernameCorrect(FunctionalTester $I) {
$route = new LoginRoute($I);
$route = new AuthenticationRoute($I);
$I->wantTo('login into account using correct username and password');
$route->login('Admin', 'password_0');
@@ -116,7 +116,7 @@ class LoginCest {
}
public function testLoginByEmailCorrect(FunctionalTester $I) {
$route = new LoginRoute($I);
$route = new AuthenticationRoute($I);
$I->wantTo('login into account using correct email and password');
$route->login('admin@ely.by', 'password_0');
@@ -127,7 +127,7 @@ class LoginCest {
}
public function testLoginInAccWithPasswordMethod(FunctionalTester $I) {
$route = new LoginRoute($I);
$route = new AuthenticationRoute($I);
$I->wantTo('login into account with old password hash function using correct username and password');
$route->login('AccWithOldPassword', '12345678');