feat: Guided Tours E2E Tests#2415
Conversation
🎩 PreviewA preview build has been created at: |
586e87d to
6bffb2c
Compare
f7adb0c to
f9ccfa0
Compare
f9ccfa0 to
c1361f2
Compare
6bffb2c to
18c2dd3
Compare
18c2dd3 to
0e1b241
Compare
088f063 to
ef6a2d0
Compare
0e1b241 to
7f552ac
Compare
ef6a2d0 to
b583f84
Compare
3b6725f to
cf9670d
Compare
b583f84 to
cf0a129
Compare
cf9670d to
9a1a38d
Compare
03beccf to
d725087
Compare
9a1a38d to
ad996b1
Compare
9954dd1 to
68c9054
Compare
173e3d0 to
fb6be72
Compare
68c9054 to
dc367c2
Compare
fb6be72 to
afe48e8
Compare
20ce5e1 to
5120618
Compare
467fa3c to
9073078
Compare
9073078 to
be78ffa
Compare
5120618 to
8c80eaf
Compare
8c80eaf to
612ade1
Compare
be78ffa to
30f2eac
Compare
612ade1 to
f048e6a
Compare
b8fa57d to
84979cf
Compare
f048e6a to
9585c4f
Compare
84979cf to
a795168
Compare
9585c4f to
96f0bf2
Compare
a795168 to
02bc46f
Compare
96f0bf2 to
1632bef
Compare
Data-driven driver that walks each tour's JSON: asserts every step's data-tour anchor, performs the gating interaction (or clicks Next), and verifies advancement, finishing on the completion step. One thin spec per tour (navigating-editor, first-pipeline, subgraphs, using-secrets). The using-secrets spec drives the no-backend path: it fails the health ping and /api/secrets so the tour's in-memory mock backend handles the secret steps, runs them fully hands-on with normal gating, and asserts the Submit Run confirm stays disabled in mock mode. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
02bc46f to
d723728
Compare
| return { x: box.x + box.width / 2, y: box.y + Math.min(box.height / 2, 200) }; | ||
| } | ||
|
|
||
| async function performInteraction( |
There was a problem hiding this comment.
🤖 This is an AI-generated code review comment.
This PR adds a new 548-line driver with FTA 72.15 and cyclomatic complexity 65, well over the strong-flag thresholds. Most of the complexity is concentrated in the interaction dispatcher and broad canvas/window/secrets helper set, so every future tour interaction will have to modify this already-large file and switch. Because this file is new in this PR, the static-analysis regression belongs here.
Suggestion: Keep runTour small and split handlers into focused modules, for example canvasInteractions.ts, windowInteractions.ts, and secretsInteractions.ts, wired through a typed Record<InteractionName, Handler> or small dispatcher. That should bring file size and cyclomatic complexity below the project thresholds and make adding a new tour interact…
Rule: static-analysis skill: FTA > 60, cyclomatic complexity > 20, and file size > 400 lines are strong flags; project-conventions: prefer focused helpers and reduce nesting/large functi
| * the real tour the app ships, not a copy that can drift. | ||
| */ | ||
| export function loadTour(fileName: string): TourDef { | ||
| return JSON.parse(readFileSync(join(TOURS_DIR, fileName), "utf8")) as TourDef; |
There was a problem hiding this comment.
🤖 This is an AI-generated code review comment.
JSON.parse returns any, and the direct as TourDef assertion bypasses the type safety the surrounding comments are trying to preserve. A malformed tour JSON can compile as TourDef and then fail later inside the runner with a less direct error.
Suggestion: Parse to unknown and add a small assertTourDef/type guard, or validate with the existing zod dependency, so missing id, non-array steps, or invalid step shapes fail at load time with the tour filename included.
Rule: typescript-standards: avoid unsafe type assertions; prefer type guards/runtime validation for external data.

Description
This PR is 100% AI generated.
End-to-end tests that replicate and verify the exact flow of every guided tour, so a UI change that breaks a tour is caught here (and points at the tour + step to fix) rather than shipping a broken tour.
Rather than four bespoke specs, this is a single data-driven driver that reads each tour's real JSON definition and walks it the way a user would:
tests/e2e/tours/tourDriver.ts—runTour(page, tour)opens the tour, then for each step: asserts the step's spotlight anchor resolves in the DOM (the core regression signal), performs the gating interaction (or clicks Next for passive steps), and waits for the tour to advance (synchronised on the?step=NURL the tour writes). It finishes on the completion step. A handler exists for everyinteractiontype — drag-from-library, edge connection, task select, set-argument, undock/redock window, subgraph navigate/unpack, marquee multi-select, create-subgraph, and the full secrets flow.navigating-editor,first-pipeline,subgraphs,using-secrets. Each loads the shipped tour JSON vialoadTour(...), so the test tracks the real tour and new steps are covered automatically (modulo a brand-new interaction type needing a handler).eslint.config.js— teachplaywright/expect-expectthatrunTourasserts internally.Because the driver asserts each step's
data-tour*anchor, removing or renaming an anchor a tour depends on fails the matching step by design.The
using-secretsspec exercises the no-backend path from #2405 / #2406: it fails the health ping and/api/secretsso the tour's in-memory mock backend serves the secret steps. The tour runs fully hands-on with normal gating, no/api/secretscalls fire, and the Submit Run confirm is asserted disabled (real run not wired in mock mode).Related Issue and Pull requests
Closes https://github.com/Shopify/oasis-frontend/issues/644
Sits on top of the guided-tour stack (#2405 / #2406 and the framework/tour PRs below them).
Type of Change
Checklist
Test Instructions
pnpm test:e2e tests/e2e/tours/— all four tour specs pass (run in parallel against a local dev server).using-secretsspec drives the no-backend path: it routes the health ping and/api/secretsto fail, so the tour'smockBackendactivates and the in-memory mock serves the secret steps. It asserts no/api/secretscalls fire and that Submit Run stays disabled in mock mode.Additional Comments
The centered tour popover overlaps a few dialog controls (Add Secret / submit confirm / the "Use Secret" lock button). The driver dispatches the click directly to those elements (
clickThrough) so React's handler still fires — the only spot where it doesn't use a real mouse click.