Answer the question
In order to leave comments, you need to log in
How to use the application object created from Codeception in complex acceptance testing?
Hello. The question is this. Started writing acceptance tests for Yii2 applications.
Came across the following:
public function landToFirstEnterApplication(AcceptanceTester $I)
{
/** @var UrlManager $urlManager */
$urlManager = Yii::$app->get('frontendUrlManager');
$I->amOnUrl($urlManager->getHostInfo());
$I->see('Авторизация');
$I->click('Зарегистрироваться');
$I->see('Зарегистрироваться');
$I->fillField(['id' => 'emailform-email'], $userEmail = '[email protected]');
$I->click('Продолжить');
$I->waitForText('Вернуться на главную страницу', 2);
$I->seeEmailIsSent(1);
/** @var Message $mail */
$mail = $I->grabLastSentEmail();
expect($mail->getTo())->hasKey($userEmail);
$link = $this->getLink($mail->getSwiftMessage()->getChildren()[0]->getBody());
$I->amOnUrl($link);
$I->see('Установить пароль');
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question