-
Notifications
You must be signed in to change notification settings - Fork 364
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
test: [M3-8744] - Reduce Cypress flakiness in Placement Group deletion tests #11107
test: [M3-8744] - Reduce Cypress flakiness in Placement Group deletion tests #11107
Conversation
|
||
// Unassign each Linode. | ||
cy.get('[data-qa-selection-list]').within(() => { | ||
// Select the first Linode to unassign | ||
const mockLinodeToUnassign = mockPlacementGroupLinodes[0]; | ||
|
||
cy.findByText(mockLinodeToUnassign.label) | ||
.should('be.visible') | ||
.closest('li') | ||
.within(() => { | ||
ui.button | ||
.findByTitle('Unassign') | ||
.should('be.visible') | ||
.should('be.enabled') | ||
.click(); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These interactions/assertions aren't needed for this test since the point is to confirm that the error message doesn't persist after re-opening the deletion dialog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a huge improvement in the flakiness of this test. I wonder what the remaining source of flakiness is...
Nice work @jdamore-linode!! 🎉
This PR (passed 9/10 times) | Develop (passed 4/10 times) |
---|---|
@@ -498,7 +568,7 @@ describe('Placement Group deletion', () => { | |||
'not.exist' | |||
); | |||
|
|||
// Click "Delete" button next to the mock Placement Group to reopen the dialog | |||
// Click "Delete" button next to the mock Placement Group to reopen the dialog. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the attention to detail 😹
Manually approved the GH Actions pipeline, @jdamore-linode you may have been removed from the GH org. |
Coverage Report: ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though it's obviously not ideal to have workarounds, the thorough in-line comments are great to explain what's going on here.
Thanks for investigating and improving this one. 🚀 (I ran this locally with a repeat 20
and only experienced one test failure, and it was on a timeout span
element that evidently existed when it shouldn't have.)
Description 📝
This PR attempts to address a specific trigger of flakiness in the Cypress Placement Group deletion tests, resulting in this failure:
Recent improvements to our React Query
useAllLinodesQuery
hook allow components to display cached data while waiting for fresh data to be fetched. In the case of the Placement Group deletion tests, however, this introduced flakiness stemming from re-renders that occur once the HTTP request resolves. This appears to affect the tests only and doesn't impact real users as far as I'm aware.This works around the React Query behavior by introducing calls to
cy.wait()
for various requests to the Linodes instances endpoint, and by opening the Placement Group deletion modal, closing it, and then re-opening it to ensure that all relevant HTTP requests have resolved by the time the modal has opened, reducing the risk of re-renders occurring during Cypress interactions[1].Changes 🔄
cy.wait
for various requests to the Linodes instances endpoint to resolveTarget release date 🗓️
N/A
How to test 🧪
useAllLinodesQuery
were added. This PR only seeks to address the recent increase flakiness, so you may still encounter some flakiness when running the tests. You can disregard any failures that do not mentioncy.click
failing.When I ran this spec on repeat against
develop
last week, I observed that at least one test failed 90% of the time (although I don't think it has been that bad in CI). When I ran the spec 10 times on repeat with these changes in place, I observed only 1 failure (and it was not acy.click()
failure).As an Author I have considered 🤔
Check all that apply