Skip to content

fix(test): match active tab panel by ARIA role, not AntD class - #669

Merged
babltiga merged 1 commit into
mainfrom
fix/AF-662-antd-tab-panel-selectors
Jul 31, 2026
Merged

fix(test): match active tab panel by ARIA role, not AntD class#669
babltiga merged 1 commit into
mainfrom
fix/AF-662-antd-tab-panel-selectors

Conversation

@babltiga

Copy link
Copy Markdown
Contributor

Unblocks #662 (antd 6.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:

rc-tabs 1.9.1 (antd 6.4.3) rc-tabs 1.11.0 (antd 6.5.2)
holder ant-tabs-content-holder ant-tabs-body-holder
list ant-tabs-content ant-tabs-body
pane ant-tabs-tabpane ant-tabs-content
active pane ant-tabs-tabpane-active ant-tabs-content-active
hidden pane ant-tabs-tabpane-hidden ant-tabs-content-hidden

13 test call sites hard-coded .ant-tabs-tabpane-active to 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 two describe.serial blocks. 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 carry aria-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.

  • New e2e/helpers/ui.ts exporting activeTabPanel(scope), used at all 12 e2e call sites across 6 specs, so a future rename is a one-line change.
  • ApiConnectorSettingsPage.test.tsx uses await screen.findByRole('tabpanel') (also drops the reliance on the tab switch having flushed synchronously).

Because it works on both versions, this lands green on main under 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:

antd 6.4.3 antd 6.5.2
Frontend suite (test:coverage) 1303/1303 1303/1303
lint / typecheck / build pass pass
6 affected e2e specs 20/20 20/20

The 6.5.2 e2e leg was built from #662's own lockfile, and the served bundle was confirmed to contain the 1.11 -body-holder DOM (vs -content-holder on the 6.4.3 leg).

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.
@github-actions

Copy link
Copy Markdown
Contributor

Frontend Test Results

1 303 tests   1 303 ✅  4m 51s ⏱️
  170 suites      0 💤
    1 files        0 ❌

Results for commit 5663d57.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report for Frontend Coverage (frontend)

Status Category Percentage Covered / Total
🟢 Lines 93.83% (🎯 90%) 2085 / 2222
🟢 Statements 91.81% (🎯 90%) 2323 / 2530
🟢 Functions 90.98% (🎯 90%) 636 / 699
🟢 Branches 83.59% (🎯 80%) 1310 / 1567
File CoverageNo changed files found.
Generated in workflow #847 for commit 5663d57 by the Vitest Coverage Report Action

@babltiga
babltiga merged commit 67d0556 into main Jul 31, 2026
14 checks passed
@babltiga
babltiga deleted the fix/AF-662-antd-tab-panel-selectors branch July 31, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant