Skip to content

test(e2e): port platform/policy_compliance/lockout_phase to Playwright#73658

Draft
stephenliang wants to merge 1 commit into
stagingfrom
stephen/playwright-lockout-phase
Draft

test(e2e): port platform/policy_compliance/lockout_phase to Playwright#73658
stephenliang wants to merge 1 commit into
stagingfrom
stephen/playwright-lockout-phase

Conversation

@stephenliang

Copy link
Copy Markdown
Member

Ports the 10 scenarios of dashboard/test/ui/features/platform/policy_compliance/lockout_phase.feature (Child Account Policy "all-user lockout" phase) to Playwright/TypeScript in frontend/packages/e2e-tests, and tags the original Cucumber feature @playwright so the Cucumber suite skips the now-ported scenarios.

The scenarios assert that on /users/edit the age and US-state selects are disabled for under-13 Colorado students in the lockout phase (email, Clever, or Google login) and enabled for everyone else (over-13, non-Colorado, or not yet in lockout).

What's here

  • tests/policy-compliance/lockout-phase.spec.ts — the 10 scenarios, each mapped 1:1 to its Cucumber source with a Migration-status doc block.
  • tests/pages/account-edit-page.ts — a small POM for /users/edit, locating the age/US-state selects inside the #account-information React mount.
  • tests/shared/auth.tscreateUser/createStudent gain SSO (clever/google) provisioning that matches the Cucumber create_user step (drops the password and forwards the OmniAuth provider + uid).
  • tests/platform/header.spec.ts — one-line import fix for a teacher-dashboard module a prior PR relocated (it was a dead import on this branch base).

Scenario coverage

Age State Created Login Age/State fields
<13 CO before CAP email disabled
<13 CO after / before CAP Clever disabled
<13 CO before CAP Google disabled
<13 not CO after / before CAP email enabled
<13 not CO after / before CAP Clever enabled
13+ CO after / before CAP email enabled

Setup mechanics (parity with the step defs)

  • CAP dates: the CPA all user lockout phase step sets a client-side DCDO cookie; the port mocks cap_CO_lockout_date_override through the shared dcdo fixture. The created_at values for "before/after CAP start" accounts are pinned to the exact Ruby-derived instants (verified with bin/rails runner). The cap_CO_start_date_override the Cucumber step also set is intentionally omitted — no app code reads that key.
  • Account creation: createStudent POSTs to the test-only /api/test/create_user with age, us_state, created_at, and SSO linkage, so the Clever/Google scenarios need no real OAuth handshake.
  • Geolocation: #user_us_state renders only for US-geolocated requests (RegistrationsController#edit derives @is_usa from request.country_code), so beforeEach pins the country to US via the shared setCountryOverride helper — the same pattern manage-students uses. The original Cucumber relied implicitly on US CI IPs.

Links

  • Jira:

Testing story

Green under the zero-flake stress gate — 5× repeats × {chromium, firefox, webkit}, retries=0 — run independently twice (150/150 clean each time) against test-studio.

Reviewed for fidelity against the authoritative Cucumber feature and step definitions. Two latent test-validity issues surfaced by the review are fixed here: (1) the US-geolocation dependency above, and (2) scoping the #user_us_state/#user_age locators to the #account-information edit form so the enabled-case assertions target the real control rather than the "finish creating your account" interstitial modal, which reuses the same element ids.

Port 10 scenarios from dashboard/test/ui/features/platform/policy_compliance/lockout_phase.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/policy_compliance/lockout_phase.feature
@stephenliang stephenliang marked this pull request as draft July 2, 2026 23:42
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