Introduction to Cypress Workshop

Custom Commands & Fixtures


The wait call can be useful to use in your tests because sometimes the server is still populating data. So, using the wait call to wait for the server to finish loading the data will allow you to test the appropriate data you are trying to test.

Exercise instructions

In the initial-page:

✅ Create a new test that tests when there are only 4 heroes returned from the initial get request

✅ Create a fixture for that sample data

✅ Create a custom command to visit the dashboard and use that initial data

(similar to the visitIronman command)

✅ Test that all 4 heroes are displaying in the dashboard

Contents of the 4heroes.json file shown:

  { "id": 21, "name": "IronMan"},
  { "id": 22, "name": "Spidey"},
  { "id": 23, "name": "Thor"},
  { "id": 24, "name": "Hulk"}

I finished! On to the next chapter