tests Reduces confidence in the team Increases the number of unfound bugs Increases debugging time Increases software engineering costs Increases the stress level of those involved Increases delivery time Decreases the perceived software quality
environment Manual and automated tests running against the same environment. Rendering order cy.get().first() vs. cy.get().should(‘have.length, n).first() Waiting times (network) cy.wait(10000) vs. cy.wait(‘@alias’) Local vs. CI Different computing resources Component state Example: Disabled button Not visible field Animations/transitions The Cypress way: cy.get(‘button’).should(‘be.e nabled’).click() Lack of tool knowledge cy.visit() cy.intercept().as(‘alias’) cy.wait(‘@alias’) vs. cy.intercept().as(‘alias’) cy.visit() cy.wait(‘@alias’) Dependency between tests describe(‘Test suite’, () => { it(‘visits the page’, () => { cy.visit(‘/’) }) it(‘checks the title’, () => { cy.get(‘h1’) .should(‘be.visible’) }) }) Parallelism Data creation that cannot be repeated Tests using shared data API limitations
some suggestions. 01. Identify the root cause and fix it immediately 02. Quarantine 03. Rewrite or move the test to another level (e.g. component instead of e2e)
are some tips on what not to do. 01. Don't ignore flaky testing 02. Don't use something like cy.wait(Number) 03. Don’t just rely on retries (you’ll just be “sweeping the dust under the rug”)
just as you don't like the phrase “it works on my machine,” understand that there is no point in passing the test just on your machine. Automated tests must be deterministic and also pass in the continuous integration environment.