How to test that staticTexts contains a string using XCTest

You can use NSPredicate to filter elements. let searchText = “the content of the staticText” let predicate = NSPredicate(format: “label CONTAINS[c] %@”, searchText) let elementQuery = app.staticTexts.containing(predicate) if elementQuery.count > 0 { // the element exists } With CONTAINS[c] you specify that the search is case insensitive. Have a look at Apples Predicate Programming Guide

Xcode7 | Xcode UI Tests | How to handle location service alert?

Xcode 9 let springboard = XCUIApplication(bundleIdentifier: “com.apple.springboard”) let allowBtn = springboard.buttons[“Allow”] if allowBtn.exists { allowBtn.tap() } Xcode 8.3.3 _ = addUIInterruptionMonitor(withDescription: “Location Dialog”) { (alert) -> Bool in alert.buttons[“Allow”].tap() return true } app.buttons[“Request Location”].tap() app.tap() // need to interact with the app for the handler to fire Note that it is a bit different as … Read more

Error with XCTestExpectation: API violation – multiple calls made to -[XCTestExpectation fulfill]

XCTestExpectation Error API violation – multiple calls made to -[XCTestExpectation fulfill] I got the same error when set expectation.expectedFulfillmentCount. Solution: expectation.assertForOverFulfill = false If expectation.assertForOverFulfill = true and fulfill() is called when it is already fulfilled then it throws an exception

Ordering unit test using XCTest in Xcode 6

It’s all sorted alphabetically (classes and methods). So when You need some tests running last, just change the name of Class or Method (for (nasty) example by prefixing ‘z_’). So…You have Class names: MyAppTest1 -testMethodA -testMethodB MyAppTest2 -testMethodC -testMethodD and they run in this order. If you need to run MyAppTest1 as second, just rename … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)