Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

110
Visualizações
Why cypress back to login page after the third IT?

I've been looking and doing research but the results are the same. Why does the it only run 2 times not to finish. When running the 3rd task cypress direct again to the login page.

describe("Overview Page", () => {
  before("Behaviour to overview page", () => {
    cy.SignIn();
    cy.preverseAllCookiesOnce();
  });

  it("Overview Page Check (Sidebar and Header)", () => {
    cy.intercept({
      method: "GET",
      url: "https://api.mapbox.com/**",
    }).as("dataMapbox");

    cy.intercept({
      method: "GET",
      url: "https://api.com/v2/**",
    }).as("data");

    cy.contains("Science Park").click();
    cy.wait("@dataMapbox", { timeout: 90000 })
      .its("response.statusCode")
      .should("equal", 200);

    cy.wait("@data", { timeout: 90000 })
      .its("response.statusCode")
      .should("equal", 200);
    // sidebar
    cy.get(".toc > .attached").as("sidebar");
    cy.get("@sidebar").should("be.visible");
    // page loaded
    cy.wait(15000);
    cy.get(".twelve > .header").should("have.text", "Overview");
  });

  it("Button Current and Dissmiss", () => {
    // current and dismiss
    cy.get(
      ':nth-child(1) > .top > [style="display: flex; align-items: center; flex-grow: 1; justify-content: flex-end;"] > .ui > .active'
    ).click();
   
  });

  it("Mapbox Button Check", () => {
    cy.get(
      ':nth-child(2) > .top > [style="display: flex; align-items: center; flex-grow: 1; justify-content: flex-end;"] > .ui > .active'
    ).click();
    for (let n = 0; n < 5; n++) {
      cy.get('[data-tooltip="Map rotate 45 degree anticlockwise."]').click();
    }

    for (let n = 0; n < 5; n++) {
      cy.get('[data-tooltip="Map rotate 45 degree clockwise."]').click();
    }
   
  });
});

The command.js

Cypress.Commands.add("preverseAllCookiesOnce", () => {
  cy.getCookies().then((cookies) => {
    const namesOfCookies = cookies.map((c) => c.name);
    Cypress.Cookies.preserveOnce(...namesOfCookies);
  });
});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Just found it out. This is the correct structure.

describe("Overview Page", () => {
  before("Behaviour to overview page", () => {
    cy.SignIn();
  });
  beforeEach("keep using the session", function () {
    cy.preverseAllCookiesOnce();
  });
})
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda