Add a basic Cypress test

This commit is contained in:
2020-12-08 19:17:35 +01:00
parent b7f1e71cbb
commit 55e1019daf

View File

@@ -1,8 +1,23 @@
// https://docs.cypress.io/api/introduction/api.html // https://docs.cypress.io/api/introduction/api.html
describe("My First Test", () => { describe("Homepage", () => {
it("Visits the app root url", () => { it("Visits the app root url", () => {
cy.visit("/"); cy.visit("http://localhost:8080");
cy.contains("h1", "Welcome to Your Vue.js App"); 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());
});
}); });
}); });