I have been working with UI test on iOS, and using XCUITest on swift. In one test I need to tap with two fingers on the screen at the same time. I used twoFingerTap()
. The test passes when I run it from Xcode. But running by command line with fastlane it fails. Then, a coworker suggested to change it to tap(withNumberOfTaps:1 numberOfTouches:2)
, and it works when running on both ways. I have no idea why this different behavior from actions that should be doing the same thing. Somebody knows?
First attempt:
appUnderTest.twoFingerTap()
Second attempt:
appUnderTest.tap(withNumberOfTaps: 1, numberOfTouches: 2)
Fastlane Command:
bundle exec fastlane scan –scheme "MyApp" –device "iPhone 13" –force_quit_simulator –prelaunch_simulator –reset_simulator
2
Answers
twoFingerTap()
does not tap twice, it simulates tapping with two fingers at the same time, I don’t really understand how it works locally. To achieve what you want you need to usedoubleTap()
. Unless you meant that you actually want to do two-finger tap, in this case your question is not stated properly.These two methods should be equivalent (either in Xcode, or when running the simulator via the command line as Fastlane does). I’d suggest filing a bug with Apple.