Skip to content

test: migrate batch 1 component tests to browser locators - #8615

Open
tay1orjones wants to merge 1 commit into
mainfrom
tay1orjones-rtl-migration-batch-1
Open

tay1orjones wants to merge 1 commit into
mainfrom
tay1orjones-rtl-migration-batch-1

Conversation

@tay1orjones

@tay1orjones tay1orjones commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Related to github/primer#6369.

Move test interactions and queries to Vitest browser locators so these tests exercise browser behavior while keeping RTL rendering and lifecycle handling where needed.

Changelog

New

Changed

  • Migrate ActionBar, ActionList, ActionList.Description, ActionList.Group, ActionList.Heading, ActionList.Item, ActionList.LinkItem, ActionMenu, and AnchoredOverlay tests to Vitest browser locators.

Removed

Rollout strategy

  • No changes needed in github/github-ui
  • Needs changes in github/github-ui
  • Ships with feature flag(s)
  • Not sure
  • None

Testing & Reviewing

Check ActionBar's More items overflow menu and submenu icons, ActionMenu opening and closing with click and keyboard (including focus return), and AnchoredOverlay outside-click dismissal. Confirm ActionList item interactions and accessible queries still behave as expected.

Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0e8e36b7-9bf7-441f-b8fb-844f81f27d32
@changeset-bot

changeset-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a9a829d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

@tay1orjones tay1orjones changed the title test(react): migrate action components to browser locators test: migrate batch 1 component tests to browser locators Oct 22, 2026
@tay1orjones tay1orjones added skip changeset This change does not need a changelog integration-tests: skipped manually Changes in this PR do not require an integration test labels Oct 22, 2026
@tay1orjones
tay1orjones marked this pull request as ready for review October 22, 2026 20:09
@tay1orjones
tay1orjones requested a review from a team as a code owner October 22, 2026 20:09
@tay1orjones
tay1orjones requested review from francinelucca and a balanced review from Copilot October 22, 2026 20:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open issue
What changed in this PR

Migrates a first batch of component tests from React Testing Library (RTL) queries/interactions to Vitest browser locators, aiming to exercise more realistic browser behavior while keeping RTL rendering/lifecycle where appropriate.

Changes:

  • Swapped many screen/within/container queries to page.getBy* locators across ActionBar, ActionMenu, ActionList, and AnchoredOverlay tests.
  • Replaced most @testing-library/user-event usage with userEvent from vitest/browser.
  • Updated focus and keyboard interaction patterns to use locators and expect.element(...) assertions.
File Description
packages/​react/​src/​AnchoredOverlay/​AnchoredOverlay.test.tsx Migrates overlay interaction tests to browser locators; updates click/keyboard flows.
packages/​react/​src/​ActionMenu/​ActionMenu.test.tsx Converts ActionMenu tests to page locators + vitest/browser events/assertions.
packages/​react/​src/​ActionList/​LinkItem.test.tsx Updates LinkItem tests to locator-based queries and interactions.
packages/​react/​src/​ActionList/​Item.test.tsx Migrates Item interaction/focus tests to locators; adjusts keyboard/click handling.
packages/​react/​src/​ActionList/​Heading.test.tsx Replaces RTL queries with page.getByRole(...) assertions.
packages/​react/​src/​ActionList/​Group.test.tsx Moves Group heading tests to browser locators and locator-based assertions.
packages/​react/​src/​ActionList/​Description.test.tsx Converts Description tests to locators and expect.element(...) assertions.
packages/​react/​src/​ActionList/​ActionList.test.tsx Updates ActionList navigation/tree role tests to use page locators and browser events.
packages/​react/​src/​ActionBar/​ActionBar.test.tsx Migrates ActionBar tests to vitest/browser locators/events; updates overflow/menu assertions.

Review effort: Lite

expect(option).toBeInTheDocument()
const option = page.getByRole('option')
await expect.element(option).toBeInTheDocument()
await userEvent.click(option)
Copilot stopped reviewing on behalf of tay1orjones due to an error October 22, 2026 20:30

This branch was successfully deployed

2 active deployments
storybook-preview-8615 — a9a829d0 Deployed Oct 22, 2026 by github-actions[bot]
github-pages — a9a829d0 Deployed Oct 22, 2026 by tay1orjones via deploy-preview #33872
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm integration-tests: skipped manually Changes in this PR do not require an integration test skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants