确定,
所以我正在运行一个UI测试,我在那里学习。在测试中有一段代码,我选择一个文本字段,点击"清除文字"按钮,输入一些文字然后点击"完成"在键盘上:
XCUIElement *textField = [app.tables.cells.textFields element];
XCTAssertTrue(textField.exists, "Text field couldn't be found");
// Clear the text field
[textField.buttons[@"Clear text"] tap];
XCTAssertTrue([textField.value length] == 0, @"The text field wasn't cleared.");
// Type in new data
[textField typeText:@"New Device"];
XCTAssertTrue([textField.value length] > 0, @"The text field is empty.");
NSString *textFieldValue = textField.value;
XCTAssertTrue([textFieldValue isEqualToString:@"New Device"], @"Strings do not equate.");
// Save
[app.keyboards.buttons[@"Done"] tap];
似乎这应该是一个简单的测试,但我遇到了一些问题:
由于Xcode中没有关于UI测试的大量文档,所以我已经知道了。任何帮助将不胜感激。