Accessibiliy Tests part 2 (#4325)

* running all the tests

* setting up CI

* fixed the workflow

* workflow on pull request, just to make it appear

* removed the test to run var

* fix archived tests name

* improved the tests, by filtering out some noise

* pr suggestions and added an improvement to the filtering

* improved the interrupt handler

* improved the UI interruption monitor handler

* some more refinement to handle the interruptor + false positive for non human readable labels

* reverted wrong commit

* ready for review, removed the on pull request check

* pr suggestions
This commit is contained in:
Mauro
2025-07-18 10:33:45 +02:00
committed by GitHub
parent f655fbc28b
commit 27f078e83c
16 changed files with 1028 additions and 54 deletions
@@ -6,6 +6,7 @@
//
import Combine
import CoreLocation
import SwiftUI
class AccessibilityTestsAppCoordinator: AppCoordinatorProtocol {
@@ -53,6 +54,8 @@ class AccessibilityTestsAppCoordinator: AppCoordinatorProtocol {
previewsWrapper = .init(name: name, previews: previewType._allPreviews)
setupSignalling()
// Used to perform the request check before the tests run on CI, so it can be immediately dismissed.
CLLocationManager().requestWhenInUseAuthorization()
}
func toPresentable() -> AnyView {
@@ -143,7 +146,12 @@ struct PreviewsWrapperView: View {
switch fulfillmentSource {
case .publisher(let publisher):
_ = await publisher.values.first { $0 == true }
_ = await publisher
// Not sure whye byt some publisher seem to not properly comunicate their completion,
// so we added a timeout. Since we are going to migrate from publishers to stream,
// this is a temporary solution
.timeout(.seconds(1), scheduler: DispatchQueue.main)
.values.first { $0 == true }
case .stream(let stream):
_ = await stream.first { $0 == true }
case .none:
@@ -6,7 +6,6 @@
//
import Foundation
import MatrixRustSDK
// https://spec.matrix.org/latest/appendices/#identifier-grammar
enum MatrixEntityRegex: String {
@@ -9,9 +9,6 @@ import Foundation
enum PillUtilities {
static let atRoom = "@room"
static var everyone: String {
L10n.commonEveryone
}
/// Used by the WYSIWYG as the urlString value to identify @room mentions
static let composerAtRoomURLString = "#"
@@ -21,6 +21,9 @@ struct RoomHeaderView: View {
// https://github.com/element-hq/element-x-ios/issues/4180
// Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSLayoutConstraint constant is not finite!
content
} else if ProcessInfo.isRunningAccessibilityTests {
// Accessibility tests scale up the dynamic size in real time which may break the view
content
} else {
content
// Take up as much space as possible, with a leading alignment for use in the principal toolbar position
@@ -168,3 +168,9 @@ final class CompletionSuggestionService: CompletionSuggestionServiceProtocol {
return roomName.localizedStandardContains(searchText) || roomAlias.localizedStandardContains(searchText)
}
}
extension PillUtilities {
static var everyone: String {
L10n.commonEveryone
}
}
@@ -124,7 +124,8 @@ struct RoomScreen: View {
private var composer: some View {
if context.viewState.hasSuccessor {
tombstonedDialogue
} else if context.viewState.canSendMessage {
} else if context.viewState.canSendMessage, !ProcessInfo.isRunningAccessibilityTests {
// We are not sure why but when wrapped in the room screen the composer toolbar breaks the accessibility tests
composerToolbar
} else {
ComposerDisabledView()