Example #1
0
 public function testSignup(FunctionalTester $I)
 {
     $I->wantTo('ensure that signup works');
     $signupPage = SignupPage::openBy($I);
     $I->seeInTitle('Signup');
     $I->see('Please fill out the following fields to signup:');
     $I->amGoingTo('submit signup form with no data');
     $signupPage->submit([]);
     $I->expectTo('see validation errors');
     $I->see('Username cannot be blank.', '.help-block');
     $I->see('Email cannot be blank.', '.help-block');
     $I->see('Password cannot be blank.', '.help-block');
     $I->see('The verification code is incorrect.', '.help-block');
     $I->amGoingTo('submit signup form with not correct data');
     $signupPage->submit(['username' => 'tester', 'email' => 'tester.email', 'password' => 'tester_password', 'verifyCode' => 'wrong']);
     $I->expectTo('see that email address is wrong');
     $I->dontSee('Username cannot be blank.', '.help-block');
     $I->dontSee('Password cannot be blank.', '.help-block');
     $I->see('Email is not a valid email address.', '.help-block');
     $I->see('The verification code is incorrect.', '.help-block');
     $I->amGoingTo('submit signup form with correct data');
     $signupPage->submit(['username' => 'tester', 'email' => '*****@*****.**', 'password' => 'tester_password', 'verifyCode' => 'testme']);
     $I->expectTo('see that user is created');
     $I->seeRecord(User::className(), ['username' => 'tester', 'email' => '*****@*****.**', 'status' => User::STATUS_WAIT]);
     $I->expectTo('see that user signed in');
     $I->see('Please confirm your Email.', '.alert-success');
     $I->amGoingTo('confirm user email by token');
     /** @var User $user */
     $user = $I->grabRecord(User::className(), ['username' => 'tester']);
     EmailConfirmPage::openBy($I, ['token' => $user->email_confirm_token]);
     $I->expectTo('see that email is confirmed');
     $I->see('Thanks! Your Email is confirmed.', '.alert-success');
     $I->expectTo('see that user status is confirmed');
     $I->seeRecord(User::className(), ['username' => 'tester', 'email' => '*****@*****.**', 'status' => User::STATUS_ACTIVE, 'email_confirm_token' => null]);
 }
Example #2
0
 /**
  * @param \AcceptanceTester $I
  */
 public function testSignup($I)
 {
     $I->wantTo('ensure that signup works');
     $signupPage = SignupPage::openBy($I);
     $I->seeInTitle('Signup');
     $I->see('Please fill out the following fields to signup:');
     $I->amGoingTo('submit signup form with no data');
     $signupPage->submit([]);
     if (method_exists($I, 'wait')) {
         $I->wait(3);
         // only for selenium
     }
     $I->expectTo('see validation errors');
     $I->see('Username cannot be blank.', '.help-block');
     $I->see('Email cannot be blank.', '.help-block');
     $I->see('Password cannot be blank.', '.help-block');
     $I->amGoingTo('submit signup form with not correct data');
     $signupPage->submit(['username' => 'tester', 'email' => 'tester.email', 'password' => 'tester_password', 'verifyCode' => 'wrong']);
     if (method_exists($I, 'wait')) {
         $I->wait(3);
         // only for selenium
     }
     $I->expectTo('see that email address is wrong');
     $I->dontSee('Password cannot be blank.', '.help-block');
     $I->see('Email is not a valid email address.', '.help-block');
     $I->see('The verification code is incorrect.', '.help-block');
     $I->amGoingTo('submit signup form with correct data');
     $signupPage->submit(['username' => 'tester', 'email' => '*****@*****.**', 'password' => 'tester_password', 'verifyCode' => 'testme']);
     if (method_exists($I, 'wait')) {
         $I->wait(3);
         // only for selenium
     }
     $I->expectTo('see that user signed in');
     $I->see('Please confirm your Email.');
     $I->amGoingTo('confirm user email by token');
     /** @var \app\modules\user\models\User $user */
     $user = User::findOne(['username' => 'tester']);
     EmailConfirmPage::openBy($I, ['token' => $user->email_confirm_token]);
     $I->expectTo('see that email is confirmed');
     $I->see('Thanks! Your Email is confirmed.', '.alert-success');
     EmailConfirmPage::openBy($I, ['token' => $user->email_confirm_token]);
     $I->expectTo('see that token is incorrect');
     $I->see('Wrong Email confirm token.');
 }