Skip to content

Commit

Permalink
Make iOS smoke tests less flaky
Browse files Browse the repository at this point in the history
  • Loading branch information
Widcket committed Aug 25, 2023
1 parent 83e7bd3 commit 149172d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion auth0_flutter/example/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Auth0
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
if ProcessInfo.processInfo.arguments.contains("SmokeTests") {
if CommandLine.arguments.contains("--smoke-tests") {
self.window?.layer.speed = 0.0
UIView.setAnimationsEnabled(false)
}
Expand Down
15 changes: 13 additions & 2 deletions auth0_flutter/example/ios/UITests/SmokeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SmokeTests: XCTestCase {
override func setUp() {
continueAfterFailure = false
let app = XCUIApplication()
app.launchArguments = ["SmokeTests"]
app.launchArguments.append("--smoke-tests")
app.launchEnvironment = ProcessInfo.processInfo.environment
app.launch()
}
Expand Down Expand Up @@ -52,7 +52,18 @@ private extension SmokeTests {
func tap(button label: String) {
let button = XCUIApplication().buttons[label]
XCTAssertTrue(button.waitForExistence(timeout: timeout))
button.tap()
button.forceTap()
tapAlert()
}
}

extension XCUIElement {
func forceTap() {
if self.isHittable {
self.tap()
} else {
let coordinate = self.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
coordinate.tap()
}
}
}

0 comments on commit 149172d

Please sign in to comment.