Skip to content

test: refactor e2e gift card tests#3518

Merged
itsjustriley merged 8 commits intomainfrom
refactor-skeleton-gift-cards
Mar 4, 2026
Merged

test: refactor e2e gift card tests#3518
itsjustriley merged 8 commits intomainfrom
refactor-skeleton-gift-cards

Conversation

@itsjustriley
Copy link
Copy Markdown
Contributor

Part of https://github.com/Shopify/developer-tools-team/issues/1075

Referring to Freddie's example test, this refactors e2e gift card tests .

Note: duplicates some of freddie's work (skeleton accessibility updates, base utils) so will need to be rebased

To validate tests pass locally: npx playwright test e2e/specs/skeleton/giftCards.spec.ts (use --ui flag if desired)

@shopify
Copy link
Copy Markdown
Contributor

shopify Bot commented Feb 27, 2026

Oxygen deployed a preview of your refactor-skeleton-gift-cards branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment March 4, 2026 2:14 PM

Learn more about Hydrogen's GitHub integration.

@itsjustriley itsjustriley force-pushed the refactor-skeleton-gift-cards branch from c40efb7 to 518ac82 Compare March 2, 2026 13:04
@itsjustriley itsjustriley force-pushed the refactor-skeleton-gift-cards branch from 518ac82 to 497d66f Compare March 2, 2026 19:24
@itsjustriley itsjustriley marked this pull request as ready for review March 2, 2026 19:28
@itsjustriley itsjustriley requested a review from a team as a code owner March 2, 2026 19:28
Comment thread e2e/fixtures/gift-card-utils.ts
@binks-code-reviewer
Copy link
Copy Markdown

binks-code-reviewer Bot commented Mar 2, 2026

🤖 Code Review · #projects-dev-ai for questions
React with 👍/👎 or reply — all feedback helps improve the agent.

Complete - No issues

📋 History

✅ 1 findings → ✅ 1 findings → ✅ No issues

Comment thread templates/skeleton/app/components/CartSummary.tsx Outdated
Comment thread e2e/fixtures/gift-card-utils.ts Outdated
Comment thread templates/skeleton/app/components/CartSummary.tsx Outdated
Comment thread templates/skeleton/app/components/CartSummary.tsx Outdated
Comment thread templates/skeleton/app/components/CartSummary.tsx Outdated
Comment thread templates/skeleton/app/components/CartSummary.tsx Outdated
Comment thread templates/skeleton/app/components/CartSummary.tsx
Comment thread e2e/fixtures/gift-card-utils.ts Outdated
Comment thread e2e/fixtures/gift-card-utils.ts Outdated
Comment thread e2e/specs/skeleton/giftCards.spec.ts Outdated
Comment thread e2e/specs/skeleton/giftCards.spec.ts
Comment thread e2e/specs/skeleton/giftCards.spec.ts Outdated
@itsjustriley
Copy link
Copy Markdown
Contributor Author

itsjustriley commented Mar 4, 2026

All review feedback addressed! 🎉

Blocking items - ✅ All fixed

  1. aria-labelledby broken reference → Changed to <section aria-label="Gift cards">
  2. Missing changeset with cli-hydrogen → Changeset includes both packages
  3. role="group" on <dd> degrades semantics → Removed, using native semantics
  4. Duplicate aria-labels on Remove buttons → Each button now has unique label with last 4 digits
  5. Hardcoded IDs → Migrated to useId() for all IDs
  6. assertCardRemoved uses not.toBeVisible() → Changed to toHaveCount(0)
  7. assertNoGiftCards should use count → Changed to toHaveCount(0)

Non-blocking items - ✅ All addressed

  1. Non-null assertion in useEffect → Fixed with proper null check
  2. Missing comment about invalid code UX → Institutional knowledge comment restored
  3. No aria-live announcementAdded aria-live="polite" region with status messages In tophatting, these were indicating success no matter what. I've left them for now, worth a follow-up.
  4. No focus management on Remove → Implemented WCAG 2.4.3-compliant focus handling
  5. Invalid HTML: <form> inside <dl> → Fixed by moving button into RemoveGiftCardForm
  6. applyCode vs tryApplyCode duplication → Consolidated into single applyCode method
  7. Test reaches into page directly → Added assertCardHasAmount utility method

Key improvements

  • Accessibility: Screen readers now announce all gift card actions (apply success, apply failure, remove)
  • Keyboard navigation: Focus properly managed when removing cards (moves to next card or input)
  • Semantic HTML: All elements use proper roles, no unnecessary overrides
  • Test maintainability: Removed duplication, better encapsulation in test utilities
  • Valid HTML: Proper nesting of definition list elements and forms

All changes are staged and ready for final review!

Comment thread e2e/fixtures/gift-card-utils.ts
@itsjustriley itsjustriley requested a review from fredericoo March 4, 2026 14:22
@itsjustriley itsjustriley merged commit b1a8a9d into main Mar 4, 2026
15 checks passed
@itsjustriley itsjustriley deleted the refactor-skeleton-gift-cards branch March 4, 2026 14:59
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.

3 participants