/**
  * Test contact page.
  *
  * @param \Codeception\AcceptanceTester $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.');
 }
Beispiel #2
0
 /**
  * @param FunctionalTester $I
  */
 public function testContact(FunctionalTester $I)
 {
     $I->wantTo('ensure that contact works');
     $contactPage = ContactPage::openBy($I);
     $I->see('Contact', 'h1');
     $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('Body cannot be blank', '.help-block');
     $I->see('The verification code is incorrect', '.help-block');
     $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 address 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('Body cannot be blank', '.help-block');
     $I->dontSee('The verification code is incorrect', '.help-block');
     $I->amGoingTo('submit contact form with correct data');
     $contactPage->submit(['name' => 'tester', 'email' => '*****@*****.**', 'subject' => 'test subject', 'body' => 'test content', 'verifyCode' => 'testme']);
     $I->see('Thank you for contacting us. We will respond to you as soon as possible.');
 }
Beispiel #3
0
<?php

use tests\codeception\frontend\AcceptanceTester;
use tests\codeception\frontend\_pages\ContactPage;
/* @var $scenario Codeception\Scenario */
$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that contact works');
$contactPage = ContactPage::openBy($I);
$I->see('Contact', 'h1');
$I->amGoingTo('submit contact form with no data');
$contactPage->submit([]);
if (method_exists($I, 'wait')) {
    $I->wait(3);
    // only for selenium
}
$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('Body cannot be blank', '.help-block');
$I->see('The verification code is incorrect', '.help-block');
$I->amGoingTo('submit contact form with not correct email');
$contactPage->submit(['name' => 'tester', 'email' => 'tester.email', 'subject' => 'test subject', 'body' => 'test content', 'verifyCode' => 'testme']);
if (method_exists($I, 'wait')) {
    $I->wait(3);
    // only for selenium
}
$I->expectTo('see that email adress is wrong');
$I->dontSee('Name cannot be blank', '.help-block');
$I->see('这不是一个有效的email地址!', '.help-block');