Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travamento do Cypress após utilizar "While" nos testes #27073

Closed
Jeremias-Souza opened this issue Jun 19, 2023 · 1 comment
Closed

Travamento do Cypress após utilizar "While" nos testes #27073

Jeremias-Souza opened this issue Jun 19, 2023 · 1 comment

Comments

@Jeremias-Souza
Copy link

Current behavior

Após acrescentar um While no meu código, e iniciar os testes através do Cypress Open, o mesmo quando chega na função trava e fecha a execução, tendo que inicializar novamente o Cypress novamente.

Desired behavior

Que execute o código normalmente, sem causar quebras no Cypress.

Test code to reproduce

let assinature = 0;
let confirmation = false;

while(confirmation === false){
    cy.xpath("(//i[normalize-space()='autorenew'])[1]").click();
}

if(cy.xpath("(//button[normalize-space()='Assinado'])[1]").contains('Assinado').should('be.visible'))
{
    assinature ++;
    confirmation = true;
}

while (assinature > 0 && assinature < 2){
    cy.xpath("//span[normalize-space()='Assinaturas']").click({force:true});
    cy.xpath("(//button[normalize-space()='Assinado'])[1]").contains('Assinado').should('be.visible');
}

Cypress Version

v11.0.1

Node version

v9.5.1

Operating System

macOs v13.3.1

Debug Logs

No response

Other

No response

@MikeMcC399
Copy link
Contributor

@Jeremias-Souza

See Cypress documentation

https://docs.cypress.io/guides/core-concepts/introduction-to-cypress#Avoid-loops

Also you might find the Cypress-BR Telegram channel https://t.me/cypress_br useful:

Grupo BR para usuários e entusiastas do Cypress (cypress.io). https://telegra.ph/Regras-do-Canal-Cypress-BR-06-26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants