예제 #1
0
 /**
  * Test contact page.
  *
  * @param \Codeception\FunctionalTester $I
  * @param \Codeception\Scenario         $scenario
  */
 public function testContact($I, $scenario)
 {
     $I->wantTo('ensure that contact works');
     $contactPage = ContactPage::openBy($I);
     $I->see('Contact', 'h1');
     //-- submit form with no data --//
     $I->amGoingTo('submit contact form with no data');
     $contactPage->submit([]);
     $I->expectTo('see validations errors');
     $I->see('Contact', 'h1');
     $I->see('Name cannot be blank', '.help-block');
     $I->see('Email cannot be blank', '.help-block');
     $I->see('Subject cannot be blank', '.help-block');
     $I->see('Text cannot be blank', '.help-block');
     $I->see('Verification Code cannot be blank.', '.help-block');
     //-- submit form with not correct email --//
     $I->amGoingTo('submit contact form with not correct email');
     $contactPage->submit(['name' => 'tester', 'email' => 'tester.email', 'subject' => 'test subject', 'body' => 'test content', 'verifyCode' => 'testme']);
     $I->expectTo('see that email adress is wrong');
     $I->dontSee('Name cannot be blank', '.help-block');
     $I->see('Email is not a valid email address.', '.help-block');
     $I->dontSee('Subject cannot be blank', '.help-block');
     $I->dontSee('Text cannot be blank', '.help-block');
     $I->dontSee('The verification code is incorrect.', '.help-block');
     //-- submit form with correct data --//
     $I->amGoingTo('submit contact form with correct data');
     $contactPage->submit(['name' => 'tester', 'email' => '*****@*****.**', 'subject' => 'test subject', 'body' => 'test content', 'verifyCode' => 'testme']);
     if (method_exists($I, 'wait')) {
         $I->wait(3);
         // only for selenium
     }
     $I->see('Thank you for contacting us. We will respond to you as soon as possible.');
 }
예제 #2
0
 /**
  * We want to be sure that not active user can not login.
  * If he try to login, he should get error flash message.
  * 
  * @param \Codeception\FunctionalTester $I
  * @param \Codeception\Scenario         $scenario
  */
 public function testLoginInactiveUser($I, $scenario)
 {
     // get setting value for 'Login With Email'
     $lwe = \Yii::$app->params['lwe'];
     $field = $lwe ? '*****@*****.**' : 'tester';
     $I->wantTo("ensure that not active user can't login");
     $loginPage = LoginPage::openBy($I);
     //-- try to login user that has not activated his account yet --//
     $I->amGoingTo('try to log in not activated user');
     $loginPage->login($field, 'test123');
     $I->expectTo('see error flash message');
     $I->see('You have to activate your account first.');
     $I->seeLink('Login');
 }
예제 #3
0
파일: LoginCest.php 프로젝트: snivs/semanti
 /**
  * We want to be sure that not active user can not login.
  * If he try to login, he should get error flash message.
  *
  * @param \Codeception\FunctionalTester $I
  * @param \Codeception\Scenario         $scenario
  */
 public function testLoginNotActiveUser($I, $scenario)
 {
     // get setting value for 'Login With Email'
     $lwe = \Yii::$app->params['LoginWithEmail'];
     $field = $lwe ? '*****@*****.**' : 'tester';
     $error = $lwe ? 'email' : 'username';
     $I->wantTo("ensure that not active user can't login");
     $loginPage = LoginPage::openBy($I);
     //-- try to login user that has not activated his account yet --//
     $I->amGoingTo('try to log in not activated user');
     $loginPage->login($field, 'test123');
     $I->expectTo('see error message');
     $I->see('Incorrect ' . $error . ' or password.', '.help-block');
     $I->seeLink('Login');
 }