sparkbox / apprentice-at

An online listing of apprenticeship opportunities.
https://apprentice.at/
3 stars 4 forks source link

test: intercept form submission #331

Closed jonoliver closed 2 years ago

jonoliver commented 2 years ago

Looks like we're getting actual form submissions come through when the Cypress tests run against the PR deployments in Netlify. We can see this in the #sparkbox-com channel on Slack. This PR uses cy.intercept to intercept the form post and stub the response by issuing a redirect to the /thank-you page. This allows the test to exercise the form submission without actually submitting it.

Validation

  1. In theory, when I create this PR, we should not see a form submission notification in #sparkbox-com after the tests run in CI.
  2. When running Cypress locally, we should now see output that the request is being intercepted. At the start of the test, we'll see the route defined: Screen Shot 2022-02-24 at 5 50 04 PM

Then, when the form is submitted in the test, we should see that it's using the intercept:

Screen Shot 2022-02-24 at 5 50 18 PM

:

cypress[bot] commented 2 years ago



Test summary

13 0 0 0


Run details

Project apprentice-at
Status Passed
Commit 929dde48df
Started Feb 25, 2022 3:04 PM
Ended Feb 25, 2022 3:05 PM
Duration 01:28 💡
OS Linux Ubuntu - 20.04
Browser Custom chromium 90

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard