Skip to content

test(e2e): run Playwright across chromium, firefox, and webkit#219

Merged
Jagadeeshftw merged 2 commits into
Grainlify:mainfrom
rindicomfort:test/e2e-cross-browser
Jun 23, 2026
Merged

test(e2e): run Playwright across chromium, firefox, and webkit#219
Jagadeeshftw merged 2 commits into
Grainlify:mainfrom
rindicomfort:test/e2e-cross-browser

Conversation

@rindicomfort

Copy link
Copy Markdown
Contributor

Run Playwright e2e across Firefox and WebKit in addition to Chromium

📌 Description

This PR addresses issue #98 by adding Firefox and WebKit rendering engines to our Playwright E2E test configuration. In addition, it fixes pre-existing TypeScript compilation and Vitest configuration issues to ensure tests run cleanly and reliably.

🔍 Problem

  • playwright.config.ts was only configured to run E2E tests on chromium, leaving potential cross-browser rendering or behavior regressions in Firefox and WebKit/Safari uncaught.
  • Local E2E/unit testing was blocked by pre-existing TypeScript compilation errors, duplicate imports, and malformed hooks/components (e.g. FiltersSection.tsx, useOptimisticData.ts, logger.test.ts).
  • Vitest was erroneously attempting to compile and run Playwright's E2E test files (e2e/*.spec.ts), which led to syntax and runtime errors due to environment differences.

✅ Solution

1. Cross-Browser E2E Testing Config (playwright.config.ts)

  • Added firefox and webkit project configurations using standard Playwright devices (Desktop Firefox and Desktop Safari).
  • Kept the dev server/web server config working seamlessly for all projects.

2. Stabilization and Build Cleanups

  • Consolidated duplicate imports and catch block in src/shared/hooks/useOptimisticData.ts.
  • Typed the destructured callback argument cacheKey in src/shared/hooks/useOptimisticData.test.ts to solve implicit any type warnings.
  • Cleaned up malformed useEffect hook structure in src/features/leaderboard/components/FiltersSection.tsx.
  • Refactored src/shared/utils/logger.test.ts to use Vitest vi.stubEnv / vi.unstubAllEnvs instead of mutating read-only env descriptors with Object.defineProperty (which fails on Node 22/Vite 6/Vitest 4).
  • Added test configurations to vite.config.ts to use jsdom by default and exclude e2e files from unit testing.
  • Installed jsdom and @testing-library/react dev dependencies to support all unit tests.

3. Documentation (README.md)

  • Added a new E2E Testing section in README.md explaining how to run the E2E tests and how to run on a single browser locally (e.g., pnpm run test:e2e --project=firefox).

🧪 Testing and Test Output

All unit and e2e configurations compile and typecheck clean:

  • pnpm run typecheck passes successfully.
  • pnpm run test (Vitest unit tests) passes successfully with all 18 tests green.

🔒 Security Notes

  • Test tooling and documentation changes only. No production code security implications.
  • The logger utility remains guarded to ensure no PII or sensitive tokens are output.

Closes #98

@rindicomfort rindicomfort force-pushed the test/e2e-cross-browser branch from d1e4002 to 3f0f830 Compare June 23, 2026 19:15
@Jagadeeshftw Jagadeeshftw merged commit 4540a7c into Grainlify:main Jun 23, 2026
@Jagadeeshftw

Copy link
Copy Markdown
Contributor

running the playwright e2e suite across chromium, firefox and webkit gives real cross-browser confidence. rebased on latest main and merged. thanks!

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.

Run Playwright e2e across Firefox and WebKit in addition to Chromium

3 participants