FREE TRIAL: Accelerate your app development career with Hacking with Swift+! >>

Ultimate Portfolio App - Error in UI Test - Cannot recognize the "NEW PROJECT" Edit Button

Forums > SwiftUI

My UI Test code:

func testEditingProjectUpdatesCorrectly() {
        app.buttons["Open"].tap()
        XCTAssertEqual(app.tables.cells.count, 0, "There should be no list rows initially.")

        app.buttons["Add Project"].tap()
        XCTAssertEqual(app.tables.cells.count, 1, "There should be 1 list row after adding a project.")

        app.buttons["NEW PROJECT"].tap()  **<<<---See Error details directly below this code **
        app.textFields["Project name"].tap()

        app.keys["space"].tap()
        app.keys["more"].tap() // more = 123 "key"
        app.keys["2"].tap()
        app.buttons["Return"].tap() // Return is a "button"...not a "key"

        app.buttons["Open Projects"].tap()
        XCTAssertTrue(app.buttons["New Project 2"].exists, "The new project name should be visible in the list.")
    }

ERROR: Failed to get matching snapshot: No matches found for Elements matching predicate '"NEW PROJECT" IN identifiers' from input {( Button, label: 'Home', Button, label: 'Open', Selected, Button, label: 'Closed', Button, label: 'Awards', Button, label: 'Sort', Button, label: 'Add Project', Button, label: 'Add New Item', Button, label: 'Compose' )}

I assume since the only button I cannot identify is [label: 'Compose'] that this must be the issue? This is likely the "Edit Project" button. I tried using "Compose" in place of "NEW PROJECT" but that did not work either. I tried it as both a button and a label.

My UI definitely has the words "NEW PROJECT" along with the "square.and.pencil" image to the right of the project name. Any ideas?

Thanks in advance!

Brad K.

   

Or is this possibly a bug in Xcode Version 13.0 beta 4 (13A5201i) using Build Setting of iOS 14.7 running on Big Sur 11.4?

   

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for iOS devs who want to become complete senior developers — from October 18th to 24th. Learn how to apply iOS app architecture patterns through a series of lectures and practical coding sessions.

Learn more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.