ContactCept.php 1.44 KB
Newer Older
1
<?php
2

Mark committed
3 4
use tests\_pages\ContactPage;

5 6
$I = new WebGuy($scenario);
$I->wantTo('ensure that contact works');
Mark committed
7

8 9
$contactPage = ContactPage::openBy($I);

10 11
$I->see('Contact', 'h1');

Mark committed
12 13 14
$I->amGoingTo('submit contact form with no data');
$contactPage->submit([]);
$I->expectTo('see validations errors');
15 16 17 18 19 20 21
$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');

Mark committed
22 23 24 25 26 27 28
$I->amGoingTo('submit contact form with not correct email');
$contactPage->submit([
	'name'			=>	'tester',
	'email'			=>	'tester.email',
	'subject'		=>	'test subject',
	'body'			=>	'test content',
	'verifyCode'	=>	'testme',
29
]);
Mark committed
30
$I->expectTo('see that email adress is wrong');
31 32 33 34 35 36
$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');

Mark committed
37 38 39 40 41 42 43
$I->amGoingTo('submit contact form with correct data');
$contactPage->submit([
	'name'			=>	'tester',
	'email'			=>	'tester@example.com',
	'subject'		=>	'test subject',
	'body'			=>	'test content',
	'verifyCode'	=>	'testme',
44
]);
45 46 47
if (method_exists($I, 'wait')) {
	$I->wait(3); // only for selenium
}
48 49
$I->dontSeeElement('#contact-form');
$I->see('Thank you for contacting us. We will respond to you as soon as possible.');