Дописаны недостающие тесты для форм смены E-mail адреса

This commit is contained in:
ErickSkrauch
2016-05-16 23:09:44 +03:00
parent f99b281f30
commit 6c74e23157
5 changed files with 100 additions and 2 deletions

View File

@ -35,4 +35,19 @@ class AccountsRoute extends BasePage {
$this->actor->sendPOST($this->getUrl());
}
public function changeEmailSubmitNewEmail($key = null, $email = null) {
$this->route = ['accounts/change-email-submit-new-email'];
$this->actor->sendPOST($this->getUrl(), [
'key' => $key,
'email' => $email,
]);
}
public function changeEmailConfirmNewEmail($key = null) {
$this->route = ['accounts/change-email-confirm-new-email'];
$this->actor->sendPOST($this->getUrl(), [
'key' => $key,
]);
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace tests\codeception\api\functional;
use Codeception\Specify;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\FunctionalTester;
class AccountsChangeEmailConfirmNewEmailCest {
/**
* @var AccountsRoute
*/
private $route;
public function _before(FunctionalTester $I) {
$this->route = new AccountsRoute($I);
}
public function testConfirmNewEmail(FunctionalTester $I) {
$I->wantTo('change my email and get changed value');
$I->loggedInAsActiveAccount('CrafterGameplays', 'password_0');
$this->route->changeEmailConfirmNewEmail('H28HBDCHHAG2HGHGHS');
$I->canSeeResponseCodeIs(200);
$I->canSeeResponseIsJson();
$I->canSeeResponseContainsJson([
'success' => true,
'data' => [
'email' => 'my-new-email@ely.by',
],
]);
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace tests\codeception\api\functional;
use Codeception\Specify;
use tests\codeception\api\_pages\AccountsRoute;
use tests\codeception\api\FunctionalTester;
class AccountsChangeEmailSubmitNewEmailCest {
/**
* @var AccountsRoute
*/
private $route;
public function _before(FunctionalTester $I) {
$this->route = new AccountsRoute($I);
}
public function testSubmitNewEmail(FunctionalTester $I) {
$I->wantTo('submit new email');
$I->loggedInAsActiveAccount('ILLIMUNATI', 'password_0');
$this->route->changeEmailSubmitNewEmail('H27HBDCHHAG2HGHGHS', 'my-new-email@ely.by');
$I->canSeeResponseCodeIs(200);
$I->canSeeResponseIsJson();
$I->canSeeResponseContainsJson([
'success' => true,
]);
}
}