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

If there are multiple spaces in error log, assert text log shows incorrect one, AssertionError correct one #29749

Open
neminovno opened this issue Jun 25, 2024 · 1 comment
Labels
pkg/reporter This is due to an issue in the packages/reporter directory stale no activity on this issue for a long period type: bug

Comments

@neminovno
Copy link

neminovno commented Jun 25, 2024

Current behavior

Noticed that should('include.text', myText) and should('contain.text', myText) fails with this in log sidebar:

assert expected '<div>' to contain text 'AAA, BBB', but the text was 'AAA, BBB some more text'

AssertionError
Timed out retrying after 10000ms: expected <div> to contain text 'AAA, BBB', but the text was 'AAA, BBB some more text'

and find out that first line is missing two spaces, while AssertionError line shows correctly two spaces within:

but the text was 'AAA,_SPACE__SPACE_BBB

The first line is wrong and misleading. I lost 20mins to find out why it fails.

image

Desired behavior

The first line message, the one starting with "assert", should be fixed to show correct text; with two spaces in this case.

Test code to reproduce

const getName = () => {
  const parser = new DOMParser();
  const stringWithTwoSpaces = '<div>Jane  Lane</div>';

  return parser.parseFromString(stringWithTwoSpaces, 'text/html');
};

cy.wrap({ name: getName })
  .invoke('name')
  .should('include.text', 'Jane Lane');

Cypress Version

13.6.6

Node version

20.11.0

Operating System

Win 10

Debug Logs

No response

Other

No response

@jennifer-shehane jennifer-shehane added type: bug pkg/reporter This is due to an issue in the packages/reporter directory labels Jun 26, 2024
@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/reporter This is due to an issue in the packages/reporter directory stale no activity on this issue for a long period type: bug
Projects
None yet
Development

No branches or pull requests

3 participants