Skip to content

test(infield-button): add complete test suites for Phase 6#6502

Open
Rajdeepc wants to merge 1 commit into
rajdeepc/feat-infield-button-migration-phase-5from
rajdeepc/feat-infield-button-migration-phase-6
Open

test(infield-button): add complete test suites for Phase 6#6502
Rajdeepc wants to merge 1 commit into
rajdeepc/feat-infield-button-migration-phase-5from
rajdeepc/feat-infield-button-migration-phase-6

Conversation

@Rajdeepc

@Rajdeepc Rajdeepc commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the Phase 6 test suite for the 2nd-gen swc-infield-button component. This PR contains only test and story files; the component implementation ships in the Phase 5 PR and must be merged into swc-2105/infield-button before this branch is rebased.

Files added:

  • stories/infield-button.stories.ts — Storybook stories with the Quiet story updated to render both default and quiet variants side-by-side for test comparison
  • test/infield-button.test.ts — 13 Storybook/Vitest play-function stories covering: defaults, property reflection (size, quiet, disabled, accessible-label), anatomy slots, sizes, quiet variant, states, click suppression, focus delegation, and dev-mode warnings
  • test/infield-button.a11y.spec.ts — Playwright ARIA snapshot tests for all 6 stories plus keyboard (Tab does not focus the button) and pointer interaction tests (click fires when enabled, suppressed when disabled)

Motivation and context

Phase 6 of the infield-button 2nd-gen migration. Establishes automated coverage for the full InfieldButton API surface so regressions can be caught during future refactors and dependency bumps.

Depends on: Phase 5 PR must merge into swc-2105/infield-button before this branch can be rebased and run independently.

Related issue(s)

  • SWC-2105

Screenshots (if appropriate)

N/A — test-only PR.

Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

Note: This PR depends on the Phase 5 implementation. Run these steps after Phase 5 merges into swc-2105/infield-button and this branch is rebased on top.

  • Vitest play functions pass

    1. From 2nd-gen/packages/swc/, run yarn vitest --project storybook infield-button
    2. Expect all 13 test stories to pass: OverviewTest, PropertyMutationTest, AccessibleLabelTest, AnatomyTest, SizesTest, QuietTest, StatesTest, DisabledBehaviorTest, ClickBehaviorTest, FocusDelegationTest, AccessibilityTest, IconOnlyMissingLabelWarningTest, IconOnlyWithLabelNoWarningTest
  • Playwright a11y spec passes

    1. From 2nd-gen/packages/swc/, run yarn playwright test infield-button.a11y.spec.ts
    2. Expect all tests in three groups to pass: ARIA Snapshots (8 tests), Keyboard Interactions (2 tests), Pointer Interactions (2 tests)
  • Storybook stories render correctly

    1. Run yarn storybook from 2nd-gen/packages/swc/
    2. Navigate to Infield Button in the sidebar
    3. Verify Overview shows a single medium button with chevron icon
    4. Verify Anatomy shows four icon affordances: Open picker, Clear, Increment, Decrement
    5. Verify Sizes shows all four sizes (s, m, l, xl)
    6. Verify Quiet shows default and quiet variants side-by-side
    7. Verify States shows default, disabled, quiet, and quiet-disabled
    8. Verify Accessibility shows a labeled button ("Open picker")
  • No regressions in Action Button

    1. Run yarn vitest --project storybook action-button
    2. Expect all action-button tests to still pass (shared ButtonBase logic)

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

Accessibility testing checklist

Required: Complete each applicable item and document your testing steps.

  • Keyboard (infield buttons are pointer-only; Tab must not focus them)

    1. Run Storybook and navigate to Infield Button > Overview
    2. Press Tab once
    3. Expect: focus does not land on swc-infield-button — the component is intentionally excluded from the tab order (tabindex="-1" on the inner button, delegatesFocus: false on the shadow root). Keyboard activation is the responsibility of the parent field.
  • Screen reader (button role and accessible name must be announced)

    1. Run Storybook and navigate to Infield Button > Accessibility
    2. Enable VoiceOver (macOS) or NVDA (Windows) and move focus to the swc-infield-button element
    3. Expect: screen reader announces "Open picker, button" — role button and the accessible-label value are correctly forwarded via aria-label on the inner <button> element
    4. Navigate to Infield Button > States and locate the disabled button
    5. Expect: screen reader announces the button as dimmed/unavailable — the native disabled attribute on the inner <button> provides the state without requiring aria-disabled

@Rajdeepc
Rajdeepc requested a review from a team as a code owner July 13, 2026 10:09
@changeset-bot

changeset-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 80b74be

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

@Rajdeepc
Rajdeepc marked this pull request as draft July 13, 2026 10:09
@github-actions

Copy link
Copy Markdown
Contributor

📚 Branch Preview Links

🔍 Gen1 Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-6502

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

@Rajdeepc
Rajdeepc force-pushed the rajdeepc/feat-infield-button-migration-phase-6 branch 12 times, most recently from 9303195 to 8375937 Compare July 16, 2026 13:29
@Rajdeepc Rajdeepc changed the title test(infield-button): add Vitest and Playwright test suites for Phase 6 test(infield-button): add complete test suites for Phase 6 Jul 17, 2026
@Rajdeepc
Rajdeepc force-pushed the rajdeepc/feat-infield-button-migration-phase-6 branch 2 times, most recently from 37d81f7 to ecb2ac1 Compare July 17, 2026 14:32
@Rajdeepc Rajdeepc self-assigned this Jul 17, 2026
@Rajdeepc Rajdeepc added the 2nd gen These issues or PRs map to our 2nd generation work to modernizing infrastructure. label Jul 17, 2026
@Rajdeepc
Rajdeepc force-pushed the rajdeepc/feat-infield-button-migration-phase-6 branch 4 times, most recently from 9340367 to 0ac6722 Compare July 20, 2026 05:58
@Rajdeepc
Rajdeepc changed the base branch from swc-2105/infield-button to rajdeepc/feat-infield-button-migration-phase-5 July 20, 2026 06:57
@Rajdeepc Rajdeepc added the Status:Ready for review PR ready for review or re-review. label Jul 20, 2026
@Rajdeepc
Rajdeepc marked this pull request as ready for review July 20, 2026 06:58
@Rajdeepc
Rajdeepc force-pushed the rajdeepc/feat-infield-button-migration-phase-6 branch 2 times, most recently from c9b6906 to e003b59 Compare July 21, 2026 07:03
@Rajdeepc
Rajdeepc force-pushed the rajdeepc/feat-infield-button-migration-phase-5 branch from 9f5d5c8 to 0856170 Compare July 21, 2026 07:07
Adds infield-button.test.ts (13 Storybook/Vitest play-function stories
covering defaults, property reflection, slots, sizes, quiet variant,
states, behaviors, and dev-mode warnings) and infield-button.a11y.spec.ts
(Playwright ARIA snapshots + keyboard and pointer interaction tests).

Updates the Quiet story to render both default and quiet variants
side-by-side so QuietTest and the ARIA snapshot can compare them.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Rajdeepc
Rajdeepc force-pushed the rajdeepc/feat-infield-button-migration-phase-6 branch from e003b59 to 80b74be Compare July 21, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2nd gen These issues or PRs map to our 2nd generation work to modernizing infrastructure. Status:Ready for review PR ready for review or re-review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant