UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Testing problems for Portfolio App

Forums > SwiftUI

I encountered my first failed test on the app thus far.

func testingEditingProjectUpdates() {
    app.buttons["Open"].tap()
    XCTAssertEqual(app.tables.cells.count, 0, "Should be no list rows")

    app.buttons["add"].tap()
    XCTAssertEqual(app.tables.cells.count, 1, "Should be 1 list rows")

    app.buttons["NEW PROJECT"].tap()
    app.textFields["Project name"].tap()

    app.keys["space"].tap()
    app.keys["more"].tap()
    app.keys["2"].tap()
    app.buttons["Return"].tap()

    app.buttons["Open Projects"].tap()
    XCTAssertTrue(app.buttons["NEW PROJECT 2"].exists, "This should be here")
}

}

I get this failure at the app.keys["space"].tap()

Failed to get matching snapshot: No matches found for Descendants matching type Key from input

I have experimented with different settings on the simulator to see if the keyboard would be effected, but to no avail.

Any ideas?

Thanks

4      

Run the App normal and then do the step EG create a new project and then tap in the textfield and if the keyboard do not show in simultor do Cmd-K to bring up the keyboard.

I am getting the same with the "Return" but comment out and test passes

7      

Thanks NigelGee, that seemed to do the trick.

3      

@cymr0  

I had the same issue, posting in case anybody else is struggling.

In the simulator, Menu, I/O Keyboard, and turn off Connect Hardware Keyboard.

All worked for me then - thanks for pointing me in the right direction.

3      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

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

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.