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

fix: Fix Cypress test broken by extra dashboards #21915

Closed
wants to merge 1 commit into from

Conversation

codyml
Copy link
Member

@codyml codyml commented Oct 21, 2022

SUMMARY

The Cypress test chart_list/list.test.ts > Charts list > Cross-referenced dashboards adds new dashboards but doesn't remove them, causing dashboard_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 an after clause that removes those dashboards, and also adds a wait that I think should help with making chart_list/list.test.ts less flaky.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:
Screen Shot 2022-10-21 at 7 25 06 PM

After:
Screen Shot 2022-10-21 at 7 24 56 PM

TESTING INSTRUCTIONS

  • In Cypress, try running chart_list/list.test.ts followed by dashboard_list/list.test.ts. There shouldn't be any errors.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codyml codyml force-pushed the fix/cypress-dashboards branch from 698931f to dc2f0ba Compare October 21, 2022 23:10
@codecov
Copy link

codecov bot commented Oct 21, 2022

Codecov Report

Merging #21915 (698931f) into master (3da9687) will not change coverage.
The diff coverage is n/a.

❗ Current head 698931f differs from pull request most recent head dc2f0ba. Consider uploading reports for the commit dc2f0ba to get more accurate results

@@           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           
Flag Coverage Δ
javascript 53.33% <ø> (ø)

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

@zhaoyongjie zhaoyongjie self-requested a review October 23, 2022 03:11
Comment on lines +71 to +84
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();
});

Copy link
Member

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).

Copy link
Member

@geido geido left a 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!

@geido geido mentioned this pull request Oct 24, 2022
9 tasks
@codyml
Copy link
Member Author

codyml commented Oct 24, 2022

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!

@codyml codyml closed this Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants