v1.0.10 · Release snapshot

Documentation comes from this release commit, without inheriting newer content. Commit: 63ea8c2b3d.

Maestro E2E Testing

End-to-end flows for Magic Piano's logic, run against the Release simulator app (JS bundled) — the same artifact CI builds on every merge to dev and publishes to the package registry. One runner for everything: run-release.sh (bun run e2e:release). Full guide: docs/runtime-provider.md.

Flows are run by a developer or CI. AI agents run them only when the user asks (see testing-and-quality.mdc).

Layout

.maestro/
├── run-release.sh                   # prepare simulator -> install Release app clean -> maestro test (JUnit + screenshots)
├── e2e.env                          # the build env the flows assume (sim variant, no film, mock catalog, ...)
├── flows/                           # the suite (run in CI); all play against the MOCK catalog, nothing is shortcut
│   ├── 00-first-run.yaml            # whole first run: intro -> tutorial welcome -> practice (tap + hold drill) -> tutorial
│   │                                #   song -> Congrats -> pick a free song -> its gameplay -> song list -> cold restart
│   ├── 00-smoke.yaml                # clean install -> home with the catalog + tabs
│   ├── 01-navigation-flows.yaml     # tabs, keyboard screen, back stack
│   ├── 02-keyboard-sampler.yaml     # free-play keyboard: zoom, minimap, sustain
│   ├── 03-gameplay-perfect-run.yaml # real run: wrong key ignored, 3 single notes + 1 hold -> Score 58, 3 stars
│   ├── 04-songs-catalog.yaml        # mock catalog listing, search (no match / match), difficulty filter
│   ├── 05-profile.yaml              # edit name, settings, name survives a restart
│   ├── 06-progress.yaml             # a played song shows in the profile (recent song, play count), survives a restart
│   ├── 07-gameplay-pause-replay.yaml # pause menu, replay, resume, leave
│   ├── 08-adaptive-tempo.yaml       # gameplay with the hidden tempo multiplier forced on: stray taps + a wait, score still 58 / 3 stars
│   ├── 09-adaptive-tempo-devtool.yaml  # simulator ↔ desktop DevTool realtime (run via run-adaptive-tempo-devtool.sh)
│   └── 10-adaptive-tempo-snap.yaml  # wait-mode pause snaps the tempo to 0.90 at once (run via run-adaptive-tempo-snap.sh)
├── subflows/                        # launch-app, bootstrap-app, play-mock-song, sleep
└── catalog/                         # song-catalog e2e against a local CDN (Debug dev client; `bun run e2e:catalog`)

Running

bun run e2e:release                                      # newest build published by CI, installed clean
bash .maestro/run-release.sh .maestro/flows/05-profile.yaml     # only some flows
LOCAL=1 bash .maestro/run-release.sh                     # your own build (fastlane ios release_simulator)
SKIP_INSTALL=1 bash .maestro/run-release.sh <flow>       # fast loop: reuse the installed app
RECORD_VIDEO=1 bash .maestro/run-release.sh              # also record build/e2e/video/e2e-run.mp4 (always on CI)

Every run writes build/e2e/: report.xml (JUnit), artifacts/ (a screenshot + command log of a failing flow) and, with RECORD_VIDEO=1 / on CI, video/e2e-run.mp4 — the whole run at a constant 60 fps (the raw simulator recording is variable-frame-rate: it only writes frames when the screen changes, so static screens look "low fps" until it is re-encoded). The folder is git-ignored. On merge requests the suite (e2e_mr) is a manual job: play it on the MR pipeline to run the flows and link the video from the MR. It does not start on its own.

Prerequisites: Maestro CLI (curl -fsSL https://get.maestro.mobile.dev | bash), Xcode with an iOS simulator, and for the registry path a GITLAB_TOKEN (read_package_registry). Building your own app: see the docs link above.

The mock catalog and how a song is played for real

In an e2e build (e2e.env) the catalog is src/core/e2e/e2e-mock-catalog.pure.ts: E2E Play Song (easy), E2E Hard Song and Twinkle Twinkle Little Star (the tutorial's song), all on one hand-authored chart at 60 BPM: C4 single, E4 single, G4 hold (2 s), D4 single. No remote catalog can override it, and the tutorial's own excerpt chart is replaced by it. There is no "finish" shortcut: a flow plays the song with real taps.

The game waits on the hit line for each tile (auto-pause), and a tap within 2 s of the tile freezing there is Perfect+, so a flow needs no clock sync (subflows/play-mock-song.yaml): wait for the first tile, then tap the keys in order, long-pressing the hold. A clean run is 4 x Perfect+ (12) + the hold bonus = Score 58, 3 stars. Keys sit at fixed positions in landscape percentages (A3..C5 at 5%, 15% ... 95% of the width, white-key faces at ~92% of the height).

How the flows cope with iOS UI automation (read before writing a flow)

  • Build switches (e2e.env): EXPO_PUBLIC_E2E=1 (no intro film, which would redraw every frame), EXPO_PUBLIC_E2E_MOCK_CATALOG=1. A flow launches with arguments: { e2eSkipFtue: "1" } to start past onboarding + tutorial (subflows/launch-app.yaml; every flow but the first-run one), or without it to walk the first run.
  • Reduce Motion: run-release.sh boots the simulator with iOS Reduce Motion on (sim:prepare) so looping animations settle.
  • Orientation (the big one): the intro is portrait, everything after it landscape. On a headless simulator iOS UI automation takes the device for whatever orientation was last set, so with the wrong one the tree is empty (portrait screen, landscape device) or taps land at rotated positions (landscape screen, portrait device). The setting persists across runs: every flow sets it explicitly (setOrientation: LANDSCAPE_LEFT in launch-app.yaml; PORTRAIT for the intro in 00-first-run.yaml, then LANDSCAPE_LEFT).
  • Not exposed to automation: some modal controls (name dialog field, settings close X) have no accessibility id. Flows type into the focused field + press Enter, or tap by position (point: "96%,9%", landscape percentages).
  • Waits: always extendedWaitUntil after navigation; subflows/sleep.yaml for a fixed delay (Maestro has no sleep).

📦 Automated CI/CD iOS Simulator Builds & Artifacts

1. Build Pipeline (currently disabled)

The simulator build workflow was already disabled on GitHub Actions and was not ported when CI moved to GitLab (.gitlab-ci.yml, see docs/ci-cd.md). Build the simulator .app locally (xcodebuild -sdk iphonesimulator) until a GitLab job (e.g. artifacts: + expire_in: 7 days) is added; bun run e2e:download still targets the old GitHub artifact and will not work.

1b. Release simulator app from the GitLab registry (current)

CI job sim_release_publish builds the Release simulator app (JS bundled) when run manually (Run pipeline → PIPELINE_TARGET=sim-release) and publishes it to the package registry. bun run e2e:release (.maestro/run-release.sh) downloads the newest one, boots a simulator, installs it clean and runs .maestro/flows with a JUnit report in build/e2e/; CI job e2e_maestro does the same only when you Run pipeline → PIPELINE_TARGET=e2e, against the newest published build. A push to dev does not start it. Details and Maestro MCP setup: docs/runtime-provider.md.

2. Downloading & Installing Artifacts Locally

Legacy flow (needs a pipeline that publishes the ios-simulator-app-* GitHub artifact; not available after the GitLab migration):

# 1. Tải và giải nén artifact iOS simulator mới nhất
bun run e2e:download

# 2. Cài đặt vào simulator đang chạy
xcrun simctl install booted ./artifacts/MagicPiano.app

# 3. Chạy bộ test Maestro
bun run e2e:test

🎵 Song catalog end-to-end (.maestro/catalog/)

Drives the real app on a simulator against a local CDN: bundled catalog by default, a newer remote catalog overrides it, a song with no bundled chart downloads its MIDI on demand, and a cold restart (server up or down) serves everything from disk.

bun run e2e:catalog            # = bash .maestro/catalog/run.sh  (needs a booted simulator with the dev-client build)

run.sh starts the CDN (scripts/catalog-e2e-server.ts) and its own Metro (port 8097, EXPO_PUBLIC_CATALOG_URL pointing at the CDN), wipes the catalog's MMKV/media state between scenarios, runs the five flows and asserts what the server saw (request counts). Notes: the sidebar mounts under the loading splash, so launch.yaml waits for the splash to disappear; Maestro env defaults (${APP_ID:-…}) are not supported by Maestro — pass -e APP_ID=….