|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace App\Tests\Functional; |
|
6
|
|
|
|
|
7
|
|
|
use App\Tests\FunctionalTester; |
|
8
|
|
|
|
|
9
|
|
|
final class ContactCest |
|
10
|
|
|
{ |
|
11
|
|
|
public function _before(FunctionalTester $I) |
|
12
|
|
|
{ |
|
13
|
|
|
$I->amOnPage('/contact'); |
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
public function openContactPage(FunctionalTester $I) |
|
17
|
|
|
{ |
|
18
|
|
|
$I->wantTo('ensure that contact page works'); |
|
19
|
|
|
$I->seeElement('button', ['name' => 'contact-button']); |
|
20
|
|
|
$I->see('Submit', ['name' => 'contact-button']); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
public function submitEmptyForm(FunctionalTester $I) |
|
24
|
|
|
{ |
|
25
|
|
|
$I->submitForm('#form-contact', []); |
|
26
|
|
|
$I->expectTo('see validations errors'); |
|
27
|
|
|
$I->see('Value cannot be blank.'); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public function submitFormWithIncorrectEmail(FunctionalTester $I) |
|
31
|
|
|
{ |
|
32
|
|
|
$I->submitForm('#form-contact', [ |
|
33
|
|
|
'ContactForm[name]' => 'tester', |
|
34
|
|
|
'ContactForm[email]' => 'tester.email', |
|
35
|
|
|
'ContactForm[subject]' => 'test subject', |
|
36
|
|
|
'ContactForm[body]' => 'test content', |
|
37
|
|
|
'ContactForm[verifyCode]' => 'testme', |
|
38
|
|
|
]); |
|
39
|
|
|
$I->expectTo('see that email address is wrong'); |
|
40
|
|
|
$I->see('This value is not a valid email address.'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function submitFormSuccessfully(FunctionalTester $I) |
|
44
|
|
|
{ |
|
45
|
|
|
$I->submitForm('#form-contact', [ |
|
46
|
|
|
'ContactForm[name]' => 'tester', |
|
47
|
|
|
'ContactForm[email]' => '[email protected]', |
|
48
|
|
|
'ContactForm[subject]' => 'test subject', |
|
49
|
|
|
'ContactForm[body]' => 'test content', |
|
50
|
|
|
]); |
|
51
|
|
|
$I->see("Thank you for contacting us, we'll get in touch with you as soon as possible."); |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
|