Xcode ui test - m1 swipe problem

On an intel mac, my XCUITest test cases which is included swipe actions works perfectly but it doesn't work on my m1 mac. I tried running simulator with Rosetta but it doesnt work out it still gives an error when I run my cases because it clicks instead of swipe.

Does anyone have a solution for swiping problem on the m1?

Replies

Hello!

Do you have a sample code you are running to reproduce this error? We would love to help you find a solution here, or dive deeper if there is an issue.

Thanks.

 cells.element(boundBy: 0).swipeLeft()

@DeveloperToolsEngineer

I'm not sure, if it's the same problem or not, but I also faced problems with failing swipes in UI tests (in iOS simulator): at least in certain cases (like swipeLeft() to reveal the standard "accessory menu" on a table row), they behave like clicks. I was able to pinpoint it to running x86_64 build of UI tests on M1 (adding ARCHS=x86_64 to xcodebuild arguments). With the very same native build on M1, swipes in UI tests behave as expected.

Just in case, I'm reproducing it on Xcode 13.4.1 and iOS simulator for iPhone 8 running iOS 15.2. Will check most recent iOS 15.5 a bit later.

  • Tried it on Xcode 14.3.1 and an M2, still have failures on my tests that use swipeLeft()

  • I am also facing the same issue with 14.3.1, when we try swipeLeft(), it actually clicks instead of swipe

Add a Comment

I am having the same issue as described by @grigorye on Xcode 14 Beta 6, in iOS Simulator. Running a M1 MacBook Pro with Monterey 12.5.1. Note: running Xcode via Rosetta at the moment. The swipe left gesture on a fairly standard table view cell to reveal the accessory menu fails and behaves as a click when calling element(...).swipeLeft()

I don’t have any input about this issue in general, sorry, but I want to stress that this:

running Xcode via Rosetta at the moment.

is not a supported configuration. If you run Xcode under Rosetta you will encounter all sorts of weird problems, so I recommend that you rule out that as a possibility first. You can do that by:

  1. Running Xcode natively.

  2. If your main project doesn’t compile like that, create a small test project that exercises this case.

  3. Does that still reproduce the problem?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • I am having pretty much the same issue on an M2 Mac running Xcode 14.3.1 with Xcode running native (no more Rosetta option) - but the simulators still use (Rosetta (not sure why))

    swipeLeft() is not swiping left enough.

Add a Comment

After loads of investigation, I managed to find out what the cause of the issue was for our project. It worked locally (running through Xcode itself) but for our CI machines it didn't (which is where we use CLI). But basically we were building our UI test bundle on the x86_64 architecture and excluding arm64. You need arm64 (which would make sense) for the M1 Simulators to swipe correctly. This small removal solved all of our problems and the UI tests work as they should. Check your Build Settings in your project.

# Before
xcodebuild build-for-testing -workspace ProjectName/ProjectName.xcworkspace ........ EXCLUDED_ARCHS=arm64

# After
xcodebuild build-for-testing -workspace ProjectName/ProjectName.xcworkspace ........

Some solutions online will tell you to run the simulator in Rosetta - don't, it doesn't solve the issue.