Skip to content

Commit

Permalink
Basic coverage of the Apple Sign in Provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Supereg committed Oct 21, 2023
1 parent d744624 commit ca7aa3c
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions Tests/UITests/TestAppUITests/FirebaseAccountTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
}

Expand Down Expand Up @@ -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
}
}


Expand Down

0 comments on commit ca7aa3c

Please sign in to comment.