Files
Ben Stull fd123da6a3 test(e2e): harden harness for deployed runs (retries, serialize, banner)
Test-infra only (e2e/ is not in the deployed artifact). Refines the
v0.52.0 deployed-env harness:
- retries:2 + on-first-retry trace now meaningful (was dead: retries
  defaulted to 0); de-risks timing flakes over the public edge.
- workers:1 — the metadata specs run in order and write real commits;
  parallel workers would race on shared state and concurrent bot pushes.
- deployed timeouts bumped (60s/20s) when E2E_TEST_AUTH_SECRET is set.
- dismissCookies forcibly removes any lingering consent-banner node so it
  can't intercept catalog-footer checkbox clicks (the recurring flake).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 23:56:32 -07:00

19 lines
1020 B
JavaScript

// Dismiss the cookie-consent banner if it's showing. It is fixed to the bottom
// of the viewport and intercepts pointer events over the catalog footer (where
// row-select checkboxes live), so tests that click there must clear it first.
export async function dismissCookies(page) {
const banner = page.locator('.cookie-consent-banner')
if (await banner.count()) {
// Click to persist the consent choice so it doesn't reappear on
// later navigation...
await page.getByRole('button', { name: 'Save choice' }).click().catch(() => {})
await banner.waitFor({ state: 'hidden', timeout: 5000 }).catch(() => {})
// ...then forcibly remove any node still in the DOM. The dismiss
// click occasionally doesn't land before a test clicks a catalog
// footer checkbox (flaky over the deployed edge), and a lingering
// fixed banner intercepts those pointer events. Removing the node
// makes the dismissal deterministic.
await banner.evaluate((el) => el.remove()).catch(() => {})
}
}