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      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

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.