Wait For 3rd Party JavaScript
Advent day 8: delay a 3rd party JS resource to check how the application handles it
This post was inspired by the question Robin Weser has asked me: “How do you deal with 3rd party JavaScript calls? What if the external library takes a while to load? How can Cypress test guard against it?”
Excellent question, Robin! In the video below, I show how to work with the 3rd party chat widget Tidio. In particular, the video shows how to:
slow down a particular network request using cy.intercept
wait for the external JavaScript library to start by checking a property it adds to the “window” object
invoke a method on the chat object from the test code (hey, App Actions!)
You can find the full set of tests in the repo bahmutov/cypress-3rd-party-script-example. Stay tuned: there are other things I want to show based on this example application!