From ca7aa3c040890041a6afc8a23b574b4f25182530 Mon Sep 17 00:00:00 2001 From: Andreas Bauer Date: Fri, 20 Oct 2023 21:48:19 -0700 Subject: [PATCH] Basic coverage of the Apple Sign in Provider --- .../TestAppUITests/FirebaseAccountTests.swift | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/Tests/UITests/TestAppUITests/FirebaseAccountTests.swift b/Tests/UITests/TestAppUITests/FirebaseAccountTests.swift index ff00421..154706a 100644 --- a/Tests/UITests/TestAppUITests/FirebaseAccountTests.swift +++ b/Tests/UITests/TestAppUITests/FirebaseAccountTests.swift @@ -63,7 +63,7 @@ final class FirebaseAccountTests: XCTestCase { XCTAssert(app.buttons["Logout"].waitForExistence(timeout: 10.0)) app.buttons["Logout"].tap() } - + @MainActor func testAccountLogin() async throws { @@ -86,7 +86,7 @@ final class FirebaseAccountTests: XCTestCase { XCTAssert(app.buttons["FirebaseAccount"].waitForExistence(timeout: 10.0)) app.buttons["FirebaseAccount"].tap() - if app.buttons["Logout"].waitForExistence(timeout: 10.0) && app.buttons["Logout"].isHittable { + if app.buttons["Logout"].waitForExistence(timeout: 3.0) && app.buttons["Logout"].isHittable { app.buttons["Logout"].tap() } @@ -352,6 +352,33 @@ final class FirebaseAccountTests: XCTestCase { XCTAssertTrue(app.alerts["Invalid Credentials"].waitForExistence(timeout: 6.0)) app.alerts["Invalid Credentials"].scrollViews.otherElements.buttons["OK"].tap() } + + @MainActor + func testBasicSignInWithApple() async throws { + let app = XCUIApplication() + app.launchArguments = ["--firebaseAccount"] + app.launch() + + XCTAssert(app.buttons["FirebaseAccount"].waitForExistence(timeout: 10.0)) + app.buttons["FirebaseAccount"].tap() + + if app.buttons["Logout"].waitForExistence(timeout: 3.0) && app.buttons["Logout"].isHittable { + app.buttons["Logout"].tap() + } + + app.buttons["Account Setup"].tap() + + addUIInterruptionMonitor(withDescription: "Apple Sign In") { element in + // there will be a dialog that you have to sign in with your apple id. We just close it. + element.buttons["Close"].tap() + return true + } + + XCTAssertTrue(app.buttons["Sign in with Apple"].waitForExistence(timeout: 2.0)) + app.buttons["Sign in with Apple"].tap() + + app.tap() // that triggers the interruption monitor closure + } }