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

Flaky Jest test: UserIdentityWarning › handles races between fetching verification status and receiving updates › update says identity needs approval #29266

Closed
richvdh opened this issue Feb 14, 2025 · 2 comments · Fixed by #29403
Assignees
Labels
A-Developer-Experience A-Testing Testing, code coverage, etc. T-Task Tasks for the team like planning Z-Flaky-Jest-Test A Jest test is raising false alarms Z-Flaky-Test A test is raising false alarms

Comments

@richvdh
Copy link
Member

richvdh commented Feb 14, 2025

https://github.com/element-hq/element-web/actions/runs/13328193582/attempts/1:

UserIdentityWarning › handles races between fetching verification status and receiving updates › update says identity needs approval: test/unit-tests/components/views/rooms/UserIdentityWarning-test.tsx#L620
Unable to find an element with the text: (content, element) => { return !!element && element.classList.contains("mx_UserIdentityWarning_main") && element.textContent === text + " Learn more"; } (normalized from '(content, element) => {
    return !!element && element.classList.contains("mx_UserIdentityWarning_main") && element.textContent === text + " Learn more";
  }'). This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body>
  <div />
</body>

    at waitForWrapper (node_modules/@testing-library/dom/dist/wait-for.js:163:27)
    at Object.<anonymous> (test/unit-tests/components/views/rooms/UserIdentityWarning-test.tsx:620:26)
@richvdh richvdh added Z-Flaky-Jest-Test A Jest test is raising false alarms Z-Flaky-Test A test is raising false alarms labels Feb 14, 2025
@dosubot dosubot bot added A-Developer-Experience A-Testing Testing, code coverage, etc. T-Task Tasks for the team like planning labels Feb 14, 2025
@langleyd
Copy link
Member

langleyd commented Feb 27, 2025

The flake is related to these sleeps. If you remove the sleep you get the reported error, so increasing the timeout might stop the flakes, but not having sleeps would probably be preferable.
Not 100% sure if it's needed as:

  • We have nothing the dom to waitFor(the component returns null).
  • We are waiting on some state of the component/view model to settle.

Somebody on the crpyto team might have more context to action this more efficiently than me.

@richvdh
Copy link
Member Author

richvdh commented Feb 28, 2025

This test seems to have been changed in #29067 in ways that I don't understand: hoping people who have previously worked on this bit of code can help me understand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Developer-Experience A-Testing Testing, code coverage, etc. T-Task Tasks for the team like planning Z-Flaky-Jest-Test A Jest test is raising false alarms Z-Flaky-Test A test is raising false alarms
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants