简体   繁体   English

在 Fastlane 上运行时,`twoFingerTap()` 和 `tap(withNumberOfTaps:1 numberOfTouches:2)` 有什么区别?

[英]What's the difference between `twoFingerTap()` and `tap(withNumberOfTaps:1 numberOfTouches:2)` when running it on Fastlane?

I have been working with UI test on iOS, and using XCUITest on swift.我一直在 iOS 上进行 UI 测试,并在 swift 上使用 XCUITest。 In one test I need to tap with two fingers on the screen at the same time.在一项测试中,我需要同时用两根手指点击屏幕。 I used twoFingerTap() .我使用twoFingerTap() The test passes when I run it from Xcode.当我从 Xcode 运行它时,测试通过了。 But running by command line with fastlane it fails.但是使用 fastlane 通过命令行运行它失败了。 Then, a coworker suggested to change it to tap(withNumberOfTaps:1 numberOfTouches:2) , and it works when running on both ways.然后,一位同事建议将其更改为tap(withNumberOfTaps:1 numberOfTouches:2) ,并且在双向运行时都可以使用。 I have no idea why this different behavior from actions that should be doing the same thing.我不知道为什么这种不同的行为与应该做同样事情的行为不同。 Somebody knows?有人知道吗?

First attempt:第一次尝试:

appUnderTest.twoFingerTap() appUnderTest.twoFingerTap()

Second attempt:第二次尝试:

appUnderTest.tap(withNumberOfTaps: 1, numberOfTouches: 2) appUnderTest.tap(withNumberOfTaps: 1, numberOfTouches: 2)

Fastlane Command:快车道命令:

bundle exec fastlane scan --scheme "MyApp" --device "iPhone 13" --force_quit_simulator --prelaunch_simulator --reset_simulator bundle exec fastlane scan --scheme "MyApp" --device "iPhone 13" --force_quit_simulator --prelaunch_simulator --reset_simulator

twoFingerTap() does not tap twice, it simulates tapping with two fingers at the same time, I don't really understand how it works locally. twoFingerTap()不会敲击两次,它模拟了两个手指同时敲击,我不太明白它在本地是如何工作的。 To achieve what you want you need to use doubleTap() .要实现您想要的,您需要使用doubleTap() 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).这两种方法应该是等价的(在 Xcode 中,或者像 Fastlane 那样通过命令行运行模拟器时)。 I'd suggest filing a bug with Apple.我建议向Apple提交错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM