Skip to content

Instantly share code, notes, and snippets.

@CodeAkinori
Created April 1, 2024 21:26
Show Gist options
  • Save CodeAkinori/13ced2c2f47f75a5f4f37c97c814f9d7 to your computer and use it in GitHub Desktop.
Save CodeAkinori/13ced2c2f47f75a5f4f37c97c814f9d7 to your computer and use it in GitHub Desktop.

Revisions

  1. CodeAkinori created this gist Apr 1, 2024.
    31 changes: 31 additions & 0 deletions contato.cy.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    /// <reference types="cypress" />

    describe("Testes para a agenda", () => {
    beforeEach(() => {
    cy.visit("https://agenda-contatos-react.vercel.app/");
    });

    it("Deve incluir um novo contato", () => {
    cy.get('input[type="text"]').type("teste");
    cy.get('input[type="email"]').type("[email protected]");
    cy.get('input[type="tel"]').type("4002 8922");
    cy.get('button[type="submit"]').click();

    cy.get("ul>li:contains(teste)").should("be.visible");
    });

    it("Deve editar um contato", () => {
    cy.get("button.edit").last().click();
    cy.get('input[type="text"]').clear().type("NomeAlterado");
    cy.get('input[type="email"]').clear().type("[email protected]");
    cy.get('input[type="tel"]').clear().type("000 00 0");
    cy.get('button[type="submit"]').click();

    cy.get("ul>li:contains(NomeAlterado)").should("be.visible");
    });

    it("Deve remover um contato", () => {
    cy.get("button.delete").last().click();
    cy.contains("NomeAlterado").should("not.exist");
    });
    });