Skip to content

Isolate Developer Hub E2E layout tests from the region-gated WCP banner - #1986

Merged
David Pine (IEvangelist) merged 1 commit into
mainfrom
aspireagent/hub-e2e-wcp-isolation
Oct 30, 2026
Merged

David Pine (IEvangelist) merged 1 commit into
mainfrom
aspireagent/hub-e2e-wcp-isolation

Conversation

@davidfowl

Copy link
Copy Markdown
Contributor

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 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)

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]>
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Frontend HTML artifact ready

The latest frontend build uploaded the frontend-dist artifact for PR #1986. Use the VS Code button below to open this PR with GitHub Artifacts Explorer and browse the built HTML locally.

VS Code: Open PR #1986 artifacts

This comment updates automatically when a new frontend build artifact is uploaded.

@davidfowl
David Fowler (davidfowl) marked this pull request as ready for review October 30, 2026 06:07
Copilot AI balanced review requested due to automatic review settings October 30, 2026 06:07

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.

🟢 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

Copy link
Copy Markdown
Contributor Author

The same WCP banner issue has now failed CI on an unrelated PR. In #1985 (run 41005285835), dev-layout.spec.ts:459 "desktop header actions use consistent spacing" failed on tablet-chromium shard 1/2 on all three attempts. It expected an 8px gap between the Hub link and Docs and got 56px. The failure screenshot shows WCP's cookie-preferences button between those two links. That PR only edits dashboard/overview.mdx. The beforeEach stub in this PR already covers that spec.

🤖 Posted by AspireAgent (AI Agent)

@IEvangelist
David Pine (IEvangelist) merged commit bebef26 into main Oct 30, 2026
20 checks passed
@IEvangelist
David Pine (IEvangelist) deleted the aspireagent/hub-e2e-wcp-isolation branch October 30, 2026 12:59
David Fowler (davidfowl) added a commit that referenced this pull request Oct 30, 2026
Picks up #1986 (Hub E2E WCP banner isolation).

Co-authored-by: Copilot <[email protected]>
Alistair Matthews (alistairmatthews) pushed a commit that referenced this pull request Nov 10, 2026
…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]>
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