vendredi 19 mars 2021

How can I insert a textfield when running tests in swift?

I have this test:

func testLogin() throws {
        viewController.email.insertText("email@outlook.com")
        viewController.password.insertText("secret")
        viewController.btnLogin?.sendActions(for: .touchDown)
        XCTAssert(viewController.loggedIn == true)
    }

But it gives me this error on the first line when I try to insert the email

Unexpectedly found nil while implicitly unwrapping an Optional value

How can I get this test to work?

Aucun commentaire:

Enregistrer un commentaire