Main E2E Test Defects: Determinism
Make Cypress tests more deterministic by randomizing a user.
We'll cover the following
Introduction
Recalling the signup flow E2E test:
context("Signup flow", () => {
it("The happy path should work", () => {
cy.visit("/register");
cy.get(".form-control").then($els => {
cy.get($els[0]).type("Tester");
cy.get($els[1]).type("user@realworld.io");
cy.get($els[2]).type("mysupersecretpassword");
});
cy.get("button").click();
cy.contains("No articles are here").should("be.visible");
});
});
This test contains many problems.
The test is not deterministic, meaning its behavior is not the same every time we restart the test.
Get hands-on with 1400+ tech skills courses.