Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created April 2, 2020 18:13
Show Gist options
  • Save azamsharp/5ca6eacc25cd56ed422c9435852b327b to your computer and use it in GitHub Desktop.
Save azamsharp/5ca6eacc25cd56ed422c9435852b327b to your computer and use it in GitHub Desktop.
//ContentView:
NavigationLink(destination: LoginView().accessibility(identifier: "loginView"), isActive: self.$registrationVM.showLoginView) {
EmptyView()
}
// Test
func test_should_register_successfully() {
let usernameTextField = self.app.textFields["usernameTextField"]
usernameTextField.tap()
usernameTextField.typeText("johndoe")
let passwordTextField = self.app.secureTextFields["passwordTextField"]
passwordTextField.tap()
passwordTextField.typeText("password123\n")
let registerButton = self.app.buttons["registerButton"]
registerButton.tap()
let loginView = self.app.staticTexts["loginView"]
let loginViewExists = loginView.waitForExistence(timeout: 5.0)
XCTAssertTrue(loginViewExists)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment