You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ContactCept.php 1.6KB

8 vuotta sitten
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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.');