From d4b134fb03cfb747f2052e4fb61b571e978a3d00 Mon Sep 17 00:00:00 2001 From: Srushti Vaidya Date: Sat, 7 Dec 2024 00:12:53 +0530 Subject: [PATCH 01/10] adding test for phone auth sign in --- .../AuthenticationExampleUITests.swift | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift b/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift index ac8d7953ae3..6185ab481f6 100644 --- a/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift +++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift @@ -182,6 +182,33 @@ class AuthenticationExampleUITests: XCTestCase { ) } + func testPhoneAuthLoginRCEInEnforceMode() { + app.staticTexts["Phone Number"].tap() + XCTAssertTrue(app.staticTexts["Sign in using Phone Auth"].waitForExistence(timeout: 3)) + let testPhone = "+12345678901" + app.textFields["Enter Phone Number"].tap() + app.textFields["Enter Phone Number"].typeText(testPhone) + app.buttons["Send Verification Code"].tap() + // Wait for the error message to appear (if there is an error) + let errorAlert = app.alerts.staticTexts["Error"] + let errorExists = errorAlert.waitForExistence(timeout: 5.0) + XCTAssertFalse(errorExists, "Error") + let verificationCodeInput = app.textFields["Enter verification code."] + XCTAssertTrue( + verificationCodeInput.waitForExistence(timeout: 2), + "OTP input should appear." + ) + verificationCodeInput.tap() + let testVerificationCode = "123456" + verificationCodeInput.typeText(testVerificationCode) + app.buttons["Continue"].tap() + // Sign out + let signOutButton = app.buttons["Sign Out"] + if signOutButton.exists { + signOutButton.tap() + } + } + func DRAFT_testGoogleSignInAndLinkAccount() { let interruptionMonitor = addUIInterruptionMonitor(withDescription: "Sign in with Google") { alert -> Bool in From 7293176ff25bde79b2f1cf13eebfe1dddeb35079 Mon Sep 17 00:00:00 2001 From: Srushti Vaidya Date: Sat, 7 Dec 2024 00:45:30 +0530 Subject: [PATCH 02/10] adding test for phone auth incorrect number --- .../AuthenticationExampleUITests.swift | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift b/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift index 6185ab481f6..b4da11f0975 100644 --- a/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift +++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift @@ -185,13 +185,13 @@ class AuthenticationExampleUITests: XCTestCase { func testPhoneAuthLoginRCEInEnforceMode() { app.staticTexts["Phone Number"].tap() XCTAssertTrue(app.staticTexts["Sign in using Phone Auth"].waitForExistence(timeout: 3)) - let testPhone = "+12345678901" + let testPhone = "12345678901" app.textFields["Enter Phone Number"].tap() app.textFields["Enter Phone Number"].typeText(testPhone) app.buttons["Send Verification Code"].tap() // Wait for the error message to appear (if there is an error) let errorAlert = app.alerts.staticTexts["Error"] - let errorExists = errorAlert.waitForExistence(timeout: 5.0) + let errorExists = errorAlert.waitForExistence(timeout: 3.0) XCTAssertFalse(errorExists, "Error") let verificationCodeInput = app.textFields["Enter verification code."] XCTAssertTrue( @@ -209,6 +209,36 @@ class AuthenticationExampleUITests: XCTestCase { } } + func testPhoneAuthLoginRCEInEnforceModeIncorrectNumber() { + app.staticTexts["Phone Number"].tap() + XCTAssertTrue(app.staticTexts["Sign in using Phone Auth"].waitForExistence(timeout: 3)) + let testPhone = "1234567890" + app.textFields["Enter Phone Number"].tap() + app.textFields["Enter Phone Number"].typeText(testPhone) + app.buttons["Send Verification Code"].tap() + // Verify that the error dialog appears + let errorDialog = app.alerts["Error"] + XCTAssertTrue( + errorDialog.waitForExistence(timeout: 5), + "Error dialog should appear." + ) + let okButton = errorDialog.buttons["OK"] // Dismiss the error dialog + XCTAssertTrue(okButton.exists, "The 'OK' button should be present in the error dialog.") + okButton.tap() + // Ensure the dialog is dismissed + XCTAssertFalse(errorDialog.exists, "The error dialog should be dismissed after tapping 'OK'.") + // Go back and check that there is no user that is signed in + app.swipeDown(velocity: .fast) + // Go back and check that there is no user that is signed in + app.tabBars.firstMatch.buttons.element(boundBy: 1).tap() + wait(forElement: app.navigationBars["User"], timeout: 5.0) + XCTAssertEqual( + app.cells.count, + 0, + "The user shouldn't be signed in and the user view should have no cells." + ) + } + func DRAFT_testGoogleSignInAndLinkAccount() { let interruptionMonitor = addUIInterruptionMonitor(withDescription: "Sign in with Google") { alert -> Bool in From 28b3aa2209dabed2580d7f18ddcef50005885533 Mon Sep 17 00:00:00 2001 From: Srushti Vaidya Date: Mon, 9 Dec 2024 16:45:31 +0530 Subject: [PATCH 03/10] refactor code to pass failed check --- .../AuthenticationExampleUITests.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift b/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift index b4da11f0975..7b092239948 100644 --- a/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift +++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift @@ -189,10 +189,11 @@ class AuthenticationExampleUITests: XCTestCase { app.textFields["Enter Phone Number"].tap() app.textFields["Enter Phone Number"].typeText(testPhone) app.buttons["Send Verification Code"].tap() - // Wait for the error message to appear (if there is an error) - let errorAlert = app.alerts.staticTexts["Error"] - let errorExists = errorAlert.waitForExistence(timeout: 3.0) - XCTAssertFalse(errorExists, "Error") + let errorDialog = app.alerts["Error"] + XCTAssertFalse( + errorDialog.waitForExistence(timeout: 5), + "Error" + ) let verificationCodeInput = app.textFields["Enter verification code."] XCTAssertTrue( verificationCodeInput.waitForExistence(timeout: 2), From dd9d3a98387b69048a13036875c371c3283a1a2c Mon Sep 17 00:00:00 2001 From: Srushti Vaidya Date: Mon, 9 Dec 2024 17:26:34 +0530 Subject: [PATCH 04/10] updating rce in project file --- .../project.pbxproj | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj/project.pbxproj b/FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj/project.pbxproj index feb55512ba4..8ebcd591192 100644 --- a/FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj/project.pbxproj +++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj/project.pbxproj @@ -7,7 +7,8 @@ objects = { /* Begin PBXBuildFile section */ - 8848765129D314A400780FA6 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8848764F29D3149200780FA6 /* GoogleService-Info.plist */; }; + 8848765129D314A400780FA6 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8848764F29D3149200780FA6 /* GoogleService-Info.plist */; }; + B8431C7D2D0706DC0093ED41 /* RecaptchaEnterprise in Frameworks */ = {isa = PBXBuildFile; productRef = B8431C7C2D0706DC0093ED41 /* RecaptchaEnterprise */; }; DE8B636F2BEC2DC300607B82 /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = DE8B636E2BEC2DC300607B82 /* FirebaseAuth */; }; DE8B63722BEC2FB900607B82 /* GoogleSignIn in Frameworks */ = {isa = PBXBuildFile; productRef = DE8B63712BEC2FB900607B82 /* GoogleSignIn */; }; DE8B63742BEC2FB900607B82 /* GoogleSignInSwift in Frameworks */ = {isa = PBXBuildFile; productRef = DE8B63732BEC2FB900607B82 /* GoogleSignInSwift */; }; @@ -33,7 +34,6 @@ DEC2E5DF2A9583CA0090260A /* AppManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC2E5DE2A9583CA0090260A /* AppManager.swift */; }; DEC2E5E42A966DE20090260A /* GoogleService-Info_multi.plist in Resources */ = {isa = PBXBuildFile; fileRef = DEC2E5E32A966DE20090260A /* GoogleService-Info_multi.plist */; }; DED37F632AB0C4F7003A67E4 /* SettingsUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED37F622AB0C4F7003A67E4 /* SettingsUITests.swift */; }; - DEE261C52C21E9F500EECAC5 /* RecaptchaEnterprise in Frameworks */ = {isa = PBXBuildFile; productRef = DEE261C42C21E9F500EECAC5 /* RecaptchaEnterprise */; }; EA02F68524A000E00079D000 /* UserActions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA02F68424A000E00079D000 /* UserActions.swift */; }; EA02F68D24A063E90079D000 /* LoginDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA02F68C24A063E90079D000 /* LoginDelegate.swift */; }; EA062D5D24A0FEB6006714D3 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = EA062D5C24A0FEB6006714D3 /* README.md */; }; @@ -159,11 +159,11 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - DEE261C52C21E9F500EECAC5 /* RecaptchaEnterprise in Frameworks */, DE8B63772BEC302200607B82 /* FacebookLogin in Frameworks */, DE8B63742BEC2FB900607B82 /* GoogleSignInSwift in Frameworks */, DE8B636F2BEC2DC300607B82 /* FirebaseAuth in Frameworks */, DE8B63722BEC2FB900607B82 /* GoogleSignIn in Frameworks */, + B8431C7D2D0706DC0093ED41 /* RecaptchaEnterprise in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -393,7 +393,7 @@ DE8B63712BEC2FB900607B82 /* GoogleSignIn */, DE8B63732BEC2FB900607B82 /* GoogleSignInSwift */, DE8B63762BEC302200607B82 /* FacebookLogin */, - DEE261C42C21E9F500EECAC5 /* RecaptchaEnterprise */, + B8431C7C2D0706DC0093ED41 /* RecaptchaEnterprise */, ); productName = "Swifty Auth"; productReference = EAE4CBC124855E3A00245E92 /* AuthenticationExample.app */; @@ -481,6 +481,7 @@ DE8B63702BEC2FB900607B82 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */, DE8B63752BEC302200607B82 /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */, DE8B63782BEC342000607B82 /* XCRemoteSwiftPackageReference "gtm-session-fetcher" */, + B8431C7B2D0706DC0093ED41 /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */, ); productRefGroup = EAE4CBC224855E3A00245E92 /* Products */; projectDirPath = ""; @@ -978,6 +979,14 @@ /* End XCLocalSwiftPackageReference section */ /* Begin XCRemoteSwiftPackageReference section */ + B8431C7B2D0706DC0093ED41 /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/GoogleCloudPlatform/recaptcha-enterprise-mobile-sdk"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 18.6.0; + }; + }; DE8B63702BEC2FB900607B82 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/google/GoogleSignIn-iOS.git"; @@ -1005,6 +1014,11 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ + B8431C7C2D0706DC0093ED41 /* RecaptchaEnterprise */ = { + isa = XCSwiftPackageProductDependency; + package = B8431C7B2D0706DC0093ED41 /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */; + productName = RecaptchaEnterprise; + }; DE8B636E2BEC2DC300607B82 /* FirebaseAuth */ = { isa = XCSwiftPackageProductDependency; productName = FirebaseAuth; From f73d3216898b1266f7da6c27447843ce5c26125d Mon Sep 17 00:00:00 2001 From: Srushti Vaidya Date: Mon, 9 Dec 2024 18:23:10 +0530 Subject: [PATCH 05/10] updating project.pbxproj file --- .../project.pbxproj | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj/project.pbxproj b/FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj/project.pbxproj index 8ebcd591192..5ea19644c76 100644 --- a/FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj/project.pbxproj +++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj/project.pbxproj @@ -7,8 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 8848765129D314A400780FA6 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8848764F29D3149200780FA6 /* GoogleService-Info.plist */; }; - B8431C7D2D0706DC0093ED41 /* RecaptchaEnterprise in Frameworks */ = {isa = PBXBuildFile; productRef = B8431C7C2D0706DC0093ED41 /* RecaptchaEnterprise */; }; + 8848765129D314A400780FA6 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8848764F29D3149200780FA6 /* GoogleService-Info.plist */; }; DE8B636F2BEC2DC300607B82 /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = DE8B636E2BEC2DC300607B82 /* FirebaseAuth */; }; DE8B63722BEC2FB900607B82 /* GoogleSignIn in Frameworks */ = {isa = PBXBuildFile; productRef = DE8B63712BEC2FB900607B82 /* GoogleSignIn */; }; DE8B63742BEC2FB900607B82 /* GoogleSignInSwift in Frameworks */ = {isa = PBXBuildFile; productRef = DE8B63732BEC2FB900607B82 /* GoogleSignInSwift */; }; @@ -34,6 +33,7 @@ DEC2E5DF2A9583CA0090260A /* AppManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC2E5DE2A9583CA0090260A /* AppManager.swift */; }; DEC2E5E42A966DE20090260A /* GoogleService-Info_multi.plist in Resources */ = {isa = PBXBuildFile; fileRef = DEC2E5E32A966DE20090260A /* GoogleService-Info_multi.plist */; }; DED37F632AB0C4F7003A67E4 /* SettingsUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED37F622AB0C4F7003A67E4 /* SettingsUITests.swift */; }; + B899DE652D071E6200D3A83D /* RecaptchaEnterprise in Frameworks */ = {isa = PBXBuildFile; productRef = B899DE642D071E6200D3A83D /* RecaptchaEnterprise */; }; EA02F68524A000E00079D000 /* UserActions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA02F68424A000E00079D000 /* UserActions.swift */; }; EA02F68D24A063E90079D000 /* LoginDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA02F68C24A063E90079D000 /* LoginDelegate.swift */; }; EA062D5D24A0FEB6006714D3 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = EA062D5C24A0FEB6006714D3 /* README.md */; }; @@ -159,11 +159,11 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + B899DE652D071E6200D3A83D /* RecaptchaEnterprise in Frameworks */, DE8B63772BEC302200607B82 /* FacebookLogin in Frameworks */, DE8B63742BEC2FB900607B82 /* GoogleSignInSwift in Frameworks */, DE8B636F2BEC2DC300607B82 /* FirebaseAuth in Frameworks */, DE8B63722BEC2FB900607B82 /* GoogleSignIn in Frameworks */, - B8431C7D2D0706DC0093ED41 /* RecaptchaEnterprise in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -393,7 +393,7 @@ DE8B63712BEC2FB900607B82 /* GoogleSignIn */, DE8B63732BEC2FB900607B82 /* GoogleSignInSwift */, DE8B63762BEC302200607B82 /* FacebookLogin */, - B8431C7C2D0706DC0093ED41 /* RecaptchaEnterprise */, + B899DE642D071E6200D3A83D /* RecaptchaEnterprise */, ); productName = "Swifty Auth"; productReference = EAE4CBC124855E3A00245E92 /* AuthenticationExample.app */; @@ -481,7 +481,7 @@ DE8B63702BEC2FB900607B82 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */, DE8B63752BEC302200607B82 /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */, DE8B63782BEC342000607B82 /* XCRemoteSwiftPackageReference "gtm-session-fetcher" */, - B8431C7B2D0706DC0093ED41 /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */, + B899DE632D071E6200D3A83D /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */, ); productRefGroup = EAE4CBC224855E3A00245E92 /* Products */; projectDirPath = ""; @@ -979,7 +979,7 @@ /* End XCLocalSwiftPackageReference section */ /* Begin XCRemoteSwiftPackageReference section */ - B8431C7B2D0706DC0093ED41 /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */ = { + B899DE632D071E6200D3A83D /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/GoogleCloudPlatform/recaptcha-enterprise-mobile-sdk"; requirement = { @@ -1014,9 +1014,9 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ - B8431C7C2D0706DC0093ED41 /* RecaptchaEnterprise */ = { + B899DE642D071E6200D3A83D /* RecaptchaEnterprise */ = { isa = XCSwiftPackageProductDependency; - package = B8431C7B2D0706DC0093ED41 /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */; + package = B899DE632D071E6200D3A83D /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */; productName = RecaptchaEnterprise; }; DE8B636E2BEC2DC300607B82 /* FirebaseAuth */ = { From b173243a91bf34d14b81c01092383e73f6452b65 Mon Sep 17 00:00:00 2001 From: Srushti Vaidya Date: Tue, 10 Dec 2024 12:29:08 +0530 Subject: [PATCH 06/10] reverting back project.pbxproj file --- .../project.pbxproj | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj/project.pbxproj b/FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj/project.pbxproj index 5ea19644c76..feb55512ba4 100644 --- a/FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj/project.pbxproj +++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExample.xcodeproj/project.pbxproj @@ -33,7 +33,7 @@ DEC2E5DF2A9583CA0090260A /* AppManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC2E5DE2A9583CA0090260A /* AppManager.swift */; }; DEC2E5E42A966DE20090260A /* GoogleService-Info_multi.plist in Resources */ = {isa = PBXBuildFile; fileRef = DEC2E5E32A966DE20090260A /* GoogleService-Info_multi.plist */; }; DED37F632AB0C4F7003A67E4 /* SettingsUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED37F622AB0C4F7003A67E4 /* SettingsUITests.swift */; }; - B899DE652D071E6200D3A83D /* RecaptchaEnterprise in Frameworks */ = {isa = PBXBuildFile; productRef = B899DE642D071E6200D3A83D /* RecaptchaEnterprise */; }; + DEE261C52C21E9F500EECAC5 /* RecaptchaEnterprise in Frameworks */ = {isa = PBXBuildFile; productRef = DEE261C42C21E9F500EECAC5 /* RecaptchaEnterprise */; }; EA02F68524A000E00079D000 /* UserActions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA02F68424A000E00079D000 /* UserActions.swift */; }; EA02F68D24A063E90079D000 /* LoginDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA02F68C24A063E90079D000 /* LoginDelegate.swift */; }; EA062D5D24A0FEB6006714D3 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = EA062D5C24A0FEB6006714D3 /* README.md */; }; @@ -159,7 +159,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - B899DE652D071E6200D3A83D /* RecaptchaEnterprise in Frameworks */, + DEE261C52C21E9F500EECAC5 /* RecaptchaEnterprise in Frameworks */, DE8B63772BEC302200607B82 /* FacebookLogin in Frameworks */, DE8B63742BEC2FB900607B82 /* GoogleSignInSwift in Frameworks */, DE8B636F2BEC2DC300607B82 /* FirebaseAuth in Frameworks */, @@ -393,7 +393,7 @@ DE8B63712BEC2FB900607B82 /* GoogleSignIn */, DE8B63732BEC2FB900607B82 /* GoogleSignInSwift */, DE8B63762BEC302200607B82 /* FacebookLogin */, - B899DE642D071E6200D3A83D /* RecaptchaEnterprise */, + DEE261C42C21E9F500EECAC5 /* RecaptchaEnterprise */, ); productName = "Swifty Auth"; productReference = EAE4CBC124855E3A00245E92 /* AuthenticationExample.app */; @@ -481,7 +481,6 @@ DE8B63702BEC2FB900607B82 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */, DE8B63752BEC302200607B82 /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */, DE8B63782BEC342000607B82 /* XCRemoteSwiftPackageReference "gtm-session-fetcher" */, - B899DE632D071E6200D3A83D /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */, ); productRefGroup = EAE4CBC224855E3A00245E92 /* Products */; projectDirPath = ""; @@ -979,14 +978,6 @@ /* End XCLocalSwiftPackageReference section */ /* Begin XCRemoteSwiftPackageReference section */ - B899DE632D071E6200D3A83D /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/GoogleCloudPlatform/recaptcha-enterprise-mobile-sdk"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 18.6.0; - }; - }; DE8B63702BEC2FB900607B82 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/google/GoogleSignIn-iOS.git"; @@ -1014,11 +1005,6 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ - B899DE642D071E6200D3A83D /* RecaptchaEnterprise */ = { - isa = XCSwiftPackageProductDependency; - package = B899DE632D071E6200D3A83D /* XCRemoteSwiftPackageReference "recaptcha-enterprise-mobile-sdk" */; - productName = RecaptchaEnterprise; - }; DE8B636E2BEC2DC300607B82 /* FirebaseAuth */ = { isa = XCSwiftPackageProductDependency; productName = FirebaseAuth; From 75ad1123374d227650228f2b61a267aa34a6d4e8 Mon Sep 17 00:00:00 2001 From: Srushti Vaidya Date: Tue, 10 Dec 2024 16:07:54 +0530 Subject: [PATCH 07/10] check --- .../AuthenticationExampleUITests.swift | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift b/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift index 7b092239948..4ded9bc09d7 100644 --- a/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift +++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift @@ -183,31 +183,35 @@ class AuthenticationExampleUITests: XCTestCase { } func testPhoneAuthLoginRCEInEnforceMode() { - app.staticTexts["Phone Number"].tap() - XCTAssertTrue(app.staticTexts["Sign in using Phone Auth"].waitForExistence(timeout: 3)) - let testPhone = "12345678901" - app.textFields["Enter Phone Number"].tap() - app.textFields["Enter Phone Number"].typeText(testPhone) - app.buttons["Send Verification Code"].tap() - let errorDialog = app.alerts["Error"] - XCTAssertFalse( - errorDialog.waitForExistence(timeout: 5), - "Error" - ) - let verificationCodeInput = app.textFields["Enter verification code."] - XCTAssertTrue( - verificationCodeInput.waitForExistence(timeout: 2), - "OTP input should appear." - ) - verificationCodeInput.tap() - let testVerificationCode = "123456" - verificationCodeInput.typeText(testVerificationCode) - app.buttons["Continue"].tap() - // Sign out - let signOutButton = app.buttons["Sign Out"] - if signOutButton.exists { - signOutButton.tap() - } + #if os(iOS) + app.staticTexts["Phone Number"].tap() + XCTAssertTrue(app.staticTexts["Sign in using Phone Auth"].waitForExistence(timeout: 3)) + let testPhone = "12345678901" + app.textFields["Enter Phone Number"].tap() + app.textFields["Enter Phone Number"].typeText(testPhone) + app.buttons["Send Verification Code"].tap() + let errorDialog = app.alerts["Error"] + XCTAssertFalse( + errorDialog.waitForExistence(timeout: 5), + "Error" + ) + let verificationCodeInput = app.textFields["Enter verification code."] + XCTAssertTrue( + verificationCodeInput.waitForExistence(timeout: 2), + "OTP input should appear." + ) + verificationCodeInput.tap() + let testVerificationCode = "123456" + verificationCodeInput.typeText(testVerificationCode) + app.buttons["Continue"].tap() + // Sign out + let signOutButton = app.buttons["Sign Out"] + if signOutButton.exists { + signOutButton.tap() + } + #else + XCTFail("This test is only supported on iOS.") + #endif } func testPhoneAuthLoginRCEInEnforceModeIncorrectNumber() { From 98dcfb65c138fd10f46b85c8f7701cd27e2e68dd Mon Sep 17 00:00:00 2001 From: Srushti Vaidya Date: Wed, 11 Dec 2024 00:44:32 +0530 Subject: [PATCH 08/10] check2 --- .../AuthenticationExampleUITests.swift | 54 +++++++++---------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift b/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift index 4ded9bc09d7..7b092239948 100644 --- a/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift +++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift @@ -183,35 +183,31 @@ class AuthenticationExampleUITests: XCTestCase { } func testPhoneAuthLoginRCEInEnforceMode() { - #if os(iOS) - app.staticTexts["Phone Number"].tap() - XCTAssertTrue(app.staticTexts["Sign in using Phone Auth"].waitForExistence(timeout: 3)) - let testPhone = "12345678901" - app.textFields["Enter Phone Number"].tap() - app.textFields["Enter Phone Number"].typeText(testPhone) - app.buttons["Send Verification Code"].tap() - let errorDialog = app.alerts["Error"] - XCTAssertFalse( - errorDialog.waitForExistence(timeout: 5), - "Error" - ) - let verificationCodeInput = app.textFields["Enter verification code."] - XCTAssertTrue( - verificationCodeInput.waitForExistence(timeout: 2), - "OTP input should appear." - ) - verificationCodeInput.tap() - let testVerificationCode = "123456" - verificationCodeInput.typeText(testVerificationCode) - app.buttons["Continue"].tap() - // Sign out - let signOutButton = app.buttons["Sign Out"] - if signOutButton.exists { - signOutButton.tap() - } - #else - XCTFail("This test is only supported on iOS.") - #endif + app.staticTexts["Phone Number"].tap() + XCTAssertTrue(app.staticTexts["Sign in using Phone Auth"].waitForExistence(timeout: 3)) + let testPhone = "12345678901" + app.textFields["Enter Phone Number"].tap() + app.textFields["Enter Phone Number"].typeText(testPhone) + app.buttons["Send Verification Code"].tap() + let errorDialog = app.alerts["Error"] + XCTAssertFalse( + errorDialog.waitForExistence(timeout: 5), + "Error" + ) + let verificationCodeInput = app.textFields["Enter verification code."] + XCTAssertTrue( + verificationCodeInput.waitForExistence(timeout: 2), + "OTP input should appear." + ) + verificationCodeInput.tap() + let testVerificationCode = "123456" + verificationCodeInput.typeText(testVerificationCode) + app.buttons["Continue"].tap() + // Sign out + let signOutButton = app.buttons["Sign Out"] + if signOutButton.exists { + signOutButton.tap() + } } func testPhoneAuthLoginRCEInEnforceModeIncorrectNumber() { From 222f2d4e04b7a9f9a4c295cc3601499448f40a56 Mon Sep 17 00:00:00 2001 From: Srushti Vaidya Date: Wed, 11 Dec 2024 01:39:22 +0530 Subject: [PATCH 09/10] check3 --- .../AuthenticationExampleUITests.swift | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift b/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift index 7b092239948..0cf4a147dfa 100644 --- a/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift +++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift @@ -189,17 +189,7 @@ class AuthenticationExampleUITests: XCTestCase { app.textFields["Enter Phone Number"].tap() app.textFields["Enter Phone Number"].typeText(testPhone) app.buttons["Send Verification Code"].tap() - let errorDialog = app.alerts["Error"] - XCTAssertFalse( - errorDialog.waitForExistence(timeout: 5), - "Error" - ) let verificationCodeInput = app.textFields["Enter verification code."] - XCTAssertTrue( - verificationCodeInput.waitForExistence(timeout: 2), - "OTP input should appear." - ) - verificationCodeInput.tap() let testVerificationCode = "123456" verificationCodeInput.typeText(testVerificationCode) app.buttons["Continue"].tap() From ea201336d596bb8d9cb46573631ca4ea12692a3e Mon Sep 17 00:00:00 2001 From: Srushti Vaidya Date: Wed, 11 Dec 2024 02:16:07 +0530 Subject: [PATCH 10/10] check4 --- .../AuthenticationExampleUITests.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift b/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift index 0cf4a147dfa..a00dc125b74 100644 --- a/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift +++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExampleUITests/AuthenticationExampleUITests.swift @@ -190,6 +190,8 @@ class AuthenticationExampleUITests: XCTestCase { app.textFields["Enter Phone Number"].typeText(testPhone) app.buttons["Send Verification Code"].tap() let verificationCodeInput = app.textFields["Enter verification code."] + let exists = verificationCodeInput.waitForExistence(timeout: 10) + XCTAssertTrue(exists, "Verification code field does not exist") let testVerificationCode = "123456" verificationCodeInput.typeText(testVerificationCode) app.buttons["Continue"].tap()