Skip to content

Commit ab557a1

Browse files
author
Teodor Ciuraru
committed
fix(swift): handle local network permission dialog in XCUITests
Add UIInterruptionMonitor to automatically tap 'Allow' on the local network permission dialog that appears when the app launches on BrowserStack devices.
1 parent 637fa6c commit ab557a1

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

swift/TasksUITests/TasksUITests.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,22 @@ final class TasksUITests: XCTestCase {
44

55
func testDidFindOnlyGitHubSeededDocument() throws {
66
let app = XCUIApplication()
7+
8+
// Handle permission dialogs that may appear
9+
addUIInterruptionMonitor(withDescription: "Local Network Permission") { alert in
10+
let allowButton = alert.buttons["Allow"]
11+
if allowButton.exists {
12+
allowButton.tap()
13+
return true
14+
}
15+
return false
16+
}
17+
718
app.launch()
819

20+
// Trigger the interruption monitor by interacting with the app
21+
app.tap()
22+
923
XCTAssertTrue(app.wait(for: .runningForeground, timeout: 30),
1024
"App should launch successfully")
1125

0 commit comments

Comments
 (0)