Solution Review: Logout the User
This review provides an explanation for solving the “Logout the User” challenge.
We'll cover the following...
We'll cover the following...
Solution
Note: You can see the Cypress UI better by opening the link next to Your app can be found at:
context("Signup flow", () => {
it("The happy path should work", () => {
cy.visit("/register");
const random = Math.floor(Math.random() * 100000);
cy.findByPlaceholderText("Username").type(`Tester${random}`);
cy.findByPlaceholderText("Email").type(`user+${random}@realworld.io`);
cy.findByPlaceholderText("Password").type("mysupersecretpassword");
cy.get("form")
.within(() => cy.findByText("Sign up").click())
cy.findByText("No articles are here... yet.", { timeout: 10000 }).should("be.visible");
cy.findByText("Settings").click();
cy.findByText("Or click here to logout.").click();
cy.findByText("Sign up").should("be.visible");
});
});
Solution