Skip to content

Commit d4b134f

Browse files
committed
adding test for phone auth sign in
1 parent 16381c7 commit d4b134f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,33 @@ class AuthenticationExampleUITests: XCTestCase {
182182
)
183183
}
184184

185+
func testPhoneAuthLoginRCEInEnforceMode() {
186+
app.staticTexts["Phone Number"].tap()
187+
XCTAssertTrue(app.staticTexts["Sign in using Phone Auth"].waitForExistence(timeout: 3))
188+
let testPhone = "+12345678901"
189+
app.textFields["Enter Phone Number"].tap()
190+
app.textFields["Enter Phone Number"].typeText(testPhone)
191+
app.buttons["Send Verification Code"].tap()
192+
// Wait for the error message to appear (if there is an error)
193+
let errorAlert = app.alerts.staticTexts["Error"]
194+
let errorExists = errorAlert.waitForExistence(timeout: 5.0)
195+
XCTAssertFalse(errorExists, "Error")
196+
let verificationCodeInput = app.textFields["Enter verification code."]
197+
XCTAssertTrue(
198+
verificationCodeInput.waitForExistence(timeout: 2),
199+
"OTP input should appear."
200+
)
201+
verificationCodeInput.tap()
202+
let testVerificationCode = "123456"
203+
verificationCodeInput.typeText(testVerificationCode)
204+
app.buttons["Continue"].tap()
205+
// Sign out
206+
let signOutButton = app.buttons["Sign Out"]
207+
if signOutButton.exists {
208+
signOutButton.tap()
209+
}
210+
}
211+
185212
func DRAFT_testGoogleSignInAndLinkAccount() {
186213
let interruptionMonitor = addUIInterruptionMonitor(withDescription: "Sign in with Google") {
187214
alert -> Bool in

0 commit comments

Comments
 (0)