'Cypress redirects randomly making test flaky

I have encountered a wierd redirect in my cypress tests that occur seemingly randomly and I would really appreciate some help on why this is happening. As you can see in my code there's no new route that should happen here:

it('should click on my account menu', () => {
    cy.getByTranslationKey('My account').click({timeout: 5000})
  });

  it('should click on Account Settings in the account menu', () => {
    cy.get('.ReactCollapse--content').should('be.visible')

    cy.getByTranslationKey('Account settings')
    .should('be.visible', {timeout: 5000})
    .click();
  });

  it('should display the email in the form', () => {
    cy.get('input[name="person.email"]')
      .should('be.visible')
      .should('have.value', email);
  });

As you can see there's a "new route" here:

https://i.stack.imgur.com/MzF7N.png



Solution 1:[1]

Each

it('', ()=>{});

construct will reinstantiate from scratch your page if you didn't set a baseUrl. See reference.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Fseee