Cypress Training Advent Lesson Day 17
Learn the difference between request reply and request continue methods π§
When mocking a network resource, your callback code can decide if the call should continue going to the server, or you can reply with some data. This is the topic of todayβs advent lesson βBonus 13: The req.reply and req.continue methodsβ. The lesson has several parts, solve each one before moving to the next one.
Tip: re-read the cy.intercept command documentation page before starting the lesson.
New video πΊ
I have recorded a short video explaining the difference between an element becoming invisible and an element being removed from the page. It matters how you attach multiple assertions!
The example recipe source code can be found at https://glebbahmutov.com/cypress-examples together with lots of assertion examples.
Mastodon account π
You can now find me on Mastodon @bahmutov@fosstodon.org
In the future, I plan to post all new information there first before posting it on other social networks.
Previous lessons
Lessons marked with π‘ are from the Cypress Network Testing Exercises course. Lessons marked with π are from the Cypress Plugins course.
Day 1: π‘ βSpec 08: Import the JSON fixture directly into the specβ
Day 2: π‘ βSpec 14: Reloads the page until it sees the word Bananas"Cypress
Day 3: π βLesson a3: Log the messages from the test to the terminalβ
Day 4: π‘ βSpec 04: The application is showing the loading elementβ
Day 5: π‘ βSpec 11: Test how the application makes a network request every minuteβ
Day 6: π βLesson a7: Re-run the tests when the source files change with cypress-watch-and-reload pluginβ
Day 7: π‘ βSpec 16: Get the fruits from the test using the cy.request commandβ
Day 8: π‘ βSpec 19: Intercept a specific request by matching the headerβ
Day 9: π βLesson b1: Slow down the test commands using cypress-slow-downβ
Day 10: π‘ βSpec 21: Modify the server response using cy.interceptβ
Day 11: π‘ βSpec 22: Using cy.wait vs cy.get to access the intercepted requestβ
Day 12: π βLesson l1: Confirm the attribute of the last itemβ
Day 13: π‘ βSpec 27: Simulate the server network errorβ
Day 14: π‘ βSpec 30: Handles test flake using the test retriesβ
Day 15: π βLesson e3: Validate URL search parametersβ
Day 16: π‘ βBonus 1: The server returns zero or more fruitsβ