My background is QA automation, mostly mobile and mostly Appium. When I decided to learn native iOS UI testing properly, XCUITest looked like the obvious choice: it's Apple's own framework, it needs no automation server, and it works with the accessibility hierarchy directly. Then a simple login turned into this:
let email = app . textFields [ "login.email" ] XCTAssertTrue ( email . waitForExistence ( timeout : 10 ), "Email field did not appear" ) email . tap () email . typeText ( "[email protected]" )
let loginButton = app . buttons [ "login.submit" ] XCTAssertTrue ( loginButton . waitForExistence ( timeout : 10 ), "Login button did not appear" ) loginButton . tap ()
Enter fullscreen mode
Exit fullscreen mode
XCUITest gives you primitives and leaves waiting, retries, screen objects and reporting to you. In most projects I've seen, that gap gets filled by a waitAndTap() extension, then a few more, until there's a small framework that nobody tests.β¦