[PR #6362] chore(e2e): reuse browser context across tests to reduce bandwidth #6466

Closed
opened 2026-02-28 21:28:47 -06:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/actualbudget/actual/pull/6362

State: closed
Merged: No


Summary

This PR updates the Playwright e2e tests to reuse a browser context across tests within the same worker, reducing bandwidth load on the server by caching static assets (JS, CSS, images).

Changes

fixtures.ts

  • Created a worker-scoped sharedContext fixture that persists across all tests in a worker
  • Each test gets a fresh page within the shared context
  • Added cleanup logic that runs before each test:
    • Clears cookies
    • Clears localStorage and sessionStorage
    • Clears IndexedDB databases
    • Navigates to "/" to reset state

All test files (20 files)

  • Removed manual browser.newPage() calls from beforeEach/beforeAll hooks
  • Removed page.close() calls from afterEach/afterAll hooks
  • Updated tests to receive page from the fixture parameters
  • Removed unused Page type imports

Benefits

  • Reduced bandwidth: Static assets are cached in the shared browser context
  • Faster test execution: No browser context recreation overhead between tests
  • Clean test isolation: Each test starts with cleared storage and cookies

Testing

  • Ran E2E_START_URL=https://edge.actualbudget.org yarn e2e onboarding - all 6 tests pass
**Original Pull Request:** https://github.com/actualbudget/actual/pull/6362 **State:** closed **Merged:** No --- ## Summary This PR updates the Playwright e2e tests to reuse a browser context across tests within the same worker, reducing bandwidth load on the server by caching static assets (JS, CSS, images). ## Changes ### fixtures.ts - Created a worker-scoped `sharedContext` fixture that persists across all tests in a worker - Each test gets a fresh `page` within the shared context - Added cleanup logic that runs before each test: - Clears cookies - Clears localStorage and sessionStorage - Clears IndexedDB databases - Navigates to "/" to reset state ### All test files (20 files) - Removed manual `browser.newPage()` calls from `beforeEach`/`beforeAll` hooks - Removed `page.close()` calls from `afterEach`/`afterAll` hooks - Updated tests to receive `page` from the fixture parameters - Removed unused `Page` type imports ## Benefits - **Reduced bandwidth**: Static assets are cached in the shared browser context - **Faster test execution**: No browser context recreation overhead between tests - **Clean test isolation**: Each test starts with cleared storage and cookies ## Testing - Ran `E2E_START_URL=https://edge.actualbudget.org yarn e2e onboarding` - all 6 tests pass
GiteaMirror added the pull-request label 2026-02-28 21:28:47 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#6466