mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
fix for flaky tests caused by location sharing blocking execution on CI
This commit is contained in:
@@ -17,17 +17,8 @@ final class AccessibilityTests: XCTestCase {
|
|||||||
await client.waitForApp()
|
await client.waitForApp()
|
||||||
defer { try? client.stop() }
|
defer { try? client.stop() }
|
||||||
|
|
||||||
// To handle system interrupts
|
// To handle location sharing popup
|
||||||
_ = addUIInterruptionMonitor(withDescription: "Location access alert handler") { alert in
|
allowLocationPermissions()
|
||||||
let alwaysAllowButton = alert.buttons["Allow While Using App"]
|
|
||||||
if alwaysAllowButton.exists {
|
|
||||||
alwaysAllowButton.tap()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
// This interaction is needed to have the UIInterruptionMonitor work properly.
|
|
||||||
app.tap()
|
|
||||||
|
|
||||||
try client.send(.accessibilityAudit(.nextPreview))
|
try client.send(.accessibilityAudit(.nextPreview))
|
||||||
forLoop: for await signal in client.signals.values {
|
forLoop: for await signal in client.signals.values {
|
||||||
@@ -50,6 +41,14 @@ final class AccessibilityTests: XCTestCase {
|
|||||||
app.terminate()
|
app.terminate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func allowLocationPermissions() {
|
||||||
|
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
|
||||||
|
let notificationAlertAllowButton = springboard.buttons["Allow While Using App"].firstMatch
|
||||||
|
if notificationAlertAllowButton.waitForExistence(timeout: 10.0) {
|
||||||
|
notificationAlertAllowButton.tap()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func performAccessibilityAuditForPreview(named name: String) {
|
private func performAccessibilityAuditForPreview(named name: String) {
|
||||||
// Alows us to log the name of the preview that is being tested
|
// Alows us to log the name of the preview that is being tested
|
||||||
XCTContext.runActivity(named: name) { _ in
|
XCTContext.runActivity(named: name) { _ in
|
||||||
|
|||||||
Reference in New Issue
Block a user