Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Timed out after 4000ms. The done() callback was never invoked!

Comecei a ver esse erro em todos os testes que implementei os comandos personalizados.

gui_commands.js

Cypress.Commands.add('login', (name, password) => {
    cy.get('input[formcontrolname=userName]').type(name);
    cy.get('input[formcontrolname=password]').type(password);
    cy.get('button[type="submit"]').click();
});

Cypress.Commands.add('register', (email, fullName, userName, password) => {
    cy.contains('a','Register now').click();
    cy.contains('button', 'Register').click();
    cy.get('input[formcontrolname=email]').type(email);
    cy.get('input[formcontrolname=fullName]').type(fullName);
    cy.get('input[formcontrolname=userName]').type(userName);
    cy.get('input[formcontrolname=password]').type(password);
    cy.contains('button', 'Register').click();
});

alurapic.js

    it('Login with valid user', (name, password) => {
        cy.login('flavio', '123');
        cy.contains('a', '(Logout)').should('be.visible');
    })

    it('Login with invalid user', (name, password) => {
        cy.login('Felipe', '1111');
        cy.on('window:alert', (str) => {
            expect(str).to.equal('Invalid user name or password');
        });
    });

    const users = require('../../fixtures/users.json')
    users.forEach(user => {
        it('Register new user' + user.userName, (email, fullName, userName, password) => {
            cy.register(user.email, user.fullName, user.userName, user.password);
        })
    })

CypressError Timed out after 4000ms. The done() callback was never invoked! View stack trace Print to console CypressError: Timed out after 4000ms. The done() callback was never invoked!

at cypressErr (https://alura-fotos.herokuapp.com/__cypress/runner/cypress_runner.js:154824:18)
at Object.errByPath (https://alura-fotos.herokuapp.com/__cypress/runner/cypress_runner.js:154879:10)
at https://alura-fotos.herokuapp.com/__cypress/runner/cypress_runner.js:156492:80

Alguma dica?

Cypress package version: 12.9.0

Cypress binary version: 12.9.0

Electron version: 21.0.0

Bundled Node version:

16.16.0

1 resposta
solução!

Encontrei os erros...

it('Login with valid user', (name, password) => {
    cy.login('flavio', '123');
    cy.contains('a', '(Logout)').should('be.visible');
})

Adicionei os argumentos dentro da funçao...

O certo

it('Login with valid user', () => {
    cy.login('flavio', '123');
    cy.contains('a', '(Logout)').should('be.visible');
})