From b4ca19f3a879de0877dd6e3953cc392e00b79a15 Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Thu, 12 Nov 2026 18:19:39 -0600 Subject: [PATCH] test(e2e): keep the stalled-font task test's font requests on the page route (#21171) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Every PR runs the Playwright e2e suite in 8 shards > - `task-loading-frame.spec.ts` "a stalled web font does not hide an otherwise prepared conversation indefinitely" failed 17 times in 48 hours, on 17 different PR branches, most with no UI changes (for example #21129) > - The test stalls `**/*.woff2` with `page.route`. The app's service worker claims the page and fetches the fonts itself. `page.route` does not see service-worker requests > - When the worker claimed the page before the font request, the font loaded. The loading frame then showed for only a few frames, and `toBeVisible()` missed it > - This pull request blocks service workers for this one test, so the font stall the test depends on always happens > - The benefit is that e2e shard 1/8 stops failing at random on unrelated PRs ## Linked Issues or Issue Description **What happened?** `tests/e2e/task-loading-frame.spec.ts:131` failed with `expect(locator).toBeVisible() failed`, `Locator: getByTestId('task-chat-loading-frame')`, `element(s) not found`, on unrelated PRs. The failure snapshot shows a fully loaded conversation. **Expected behavior** The test stalls the web fonts, sees the loading frame, and then sees the conversation within 5 seconds. **Steps to reproduce** `PAPERCLIP_E2E_PORT=3291 npx playwright test --config tests/e2e/playwright.config.ts tests/e2e/task-loading-frame.spec.ts -g "stalled web font" --repeat-each=40` on master: 6 of 40 runs fail with the CI error. **Paperclip version or commit** master at 4e932fd178 and later. **Deployment mode** CI e2e (local_trusted, built UI). **Agent adapter(s) involved** N/A, CI test. ## What Changed - `tests/e2e/task-loading-frame.spec.ts`: the stalled-font test runs in a `test.describe` with `test.use({ serviceWorkers: "block" })`. The test body is unchanged. ## Verification - Before (master): `--repeat-each=40`: 34 passed, 6 failed. All 6 failures are the CI signature (`task-chat-loading-frame` not found). - After: `--repeat-each=50`: 50 passed, 0 failed. - `ui/public/sw.js` claims clients on activate and answers every same-origin non-API GET with `fetch()`, including `/fonts/*.woff2`. Playwright documents that `page.route` does not intercept requests that a service worker handles. ## Risks - Low risk. Test-only change. Only this test runs without a service worker. The product path for a stalled font is still tested. Service-worker behavior has its own unit tests. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code with tool use (shell, GitHub CLI, Playwright). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 --- tests/e2e/task-loading-frame.spec.ts | 41 +++++++++++++++------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/tests/e2e/task-loading-frame.spec.ts b/tests/e2e/task-loading-frame.spec.ts index a4bc1462b7a..95107ed1e39 100644 --- a/tests/e2e/task-loading-frame.spec.ts +++ b/tests/e2e/task-loading-frame.spec.ts @@ -128,25 +128,28 @@ test("Classic startup does not guess a chat layout while personal preferences ar } }); -test("a stalled web font does not hide an otherwise prepared conversation indefinitely", async ({ page, request }) => { - const fixture = await createTask(request); - let release!: () => void; - const fontReady = new Promise(resolve => { release = resolve; }); - try { - await page.route("**/api/workspace-preferences/me", async route => { - const response = await route.fetch(); - await route.fulfill({ json: { ...await response.json(), coordinatorWorkspaceEnabled: true } }); - }); - await page.route("**/*.woff2", async route => { await fontReady; await route.abort(); }); - await page.goto(fixture.route, { waitUntil: "domcontentloaded" }); - await expect(page.getByTestId("task-chat-loading-frame")).toBeVisible(); - await expect(page.getByTestId("task-chat-thread").locator(':scope > [aria-busy="false"]')).toBeVisible({ timeout: 5000 }); - await expect(page.getByTestId("task-chat-composer-stack").locator('[contenteditable="true"]')).toBeEditable(); - } finally { - release(); - await page.unrouteAll({ behavior: "wait" }); - await request.patch(`/api/companies/${fixture.company.id}`, { data: { status: "archived" } }); - } +test.describe(() => { + test.use({ serviceWorkers: "block" }); + test("a stalled web font does not hide an otherwise prepared conversation indefinitely", async ({ page, request }) => { + const fixture = await createTask(request); + let release!: () => void; + const fontReady = new Promise(resolve => { release = resolve; }); + try { + await page.route("**/api/workspace-preferences/me", async route => { + const response = await route.fetch(); + await route.fulfill({ json: { ...await response.json(), coordinatorWorkspaceEnabled: true } }); + }); + await page.route("**/*.woff2", async route => { await fontReady; await route.abort(); }); + await page.goto(fixture.route, { waitUntil: "domcontentloaded" }); + await expect(page.getByTestId("task-chat-loading-frame")).toBeVisible(); + await expect(page.getByTestId("task-chat-thread").locator(':scope > [aria-busy="false"]')).toBeVisible({ timeout: 5000 }); + await expect(page.getByTestId("task-chat-composer-stack").locator('[contenteditable="true"]')).toBeEditable(); + } finally { + release(); + await page.unrouteAll({ behavior: "wait" }); + await request.patch(`/api/companies/${fixture.company.id}`, { data: { status: "archived" } }); + } + }); }); for (const coordinator of [false, true]) test(`mobile chrome stays fixed when personal preferences resolve (Coordinator=${coordinator})`, async ({ page, request }, info) => {