Skip to content

fix(e2e): register upstream-block listeners before selectOption to avoid race condition - #9640

Merged
ardatan merged 2 commits into
masterfrom
copilot/fix-review-comment-3813837700
Aug 19, 2026
Merged

fix(e2e): register upstream-block listeners before selectOption to avoid race condition#9640
ardatan merged 2 commits into
masterfrom
copilot/fix-review-comment-3813837700

Conversation

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

upstreamBlockPromise and xFrameOptionsPromise were set up after selectOption() and the iframe title visibility wait. Since ExamplesSandbox sends a postMessage and updates the iframe title synchronously on change, a 403 response or X-Frame-Options console error could fire before the listeners were attached — causing the test to miss the "blocked" signal and eventually time out.

Changes

  • website/src/components/examples-sandbox.e2e.ts
    • Move upstreamBlockPromise and xFrameOptionsPromise registration to before exampleSelect.selectOption(...) and the iframe title toBeVisible wait.
    • Guard both promises with process.env.AGAINST_PROD === '1' ternaries (resolving to 'blocked-timeout' otherwise) so non-prod runs are unaffected.
// Before: listeners registered after selection — could miss early failures
await exampleSelect.selectOption(SELECTED_EXAMPLE);
await expect(sandboxIframe).toBeVisible(...);
if (process.env.AGAINST_PROD === '1') {
  const upstreamBlockPromise = page.waitForResponse(...);
  const xFrameOptionsPromise = page.waitForEvent('console', ...);
  ...
}

// After: listeners registered first, then selection is triggered
const upstreamBlockPromise = process.env.AGAINST_PROD === '1'
  ? page.waitForResponse(...).then(...).catch(...)
  : Promise.resolve('blocked-timeout' as const);
const xFrameOptionsPromise = process.env.AGAINST_PROD === '1'
  ? page.waitForEvent('console', ...).then(...).catch(...)
  : Promise.resolve('blocked-timeout' as const);

await exampleSelect.selectOption(SELECTED_EXAMPLE);

…n to capture early failures

Co-authored-by: ardatan <20847995+ardatan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code as per review comment 3813837700 fix(e2e): register upstream-block listeners before selectOption to avoid race condition Aug 19, 2026
Copilot AI requested a review from ardatan August 19, 2026 14:26
@ardatan
ardatan requested a lite review from Copilot August 19, 2026 14:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 reduces flakiness in the ExamplesSandbox Playwright e2e test by registering the “blocked” detection listeners (403 upstream response and X-Frame-Options console error) before triggering the example selection, preventing missed early failures that could otherwise lead to timeouts.

Changes:

  • Moves upstreamBlockPromise and xFrameOptionsPromise setup to occur before exampleSelect.selectOption(...) and the iframe-title visibility wait.
  • Gates both listeners behind process.env.AGAINST_PROD === '1', resolving to 'blocked-timeout' otherwise so non-prod runs keep existing behavior.
  • Keeps prod-specific verification logic (waiting for CodeSandbox content / outage banners / blocked signals) unchanged aside from the listener timing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

Apollo Federation Subgraph Compatibility Results

Federation 1 Support Federation 2 Support
_service🟢
@key (single)🟢
@key (multi)🟢
@key (composite)🟢
repeatable @key🟢
@requires🟢
@provides🟢
federated tracing🟢
@link🟢
@shareable🟢
@tag🟢
@override🟢
@inaccessible🟢
@composeDirective🟢
@interfaceObject🟢

Learn more:

@github-actions

Copy link
Copy Markdown
Contributor

💻 Website Preview

The latest changes are available as preview in: https://pr-9640.graphql-mesh-ai3.pages.dev

@ardatan
ardatan marked this pull request as ready for review August 19, 2026 15:18
@ardatan
ardatan merged commit a3f7658 into master Aug 19, 2026
21 of 22 checks passed
@ardatan
ardatan deleted the copilot/fix-review-comment-3813837700 branch August 19, 2026 15:18
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