Challenge: e2e Tests

Practice what we’ve learned about Cypress and the Cypress testing library.

Problem statement

End-to-end tests are a great way to test if core user journeys on a website work in a cohesive and coherent manner. Your task is to write e2e tests using Cypress and the Cypress testing library to ensure that the website displays the correct information.

Challenge

Your project contains “Home,” “About,” and “Contact” pages. Your task is to write tests using Cypress and the Cypress testing library that will do the following:

Home

  • Visit the homepage.
  • Check that the homepage contains the Welcome to The Road To Enterprise text.

About

  • Navigate to the “About” page.

  • Check that the “About” page doesn’t contain Welcome to The Road To Enterprise text.

  • Check that the about page contains About Us text.

Contact

  • Navigate to the “contact us” page.
  • Fill in the email and message fields using the contactData fixture.
  • Submit the form by clicking on the “Send” button.
  • Check that the “contact us” page contains the Message sent text.
  • Check that the “contact us” page contains the email and message texts entered in the form.

The tests should be written in the tests/e2e/specs/website.js file. Note that while you should use the cy.visit command to get to the homepage for the first test, you should not use it to get to other pages. Instead, use the navigation buttons that are rendered in the App.vue component.

Get hands-on with 1400+ tech skills courses.