0

I'm testing an angular application with cypress (e2e testing with chrome). When I click a div element the code redirects to the /begincompilation page. Instead, when I run the test, the click redirects to the login (base url)

component.html

<div  [attr.data-cy]="module.name" class="blog-card" (click)="modClicked();">

modClicked() is called correctly but in the cypress console they see a redirect to /home and then to /login, so the test fails because obviously the url doesn't contain /begincompilation

enter image description here

spec.cy.ts

it('Inizializzazione della compilazione', () => {

    const moduleCard = cy.get('[data-cy="cypress"]').eq(1);
    moduleCard.should('be.visible');
    
    moduleCard.click();
    
    cy.url().should('include','begincompilation');
  })
sigi
  • 1

0 Answers0