-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
fix: Fix Cypress test broken by extra dashboards #21915
Conversation
698931f
to
dc2f0ba
Compare
Codecov Report
@@ Coverage Diff @@
## master #21915 +/- ##
=======================================
Coverage 65.50% 65.50%
=======================================
Files 1807 1807
Lines 69141 69141
Branches 7394 7394
=======================================
Hits 45291 45291
Misses 21940 21940
Partials 1910 1910
Flags with carried forward coverage won't be shown. Click here to find out more. 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
after(() => { | ||
cy.visit(DASHBOARD_LIST); | ||
cy.wait(1000); | ||
toggleBulkSelect(); | ||
cy.wait(1000); | ||
cy.getBySel('table-row').each($row => { | ||
if ($row.text().indexOf('Sample dashboard') > -1) { | ||
cy.wrap($row).find('input[type="checkbox"]').click(); | ||
} | ||
}); | ||
cy.getBySel('bulk-select-action').eq(0).contains('Delete').click(); | ||
confirmDelete(); | ||
}); | ||
|
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.
@codyml There is a utils that it seems to do this is cy.deleteDashboard(id: number, failOnStatusCode: boolean)
or deleteDashboardByName(dashboardName: string, failOnStatusCode: boolean)
.
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.
We shouldn't be doing cleanup work in afterEach. I think there is an approach that would work for every test and not just this one. Let me get back to you. Thanks for pointing this out!
Sounds good, closing in favor of #21921! |
SUMMARY
The Cypress test
chart_list/list.test.ts
> Charts list > Cross-referenced dashboards adds new dashboards but doesn't remove them, causingdashboard_list/list.test.ts
to fail when testing sort order if the two test files end up run on the same worker/machine. This PR adds anafter
clause that removes those dashboards, and also adds await
that I think should help with makingchart_list/list.test.ts
less flaky.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
![Screen Shot 2022-10-21 at 7 25 06 PM](https://user-images.githubusercontent.com/13007381/197310756-63187681-23ec-48e9-bd22-7d135270e3b0.png)
After:
![Screen Shot 2022-10-21 at 7 24 56 PM](https://user-images.githubusercontent.com/13007381/197310761-df2b3433-2e09-42cb-a79e-b29401fc8504.png)
TESTING INSTRUCTIONS
chart_list/list.test.ts
followed bydashboard_list/list.test.ts
. There shouldn't be any errors.ADDITIONAL INFORMATION