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

Wrong message in correct assert #173

Closed
xavigimenezsanchez opened this issue Feb 2, 2023 · 3 comments
Closed

Wrong message in correct assert #173

xavigimenezsanchez opened this issue Feb 2, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@xavigimenezsanchez
Copy link

Every time I have a correct assert comparing two strings, for instance,
cy.get(".card__header__text").should("have.text", name);

Cypress-terminal-report is showing a wrong message:
cy:command ✔ assert expected .card__header__text to have text db1, but the text was ''

It is happening with the last version 5.0.1 and with version 3.5.2

@archfz
Copy link
Owner

archfz commented Feb 2, 2023

I've tried to reproduce this in the https://github.com/archfz/cypress-terminal-report-demo by running npx cypress run --spec cypress/integration/examples/assertions.spec.ts but I get correct output: cy:command ✔ assert expected **<td>** to have text **Column content**. The demo is on latest version both cypress and the plugin.

Is the output correct in the cypress GUI? Could you provide more details, preferably a minimal reproduction.

@xavigimenezsanchez
Copy link
Author

In cypress GUI is correct.

Details about how it is working:

  • cy.visit is call it in beforeEach statement
  • An example of the output comparing texts:
  • cy:command + assert expected <span.main-head__header-bar__left__logo--bold> to have text PSLink
    cy:command + assert expected <span.main-head__header-bar__left__logo--light> to have text e2e-test-xavi, but the text was ''
  • The difference between the first one and the second that appears the message "but the text was ''" is that the second one needs more milliseconds to load.

If a cy.wait is put after the cy.visit the problem disappears

@archfz
Copy link
Owner

archfz commented Feb 4, 2023

Fixed in 5.0.2. If backport needed into 3.x.x, contribution is welcome (https://github.com/archfz/cypress-terminal-report/pull/174/files).

@archfz archfz closed this as completed Feb 4, 2023
@archfz archfz added the bug Something isn't working label Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants