dimanche 23 décembre 2018

How to assert page doesnt reload with Cypress

I am running a test that assures a page does not reload when a button is clicked. So far, I have not found the best way to assert on this. I initially thought to create a route and wait for the xhr request that I don't want to happen, and if it happens, to fail the test. However, there does not appear to be a way to catch an error from a cy.wait() which makes it impossible for me to pass the test once the timeout occurs. My current solution is to ensure that the href for the given element starts with "#", but that seems to have the shortcoming of someone potentially attaching an event to it that would in-fact reload the page and it would not be caught by my test.

Aucun commentaire:

Enregistrer un commentaire