Skip to content

test: server.getUrl is now a promise#3533

Open
fredericoo wants to merge 5 commits intomainfrom
fb-playwright-server-stability
Open

test: server.getUrl is now a promise#3533
fredericoo wants to merge 5 commits intomainfrom
fb-playwright-server-stability

Conversation

@fredericoo
Copy link
Contributor

WHY are these changes introduced?

Fixes intermittent issues locally when the server URL is requested before it had time to start, and if it didn’t have a hardcoded port it would throw an error

WHAT is this pull request doing?

  • server starts in constructor instead of separately (we always created a new instance and initialised it at the same time anyway)
  • server.getUrl() now is a promise, so we can await for it to be done in our test statements and then we have the base URL to go to

HOW to test your changes?

  • run e2e locally
  • check CI in this pr

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

@fredericoo fredericoo requested a review from a team as a code owner March 5, 2026 13:42
@shopify
Copy link
Contributor

shopify bot commented Mar 5, 2026

Oxygen deployed a preview of your fb-playwright-server-stability branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment March 20, 2026 5:45 PM

Learn more about Hydrogen's GitHub integration.

@binks-code-reviewer
Copy link

🤖 Code Review · #projects-dev-ai for questions
React with 👍/👎 or reply — all feedback helps improve the agent.

Complete - No issues

📋 History

✅ No issues

… baseURL

Address PR review feedback from kdaviduik:
- Make `capturedUrl` private so `getUrl()` is the sole public access point
- Make `start()` private since it's only called from the constructor,
  preventing misuse if called post-stop()
- Remove redundant `this.capturedUrl = startupPromise` inside start() -
  the constructor assignment is the single write point. The `.catch()`
  now references `startupPromise` directly because `this.capturedUrl`
  hasn't been assigned yet during start() execution (the constructor
  assignment happens after start() returns)
- Add explicit guard in index.ts throwing if baseURL is falsy, surfacing
  a clear error instead of silently passing undefined to Playwright
@fredericoo fredericoo marked this pull request as draft March 20, 2026 14:47
…stability

# Conflicts:
#	e2e/fixtures/server.ts
On main, beforeAll ended with `await server.start()` which blocked until
the server was ready. After making start() private (called eagerly in
constructor), beforeAll returned immediately without waiting. This caused
the baseURL fixture to see server as null in parallel worker
configurations.

Restore the barrier with `await server.getUrl()` at the end of
beforeAll. Also remove the overly aggressive undefined guard that was
masking the real error in CI.
@fredericoo fredericoo marked this pull request as ready for review March 20, 2026 15:12
…stability

# Conflicts:
#	e2e/fixtures/index.ts
#	e2e/fixtures/server.ts
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