Я делаю модульное тестирование пользовательского интерфейса. На картинке.
Это UILabels, за исключением длинного описания, которое представляет собой UITextView.
На странице я хочу проверить значение в ответе.
Для ответа в UILabels все в порядке. Я могу следовать примеру теста пользовательского интерфейса Xcode
Этот метод довольно прост, просто нажмите на элемент и изменить метод с .tap()
на .exist()
Затем заключите его в assert()
;
Моя проблема в том, что UITextView
сложнее, чем UILabel
.
Как я могу получить значение UITextView
, чтобы выполнить проверку утверждений?
func testG(){
let app = XCUIApplication()
app.launch();
app.buttons["Enter"].tap()
app.tables.staticTexts["Bee"].tap()
assert(app.scrollViews.staticTexts["Name :"].exists);
assert(app.scrollViews.staticTexts["Age :"].exists);
assert(app.scrollViews.staticTexts["Specialty :"].exists);
assert(app.scrollViews.staticTexts["Description :"].exists);
assert(app.scrollViews.staticTexts["Bee"].exists);
assert(app.scrollViews.staticTexts["11"].exists);
assert(app.scrollViews.staticTexts["Sky Diver"].exists);
let text = "Bees are flying insects closely related to wasps and ants, known for their role in pollination and, in the case of the best-known bee species, the European honey bee, for producing honey and beeswax. Bees are a monophyletic lineage within the superfamily Apoidea, presently considered as a clade Anthophila. There are nearly 20,000 known species of bees in seven to nine recognized families,[1] though many are undescribed and the actual number is probably higher. They are found on every continent except Antarctica, in every habitat on the planet that contains insect-pollinated flowering plants.EOF";
assert(app.scrollViews.childrenMatchingType(.TextView).element.exists);
}
value
? masilotti.com/xctest-documentation/Protocols/ а> - person dasdom   schedule 09.09.2015XCTAssertEqual(app.scrollViews.childrenMatchingType(.TextView).element.value as? String, text)
- person joe   schedule 09.09.2015