test(sqllab): repair broken TablePreview and SavedQueryList jest tests#41628
Conversation
Two sharded-jest-tests suites were failing on master after action buttons
gained proper accessible names, invalidating role-name queries in the
tests.
- TablePreview: the refresh/view buttons are now named by their labels
("Refresh table schema", "Show CREATE VIEW statement") instead of the
raw icon names ("sync", "eye"); update the queries to match.
- SavedQueryList: `/query/i` now also matches the per-row "Query preview"
and "Copy query URL" action buttons, so the "+ Query" create button is
ambiguous. Give it a stable `data-test` and select by that.
Code Review Agent Run #90524bActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41628 +/- ##
==========================================
+ Coverage 64.42% 64.43% +0.01%
==========================================
Files 2668 2668
Lines 147183 147231 +48
Branches 33947 33965 +18
==========================================
+ Hits 94822 94869 +47
- Misses 50646 50647 +1
Partials 1715 1715
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
SUMMARY
Two
sharded-jest-testssuites have been failing onmaster(reproduces on every open PR, e.g. #41624/#41625/#41585 — not caused by any of them). Both broke because SQL Lab action buttons gained proper accessible names, invalidating the tests' role/name queries.table actions): the refresh/view buttons are now named by their labels —Refresh table schema/Show CREATE VIEW statement— instead of falling through to the raw icon names (sync/eye, which now belong to the decorativerole="img"icons). Queries updated to the new names."+ Query"navigation test):/query/inow also matches the per-rowQuery previewandCopy query URLaction buttons, sofindByRole('button', { name: /query/i })throws "found multiple elements". Gave the create button a stabledata-test="add-saved-query-button"and select by that.No production behavior changes — one added
data-testattribute plus test-query updates.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — test-only fix (plus a
data-testhook).TESTING INSTRUCTIONS
cd superset-frontend && npm run test -- src/SqlLab/components/TablePreview/TablePreview.test.tsx src/pages/SavedQueryList/SavedQueryList.test.tsx— both suites pass.ADDITIONAL INFORMATION
data-testattribute only