Skip to content

Fix Playwright port conflict in CI by disabling webServer auto-start#268

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-playwright-port-conflict
Draft

Fix Playwright port conflict in CI by disabling webServer auto-start#268
Copilot wants to merge 4 commits intomainfrom
copilot/fix-playwright-port-conflict

Conversation

Copy link
Contributor

Copilot AI commented Nov 5, 2025

CI workflow fails with "port 3000 already in use" because the workflow manually starts netlify dev --port 8888 while Playwright config attempts to auto-start a second server on port 3000.

Changes

playwright.config.ts

  • Conditionally disable webServer in CI environments where the workflow pre-starts the server
  • Enable reuseExistingServer: true for local development to prevent conflicts
webServer: process.env.CI ? undefined : {
  command: 'npm run dev',
  url: 'http://localhost:3000',
  reuseExistingServer: true,
  // ...
}

Documentation

  • e2e/README.md: Updated CI behavior and troubleshooting for port conflicts
  • CHANGELOG.md: Added entry documenting the fix

Behavior

  • CI: Uses workflow-managed netlify dev on port 8888 via BASE_URL env var
  • Local: Auto-starts Next.js on port 3000 with server reuse enabled

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Important Execution Steps:

Actions such as checkout, setup-node, installing dependencies and Playwright browsers, and environment checks ran successfully.
The system verified readiness of local dev server at http://localhost:8888.
Functions and TypeScript compilation steps succeeded.
The Playwright E2E test step failed due to a port conflict:
Error: http://localhost:3000 is already used, make sure that nothing is running on the port/url or set reuseExistingServer:true in config.webServer.
This error repeated, which led to the test job failing with exit code 1 and the workflow stopping.
Summary of Errors and Warnings:

The primary cause was a port usage conflict on localhost:3000. The Playwright config did not specify reuseExistingServer:true or ensure the port was free before launching tests.
Action Required: Before rerunning this workflow:
Ensure no existing instance is running on port 3000, or
Set reuseExistingServer:true in Playwright’s configuration under config.webServer to allow port sharing during tests.
Conclusion:
While the intended code fix was set up for testing, the end-to-end tests did not execute due to an environment setup issue, not a code failure. Addressing the port usage will enable the tests to proceed and properly validate the code change.

Recommendation:

Adjust the Playwright configuration or free up port 3000, then re-run the workflow to confirm successful testing of the fix.


💡 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.

@netlify
Copy link

netlify bot commented Nov 5, 2025

Deploy Preview for sprightly-genie-998c07 failed. Why did it fail? →

Name Link
🔨 Latest commit 6db9f04
🔍 Latest deploy log https://app.netlify.com/projects/sprightly-genie-998c07/deploys/690acb6131c5330008b3d26d

Copilot AI and others added 3 commits November 5, 2025 03:53
Co-authored-by: DHCross <45954119+DHCross@users.noreply.github.com>
Co-authored-by: DHCross <45954119+DHCross@users.noreply.github.com>
Co-authored-by: DHCross <45954119+DHCross@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Playwright E2E test port conflict Fix Playwright port conflict in CI by disabling webServer auto-start Nov 5, 2025
Copilot AI requested a review from DHCross November 5, 2025 03:59
Copy link
Owner

@DHCross DHCross left a comment

Choose a reason for hiding this comment

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

I'm having Codex take a look

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.

2 participants