Skip to content

Commit

Permalink
Add indexPageWithLoginUser test case to LoginCest.
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Dec 8, 2023
1 parent 50ac0dc commit 0ec18d1
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/Acceptance/LoginCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,37 @@ public function indexPage(AcceptanceTester $I): void
$I->see(Yii::t('yii.user', 'Please fill out the following fields to Sign in.'));
}

public function indexPageWithLoginUser(AcceptanceTester $I): void
{
$I->wantTo('security login username submit form success data.');
$I->haveFixtures([Account::class => AccountFixture::class]);
$account = $I->grabFixture(Account::class, 'confirmed');

$I->amGoingTo('navigate to the login page.');
$I->amOnRoute('login/index');

$I->wantTo('ensure that login page works.');
$I->expectTo('see page index.');
$I->see(Yii::t('yii.user', 'Sign in'), 'h1');
$I->see(Yii::t('yii.user', 'Please fill out the following fields to Sign in.'));

$I->expectTo('fill in the form.');
$I->fillField('#loginform-login', $account->email);
$I->fillField('#loginform-password', '123456');
$I->click(Yii::t('yii.user', 'Sign in'));

$I->expectTo('see that the user is logged in.');
$I->seeLink(Yii::t('yii.user', 'Logout'));

$I->amGoingTo('navigate to the login page.');
$I->amOnRoute('login/index');

$I->expectTo('see message home page and not see login page.');
$I->see(Yii::t('app.basic', 'Web Application'));
$I->dontSee(Yii::t('yii.user', 'Sign in'), 'h1');
$I->dontSee(Yii::t('yii.user', 'Please fill out the following fields to Sign in.'));
}

public function linkResendConfirmationMessage(AcceptanceTester $I): void
{
$I->amGoingTo('set confirmation true.');
Expand Down

0 comments on commit 0ec18d1

Please sign in to comment.