如何测试键盘布局(keyboardType)



我目前正在Xcode中探索新的UITest库,我想测试一下在点击UITextView时弹出的键盘是否具有适当的类型(在这种情况下应该是.PhonePad)。

我不认为这是可行的默认XCUIElementXCUIElementAttributes(这对我来说仍然有点模糊关于他们的实际意义),我真的不明白如何以及我应该扩展什么,以便能够测试这一点。

任何帮助都将非常感激!:)

下面的代码我是用来测试电话号码和密码验证检查。

let app = XCUIApplication()
let tablesQuery = app.tables
tablesQuery.cells.containingType(.StaticText, identifier:"Login Using").buttons["Icon mail"].tap()
tablesQuery.textFields["Phone Number"].tap()
tablesQuery.cells.containingType(.SecureTextField, identifier:"Password").childrenMatchingType(.TextField).element.typeText("ooo")
tablesQuery.staticTexts["Login Using"].swipeUp()
tablesQuery.secureTextFields["Password"].tap()
tablesQuery.cells.containingType(.Button, identifier:"Login").childrenMatchingType(.SecureTextField).element.typeText("eeee")
tablesQuery.buttons["Login"].tap()
app.alerts["Error"].collectionViews.buttons["OK"].pressForDuration(1.1);
我希望这对你有用。

最新更新