Close #41 remove deprecated package yii2-codeception. Update tests.
This commit is contained in:
@ -3,8 +3,8 @@
|
||||
/**
|
||||
* @var Codeception\Scenario
|
||||
*/
|
||||
|
||||
use tests\_fixtures\TokenFixture;
|
||||
use yii\helpers\Url;
|
||||
|
||||
$I = new FunctionalTester($scenario);
|
||||
$I->wantTo('ensure that confirmation works');
|
||||
@ -12,11 +12,11 @@ $I->haveFixtures(['token' => TokenFixture::className()]);
|
||||
|
||||
$I->amGoingTo('check that error is showed when token expired');
|
||||
$token = $I->grabFixture('token', 'expired_confirmation');
|
||||
$I->amOnPage(Url::toRoute(['/user/registration/confirm', 'id' => $token->user_id, 'code' => $token->code]));
|
||||
$I->amOnRoute('/user/registration/confirm', ['id' => $token->user_id, 'code' => $token->code]);
|
||||
$I->see('The confirmation link is invalid or expired. Please try requesting a new one.');
|
||||
|
||||
$I->amGoingTo('check that user get confirmed');
|
||||
$token = $I->grabFixture('token', 'confirmation');
|
||||
$I->amOnPage(Url::toRoute(['/user/registration/confirm', 'id' => $token->user_id, 'code' => $token->code]));
|
||||
$I->amOnRoute('/user/registration/confirm', ['id' => $token->user_id, 'code' => $token->code]);
|
||||
$I->see('Thank you, registration is now complete.');
|
||||
$I->see('Logout');
|
||||
|
||||
@ -3,29 +3,38 @@
|
||||
/**
|
||||
* @var Codeception\Scenario
|
||||
*/
|
||||
|
||||
use tests\_fixtures\UserFixture;
|
||||
use tests\_pages\CreatePage;
|
||||
use tests\_pages\LoginPage;
|
||||
|
||||
$I = new FunctionalTester($scenario);
|
||||
$I->wantTo('ensure that user creation works');
|
||||
$I->haveFixtures(['user' => UserFixture::className()]);
|
||||
|
||||
$loginPage = LoginPage::openBy($I);
|
||||
$user = $I->grabFixture('user', 'user');
|
||||
$loginPage->login($user->email, 'qwerty');
|
||||
|
||||
$page = CreatePage::openBy($I);
|
||||
$I->amLoggedInAs($user);
|
||||
|
||||
$I->amOnRoute('/user/admin/create');
|
||||
|
||||
$I->amGoingTo('try to create user with empty fields');
|
||||
$page->create('', '', '');
|
||||
$I->fillField('#user-username', '');
|
||||
$I->fillField('#user-email', '');
|
||||
$I->fillField('#user-password', '');
|
||||
$I->click('Save');
|
||||
|
||||
$I->expectTo('see validations errors');
|
||||
$I->see('Username cannot be blank.');
|
||||
$I->see('Email cannot be blank.');
|
||||
|
||||
$page->create('foobar', 'foobar@example.com', 'foobar');
|
||||
$I->fillField('#user-username', 'foobar');
|
||||
$I->fillField('#user-email', 'foobar@example.com');
|
||||
$I->fillField('#user-password', 'foobar');
|
||||
$I->click('Save');
|
||||
$I->see('User has been created');
|
||||
|
||||
Yii::$app->user->logout();
|
||||
LoginPage::openBy($I)->login('foobar@example.com', 'foobar');
|
||||
$I->amOnRoute('/user/security/login');
|
||||
$I->fillField('#loginform-login', 'foobar@example.com');
|
||||
$I->fillField('#loginform-password', 'foobar');
|
||||
$I->click('Sign in');
|
||||
$I->see('Logout');
|
||||
|
||||
@ -3,38 +3,50 @@
|
||||
/**
|
||||
* @var Codeception\Scenario
|
||||
*/
|
||||
|
||||
use tests\_fixtures\UserFixture;
|
||||
use tests\_pages\LoginPage;
|
||||
|
||||
$I = new FunctionalTester($scenario);
|
||||
$I->wantTo('ensure that login works');
|
||||
$I->haveFixtures(['user' => UserFixture::className()]);
|
||||
|
||||
$page = LoginPage::openBy($I);
|
||||
$I->amOnRoute('/user/security/login');
|
||||
|
||||
$I->amGoingTo('try to login with empty credentials');
|
||||
$page->login('', '');
|
||||
$I->fillField('#loginform-login', '');
|
||||
$I->fillField('#loginform-password', '');
|
||||
$I->click('Sign in');
|
||||
$I->expectTo('see validations errors');
|
||||
$I->see('Login cannot be blank.');
|
||||
$I->see('Password cannot be blank.');
|
||||
|
||||
|
||||
$I->amGoingTo('try to login with unconfirmed account');
|
||||
$user = $I->grabFixture('user', 'unconfirmed');
|
||||
$page->login($user->email, 'qwerty');
|
||||
$I->fillField('#loginform-login', $user->email);
|
||||
$I->fillField('#loginform-password', 'qwerty');
|
||||
$I->click('Sign in');
|
||||
$I->expectTo('see validations errors');
|
||||
$I->see('You need to confirm your email address');
|
||||
|
||||
$I->amGoingTo('try to login with blocked account');
|
||||
$user = $I->grabFixture('user', 'blocked');
|
||||
$page->login($user->email, 'qwerty');
|
||||
$I->fillField('#loginform-login', $user->email);
|
||||
$I->fillField('#loginform-password', 'qwerty');
|
||||
$I->click('Sign in');
|
||||
$I->expectTo('see blocking information');
|
||||
$I->see('Your account has been blocked');
|
||||
|
||||
$I->amGoingTo('try to login with wrong credentials');
|
||||
$user = $I->grabFixture('user', 'user');
|
||||
$page->login($user->email, 'wrong');
|
||||
$I->fillField('#loginform-login', $user->email);
|
||||
$I->fillField('#loginform-password', 'wrong');
|
||||
$I->click('Sign in');
|
||||
$I->expectTo('see validations errors');
|
||||
$I->see('Invalid login or password');
|
||||
|
||||
$I->amGoingTo('try to login with correct credentials');
|
||||
$page->login($user->email, 'qwerty');
|
||||
$I->fillField('#loginform-login', $user->email);
|
||||
$I->fillField('#loginform-password', 'qwerty');
|
||||
$I->click('Sign in');
|
||||
$I->dontSee('Login');
|
||||
$I->see('Logout');
|
||||
|
||||
@ -3,53 +3,64 @@
|
||||
/**
|
||||
* @var Codeception\Scenario
|
||||
*/
|
||||
|
||||
use Da\User\Model\Token;
|
||||
use Da\User\Model\User;
|
||||
use tests\_fixtures\TokenFixture;
|
||||
use tests\_fixtures\UserFixture;
|
||||
use tests\_pages\RecoveryPage;
|
||||
use tests\_pages\LoginPage;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
use Da\User\Model\User;
|
||||
use Da\User\Model\Token;
|
||||
|
||||
$I = new FunctionalTester($scenario);
|
||||
$I->wantTo('ensure that password recovery works');
|
||||
$I->haveFixtures(['user' => UserFixture::className(), 'token' => TokenFixture::className()]);
|
||||
|
||||
$I->amGoingTo('try to request recovery token for unconfirmed account');
|
||||
$page = RecoveryPage::openBy($I);
|
||||
$I->amOnRoute('/user/recovery/request');
|
||||
$user = $I->grabFixture('user', 'unconfirmed');
|
||||
$page->recover($user->email);
|
||||
$I->fillField('#recoveryform-email', $user->email);
|
||||
$I->click('Continue');
|
||||
|
||||
$I->see('An email has been sent with instructions for resetting your password');
|
||||
|
||||
$I->amGoingTo('try to request recovery token');
|
||||
$page = RecoveryPage::openBy($I);
|
||||
$I->amOnRoute('/user/recovery/request');
|
||||
$user = $I->grabFixture('user', 'user');
|
||||
$page->recover($user->email);
|
||||
$I->fillField('#recoveryform-email', $user->email);
|
||||
$I->click('Continue');
|
||||
|
||||
$I->see('An email has been sent with instructions for resetting your password');
|
||||
$user = $I->grabRecord(User::className(), ['email' => $user->email]);
|
||||
$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_RECOVERY]);
|
||||
/** @var yii\swiftmailer\Message $message */
|
||||
$message = $I->grabLastSentEmail();
|
||||
//$I->assertArrayHasKey($user->email, $message->getTo());
|
||||
//$I->assertContains(Html::encode($token->getUrl()), utf8_encode(quoted_printable_decode($message->getSwiftMessage()->toString())));
|
||||
$I->assertArrayHasKey($user->email, $message->getTo());
|
||||
$I->assertContains(
|
||||
Html::encode($token->getUrl()),
|
||||
utf8_encode(quoted_printable_decode($message->getSwiftMessage()->toString()))
|
||||
);
|
||||
|
||||
//$I->amGoingTo('reset password with invalid token');
|
||||
//$user = $I->grabFixture('user', 'user_with_expired_recovery_token');
|
||||
//$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_RECOVERY]);
|
||||
//$I->amOnPage(Url::toRoute(['/user/recovery/reset', 'id' => $user->id, 'code' => $token->code]));
|
||||
//$I->see('Recovery link is invalid or expired. Please try requesting a new one.');
|
||||
$I->amGoingTo('reset password with invalid token');
|
||||
$user = $I->grabFixture('user', 'user_with_expired_recovery_token');
|
||||
$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_RECOVERY]);
|
||||
$I->amOnRoute('/user/recovery/reset', ['id' => $user->id, 'code' => $token->code]);
|
||||
$I->see('Recovery link is invalid or expired. Please try requesting a new one.');
|
||||
|
||||
//$I->amGoingTo('reset password');
|
||||
//$user = $I->grabFixture('user', 'user_with_recovery_token');
|
||||
//$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_RECOVERY]);
|
||||
//$I->amOnPage(Url::toRoute(['/user/recovery/reset', 'id' => $user->id, 'code' => $token->code]));
|
||||
//$I->fillField('#recoveryform-password', 'newpass');
|
||||
//$I->click('Finish');
|
||||
//$I->see('Your password has been changed successfully.');
|
||||
$I->amGoingTo('reset password');
|
||||
$user = $I->grabFixture('user', 'user_with_recovery_token');
|
||||
$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_RECOVERY]);
|
||||
$I->amOnRoute('/user/recovery/reset', ['id' => $user->id, 'code' => $token->code]);
|
||||
$I->fillField('#recoveryform-password', 'newpassword');
|
||||
$I->click('Finish');
|
||||
|
||||
//$page = LoginPage::openBy($I);
|
||||
//$page->login($user->email, 'qwerty');
|
||||
//$I->see('Invalid login or password');
|
||||
//$page->login($user->email, 'newpass');
|
||||
//$I->dontSee('Invalid login or password');
|
||||
$I->amGoingTo('Login with old password');
|
||||
$I->amOnRoute('/user/security/login');
|
||||
$I->fillField('#loginform-login', $user->email);
|
||||
$I->fillField('#loginform-password', 'qwerty');
|
||||
$I->click('Sign in');
|
||||
$I->see('Invalid login or password');
|
||||
|
||||
$I->amGoingTo('Login with new password');
|
||||
$I->fillField('#loginform-login', $user->email);
|
||||
$I->fillField('#loginform-password', 'newpassword');
|
||||
$I->click('Sign in');
|
||||
$I->see('Logout');
|
||||
|
||||
@ -5,8 +5,6 @@ use Da\User\Model\Token;
|
||||
use Da\User\Model\User;
|
||||
use Da\User\Module;
|
||||
use tests\_fixtures\UserFixture;
|
||||
use tests\_pages\LoginPage;
|
||||
use tests\_pages\RegistrationPage;
|
||||
use yii\helpers\Html;
|
||||
|
||||
class RegistrationCest
|
||||
@ -36,10 +34,10 @@ class RegistrationCest
|
||||
'generatePasswords' => false,
|
||||
]);
|
||||
|
||||
$page = RegistrationPage::openBy($I);
|
||||
$I->amOnRoute('/user/registration/register');
|
||||
|
||||
$I->amGoingTo('try to register with empty credentials');
|
||||
$page->register('', '', '');
|
||||
$this->register($I, '', '', '');
|
||||
$I->see('Username cannot be blank');
|
||||
$I->see('Email cannot be blank');
|
||||
$I->see('Password cannot be blank');
|
||||
@ -47,17 +45,19 @@ class RegistrationCest
|
||||
$I->amGoingTo('try to register with already used email and username');
|
||||
$user = $I->grabFixture('user', 'user');
|
||||
|
||||
$page->register($user->email, $user->username, 'qwerty');
|
||||
$this->register($I, $user->email, $user->username, 'qwerty');
|
||||
$I->see(Html::encode('This username has already been taken'));
|
||||
$I->see(Html::encode('This email address has already been taken'));
|
||||
|
||||
$page->register('tester@example.com', 'tester', 'tester');
|
||||
$this->register($I, 'tester@example.com', 'tester', 'tester');
|
||||
$I->see('Your account has been created and a message with further instructions has been sent to your email');
|
||||
$user = $I->grabRecord(User::className(), ['email' => 'tester@example.com']);
|
||||
$I->assertTrue($user->isConfirmed);
|
||||
|
||||
$page = LoginPage::openBy($I);
|
||||
$page->login('tester', 'tester');
|
||||
$I->amOnRoute('/user/security/login');
|
||||
$I->fillField('#loginform-login', 'tester');
|
||||
$I->fillField('#loginform-password', 'tester');
|
||||
$I->click('Sign in');
|
||||
$I->see('Logout');
|
||||
}
|
||||
|
||||
@ -71,8 +71,8 @@ class RegistrationCest
|
||||
\Yii::$container->set(Module::className(), [
|
||||
'enableEmailConfirmation' => true,
|
||||
]);
|
||||
$page = RegistrationPage::openBy($I);
|
||||
$page->register('tester@example.com', 'tester', 'tester');
|
||||
$I->amOnRoute('/user/registration/register');
|
||||
$this->register($I, 'tester@example.com', 'tester', 'tester');
|
||||
$I->see('Your account has been created and a message with further instructions has been sent to your email');
|
||||
$user = $I->grabRecord(User::className(), ['email' => 'tester@example.com']);
|
||||
$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_CONFIRMATION]);
|
||||
@ -94,8 +94,8 @@ class RegistrationCest
|
||||
'enableEmailConfirmation' => false,
|
||||
'generatePasswords' => true,
|
||||
]);
|
||||
$page = RegistrationPage::openBy($I);
|
||||
$page->register('tester@example.com', 'tester');
|
||||
$I->amOnRoute('/user/registration/register');
|
||||
$this->register($I, 'tester@example.com', 'tester');
|
||||
$I->see('Your account has been created and a message with further instructions has been sent to your email');
|
||||
$user = $I->grabRecord(User::className(), ['email' => 'tester@example.com']);
|
||||
$I->assertEquals('tester', $user->username);
|
||||
@ -104,4 +104,14 @@ class RegistrationCest
|
||||
$I->assertArrayHasKey($user->email, $message->getTo());
|
||||
$I->assertContains('We have generated a password for you', utf8_encode(quoted_printable_decode($message->getSwiftMessage()->toString())));
|
||||
}
|
||||
|
||||
protected function register(FunctionalTester $I, $email, $username = null, $password = null) {
|
||||
$I->fillField('#registrationform-email', $email);
|
||||
$I->fillField('#registrationform-username', $username);
|
||||
if ($password !== null) {
|
||||
$I->fillField('#registrationform-password', $password);
|
||||
}
|
||||
$I->click('Sign up');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,26 +3,29 @@
|
||||
/**
|
||||
* @var Codeception\Scenario
|
||||
*/
|
||||
|
||||
use tests\_fixtures\UserFixture;
|
||||
use tests\_pages\ResendPage;
|
||||
|
||||
$I = new FunctionalTester($scenario);
|
||||
$I->wantTo('ensure that resending of confirmation tokens works');
|
||||
$I->haveFixtures(['user' => UserFixture::className()]);
|
||||
|
||||
$I->amGoingTo('try to resend token to non-existent user');
|
||||
$page = ResendPage::openBy($I);
|
||||
$page->resend('foo@example.com');
|
||||
$I->amOnRoute('/user/registration/resend');
|
||||
$I->fillField('#resendform-email', 'foo@example.com');
|
||||
$I->click('Continue');
|
||||
$I->see('We couldn\'t re-send the mail to confirm your address. Please, verify is the correct email or if it has been confirmed already.');
|
||||
|
||||
$I->amGoingTo('try to resend token to already confirmed user');
|
||||
$page = ResendPage::openBy($I);
|
||||
$I->amOnRoute('/user/registration/resend');
|
||||
$user = $I->grabFixture('user', 'user');
|
||||
$page->resend($user->email);
|
||||
$I->fillField('#resendform-email', $user->email);
|
||||
$I->click('Continue');
|
||||
$I->see('We couldn\'t re-send the mail to confirm your address. Please, verify is the correct email or if it has been confirmed already.');
|
||||
|
||||
$I->amGoingTo('try to resend token to unconfirmed user');
|
||||
$page = ResendPage::openBy($I);
|
||||
$I->amOnRoute('/user/registration/resend');
|
||||
$user = $I->grabFixture('user', 'unconfirmed');
|
||||
$page->resend($user->email);
|
||||
$I->fillField('#resendform-email', $user->email);
|
||||
$I->click('Continue');
|
||||
$I->see('A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.');
|
||||
|
||||
@ -3,31 +3,36 @@
|
||||
/**
|
||||
* @var Codeception\Scenario
|
||||
*/
|
||||
|
||||
use Da\User\Model\Token;
|
||||
use Da\User\Model\User;
|
||||
use tests\_fixtures\ProfileFixture;
|
||||
use tests\_fixtures\UserFixture;
|
||||
use tests\_pages\LoginPage;
|
||||
use tests\_pages\SettingsPage;
|
||||
use yii\helpers\Html;
|
||||
|
||||
$I = new FunctionalTester($scenario);
|
||||
$I->wantTo('ensure that account settings page work');
|
||||
$I->haveFixtures(['user' => UserFixture::className(), 'profile' => ProfileFixture::className()]);
|
||||
|
||||
$page = LoginPage::openBy($I);
|
||||
$user = $I->grabFixture('user', 'user');
|
||||
$page->login($user->username, 'qwerty');
|
||||
$I->amLoggedInAs($user);
|
||||
|
||||
$page = SettingsPage::openBy($I);
|
||||
$I->amOnRoute('/user/settings/account');
|
||||
|
||||
$I->amGoingTo('check that current password is required and must be valid');
|
||||
$page->update($user->email, $user->username, 'wrong');
|
||||
$I->fillField('#settingsform-email', $user->email);
|
||||
$I->fillField('#settingsform-username', $user->username);
|
||||
$I->fillField('#settingsform-current_password', 'wrong');
|
||||
$I->click('Save');
|
||||
$I->see('Current password is not valid');
|
||||
|
||||
$I->amGoingTo('check that email is changing properly');
|
||||
$page->update('new_user@example.com', $user->username, 'qwerty');
|
||||
$I->fillField('#settingsform-email', 'new_user@example.com');
|
||||
$I->fillField('#settingsform-username', $user->username);
|
||||
$I->fillField('#settingsform-current_password', 'qwerty');
|
||||
$I->click('Save');
|
||||
$I->seeRecord(User::className(), ['email' => $user->email, 'unconfirmed_email' => 'new_user@example.com']);
|
||||
|
||||
$I->see('A confirmation message has been sent to your new email address');
|
||||
$user = $I->grabRecord(User::className(), ['id' => $user->id]);
|
||||
$token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_CONFIRM_NEW_EMAIL]);
|
||||
@ -35,12 +40,13 @@ $token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => T
|
||||
$message = $I->grabLastSentEmail();
|
||||
$I->assertArrayHasKey($user->unconfirmed_email, $message->getTo());
|
||||
$I->assertContains(Html::encode($token->getUrl()), utf8_encode(quoted_printable_decode($message->getSwiftMessage()->toString())));
|
||||
|
||||
Yii::$app->user->logout();
|
||||
|
||||
$I->amGoingTo('log in using new email address before clicking the confirmation link');
|
||||
$page = LoginPage::openBy($I);
|
||||
$page->login('new_user@example.com', 'qwerty');
|
||||
$I->amOnRoute('/user/security/login');
|
||||
$I->fillField('#loginform-login', 'new_user@example.com');
|
||||
$I->fillField('#loginform-password', 'qwerty');
|
||||
$I->click('Sign in');
|
||||
$I->see('Invalid login or password');
|
||||
|
||||
$I->amGoingTo('log in using new email address after clicking the confirmation link');
|
||||
@ -48,7 +54,9 @@ $I->amGoingTo('log in using new email address after clicking the confirmation li
|
||||
$emailChangeService = Yii::createObject(\Da\User\Service\EmailChangeService::class, [$token->code, $user]);
|
||||
$emailChangeService->run();
|
||||
|
||||
$page->login('new_user@example.com', 'qwerty');
|
||||
$I->fillField('#loginform-login', 'new_user@example.com');
|
||||
$I->fillField('#loginform-password', 'qwerty');
|
||||
$I->click('Sign in');
|
||||
$I->see('Logout');
|
||||
$I->seeRecord(User::className(), [
|
||||
'id' => 1,
|
||||
@ -57,15 +65,26 @@ $I->seeRecord(User::className(), [
|
||||
]);
|
||||
|
||||
$I->amGoingTo('reset email changing process');
|
||||
$page = SettingsPage::openBy($I);
|
||||
$page->update('user@example.com', $user->username, 'qwerty');
|
||||
$I->amOnRoute('/user/settings/account');
|
||||
|
||||
$I->fillField('#settingsform-email', 'user@example.com');
|
||||
$I->fillField('#settingsform-username', $user->username);
|
||||
$I->fillField('#settingsform-new_password', null);
|
||||
$I->fillField('#settingsform-current_password', 'qwerty');
|
||||
$I->click('Save');
|
||||
$I->see('A confirmation message has been sent to your new email address');
|
||||
$I->seeRecord(User::className(), [
|
||||
'id' => 1,
|
||||
'email' => 'new_user@example.com',
|
||||
'unconfirmed_email' => 'user@example.com',
|
||||
]);
|
||||
$page->update('new_user@example.com', $user->username, 'qwerty');
|
||||
|
||||
$I->fillField('#settingsform-email', 'new_user@example.com');
|
||||
$I->fillField('#settingsform-username', $user->username);
|
||||
$I->fillField('#settingsform-new_password', null);
|
||||
$I->fillField('#settingsform-current_password', 'qwerty');
|
||||
$I->click('Save');
|
||||
|
||||
$I->see('Your account details have been updated');
|
||||
$I->seeRecord(User::className(), [
|
||||
'id' => 1,
|
||||
@ -73,7 +92,12 @@ $I->seeRecord(User::className(), [
|
||||
'unconfirmed_email' => null,
|
||||
]);
|
||||
$I->amGoingTo('change username and password');
|
||||
$page->update('new_user@example.com', 'nickname', 'qwerty', '123654');
|
||||
|
||||
$I->fillField('#settingsform-email', 'new_user@example.com');
|
||||
$I->fillField('#settingsform-username', 'nickname');
|
||||
$I->fillField('#settingsform-new_password', '123654');
|
||||
$I->fillField('#settingsform-current_password', 'qwerty');
|
||||
$I->click('Save');
|
||||
$I->see('Your account details have been updated');
|
||||
$I->seeRecord(User::className(), [
|
||||
'username' => 'nickname',
|
||||
@ -83,6 +107,8 @@ $I->seeRecord(User::className(), [
|
||||
Yii::$app->user->logout();
|
||||
|
||||
$I->amGoingTo('login with new credentials');
|
||||
$page = LoginPage::openBy($I);
|
||||
$page->login('nickname', '123654');
|
||||
$I->amOnRoute('/user/security/login');
|
||||
$I->fillField('#loginform-login', 'new_user@example.com');
|
||||
$I->fillField('#loginform-password', '123654');
|
||||
$I->click('Sign in');
|
||||
$I->see('Logout');
|
||||
|
||||
@ -3,23 +3,28 @@
|
||||
/**
|
||||
* @var Codeception\Scenario
|
||||
*/
|
||||
|
||||
use tests\_fixtures\UserFixture;
|
||||
use tests\_pages\UpdatePage;
|
||||
use tests\_pages\LoginPage;
|
||||
|
||||
$I = new FunctionalTester($scenario);
|
||||
$I->wantTo('ensure that user update works');
|
||||
$I->haveFixtures(['user' => UserFixture::className()]);
|
||||
|
||||
$loginPage = LoginPage::openBy($I);
|
||||
$user = $I->grabFixture('user', 'user');
|
||||
$loginPage->login($user->email, 'qwerty');
|
||||
$I->amLoggedInAs($user);
|
||||
|
||||
$page = UpdatePage::openBy($I, ['id' => $user->id]);
|
||||
$I->amOnRoute('/user/admin/update', ['id' => $user->id]);
|
||||
|
||||
$page->update('user', 'updated_user@example.com', 'new_pass');
|
||||
$I->fillField('#user-username', 'user');
|
||||
$I->fillField('#user-email', 'updated_user@example.com');
|
||||
$I->fillField('#user-password', 'newpassword');
|
||||
$I->click('Update');
|
||||
$I->see('Account details have been updated');
|
||||
|
||||
Yii::$app->user->logout();
|
||||
LoginPage::openBy($I)->login('updated_user@example.com', 'new_pass');
|
||||
|
||||
$I->amOnRoute('/user/security/login');
|
||||
$I->fillField('#loginform-login', 'updated_user@example.com');
|
||||
$I->fillField('#loginform-password', 'newpassword');
|
||||
$I->click('Sign in');
|
||||
$I->see('Logout');
|
||||
|
||||
Reference in New Issue
Block a user