Skip to content

Commit

Permalink
Add expectation when checking email text field value
Browse files Browse the repository at this point in the history
  • Loading branch information
jotaemepereira committed Nov 19, 2024
1 parent 6520201 commit 0f1bfe6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion UITests/FireWindowTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,15 @@ class FireWindowTests: XCTestCase {
let coordinate = autoFillPopup.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
coordinate.tap()

XCTAssertEqual(emailTextFieldFire.value as? String, "[email protected]")
// Use an expectation to wait for the value to update
let expectedValue = "[email protected]"
let valuePredicate = NSPredicate(format: "value == %@", expectedValue)

let expectation = XCTNSPredicateExpectation(predicate: valuePredicate, object: emailTextFieldFire)

let result = XCTWaiter().wait(for: [expectation], timeout: UITests.Timeouts.elementExistence)
XCTAssertEqual(result, .completed, "The email text field value did not update as expected.")
XCTAssertEqual(emailTextFieldFire.value as? String, expectedValue)
}
}

Expand Down

0 comments on commit 0f1bfe6

Please sign in to comment.