Skip to content

fix(stage2): launch the app under test in English whatever the device language - #161

Merged
dadachi merged 2 commits into
mainfrom
fix/stage2-english-locale
Oct 18, 2026
Merged

dadachi merged 2 commits into
mainfrom
fix/stage2-english-locale

Conversation

@dadachi

@dadachi dadachi commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Closes #159

Stage 2 waits for English UI text ("Welcome to", button labels) but the generated apps follow the device language, so a simulator set to Japanese failed Stage 2 on its first step.

Changes

  • iOS — Stage 1's install/launch (src/validation/launch.ts) now runs xcrun simctl launch booted <bundle> -AppleLanguages "(en)" -AppleLocale en_US.
  • Android — after install, before the monkey launch: adb shell cmd locale set-app-locales <pkg> --locales en-US (Android 13 / API 33+). If it fails (older Android), the launch still goes ahead and a warning (LaunchResult.warnings) is traced: the app then follows the device language.
  • Stage 2 foreground / springboard relaunch — MobileClient.launchApp(pkg, locale) passes locale: "en-US" to mobile-mcp's mobile_launch_app (0.0.54 supports it: -AppleLanguages/-AppleLocale on iOS simulators through mobilecli, set-app-locales on Android), so the retry path is English too.
  • Non-English UI detection — when a wait_for_text / tap_text step fails and the screen shows non-Latin text, the Stage 2 error reads environment: the app's UI is not in English (the screen shows "Orange Baton へようこそ") although the agent launched it in English (...); ... Set the simulator's language to English and re-run. (<original step error>). Deliberately simple: Latin-script languages (French, German) still surface as a plain step failure.
  • installAndLaunch / selectAdbTarget take an injectable exec layer (LaunchExec) so the commands are unit-tested without simctl/adb.
  • README: one sentence on the English launch under NATIVEAPPTEMPLATE_VISUAL=2.

Tests

  • iOS launch args, Android set-app-locales ordering (after install, before monkey; emulator picked over a phone), Android < 13 fallback warning — via a recording exec.
  • The existing springboard-relaunch test now asserts both launches ask for en-US.
  • Stage 2 on a fake mobile-mcp screen showing Orange Baton へようこそ → environment: error; an English screen keeps the plain error.
  • Each new assertion was seen red by reverting its piece of the fix (5 failures), then green. npm run ci: 192 pass.

Real-device check (no paid run)

Using the already-built Orange Baton app:

  • iPhone 17 Pro simulator (iOS 26.2) switched to AppleLanguages (ja-JP, en-US) / ja_JP: plain simctl launch → Japanese UI; installAndLaunch from this branch → "Welcome to Orange Baton" / "Start" / "Support Website".
  • mobile-mcp 0.0.54 mobile_launch_app on the same Japanese simulator: without locale → Orange Batonへようこそ | はじめる; with locale: "en-US" → Welcome to Orange Baton | Start (both attempts).
  • Android emulator (API 37) with device locale ja-JP: plain launch → Orange Batonへようこそ / はじめる; installAndLaunch from this branch → English, get-app-locales = [en-US].
  • Simulator restored to en-US, ja-JP / en_US and left booted; emulator restored to en-US.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UZJxUoubntzu7Ec7DPVfAr

… language

Stage 2's scripted scenario waits for English UI text, but the generated
apps follow the device language, so a Japanese simulator failed the run
on its first wait_for_text even though the app was fine.

- iOS: Stage 1's `simctl launch` passes -AppleLanguages "(en)"
  -AppleLocale en_US.
- Android: `cmd locale set-app-locales <pkg> --locales en-US` before the
  launch (API 33+); on older devices the launch goes ahead and a warning
  is traced.
- Stage 2's foreground launch (and its springboard relaunch retry) asks
  mobile-mcp for locale en-US.
- A failing text step on a screen with non-Latin text is reported as an
  `environment:` problem instead of a bare wait_for_text timeout.
- installAndLaunch takes an injectable exec layer so the commands are
  unit-tested without simctl/adb.

Closes #159

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UZJxUoubntzu7Ec7DPVfAr
@dadachi
dadachi merged commit 8684e9d into main Oct 18, 2026
1 check passed
@dadachi
dadachi deleted the fix/stage2-english-locale branch October 18, 2026 02:19
@dadachi dadachi mentioned this pull request Oct 18, 2026
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.

Stage 2 fails when the simulator/emulator isn't in English

1 participant