How to switch Angular Tab in a Cypress Test

Discussão em 'Angular' iniciado por Tristate, Março 26, 2025.

  1. Tristate

    Tristate Guest

    I have a Signup/Signin Angular Material Form

    <mat-tab-group class="signupDiv">
    <mat-tab label="Sign Up">
    <app-signup></app-signup>
    </mat-tab>
    <mat-tab id="idTabSignIn" label="Signin">
    <app-signin></app-signin>
    </mat-tab>
    </mat-tab-group>


    I want to build a cypress test like

    1. Switch Tab to Signin.
    2. Fill Form.
    3. Click Sign in.

    two and three is no Problem, but I struggle with 1. How I can switch the tab with Cypress?

    My code so far

    describe('Signin', () => {
    it('Sign with existing account', function () {
    cy.visit('/')
    cy.get('#idTabSignIn').click() <---ERROR: idTabSignIn not found
    })
    })

    Continue reading...

Compartilhe esta Página