-
Couldn't load subscription status.
- Fork 430
Launch Codename One app via simctl before iOS UI screenshots #4018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| emitScreenshotPayloads(for: shot, name: name) | ||
| } | ||
|
|
||
| private func ensureAppLaunched(timeout: TimeInterval = 45) { | ||
| if app.state == .runningForeground { | ||
| return | ||
| } | ||
|
|
||
| if !simctlLaunchAttempted, let bundleID = targetBundleIdentifier, launchViaSimctl(bundleIdentifier: bundleID) { | ||
| simctlLaunchAttempted = true | ||
| print("CN1SS:INFO:simctl_launch_attempted bundle=\(bundleID) result=success") | ||
| if app.wait(for: .runningForeground, timeout: timeout) { | ||
| return | ||
| } | ||
| app.activate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simctl launch bypasses configured locale arguments
The setup adds app.launchArguments += ["-AppleLocale", "en_US", "-AppleLanguages", "(en)"] to keep screenshots deterministic, but ensureAppLaunched() now returns immediately when launchViaSimctl succeeds. In that code path the app is never launched through XCUIApplication.launch(), so the configured launch arguments and any launch environment are never applied. When the simulator launch succeeds, the screenshots will run with whatever locale the simulator already has, producing nondeterministic output. You either need to pass the same arguments when calling simctl or still invoke app.launch()/activate() with those arguments after the simctl launch so the app sees the intended configuration.
Useful? React with 👍 / 👎.
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
d6905ce to
b5276a3
Compare

Summary
xcrun simctl launchonce before falling back toXCUIApplication.launch()Testing
https://chatgpt.com/codex/tasks/task_e_68f669797d2c8331b1865058ee8aa328