fix(test): match active tab panel by ARIA role, not AntD class - #669
Merged
Conversation
antd 6.5 bumps @rc-component/tabs 1.9 -> 1.11, which renames the Tabs content DOM: the active pane goes from `ant-tabs-tabpane-active` to `ant-tabs-content-active` (and the holder/list from `-content-holder`/ `-content` to `-body-holder`/`-body`). 13 test call sites hard-coded the old class to scope assertions to the visible pane, breaking 3 frontend unit tests and 6 e2e specs on #662. Scope by `role="tabpanel"` instead — both rc-tabs versions emit it, with inactive panes aria-hidden, so Playwright's and RTL's role queries resolve to the visible pane on either version. Adds an `activeTabPanel(scope)` e2e helper so the next rename is a one-line change. Verified: full frontend suite (1303 tests) plus the 6 affected e2e specs (20 tests) green on both antd 6.4.3 and 6.5.2.
Contributor
Frontend Test Results1 303 tests 1 303 ✅ 4m 51s ⏱️ Results for commit 5663d57. |
Contributor
Coverage Report for Frontend Coverage (frontend)
File CoverageNo changed files found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unblocks #662 (
antd6.4.3 → 6.5.2).Problem
antd 6.5 bumps
@rc-component/tabs~1.9.0→~1.11.0, which renames the Tabs content DOM:ant-tabs-content-holderant-tabs-body-holderant-tabs-contentant-tabs-bodyant-tabs-tabpaneant-tabs-contentant-tabs-tabpane-activeant-tabs-content-activeant-tabs-tabpane-hiddenant-tabs-content-hidden13 test call sites hard-coded
.ant-tabs-tabpane-activeto scope assertions to the visible pane (AntD keeps inactive panes mounted, so scoping is required). That is the sole cause of every failure on #662: 3 frontend unit tests, 6 e2e specs, plus the 6 "did not run" — the remainder of the same twodescribe.serialblocks. No application source or CSS references these classes.Fix
Scope by the ARIA contract instead of AntD's internal class.
role="tabpanel"is emitted identically by both rc-tabs versions, and inactive panes carryaria-hidden="true", which Playwright's and RTL's role queries exclude by default — so the same query resolves to the visible pane on either version.e2e/helpers/ui.tsexportingactiveTabPanel(scope), used at all 12 e2e call sites across 6 specs, so a future rename is a one-line change.ApiConnectorSettingsPage.test.tsxusesawait screen.findByRole('tabpanel')(also drops the reliance on the tab switch having flushed synchronously).Because it works on both versions, this lands green on
mainunder today's antd 6.4.3; #662 then only needs a rebase, with no test edits of its own. No dependency changes in this PR.Verification
Run locally against a full docker-compose e2e stack, on both antd versions:
test:coverage)lint/typecheck/buildThe 6.5.2 e2e leg was built from #662's own lockfile, and the served bundle was confirmed to contain the 1.11
-body-holderDOM (vs-content-holderon the 6.4.3 leg).