2016-07-16 04:13:51 +03:00
|
|
|
<?php
|
2017-09-12 17:29:58 +08:00
|
|
|
|
2016-07-16 04:13:51 +03:00
|
|
|
class ContactFormCest
|
|
|
|
{
|
|
|
|
public function _before(\FunctionalTester $I)
|
|
|
|
{
|
2022-02-24 21:45:17 +00:00
|
|
|
$I->amOnRoute('site/contact');
|
2016-07-16 04:13:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function openContactPage(\FunctionalTester $I)
|
|
|
|
{
|
|
|
|
$I->see('Contact', 'h1');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function submitEmptyForm(\FunctionalTester $I)
|
|
|
|
{
|
|
|
|
$I->submitForm('#contact-form', []);
|
|
|
|
$I->expectTo('see validations errors');
|
|
|
|
$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');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function submitFormWithIncorrectEmail(\FunctionalTester $I)
|
|
|
|
{
|
|
|
|
$I->submitForm('#contact-form', [
|
2016-07-25 23:41:30 +03:00
|
|
|
'ContactForm[name]' => 'tester',
|
|
|
|
'ContactForm[email]' => 'tester.email',
|
|
|
|
'ContactForm[subject]' => 'test subject',
|
|
|
|
'ContactForm[body]' => 'test content',
|
|
|
|
'ContactForm[verifyCode]' => 'testme',
|
2016-07-16 04:13:51 +03:00
|
|
|
]);
|
|
|
|
$I->expectTo('see that email address is wrong');
|
|
|
|
$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');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function submitFormSuccessfully(\FunctionalTester $I)
|
|
|
|
{
|
|
|
|
$I->submitForm('#contact-form', [
|
2016-07-25 23:41:30 +03:00
|
|
|
'ContactForm[name]' => 'tester',
|
|
|
|
'ContactForm[email]' => 'tester@example.com',
|
|
|
|
'ContactForm[subject]' => 'test subject',
|
|
|
|
'ContactForm[body]' => 'test content',
|
|
|
|
'ContactForm[verifyCode]' => 'testme',
|
2016-07-16 04:13:51 +03:00
|
|
|
]);
|
2016-07-19 03:43:26 +03:00
|
|
|
$I->seeEmailIsSent();
|
2016-07-16 04:13:51 +03:00
|
|
|
$I->dontSeeElement('#contact-form');
|
|
|
|
$I->see('Thank you for contacting us. We will respond to you as soon as possible.');
|
|
|
|
}
|
|
|
|
}
|