1

In our application, we have a hidden test screen in debug builds which allows us to manipulate the state of the application. For several UI tests (including a snapshot script), we need to access this test screen. This is done by triple tapping with two fingers anywhere on the screen.

extension XXXTestCase {
    /// Performs a hidden gesture which presents the testing screen.
    func navigateToTestingScreen(file: StaticString = #file, line: UInt = #line) {
        app.navigationBars
            .element
            .tap(withNumberOfTaps: 3, numberOfTouches: 2)
        testingScreen.assertExists(file: file, line: line)
    }
}

This worked fine in Xcode 9.2 (and 11.2 simulator), but Xcode 9.3 (11.3 simulator) gives the following runtime error on the .tap method:

No element found at point {5, 42} while computing gesture coordinates, internal error possibly due to orientation or remote view hosting.

I checked it wasn't anything with the XCUIElement itself by changing the tap to just .tap(), which does not produce any runtime errors. It seems XCTest on Xcode 9.3 has trouble with the multi-touch. How would I fix this?

Of course, the monkey approach would be to alter the gesture to access the testing screen, but I'm not giving up that easy :)

Additional experiments

+-------+-----------+--------+
| Xcode | Simulator | Result |
+-------+-----------+--------+
|  9.2  |   11.2    |    v   | <-- not an option when migrated to Swift 4.1
|  9.3  |   11.3    |    X   |
|  9.3  |   11.2    |    X   | *
|  9.3  |   11.1    |    X   | *
|  9.3  |   11.0.1  |    X   | *
|  9.3  |   10.3.1  |    v   | <-- not an option, iOS 10 status bar is styled noticeably different
+-------+-----------+--------+

* This combination crashes somewhere else, namely:

app.tabBars["main-tab-bar"].buttons["some-identifier"].tap() 

with the most useful phrase EXC_BAD_ACCESS. The element exists (and can be manipulated manually by clicking in the Simulator), but sending tap() to it raises the exception.

CloakedEddy
  • 1,965
  • 15
  • 27

0 Answers0