I have the following test, written in Cypress. I use VueJS with SSR support for my frontend. My app it’s an SPA and I am testing the user click on a menu.
before(() => {
// mock data etc.
});
it('should check if component render properly without ssr', () => {
cy.visit('url');
cy.wait(1000);
cy.get('.menuElement').click();
cy.get('.something').should($something => {
expect($something).to.have.length(10);
});
});
According to Cypress’ best practices, I shouldn't use cy.wait in this form. But the problem is; without the wait, the test will fail. I tried using:
{ timeout: 10000 }
as param in cy.get and cy.visit- aded something like
.should('be.visible');
(for waiting when will be visible) - added route with
cy.wait("@abc")
But none of the above works for me.
Please suggest a solution. What should I do that everything works correctly in my case?
cy.wait (1000);
. – Twelvemonth.menuElement
but then it times out? – Kolkhozcy.wait(0);
? – Heterozygote