2013-06-22 20:26:22 -04:00
|
|
|
<?php
|
2013-12-17 00:27:33 +01:00
|
|
|
|
2014-08-24 14:14:35 +04:00
|
|
|
use tests\codeception\_pages\ContactPage;
|
2013-12-02 15:25:21 +04:00
|
|
|
|
2014-08-16 18:15:41 +04:00
|
|
|
$I = new AcceptanceTester($scenario);
|
2013-06-22 20:26:22 -04:00
|
|
|
$I->wantTo('ensure that contact works');
|
2013-12-02 15:25:21 +04:00
|
|
|
|
2013-12-17 23:43:43 -05:00
|
|
|
$contactPage = ContactPage::openBy($I);
|
|
|
|
|
2013-06-22 20:26:22 -04:00
|
|
|
$I->see('Contact', 'h1');
|
|
|
|
|
2013-12-02 15:25:21 +04:00
|
|
|
$I->amGoingTo('submit contact form with no data');
|
|
|
|
$contactPage->submit([]);
|
|
|
|
$I->expectTo('see validations errors');
|
2013-06-22 20:26:22 -04:00
|
|
|
$I->see('Contact', 'h1');
|
|
|
|
$I->see('Name cannot be blank');
|
|
|
|
$I->see('Email cannot be blank');
|
|
|
|
$I->see('Subject cannot be blank');
|
|
|
|
$I->see('Body cannot be blank');
|
|
|
|
$I->see('The verification code is incorrect');
|
|
|
|
|
2013-12-02 15:25:21 +04:00
|
|
|
$I->amGoingTo('submit contact form with not correct email');
|
|
|
|
$contactPage->submit([
|
2014-08-17 18:45:58 +04:00
|
|
|
'name' => 'tester',
|
|
|
|
'email' => 'tester.email',
|
|
|
|
'subject' => 'test subject',
|
|
|
|
'body' => 'test content',
|
|
|
|
'verifyCode' => 'testme',
|
2013-10-18 12:03:36 +00:00
|
|
|
]);
|
2013-12-02 15:25:21 +04:00
|
|
|
$I->expectTo('see that email adress is wrong');
|
2013-06-22 20:26:22 -04:00
|
|
|
$I->dontSee('Name cannot be blank', '.help-inline');
|
|
|
|
$I->see('Email is not a valid email address.');
|
|
|
|
$I->dontSee('Subject cannot be blank', '.help-inline');
|
|
|
|
$I->dontSee('Body cannot be blank', '.help-inline');
|
|
|
|
$I->dontSee('The verification code is incorrect', '.help-inline');
|
|
|
|
|
2013-12-02 15:25:21 +04:00
|
|
|
$I->amGoingTo('submit contact form with correct data');
|
|
|
|
$contactPage->submit([
|
2014-08-17 18:45:58 +04:00
|
|
|
'name' => 'tester',
|
|
|
|
'email' => 'tester@example.com',
|
|
|
|
'subject' => 'test subject',
|
|
|
|
'body' => 'test content',
|
|
|
|
'verifyCode' => 'testme',
|
2013-10-18 12:03:36 +00:00
|
|
|
]);
|
2013-12-17 00:46:46 +01:00
|
|
|
if (method_exists($I, 'wait')) {
|
2014-03-16 10:46:16 +06:00
|
|
|
$I->wait(3); // only for selenium
|
2013-12-17 00:46:46 +01:00
|
|
|
}
|
2013-06-22 20:26:22 -04:00
|
|
|
$I->dontSeeElement('#contact-form');
|
|
|
|
$I->see('Thank you for contacting us. We will respond to you as soon as possible.');
|