Chapter 16: error with test testAddingTwoDigits()

When adding the test for adding two digits I get the following error, even when copying the code directly from the final example code.

Failed to get matching snapshot: No matches found for Elements matching predicate ‘“display” IN identifiers’ from input {(
StaticText, label: ‘8.0’

Here’s my code:

func testAddingTwoDigits() {
    let app = XCUIApplication()
    let threeButton = app.buttons["3"]
    let addButton = app.buttons["+"]
    let fiveButton = app.buttons["5"]
    let equalButton = app.buttons["="]
    let display = app.staticTexts["display"]
    let displayText = display.label
    XCTAssertEqual(displayText, "8.0")

Is the .accessibility(identifier: "display") modifier present for both the if an else statements at the start of the HStack in ContentView?

1 Like