Skip to content

Two new urls but second one missing path variable in Cypress

Maybe a bit difficult to explain but I have the following issue. I have created a link and Cypress wants to click it, but it seems to click it twice. The second time the path variable is missing (the ID of an incident) and now it stores ‘undefined’ as incident ID, while the ID is ‘458868’

Does anyone why it calls this URL twice and why the second time the incident ID is missing in the URL?

The step definition is:

cy.get('.html-link').click({force:true});

Thanks!! enter image description here

Answer

I think i have solved the issue:

@Fody said to add a wait in the step.

cy.get('.html-link').wait(1000).click({force:true});

Although i’m not a fan of waits, in this case it seems to work. Thanks.