/** * * @param \codeception_frontend\FunctionalTester $I * @param \Codeception\Scenario $scenario */ public function testRefSettings($I, $scenario) { $I->wantTo('ensure that signup works'); $signupPage = SettingsPage::openBy($I); $I->see('Personal settings', 'h3'); $I->seeLink('Reference'); $I->click('Reference'); $I->seeLink('Block state'); $I->click('Block state'); $I->see('Block state', 'h3'); $I->click('Back to reference'); $I->seeLink('Visual style'); $I->click('Visual style'); $I->see('Visual style', 'h3'); $I->click('Back to reference'); $I->seeLink('Role types'); $I->click('Role types'); $I->see('Role types', 'h3'); $I->click('Back to reference'); $I->seeLink('Icons list'); $I->click('Icons list'); $I->see('Icons list', 'h3'); $I->click('Back to reference'); }
$user = $I->grabRecord(User::className(), ['id' => $user->id]); $token = $I->grabRecord(Token::className(), ['user_id' => $user->id, 'type' => Token::TYPE_CONFIRM_NEW_EMAIL]); $I->seeInEmail(Html::encode($token->getUrl())); $I->seeInEmailRecipients($user->unconfirmed_email); Yii::$app->user->logout(); $I->amGoingTo('log in using new email address before clicking the confirmation link'); $page = LoginPage::openBy($I); $page->login('*****@*****.**', 'qwerty'); $I->see('Invalid login or password'); $I->amGoingTo('log in using new email address after clicking the confirmation link'); $user->attemptEmailChange($token->code); $page->login('*****@*****.**', 'qwerty'); $I->see('Logout'); $I->seeRecord(User::className(), ['id' => 1, 'email' => '*****@*****.**', 'unconfirmed_email' => null]); $I->amGoingTo('reset email changing process'); $page = SettingsPage::openBy($I); $page->update('*****@*****.**', $user->username, 'qwerty'); $I->see('Confirmation message has been sent to your new email address'); $I->seeRecord(User::className(), ['id' => 1, 'email' => '*****@*****.**', 'unconfirmed_email' => '*****@*****.**']); $page->update('*****@*****.**', $user->username, 'qwerty'); $I->see('You have successfully cancelled email changing process'); $I->seeRecord(User::className(), ['id' => 1, 'email' => '*****@*****.**', 'unconfirmed_email' => null]); $I->amGoingTo('change username and password'); $page->update('*****@*****.**', 'nickname', 'qwerty', '123654'); $I->see('Account settings have been successfully saved'); $I->seeRecord(User::className(), ['username' => 'nickname', 'email' => '*****@*****.**']); Yii::$app->user->logout(); $I->amGoingTo('login with new credentials'); $page = LoginPage::openBy($I); $page->login('nickname', '123654'); $I->see('Logout');
<?php use tests\codeception\_pages\SettingsPage; /* @var $scenario Codeception\Scenario */ $I = new AcceptanceTester($scenario); $I->wantTo('ensure that about works'); $contactPage = SettingsPage::openBy($I); $I->see('Personal settings', 'h3'); $I->see('Important information');