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

Closed
opened 2026-04-10 21:56:44 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/6362
Author: @MatissJanis
Created: 12/10/2025
Status: Closed

Base: masterHead: matiss/e2e-reuse-browser-context


📝 Commits (1)

  • 1fafadb chore(e2e): reuse browser context and page across tests to reduce bandwidth

📊 Changes

54 files changed (+269 additions, -336 deletions)

View changed files

📝 packages/desktop-client/e2e/accounts.mobile.test.ts (+5 -12)
📝 packages/desktop-client/e2e/accounts.test.ts (+29 -27)
📝 packages/desktop-client/e2e/bank-sync.mobile.test.ts (+4 -13)
📝 packages/desktop-client/e2e/bank-sync.test.ts (+2 -14)
📝 packages/desktop-client/e2e/budget.mobile.test.ts (+41 -26)
📝 packages/desktop-client/e2e/budget.test.ts (+8 -13)
📝 packages/desktop-client/e2e/command-bar.test.ts (+3 -12)
📝 packages/desktop-client/e2e/fixtures.ts (+75 -2)
📝 packages/desktop-client/e2e/help-menu.test.ts (+3 -12)
📝 packages/desktop-client/e2e/onboarding.test.ts (+8 -16)
📝 packages/desktop-client/e2e/payees.mobile.test.ts (+6 -15)
📝 packages/desktop-client/e2e/payees.test.ts (+7 -19)
📝 packages/desktop-client/e2e/reports.test.ts (+20 -26)
📝 packages/desktop-client/e2e/rules.mobile.test.ts (+5 -14)
📝 packages/desktop-client/e2e/rules.test.ts (+8 -18)
📝 packages/desktop-client/e2e/rules.test.ts-snapshots/Rules-creates-a-split-transaction-rule-and-makes-sure-it-is-applied-when-creating-a-transaction-1-chromium-linux.png (+0 -0)
📝 packages/desktop-client/e2e/rules.test.ts-snapshots/Rules-creates-a-split-transaction-rule-and-makes-sure-it-is-applied-when-creating-a-transaction-2-chromium-linux.png (+0 -0)
📝 packages/desktop-client/e2e/rules.test.ts-snapshots/Rules-creates-a-split-transaction-rule-and-makes-sure-it-is-applied-when-creating-a-transaction-3-chromium-linux.png (+0 -0)
📝 packages/desktop-client/e2e/schedules.mobile.test.ts (+6 -15)
📝 packages/desktop-client/e2e/schedules.test.ts (+9 -17)

...and 34 more files

📄 Description

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/6362 **Author:** [@MatissJanis](https://github.com/MatissJanis) **Created:** 12/10/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `matiss/e2e-reuse-browser-context` --- ### 📝 Commits (1) - [`1fafadb`](https://github.com/actualbudget/actual/commit/1fafadbd22fe3420f2294bd0d36373f258bc7270) chore(e2e): reuse browser context and page across tests to reduce bandwidth ### 📊 Changes **54 files changed** (+269 additions, -336 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/e2e/accounts.mobile.test.ts` (+5 -12) 📝 `packages/desktop-client/e2e/accounts.test.ts` (+29 -27) 📝 `packages/desktop-client/e2e/bank-sync.mobile.test.ts` (+4 -13) 📝 `packages/desktop-client/e2e/bank-sync.test.ts` (+2 -14) 📝 `packages/desktop-client/e2e/budget.mobile.test.ts` (+41 -26) 📝 `packages/desktop-client/e2e/budget.test.ts` (+8 -13) 📝 `packages/desktop-client/e2e/command-bar.test.ts` (+3 -12) 📝 `packages/desktop-client/e2e/fixtures.ts` (+75 -2) 📝 `packages/desktop-client/e2e/help-menu.test.ts` (+3 -12) 📝 `packages/desktop-client/e2e/onboarding.test.ts` (+8 -16) 📝 `packages/desktop-client/e2e/payees.mobile.test.ts` (+6 -15) 📝 `packages/desktop-client/e2e/payees.test.ts` (+7 -19) 📝 `packages/desktop-client/e2e/reports.test.ts` (+20 -26) 📝 `packages/desktop-client/e2e/rules.mobile.test.ts` (+5 -14) 📝 `packages/desktop-client/e2e/rules.test.ts` (+8 -18) 📝 `packages/desktop-client/e2e/rules.test.ts-snapshots/Rules-creates-a-split-transaction-rule-and-makes-sure-it-is-applied-when-creating-a-transaction-1-chromium-linux.png` (+0 -0) 📝 `packages/desktop-client/e2e/rules.test.ts-snapshots/Rules-creates-a-split-transaction-rule-and-makes-sure-it-is-applied-when-creating-a-transaction-2-chromium-linux.png` (+0 -0) 📝 `packages/desktop-client/e2e/rules.test.ts-snapshots/Rules-creates-a-split-transaction-rule-and-makes-sure-it-is-applied-when-creating-a-transaction-3-chromium-linux.png` (+0 -0) 📝 `packages/desktop-client/e2e/schedules.mobile.test.ts` (+6 -15) 📝 `packages/desktop-client/e2e/schedules.test.ts` (+9 -17) _...and 34 more files_ </details> ### 📄 Description ## 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-10 21:56:44 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#13521