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

chore: Fix flaky test #25726

Merged
merged 2 commits into from
Feb 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions packages/app/src/debug/GroupedDebugFailedTest.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,18 @@ describe('<GroupedDebugFailedTest/>', () => {
]

it('mounts correctly and shows artifacts on hover', () => {
// On retries in CI, the realHover() event can be persistant, causing the component to
// be hovered at the start of the test. We therefore hover the mouse somewhere else on the screen
// to reduce flake.
// This sort of weirdness is exactly why Cypress doesn't support a 'hover' command natively.
cy.get('body').realHover({ position: 'topLeft' })

cy.mount(() => (
<div class='p-24px'>
<GroupedDebugFailedTest groups={groups} failedTests={testResult} />
</div>
))

cy.get('body').click('topLeft')
// 👆 this click is to address some flake in CI where this component renders already in the hover state
// example: https://cloud.cypress.io/projects/ypt4pf/runs/43417/overview/18107774-3213-47f0-902e-79502a832c34/video?reviewViewBy=FAILED&utm_source=Dashboard&utm_medium=Share+URL&utm_campaign=Video
// this should avoid whatever situation leads to the appearance of being hovered right after mount.

cy.findAllByTestId(`grouped-row`).should('have.length', 2).each((el) => cy.wrap(el).within(() => {
cy.findByTestId('debug-artifacts').should('not.be.visible')
cy.findByTestId('test-failed-metadata').realHover()
Expand Down