Skip to content

Commit

Permalink
Fix problem with nil username or password in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mikenachbaur-okta committed Nov 23, 2023
1 parent b6b0e5d commit 881bb56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ commands:
name: "Compress test results"
when: always
command: |
if [[ -d "~/TestResults/<<parameters.scheme>>.xcresult" ]]; then
(
cd ~/TestResults
zip -r "<<parameters.scheme>>.zip" "<<parameters.scheme>>.xcresult"
rm -rf "<<parameters.scheme>>.xcresult"
)
fi
jobs:
setup:
Expand Down
12 changes: 6 additions & 6 deletions Samples/Shared/Common/Testing/Screen+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ extension WebLogin where Self: Screen {
}

func send(username: String? = nil) {
if let username = username,
app.webViews.textFields.firstMatch.waitForExistence(timeout: .veryLong)
{
guard let username else { return }

if app.webViews.textFields.firstMatch.waitForExistence(timeout: .veryLong) {
let field = app.webViews.textFields.element(boundBy: 0)
field.tap()

Expand Down Expand Up @@ -97,13 +97,13 @@ extension WebLogin where Self: Screen {
}

func send(password: String? = nil) {
guard let password else { return }

if app.webViews.staticTexts["Select from the following options"].waitToBeHittable(timeout: .standard) {
select(authenticator: "Password")
}

if let password = password,
app.webViews.secureTextFields.firstMatch.waitForExistence(timeout: 5)
{
if app.webViews.secureTextFields.firstMatch.waitForExistence(timeout: 5) {
let field = app.webViews.secureTextFields.element(boundBy: 0)
field.tap()
field.typeText(password)
Expand Down

0 comments on commit 881bb56

Please sign in to comment.