From 55e1019daf5fba1e80643c98e5bfdca0d926f5f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Viricel?= Date: Tue, 8 Dec 2020 19:17:35 +0100 Subject: [PATCH] Add a basic Cypress test --- tests/e2e/specs/test.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/e2e/specs/test.js b/tests/e2e/specs/test.js index 1d74984..a22a738 100644 --- a/tests/e2e/specs/test.js +++ b/tests/e2e/specs/test.js @@ -1,8 +1,23 @@ // https://docs.cypress.io/api/introduction/api.html -describe("My First Test", () => { +describe("Homepage", () => { it("Visits the app root url", () => { - cy.visit("/"); - cy.contains("h1", "Welcome to Your Vue.js App"); + cy.visit("http://localhost:8080"); + cy.contains("h2", "Directory"); + }); + + it("Deletes a fruit", () => { + cy.get(".action-btn--delete").click(); + cy.get(".grid-item:first-of-type .delete-btn").click(); + cy.get(".btn--success").click(); + cy.url().should("equal", "http://localhost:8080/"); + }); + + it("Navigates to fruit details", () => { + const fruitElmt = cy.get(".grid-item:first-of-type a"); + fruitElmt.get("h3").then(elmt => { + fruitElmt.click(); + cy.contains("h3", elmt.text()); + }); }); });