//Helper
class UITest: XCTestCase {
final func setInitalCredentials() {
print("\(app.textFields.count)") <-- prints (1)
let loginTextField = app.textFields["LoginTextField"] <-- is found
loginTextField.tap()
let deleteKey = app.keys["delete"]
let _ = deleteKey.waitForExistence(timeout: 2)
deleteKey.press(forDuration: 2)
loginTextField.typeText("login")
let passwordTextField = app.textFields["PasswordTextField"] <- is not
passwordTextField.tap()
let _ = deleteKey.waitForExistence(timeout: 2)
deleteKey.press(forDuration: 2)
passwordTextField.typeText("password")
}
var app: XCUIApplication!
override func setUp() {
super.setUp()
continueAfterFailure = false
app = XCUIApplication()
app.launch()
app.launchArguments.append("--uitesting")
}
override func tearDown() {
app.terminate()
super.tearDown()
app.launch()
}
}
//Actual test
class UILoginViewTest: UITest {
func testLogin() {
setInitalCredentials()
let loginButton = app.buttons["Connect"]
loginButton.tap()
let applicationRootView = app.otherElements["QuotesViewController"]
let _ = applicationRootView.waitForExistence(timeout: 10)
XCTAssert(applicationRootView.exists)
}
}
What am I missing? Why is second UITextField
not found? I am sure all IDs are set, I cannot even access it via placeholder or text, cause XCUIElementQuery
tells I have only 1 UITextField
.
app
has secureTextFields
, which contains any `UITextFields' with secure text entering.