Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

112
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!