Skip to content

test(e2e): port OneTrust integration to Playwright#73350

Draft
stephenliang wants to merge 3 commits into
stagingfrom
port/one-trust
Draft

test(e2e): port OneTrust integration to Playwright#73350
stephenliang wants to merge 3 commits into
stagingfrom
port/one-trust

Conversation

@stephenliang

@stephenliang stephenliang commented Jun 18, 2026

Copy link
Copy Markdown
Member

Ports dashboard/test/ui/features/platform/one_trust.feature (the OneTrust cookie-consent integration suite) from Cucumber/Selenium to Playwright in frontend/packages/e2e-tests. OneTrust is injected into every studio page rather than being a page of its own, so it is modeled as a reusable component (mirroring AuthoredHints). No product code changes — test-only.

The original Cucumber feature is tagged @playwright so the legacy Selenium suite skips the now-ported scenarios.

What changed

  • tests/components/one-trust.ts — new OneTrustComponent. Owns a named locator per OneTrust-emitted <script> (sdkStub, selfHostedSdkStub, autoBlock, prodAutoBlock, testAutoBlock) plus the consent banner, a categorizedScript() helper for the optanon-category-* tagging convention, and a waitForSdkSettled() readiness wait. Locators and waits only; assertions live in the spec.
  • tests/platform/one-trust.spec.ts — the 8 ported scenarios: banner display under European geo, the four onetrust_cookie_scripts modes (self-hosted / prod / test / off), critical-script categorization, and the 9-project-type embedded-view check. The @eyes scenario is test.skip'd (Applitools visual diff has no equivalent here; the functional flow is covered by the adjacent scenario).
  • tests/shared/dcdo.ts, tests/shared/geolocation.ts — shared helpers that set the DCDO and GeolocationOverride cookies, mirroring the Rails Rack::CookieDCDO / Rack::GeolocationOverride middleware and the mock_dcdo / "I am in Europe" Cucumber steps.
  • one_trust.feature — tagged @playwright so the Cucumber run skips the now-ported scenarios.

Test structure

flowchart LR
  feature["one_trust.feature<br/>(authoritative source)"] -.ported to.-> spec
  spec["one-trust.spec.ts<br/>(navigation + expect)"] --> comp["OneTrustComponent<br/>(locators + waits)"]
  spec --> dcdo["shared/dcdo.ts<br/>(DCDO cookie)"]
  spec --> geo["shared/geolocation.ts<br/>(GeolocationOverride cookie)"]
  comp --> page["Playwright page<br/>(test-studio.code.org)"]
Loading

Links

  • Jira:
  • Source feature: dashboard/test/ui/features/platform/one_trust.feature

Testing story

  • yarn typecheck — clean
  • eslint and prettier --check on the changed files — clean
  • npx playwright test tests/platform/one-trust.spec.ts --project=chromium against test-studio.code.org15 passed, 1 skipped (the @eyes scenario)

Full cross-browser (firefox/webkit) coverage runs in CI.

Deployment notes

Standard merge — test-only change, no migrations or flags.

Privacy and security

None — test-only. No product code, PII, or auth surface changes.

stephenliang and others added 2 commits June 18, 2026 10:28
Port 8 scenarios from dashboard/test/ui/features/platform/one_trust.feature.
Green under the 5x/all-browser stress gate; original Cucumber feature tagged @playwright so the Cucumber suite skips it.

Source: dashboard/test/ui/features/platform/one_trust.feature
The port modeled OneTrust as `OneTrustPage extends BasePage` with the
assertions baked into the page object. OneTrust is injected into every
page rather than being a page of its own, so model it as a component
(mirroring AuthoredHints) and keep assertions in the spec, per the
e2e-tests convention.

- add OneTrustComponent owning a named locator per emitted OT script
  (sdkStub, selfHostedSdkStub, autoBlock, prod/testAutoBlock), so the
  script paths live in one place instead of repeated across tests
- move every expect() out of the page object into the spec
- name and justify the OT timeouts; drop comments that narrate the
  next line

Verified: typecheck, eslint, prettier, and 15 passed / 1 skipped on
chromium against test-studio.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@stephenliang stephenliang marked this pull request as ready for review June 18, 2026 20:16
The @eyes scenario is a visual (Applitools) test with no equivalent in
the Playwright suite, so it is not migrated. Tagging the whole feature
@playwright wrongly claimed it was done and, once the Cucumber<->Playwright
dedup activates, would drop the eyes coverage with no replacement.

- feature: drop feature-level @playwright; tag the 7 migrated scenarios
  individually; leave the @eyes scenario untagged so the Cucumber eyes
  run keeps covering it
- spec: the @eyes stub is now Migration status: PENDING and test.fixme,
  documenting it stays in Cucumber until Playwright visual diff exists

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@stephenliang stephenliang marked this pull request as draft June 18, 2026 23:19
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.

1 participant