Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 14, 2025

Enables WebKit testing for both Playwright and Vitest to properly validate issue #6554, with fixes for webkit-specific compatibility issues.

Changes

  • packages/atomic/playwright.config.ts: Added WebKit project configuration with extended timeout (30s) to handle webkit-specific timing issues. WebKit is now always enabled (not CI-only) for easier toggling via VS Code extension.
  • packages/atomic/vitest.config.js: Added conditional WebKit browser instance for atomic-default test project only (storybook remains Chromium-only)
  • packages/atomic/src/components/commerce/atomic-product-children/atomic-product-children.spec.ts: Added describe.skipIf(server.browser === 'webkit') to skip Touch-based tests in WebKit since the Touch constructor is not supported. Renamed test helper function from touchChild to touchChildProduct for clarity.
  • packages/atomic/src/components/search/result-template-components/quickview-iframe/quickview-iframe.tsx: Fixed iframe race condition where contentDocument is not available until the iframe is connected to the DOM
  • packages/atomic/src/components/search/atomic-search-box/atomic-search-box.tsx: Replaced unsafe use of in operator with Object.hasOwn for better type safety
  • packages/atomic/src/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.ts: Replaced unsafe use of in operator with Object.hasOwn for better type safety

Implementation

Playwright E2E tests:

projects: [
  {
    name: 'chromium',
    use: {...devices['Desktop Chrome'], viewport: DEFAULT_DESKTOP_VIEWPORT},
  },
  {
    name: 'webkit',
    use: {
      ...devices['Desktop Safari'],
      viewport: DEFAULT_DESKTOP_VIEWPORT,
    },
    expect: {
      timeout: 30 * 1000,  // Extended timeout for webkit
    },
  },
],

Vitest atomic-default tests:

instances: [
  {
    browser: 'chromium',
    context: {actionTimeout: 3000},
  },
  ...(process.env.CI
    ? [{
        browser: 'webkit',
        context: {actionTimeout: 3000},
      }]
    : []),
],

Vitest storybook tests:

instances: [{browser: 'chromium'}],  // Chromium only

Skipping incompatible tests:

import {server} from 'vitest/browser';

describe.skipIf(server.browser === 'webkit')(
  'when a child product is touched',
  () => {
    // Tests that use Touch constructor - skipped in WebKit
  }
);

Result:

  • Playwright e2e: Both Chromium and WebKit enabled (888 tests total: 444 per browser)
  • Vitest atomic-default: Chromium locally, Chromium + WebKit in CI (Touch tests skipped in WebKit)
  • Vitest storybook: Chromium only
Original prompt

To test #6554 correctly, we need to run our tests on webkit.
Add that.
Locally, make it so that we run only on Chrome (gofast local)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add support for running tests on webkit Add WebKit browser testing to Playwright E2E tests in CI only Nov 14, 2025
Copilot AI requested a review from louis-bompart November 14, 2025 19:25
Copilot finished work on behalf of louis-bompart November 14, 2025 19:25
@louis-bompart
Copy link
Collaborator

@copilot Playwright is cool, but what about vitestÉ

Copy link
Contributor Author

Copilot AI commented Nov 14, 2025

@copilot Playwright is cool, but what about vitestÉ

Good catch! I've added WebKit support to Vitest as well in commit 5595d0b.

Both the atomic-default and storybook test projects now run on WebKit in CI, while keeping Chromium-only for local development. This ensures consistent browser coverage across both Playwright e2e tests and Vitest unit/component tests.

Copilot AI changed the title Add WebKit browser testing to Playwright E2E tests in CI only Add WebKit browser testing to Playwright and Vitest tests in CI only Nov 14, 2025
Copilot finished work on behalf of louis-bompart November 14, 2025 19:32
Copilot AI temporarily deployed to Prerelease (CDN) November 14, 2025 19:58 Inactive
@louis-bompart
Copy link
Collaborator

@copilot:

  • let's skip webkit for storybook
  • For atomic default, use skipIf (on describe or it) to skip failing test, notably atomic-product-children > when a child product is touched (because we use Touch ctor which ain't supported in webkit)

Copy link
Contributor Author

Copilot AI commented Nov 14, 2025

@copilot:

  • let's skip webkit for storybook
  • For atomic default, use skipIf (on describe or it) to skip failing test, notably atomic-product-children > when a child product is touched (because we...

Done in commit d1717eb:

  1. Removed webkit from storybook tests - now chromium only
  2. Added describe.skipIf(typeof Touch === 'undefined') to skip the "when a child product is touched" tests in webkit, since the Touch constructor isn't supported

The atomic-default tests will now run on both chromium and webkit in CI, with the Touch-based tests automatically skipped in webkit.

Copilot finished work on behalf of louis-bompart November 14, 2025 22:09
@louis-bompart louis-bompart marked this pull request as draft November 18, 2025 18:07
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@louis-bompart
Copy link
Collaborator

@copilot refresh the PR description/title based on the changes I brought up

Copy link
Contributor Author

Copilot AI commented Nov 19, 2025

@copilot refresh the PR description/title based on the changes I brought up

Updated the PR title and description to reflect all changes:

New Title: test: add WebKit browser testing and fix webkit-related issues

Key updates to description:

  1. WebKit is now always enabled in Playwright (not just CI) with extended timeout for webkit-specific timing issues
  2. Added fixes for webkit-specific issues including iframe race condition and Object.hasOwn replacements
  3. Removed the CI-only language since webkit runs locally now too (easier to toggle via VS Code extension)

Copilot AI changed the title test: add WebKit browser testing to Playwright and Vitest tests in CI only test: add WebKit browser testing and fix webkit-related issues Nov 19, 2025
Copilot finished work on behalf of louis-bompart November 19, 2025 05:25
Copilot AI requested a review from louis-bompart November 19, 2025 05:25
@louis-bompart louis-bompart marked this pull request as ready for review November 19, 2025 05:45
@louis-bompart louis-bompart added this pull request to the merge queue Nov 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 19, 2025
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.

4 participants