Cypress: [Bug] Simple tests fail randomly

Created on 1 Jun 2018  路  6Comments  路  Source: cypress-io/cypress

Current behavior:

  • Tests passes
    or
  • Tests fail randomly clicking on menu items due elements not visible?

image

How the test(s) look like:

it('Audiences > Source audiences', function () {
    cy.get('li[id="mainMenu:Audiences"]').should('be.visible').click()
    cy.get('li[id="mainMenu:SourceAudiences"]').should('be.visible').click()
        cy.url().should('eq', 'https://domain.com/audiences')
    cy.get('h1[id="screen-title"]').should('have.text', 'Your audiences')
    cy.get('h4[id="screen-subtitle"]').should('have.text', 'Manage & create your source audiences')
})

or even when i run the test like this the same bevavior

it('Audiences > Source audiences', function () {
    cy.get('li[id="mainMenu:Audiences"]').click()
    cy.get('li[id="mainMenu:SourceAudiences"]').click()
        cy.url().should('eq', 'https://domain.com/audiences')
    cy.get('h1[id="screen-title"]').should('have.text', 'Your audiences')
    cy.get('h4[id="screen-subtitle"]').should('have.text', 'Manage & create your source audiences')
})

Also happening when running headless mode.

Desired behavior:

Tests should always pass since the snapshots are showing the elements just fine?
Sometimes the elements seems not to be recognized as visible in cypress GUI.

Versions

Cypress: 3.0.0 / Windows 10

visibility 馃憗 bug

Most helpful comment

I solved this by adding cy.wait() between the navigation. It takes around +/- 3 times longer for the full test to run, but at-least the tests are all passing now! The cause of the test randomly failing seems to be the loading time of iframe(s) on those pages. When the iframe is not completely loaded test(s) fails.

All 6 comments

I solved this by adding cy.wait() between the navigation. It takes around +/- 3 times longer for the full test to run, but at-least the tests are all passing now! The cause of the test randomly failing seems to be the loading time of iframe(s) on those pages. When the iframe is not completely loaded test(s) fails.

Unfortunately we'll have to close this issue if no reproducible example is provided. Can you provide a way to reproduce this?

I also have random errors in the test. The problem is, its random, so reproducing is hard :)
But i reduced the rate of fails with a timeout set to 30 sec, but i still have some issues, randomly.

Sorry for not coming back to this issue. Didn't dived into it yet!
Will try to run fix my tests and run them again to see if it fails randomly.

Unfortunately we have to close this issue as there is not enough information to reproduce the problem.

Please comment in this issue with a reproducible example and we will reopen the issue. 馃檹

I keep on having the same issues.

The great thing is my tests pass just fine locally, but on Buildkite is suddenly pretends to not be able to detect a .should('not.be.visible') (while the element literally is not visible) and complains about an "overlaying element", which doesn't exist.

It only fails in 1 test, yet I do the same test twice (it only ever fails the second time).

I'm starting to get the feeling it's somehow caching DOM fragments or something, because I'm all out of explanations.

And because the error is incorrect (it's doesn't seem to reflect the real state of the DOM), it's impossible to debug.

Was this page helpful?
0 / 5 - 0 ratings