Skip to content

fix: remove derived testIDs - #5099

Draft
k0ndee wants to merge 1 commit into
callstack:mainfrom
k0ndee:@k0ndee/derived_testids
Draft

fix: remove derived testIDs#5099
k0ndee wants to merge 1 commit into
callstack:mainfrom
k0ndee:@k0ndee/derived_testids

Conversation

@k0ndee

@k0ndee k0ndee commented Sep 3, 2026

Copy link
Copy Markdown

Motivation

Many components generated "derived" testIDs by appending a hardcoded suffix to the user-supplied testID prop (e.g. ${testID}-container, ${testID}-outer-layer, ${testID}-text) so that tests could reach into internal, non-public parts of a component's render tree.

This PR removes every derived testID suffix from the library and updates the corresponding tests to assert public, user-visible behavior instead (accessible role/label/text queries, or the component's own real interactive element's testID). Where a check was genuinely about an internal implementation detail with no public equivalent (e.g. which of Surface's two iOS shadow layers a style lands on, or an in-flight animated value), the test was converted to a full render (toJSON()) snapshot instead of reaching into a specific internal node. Tests that turned out to assert nothing observable once the derived testID was gone were removed.

Affected components: Surface, Button, IconButton, CrossFadeIcon, Appbar (AppbarHeader, AppbarContent), ProgressBar, Chip, ListItem, Card, FAB (Content, Shell, Menu), SegmentedButtonItem, CheckboxItem, DataTableCell, Searchbar, Snackbar, Banner, ToggleButton, Menu/MenuItem, Modal, Dialog, DrawerCollapsedItem, BottomNavigation/BottomNavigationBar.

Related issue

None. This is an internal contributor task.

Test plan

  • yarn jest — full suite passes (55 suites, 729 tests, 299 snapshots).
  • yarn eslint src — no violations (including testing-library/no-node-access and the repo's no-restricted-syntax rule against raw .props access).
  • yarn typecheck — no type errors.
  • Snapshot diffs were reviewed to confirm each one only drops a removed testID line, with no unrelated structural or style changes.
  • No UI/visual changes — this is a test-only and internal-prop-only change; component render output is otherwise identical (aside from the removed testID attributes themselves).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants