Skip to content

Instantly share code, notes, and snippets.

@sukhrobkhakimov
Created March 2, 2020 10:51
Show Gist options
  • Save sukhrobkhakimov/0e535a736f99b3a301b9bb1a926aef80 to your computer and use it in GitHub Desktop.
Save sukhrobkhakimov/0e535a736f99b3a301b9bb1a926aef80 to your computer and use it in GitHub Desktop.
import XCTest
// MARK: - Sign In
extension Accessibility.SignIn {
var element: XCUIElement {
let application = XCUIApplication() // This doesn't create a new instance every time but the existing instance is reused by XCTest framework automatically if there is one already.
let identifier = self.identifier
switch self {
case .emailTextField,
.passwordTextField:
return application.textFields[identifier].firstMatch
case .signInButton:
return application.buttons[identifier].firstMatch
}
}
}
// MARK: - Sign Up
extension Accessibility.SignUp {
var element: XCUIElement {
let application = XCUIApplication()
let identifier = self.identifier
switch self {
case .emailTextField,
.passwordTextField,
.confirmPasswordTextField:
return application.textFields[identifier].firstMatch
case .signUpButton:
return application.buttons[identifier].firstMatch
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment