I've go a very simple calculator and I' trying to test whether a label gets updated when a button is tapped.
My test method looks like this:
let app = XCUIApplication()
app.buttons["9"].tap()
I can visually see the Label being updated but I'm not sure how to test it.
I think I need to use XCUIElementQuery
API to query label and then assert that the label text has changed. I'm just not sure how to do that.
I'm not sure about the following questions:
- Do I need to know what the value is for the label to be able to query?
- Is there a way of querying for the label without knowing what the value is when the application starts?
staticTexts
refer to the label text or could it refer to the button's text value? – Bravado