UI Testing
XCUITest, introduced in iOS 9, is a technology for automating acceptance tests. It works by running your app in a separate process from the test, with the test communicating to the app using a form of IPC (Inter-Process-Communication). Elements are identified via accessibility IDs/values.
A pretty decent introduction/reminder of what all is involved.
Predicates
You can fetch a group of elements matching a predicate by calling element(matching:)
on any XCUIElementQuery. Most objects in XCUITest are XCUIElementQuery’s.
Anything that conforms to XCUIElementAttribute
can be queried as part of one of these queries.
Queries
- Finding text on a Cell
Honestly, I had more luck withapp.tables.cells.element(boundBy: 0).firstMatch.staticText[LABEL_ACCESSIBILITY_ID]
.
Dismissing a popover
Popover are dismissed by tapping… basically anywhere outside the popover. There’s a specific element to tap that’ll do this:
XCUIApplication().otherElements["PopoverDismissRegion"].tap()
Last updated: 2021-11-14 22:08:54 -0800