Skip to content

Commit

Permalink
Another attempt to fix UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mikenachbaur-okta committed Nov 23, 2023
1 parent e9d9396 commit 4cdc43d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Samples/DirectAuthSignIn/UITests/Pages/SignInScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,15 @@ class SignInScreen: Screen {
}

func login(username: String? = nil, factor: Factor, value: String? = nil) {
if let username = username {
if factorTypeButton.label != factor.rawValue {
factorTypeButton.tap()
app.buttons[factor.rawValue].tap()
}

if let username = username,
app.textFields.firstMatch.waitForExistence(timeout: .standard)
{
let field = app.textFields["username_field"]
_ = field.waitForExistence(timeout: .standard)
field.tap()

if let fieldValue = field.value as? String,
Expand All @@ -96,11 +102,6 @@ class SignInScreen: Screen {
field.typeText(username)
}

if factorTypeButton.label != factor.rawValue {
factorTypeButton.tap()
app.buttons[factor.rawValue].tap()
}

if let value = factor.value(from: value) {
var field = app.textFields[factor.accessibilityIdentifier]
if !field.exists {
Expand Down

0 comments on commit 4cdc43d

Please sign in to comment.