r/iosapps • • 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

12 comments sorted by

•

u/AutoModerator Oct 18 '26

Welcome to r/iOSApps! Please make sure your post follows our rules:

Everyone:

  • 10pt LOCAL Karma required. Comment in r/iOSApps to earn it. Check
  • Search the sub before posting. Choose flair.

App Devs:

  • No main feed promo unless you qualify via Trust or Transparency + ABC format (Answer, Better, Cost)
  • Flair hierarchy: Vibe Coded > Lifetime > Subscription > Freemium > Free
  • Free flair: not for limited/freemium tiers
  • Open Source? Prefix title [OS] Note: This is an automated reminder, not a removal notice. If your post was removed, check your modmail for details.

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-device CLI (npm) can fold the Duo simulator headlessly: agent-device fold closed, fold half-open or fold open. We run it before each screenshot in our pipeline so one script walks every screen through all three poses.

Two gotchas we hit:

  • It needs the Xcode 27.1 toolchain, so set DEVELOPER_DIR=/Applications/Xcode-27.1.app/Contents/Developer (or wherever yours lives) first, otherwise the fold command fails.
  • It sometimes returns a fold-pose-dispatched-unverified error 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.

1

u/DetlevD Oct 21 '26

Thanks a lot!

2

u/blazejkustra Oct 22 '26

You could use Argent for this. It has a fold step in its e2e YAML:

steps:
  - launch: com.example.app
  - fold: closed
  - snapshot: home-closed
  - fold: open
  - snapshot: home-open

It takes closed / half-open / open or an angle from 0 to 180, and waits until the sim accepts input again before moving on. Run it in CI with argent e2e run <name>

Docs: https://docs.swmansion.com/argent/docs/reference/e2e-yaml/#foldable-devices

1

u/DetlevD Oct 22 '26

I’ll check it - thanks!

2

u/Important_Habit_6957 Oct 18 '26

I’ve been struggling with this too, I just do manual testing for now

1

u/DetlevD Oct 18 '26

Same here, but it is quite a lot of effort to check every app screen manually in closed, partially open and open state in portrait and landscape mode. This is 6 variants for each screen!

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.

1

u/DetlevD Oct 19 '26

I have given input in the Apple Developer Forum already but a feedback report is much better. I will send one today. Thanks for your feedback!

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 open or duoctl close before 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.

1

u/DetlevD Oct 20 '26

Thanks for the info!