Skip to content

Run Playwright against production build in CI#102

Merged
d-oit merged 6 commits intomainfrom
feat/prod-e2e-ci-1179591998497924283
May 4, 2026
Merged

Run Playwright against production build in CI#102
d-oit merged 6 commits intomainfrom
feat/prod-e2e-ci-1179591998497924283

Conversation

@d-oit
Copy link
Copy Markdown
Owner

@d-oit d-oit commented May 4, 2026

This PR updates the Playwright and CI configuration to run E2E tests against a production build instead of the development server. This ensures that the application is correctly bundled and that required cross-origin isolation headers (COOP/COEP) are preserved in the production-serving path.

Key changes:

  • Updated playwright.config.ts to support toggling between dev and production modes.
  • Added test:e2e:ci to package.json to build the app and run tests against vite preview.
  • Updated vite.config.ts to include COOP/COEP headers in the preview server.
  • Added tests/e2e/smoke.spec.ts to verify app boot, navigation, and security headers.
  • Updated .github/workflows/ci-and-labels.yml to install necessary browsers and run production E2E tests.
  • Fixed a TypeScript error in GraphView.tsx discovered during the build process.
  • Robustified existing E2E tests with better selectors and increased timeouts.

Fixes #97


PR created automatically by Jules for task 1179591998497924283 started by @d-oit

Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@deepsource-io
Copy link
Copy Markdown

deepsource-io Bot commented May 4, 2026

DeepSource Code Review

We reviewed changes in a0b7498...1d1eccb on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
JavaScript May 4, 2026 5:04p.m. Review ↗
Python May 4, 2026 5:04p.m. Review ↗
Shell May 4, 2026 5:04p.m. Review ↗
SQL May 4, 2026 5:04p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

Comment thread playwright.config.ts
@d-oit d-oit marked this pull request as ready for review May 4, 2026 08:24
google-labs-jules Bot and others added 3 commits May 4, 2026 08:57
- Configure playwright.config.ts for dynamic dev/prod switching
- Add test:e2e:ci script to package.json
- Add security headers to vite preview in vite.config.ts
- Add comprehensive production smoke test
- Robustify existing E2E tests for CI environment
- Fix TypeScript job handler return type mismatch
- Update CI workflow to install all Playwright browsers and run production E2E tests

Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com>
- Configure playwright.config.ts for dynamic dev/prod switching
- Add test:e2e:ci script to package.json
- Add security headers to vite preview in vite.config.ts
- Add comprehensive production smoke test with mobile support
- Robustify existing E2E tests for CI and responsive layouts
- Fix TypeScript job handler return type mismatch
- Update CI workflow to install all Playwright browsers and run production E2E tests

Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com>
- Updated playwright.config.ts to support dynamic dev/production modes via PLAYWRIGHT_MODE env var.
- Added test:e2e:ci script to package.json to automate build and production E2E testing.
- Configured vite.config.ts preview server with COOP/COEP headers to support SQLite WASM in production mode.
- Added a new smoke test (smoke.spec.ts) covering app boot, responsive navigation, and security headers.
- Robustified existing E2E tests for CI environments (better selectors, mobile menu handling, increased timeouts).
- Fixed a SQL syntax error in public/db/schema.sql that blocked database initialization in bundled builds.
- Fixed a Web Worker bundling issue in src/db/connection-pool.ts by inlining the URL for Vite's static analysis.
- Updated CI workflow to install all necessary browsers and execute production E2E tests.

Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com>
Comment thread src/db/connection-pool.ts
@@ -65,7 +62,7 @@ export class ConnectionPool {
}

private createWorker(): WorkerEntry {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 'this' to be used by class method 'createWorker'


If a class method does not use this, it can sometimes be made into a static function. If you do convert the method into a static function, instances of the class that call that particular method have to be converted to a static call as well (MyClass.callStaticMethod())

@d-oit
Copy link
Copy Markdown
Owner Author

d-oit commented May 4, 2026

@jules address feedback and failing ci, test, git

google-labs-jules Bot and others added 2 commits May 4, 2026 15:08
- Updated playwright.config.ts for dynamic dev/prod switching.
- Added test:e2e:ci script to package.json.
- Configured vite.config.ts preview with COOP/COEP headers.
- Added smoke.spec.ts and robustified existing E2E tests for CI.
- Fixed SQL syntax error in schema.sql.
- Fixed Web Worker bundling in connection-pool.ts.
- Updated CI workflow to install browsers and run production tests.

Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com>
This change updates the CI workflow to execute Playwright tests against a
production bundle (via `vite preview`) rather than the development server.

Key changes:
- Configured `playwright.config.ts` to switch ports and commands based on
  `PLAYWRIGHT_MODE=production`.
- Added `test:e2e:ci` script to `package.json` that builds the app before testing.
- Updated `vite.config.ts` to provide mandatory COOP and COEP headers in
  `preview` mode, enabling SQLite WASM in the production artifact.
- Fixed a syntax error in `public/db/schema.sql` regarding UUID defaults
  and a missing `verification_status` column.
- Refactored Web Worker initialization in `connection-pool.ts` for correct
  Vite bundling.
- Added a production smoke test and refactored existing E2E tests with a
  shared `ensureNavVisible` utility to handle responsive layouts.
- Updated CI workflow to install all Playwright browsers.

Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com>
Comment thread tests/e2e/utils.ts
Comment on lines +7 to +15
export async function ensureNavVisible(page: Page) {
const navButton = page.locator('.nav-button').filter({ hasText: 'Editor' });
if (!(await navButton.isVisible())) {
const menuButton = page.getByLabel('Open menu');
if (await menuButton.isVisible()) {
await menuButton.click();
}
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected function declaration in the global scope, wrap in an IIFE for a local variable, assign as global property for a global variable


It is considered a best practice to avoid 'polluting' the global scope with variables that are intended to be local to the script. Global variables created from a script can produce name collisions with global variables created from another script, which will usually lead to runtime errors or unexpected behavior. It is mostly useful for browser scripts.

@d-oit d-oit merged commit 56a3b31 into main May 4, 2026
22 of 23 checks passed
@d-oit d-oit deleted the feat/prod-e2e-ci-1179591998497924283 branch May 4, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci config tests Related to automated/manual tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run Playwright against the production build instead of the dev server in CI

1 participant