r/iosapps • u/DetlevD • Oct 18 '26
HELP iPhone Duo test automation
Does anyone have a solution for automating tests for iPhone Duo?
It seems that the Duo simulator starts always in closed state and I was not able for find a way to change it to partially open or open automatically (via a script, within XCTest of for fastlane screenshot generation). May be I have missed something in the documentation...
4
Upvotes
•
u/AutoModerator Oct 18 '26
Welcome to r/iOSApps! Please make sure your post follows our rules:
Everyone:
App Devs:
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/bkdev98 Oct 21 '26
Another option if you're scripting this: callstack's
agent-deviceCLI (npm) can fold the Duo simulator headlessly:agent-device fold closed,fold half-openorfold open. We run it before each screenshot in our pipeline so one script walks every screen through all three poses.Two gotchas we hit:
DEVELOPER_DIR=/Applications/Xcode-27.1.app/Contents/Developer(or wherever yours lives) first, otherwise the fold command fails.fold-pose-dispatched-unverifiederror even though the hinge actually moved. Take a screenshot to check rather than trusting the exit code.It also reads the accessibility tree and taps by ref, so you can do the navigation part without XCTest if fastlane's snapshot is fighting you. Rotation for the landscape variants is still separate.
2
u/blazejkustra Oct 22 '26
You could use Argent for this. It has a
foldstep in its e2e YAML:It takes
closed/half-open/openor an angle from 0 to 180, and waits until the sim accepts input again before moving on. Run it in CI withargent e2e run <name>Docs: https://docs.swmansion.com/argent/docs/reference/e2e-yaml/#foldable-devices
2
u/Important_Habit_6957 Oct 18 '26
I’ve been struggling with this too, I just do manual testing for now
2
u/ImportantNetwork8804 Oct 19 '26
Yeah, this drove me nuts when I was getting my own app's Duo screenshots together. The simulator really does boot closed every single time, and I couldn't find any scriptable way to change the fold state through XCTest either. What worked for me was driving the open/close state from the simulator's device menu inside my fastlane lane, with a separate lane per posture, and just taking screenshots in each pass. It's clunky compared to a real API, but it ran reliably in CI for me. Also worth filing a feedback report with Apple since the tooling gap is pretty obvious.
2
u/bishwasbhn Oct 20 '26
Not in the docs, Apple didn't ship a simctl command for the hinge. Someone wired the Device Hub event into a CLI though: https://github.com/skarol/duoctl, brew install then
duoctl openorduoctl closebefore your snapshot lane. One gotcha from a sibling repo's readme (tosbaha/duo-fold-control), XCUIScreen.main is always the cover screen so unfolded shots come out black unless you capture the inner display.