Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

48 lines
1.6KB

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