Skip to content

Fix e2e test timeouts caused by blocking fetch in loadExistingMessages#100

Merged
mahata merged 5 commits intomainfrom
copilot/66899388030-fix-e2e-workflow
Mar 13, 2026
Merged

Fix e2e test timeouts caused by blocking fetch in loadExistingMessages#100
mahata merged 5 commits intomainfrom
copilot/66899388030-fix-e2e-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 13, 2026

All 5 e2e tests were timing out at page.goto("/") in the test body. Server logs showed a consistent ~20-second gap between beforeEach completing and the test body's navigation reaching the server — with zero server activity in between.

Root cause: After loginWithMock's page.goto("/") loads the ChatPage, loadExistingMessages() immediately fires fetch("/api/messages"). This is the first DB connection from the freshly-started webServer process; pg.Pool cold-start takes ~20s in CI. While that fetch was pending, Chrome held the subsequent page.goto("/") request (Playwright/CDP tracking + HTTP/1.1 connection pool pressure from WebSocket + fetch + keep-alive connections). The ~20s wait consumed the 30s test budget.

Fix

  • hono/static/ChatPage.ts: Added AbortController with a 5-second timeout to loadExistingMessages. Aborted fetch signals completion to Chrome immediately, unblocking navigation. clearTimeout in finally to prevent timer leaks.
async function loadExistingMessages(): Promise<void> {
  const controller = new AbortController();
  const timeoutId = setTimeout(() => controller.abort(), 5000);
  try {
    const response = await fetch("/api/messages", { signal: controller.signal });
    // ...
  } catch (error) {
    console.error("Error loading existing messages:", error);
  } finally {
    clearTimeout(timeoutId);
  }
}

Refactor changes (from refactor/no-nvm-dependency branch)

  • .nvmrc.node-version: Replaced nvm-specific file with the broadly-supported .node-version format; both contain 22.
  • ci.yml: Use node-version-file: ".node-version" and pnpm exec playwright install instead of npx.
  • playwright.config.ts: WebServer command changed to pnpm build:client && pnpm start — ensures client JS is compiled for local pnpm test:e2e runs without a prior build.
  • e2e/app.spec.ts: Logout test checks .user-email not visible instead of asserting Google OAuth URL redirect (avoids external network dependency in assertion).
  • .gitignore: Exclude .github/prompts/*.md.
Original prompt

Fix the failing GitHub Actions workflow e2e
Analyze the workflow logs, identify the root cause of the failure, and implement a fix.
Job ID: 66899388030
Job URL: https://github.com/mahata/mlack/actions/runs/23034475452/job/66899388030


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…sages, use .node-version

Co-authored-by: mahata <23497+mahata@users.noreply.github.com>
Copilot AI changed the title [WIP] [66899388030] Fix failing GitHub Actions workflow e2e Fix e2e test timeouts caused by blocking fetch in loadExistingMessages Mar 13, 2026
Copilot AI requested a review from mahata March 13, 2026 04:05
@mahata mahata marked this pull request as ready for review March 13, 2026 04:26
Copilot AI review requested due to automatic review settings March 13, 2026 04:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses Playwright e2e timeouts caused by an initial fetch("/api/messages") from the chat page blocking subsequent navigations in CI, and also updates CI/local tooling around Node + Playwright setup.

Changes:

  • Add a timeout + abort to loadExistingMessages() to prevent long-running message loads from blocking navigation.
  • Update Playwright webServer startup to build client assets before starting the server.
  • Replace .nvmrc with .node-version and adjust CI + e2e logout assertion to be less externally dependent.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
hono/static/ChatPage.ts Abort fetch("/api/messages") after 5s and clear timer to avoid long hangs affecting navigation.
playwright.config.ts Build client assets before starting the Playwright webServer.
e2e/app.spec.ts Make logout assertion internal/UI-based rather than relying on Google redirect URL.
.github/workflows/ci.yml Use .node-version, switch Playwright install to pnpm exec, and formatting cleanups.
.nvmrc Removed in favor of .node-version.
.node-version Added to pin Node 22 in a broadly-supported way.
.gitignore Ignore .github/prompts/*.md.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread hono/static/ChatPage.ts Outdated
Comment thread hono/static/ChatPage.ts
mahata and others added 3 commits March 13, 2026 14:18
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Initial plan

* Fix e2e test timeouts: increase timeout to 60s, remove external image from mock user

Co-authored-by: mahata <23497+mahata@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mahata <23497+mahata@users.noreply.github.com>
@mahata mahata merged commit 49cee0d into main Mar 13, 2026
2 checks passed
@mahata mahata deleted the copilot/66899388030-fix-e2e-workflow branch March 13, 2026 05:48
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.

3 participants