I've got a test like below:
let navnTextField = app.textFields["First Name"]
let name = "Henrik"
navnTextField.tap()
navnTextField.typeText("Henrik")
XCTAssertEqual(navnTextField.value as? String, name)
Problem is that by default my iPhone Simulator
has got Polish keyboard because of the system settings and "Henrik" is automatically changed into "ha" by autocorrect.
Simple solution is to remove Polish keyboard from the iOS Settings
. This solution however is not solving the problem because iPhone Simulator
can be reset and then test will fail again.
Is there any way to setup autocorrect before test case or other way to input text to text field.
There is a workaround to use UIPasteboard to provide input text:
let navnTextField = app.textFields["First name"]
navnTextField.tap()
UIPasteboard.generalPasteboard().string = "Henrik"
navnTextField.doubleTap()
app.menuItems.elementBoundByIndex(0).tap()
XCTAssertEqual(navnTextField.value as? String, name)
You can check link with description as a workaround for secure input in GM
Edit
For better readability instead app.menuItems.elementBoundByIndex(0).tap()
you can do app.menuItems["Paste"].tap()
.