Repository navigation
Isolate Developer Hub E2E layout tests from the region-gated WCP banner - #1986
Conversation
The live WCP consent script shows its banner only in regions that require consent. When a CI runner lands in such a region, the fixed banner pushes the Developer Hub layout down and eight layout assertions fail on every attempt (e.g. run 40999614344, mobile-chromium shard 1/2). Add a shared emulateConsentNotRequiredRegion helper that aborts wcpstatic and primes the cached no-consent state, following the existing pattern in cookie-consent, ui-regressions and live-status specs, and apply it to the dev-browse, dev-layout and dev-grain specs. Assertions are unchanged. Co-authored-by: Copilot <[email protected]>
Frontend HTML artifact readyThe latest frontend build uploaded the This comment updates automatically when a new frontend build artifact is uploaded. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the change to isolate end-to-end layout tests from the region-dependent cookie banner.
No open issues 🎉
What changed in this PR
This PR isolates Developer Hub end-to-end layout tests from the region-dependent WCP cookie banner, making layout checks consistent across CI runner regions without changing production behavior.
Changes:
- Adds a shared helper that blocks the WCP script and initializes the no-consent-required state.
- Applies the helper to the browse, layout, and grain specs while leaving assertions, timeouts, and retries unchanged.
| File | Description |
|---|---|
src/frontend/tests/e2e/helpers.ts |
Adds emulateConsentNotRequiredRegion for consistent consent state. |
src/frontend/tests/e2e/dev-layout.spec.ts |
Applies the helper before each layout test. |
src/frontend/tests/e2e/dev-grain.spec.ts |
Replaces localStorage-only setup with the shared helper. |
src/frontend/tests/e2e/dev-browse.spec.ts |
Applies the helper in the existing test setup. |
Review effort: Balanced
|
The same WCP banner issue has now failed CI on an unrelated PR. In #1985 (run 41005285835), 🤖 Posted by AspireAgent (AI Agent) |
Picks up #1986 (Hub E2E WCP banner isolation). Co-authored-by: Copilot <[email protected]>
…er (#1986) ## Summary The Developer Hub E2E layout tests fail when a CI runner lands in a region where Microsoft's WCP cookie-consent script shows its banner. The banner is a fixed strip at the top of the page, and `wcp-consent.css` pushes `.page` down by its height. The Hub specs don't stub `wcpstatic.microsoft.com`, so in those regions eight layout assertions fail on every attempt. Example: [run 40999614344, mobile-chromium shard 1/2](https://github.com/microsoft/aspire.dev/actions/runs/40999614344/job/123883461177) on #1984. All 8 failures (24 attempts including retries) show the "We use optional cookies…" banner in their error context. The other five shards passed. This change adds a shared `emulateConsentNotRequiredRegion(page)` helper to `tests/e2e/helpers.ts` that: - aborts `wcpstatic.microsoft.com`, as `cookie-consent`, `ui-regressions` and `live-status` already do, and - primes `aspireConsentRequired=false`, which is the state WCP reaches in a no-consent region. The helper is applied to `dev-browse`, `dev-layout` and `dev-grain`. `dev-grain` previously set only the localStorage value, which doesn't stop the live banner. Assertions, timeouts and retries are unchanged. Banner behavior stays covered by `cookie-consent.spec.ts` and `cookie-dialog-layout.spec.ts`. ## Third-party links and affiliations None. ## Validation I reproduced the CI condition locally by serving a consent-required WCP stand-in on `wcpstatic.microsoft.com` through Chromium host-resolver mapping (this sandbox can't reach the real CDN). The stand-in's text, links and buttons match the banner captured in CI. Results are on mobile-chromium against `astro dev`: | Test | main + banner | this PR + banner | | --- | --- | --- | | `dev-browse` mobile filters (`:579`) | ❌ `box.y` 418 (≤ 90) — matches CI | ✅ | | `dev-browse` filter positions (`:674`) | ❌ positions shift — matches CI | ✅ | | `dev-browse` type options (`:699`) | ❌ 908 (≤ 700) — matches CI | ✅ | | `dev-grain` `/hub/browse/` | ❌ `elementFromPoint` false — matches CI | ✅ | | `dev-layout` header spacing (`:459`) | ❌ 56 (expected 8) — matches CI | ✅ | | `dev-layout` narrow reflow (`:1105`) | ❌ 941.5 (< 900) | ✅ | | `dev-browse` initial paint ×2 (`:131`) | ❌ 341 px offset (CI: 428) |⚠️ 4 px | On main without the banner, the initial-paint cases also drift 4 px under `astro dev`. That drift is a local dev-server difference: they pass in CI's production build. With the fix, the stub received 0 requests. I also ran the full three specs on mobile and desktop with the banner stand-in: 139 passed, 5 skipped, 14 failed. The failures are pagination/URL-state drift and unreachable external images. The same signatures fail on unchanged main without the banner in this sandbox (`astro dev`, no external network). This PR's CI production-build matrix is the authoritative check for those. - `eslint . --max-warnings 0` (with `astro sync` and the skill-digest check) passes. - Prettier and `tsc` findings on `helpers.ts`/`dev-grain.spec.ts` are present on main too. **🤖 Posted by AspireAgent (AI Agent)** Co-authored-by: davidfowl <[email protected]> Co-authored-by: Copilot <[email protected]>
Summary
The Developer Hub E2E layout tests fail when a CI runner lands in a region where Microsoft's WCP cookie-consent script shows its banner. The banner is a fixed strip at the top of the page, and
wcp-consent.csspushes.pagedown by its height. The Hub specs don't stubwcpstatic.microsoft.com, so in those regions eight layout assertions fail on every attempt.Example: run 40999614344, mobile-chromium shard 1/2 on #1984. All 8 failures (24 attempts including retries) show the "We use optional cookies…" banner in their error context. The other five shards passed.
This change adds a shared
emulateConsentNotRequiredRegion(page)helper totests/e2e/helpers.tsthat:wcpstatic.microsoft.com, ascookie-consent,ui-regressionsandlive-statusalready do, andaspireConsentRequired=false, which is the state WCP reaches in a no-consent region.The helper is applied to
dev-browse,dev-layoutanddev-grain.dev-grainpreviously set only the localStorage value, which doesn't stop the live banner. Assertions, timeouts and retries are unchanged. Banner behavior stays covered bycookie-consent.spec.tsandcookie-dialog-layout.spec.ts.Third-party links and affiliations
None.
Validation
I reproduced the CI condition locally by serving a consent-required WCP stand-in on
wcpstatic.microsoft.comthrough Chromium host-resolver mapping (this sandbox can't reach the real CDN). The stand-in's text, links and buttons match the banner captured in CI. Results are on mobile-chromium againstastro dev:dev-browsemobile filters (:579)box.y418 (≤ 90) — matches CIdev-browsefilter positions (:674)dev-browsetype options (:699)dev-grain/hub/browse/elementFromPointfalse — matches CIdev-layoutheader spacing (:459)dev-layoutnarrow reflow (:1105)dev-browseinitial paint ×2 (:131)On main without the banner, the initial-paint cases also drift 4 px under
astro dev. That drift is a local dev-server difference: they pass in CI's production build. With the fix, the stub received 0 requests.I also ran the full three specs on mobile and desktop with the banner stand-in: 139 passed, 5 skipped, 14 failed. The failures are pagination/URL-state drift and unreachable external images. The same signatures fail on unchanged main without the banner in this sandbox (
astro dev, no external network). This PR's CI production-build matrix is the authoritative check for those.eslint . --max-warnings 0(withastro syncand the skill-digest check) passes.tscfindings onhelpers.ts/dev-grain.spec.tsare present on main too.🤖 Posted by AspireAgent (AI Agent)