ContactCept.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. use tests\_pages\ContactPage;
  3. $I = new WebGuy($scenario);
  4. $I->wantTo('ensure that contact works');
  5. $contactPage = ContactPage::of($I);
  6. $I->amOnPage(ContactPage::$URL);
  7. $I->see('Contact', 'h1');
  8. $I->amGoingTo('submit contact form with no data');
  9. $contactPage->submit([]);
  10. $I->expectTo('see validations errors');
  11. $I->see('Contact', 'h1');
  12. $I->see('Name cannot be blank');
  13. $I->see('Email cannot be blank');
  14. $I->see('Subject cannot be blank');
  15. $I->see('Body cannot be blank');
  16. $I->see('The verification code is incorrect');
  17. $I->amGoingTo('submit contact form with not correct email');
  18. $contactPage->submit([
  19. 'name' => 'tester',
  20. 'email' => 'tester.email',
  21. 'subject' => 'test subject',
  22. 'body' => 'test content',
  23. 'verifyCode' => 'testme',
  24. ]);
  25. $I->expectTo('see that email adress is wrong');
  26. $I->dontSee('Name cannot be blank', '.help-inline');
  27. $I->see('Email is not a valid email address.');
  28. $I->dontSee('Subject cannot be blank', '.help-inline');
  29. $I->dontSee('Body cannot be blank', '.help-inline');
  30. $I->dontSee('The verification code is incorrect', '.help-inline');
  31. $I->amGoingTo('submit contact form with correct data');
  32. $contactPage->submit([
  33. 'name' => 'tester',
  34. 'email' => 'tester@example.com',
  35. 'subject' => 'test subject',
  36. 'body' => 'test content',
  37. 'verifyCode' => 'testme',
  38. ]);
  39. $I->wait(3);
  40. $I->dontSeeElement('#contact-form');
  41. $I->see('Thank you for contacting us. We will respond to you as soon as possible.');