From 309975ed8b4ac474b913a1e4ff230240774a2d55 Mon Sep 17 00:00:00 2001 From: Heitor Oliveira Date: Thu, 25 Jul 2024 22:47:19 +0000 Subject: [PATCH] Arrumei todos os specs do cypress. --- src/cypress/commands/checkFilterCount.js | 42 ++++++++++++------------ src/cypress/e2e/homepage/full.cy.js | 15 ++++----- src/cypress/e2e/opportunity/index.cy.js | 4 ++- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/cypress/commands/checkFilterCount.js b/src/cypress/commands/checkFilterCount.js index bd4e1fcefd..cd66af920c 100644 --- a/src/cypress/commands/checkFilterCount.js +++ b/src/cypress/commands/checkFilterCount.js @@ -6,27 +6,27 @@ function checkFilterCount() { let resultsType = resultsTextArray[1]; const resultsCountPerPage = resultsCount < countPerPage ? resultsCount : countPerPage; - switch (resultsType) { - case "Oportunidades": - cy.get('.upper').should("have.length", resultsCountPerPage); - cy.wait(1000); - cy.contains(resultsCount + " Oportunidades encontradas"); - - break; - - case "Projetos": - cy.get('.upper').should("have.length", resultsCountPerPage); - cy.wait(1000); - cy.contains(resultsCount + " Projetos encontrados"); - - break; - - case "Espaços": - cy.get('.upper').should("have.length", resultsCountPerPage); - cy.wait(1000); - cy.contains(resultsCount + " Espaços encontrados"); - - break; + switch (resultsType) { + case "Oportunidades": + cy.get('.upper').should("have.length", resultsCountPerPage); + cy.wait(1000); + cy.contains(resultsCount + " Oportunidades encontradas"); + + break; + + case "Projetos": + cy.get('.upper').should("have.length", resultsCountPerPage); + cy.wait(1000); + cy.contains(resultsCount + " Projetos encontrados"); + + break; + + case "Espaços": + cy.get('.upper').should("have.length", resultsCountPerPage); + cy.wait(1000); + cy.contains(resultsCount + " Espaços encontrados"); + + break; default: cy.log("checkFilterCount(): tipo inválido"); diff --git a/src/cypress/e2e/homepage/full.cy.js b/src/cypress/e2e/homepage/full.cy.js index 64c841e592..b1efa39244 100644 --- a/src/cypress/e2e/homepage/full.cy.js +++ b/src/cypress/e2e/homepage/full.cy.js @@ -46,20 +46,19 @@ describe("Homepage", () => { cy.get(".carousel__prev").click(); }); - it("Acessa o navbar e o botão \"Acessar\" dos cards da seção \"Em destaque\"", () => { - cy.get(".agents > a > span").click(); - cy.wait(1000); - cy.get(".carousel__slide--active > .entity-card > .entity-card__footer > .entity-card__footer--action > .button").click(); - cy.url().should("include", "/agente/"); + it("Acessa o navbar e o botão \"Acessar\" dos cards da seção \"Em desteaque\"", () => { + cy.contains("Acessar").eq(0).click(); + cy.wait(2000); + cy.url().should("include", "/agente/27/#info"); cy.contains("Anne Elisa"); backHomepage(); cy.get(".agents > a > span").click(); cy.wait(1000); cy.get('.carousel__next').click(); - cy.get('[style="width: 31.25%; order: 3;"] > .entity-card > .entity-card__footer > .entity-card__footer--action > .button').click(); - cy.url().should("include", "/agente/"); - cy.contains("a", "https://pt.wikipedia.org/wiki/Cleodon_Silva"); + cy.get('[style="width: 31.25%; order: 2;"] > .entity-card > .entity-card__footer > .entity-card__footer--action > .button').click(); + cy.url().should("include", "/agente/16/#info"); + cy.contains("Universidade de Brasília"); backHomepage(); /* diff --git a/src/cypress/e2e/opportunity/index.cy.js b/src/cypress/e2e/opportunity/index.cy.js index fb9899da30..5a56f33b1e 100644 --- a/src/cypress/e2e/opportunity/index.cy.js +++ b/src/cypress/e2e/opportunity/index.cy.js @@ -29,7 +29,9 @@ describe("Opportunity Page", () => { it("Garante que os filtros de oportunidades funcionam quando existem resultados para a busca textual", () => { cy.visit("/oportunidades"); - cy.get(".search-filter__actions--form-input").type("f"); + + cy.get(".search-filter__actions--form-input").type("teste"); + cy.wait(1000); checkFilterCount();