diff --git a/ElementX/Sources/Other/UserIndicator/UserIndicatorController.swift b/ElementX/Sources/Other/UserIndicator/UserIndicatorController.swift index 36c4e950f..0406feae0 100644 --- a/ElementX/Sources/Other/UserIndicator/UserIndicatorController.swift +++ b/ElementX/Sources/Other/UserIndicator/UserIndicatorController.swift @@ -42,7 +42,7 @@ class UserIndicatorController: ObservableObject, UserIndicatorControllerProtocol var window: UIWindow? { didSet { - let hostingController = UIHostingController(rootView: UserIndicatorPresenter(userIndicatorController: self)) + let hostingController = UIHostingController(rootView: UserIndicatorPresenter(userIndicatorController: self).statusBarHidden(ProcessInfo.isRunningUITests)) hostingController.view.backgroundColor = .clear window?.rootViewController = hostingController } diff --git a/ElementX/Sources/UITests/UITestsAppCoordinator.swift b/ElementX/Sources/UITests/UITestsAppCoordinator.swift index 05246ed16..b5b68a6a3 100644 --- a/ElementX/Sources/UITests/UITestsAppCoordinator.swift +++ b/ElementX/Sources/UITests/UITestsAppCoordinator.swift @@ -35,7 +35,7 @@ class UITestsAppCoordinator: AppCoordinatorProtocol, WindowManagerDelegate { windowManager.delegate = self - ServiceLocator.shared.register(userIndicatorController: UserIndicatorControllerMock.default) + ServiceLocator.shared.register(userIndicatorController: UserIndicatorController()) AppSettings.configureWithSuiteName("io.element.elementx.uitests") AppSettings.reset() @@ -63,8 +63,10 @@ class UITestsAppCoordinator: AppCoordinatorProtocol, WindowManagerDelegate { } func windowManagerDidConfigureWindows(_ windowManager: WindowManager) { - guard let screenID = ProcessInfo.testScreenID, screenID == .appLockFlow || screenID == .appLockFlowDisabled else { return } + ServiceLocator.shared.userIndicatorController.window = windowManager.overlayWindow + // Set up the alternate window for the App Lock flow coordinator tests. + guard let screenID = ProcessInfo.testScreenID, screenID == .appLockFlow || screenID == .appLockFlowDisabled else { return } let screen = MockScreen(id: screenID == .appLockFlow ? .appLockFlowAlternateWindow : .appLockFlowDisabledAlternateWindow, windowManager: windowManager) windowManager.alternateWindow.rootViewController = UIHostingController(rootView: screen.coordinator.toPresentable().statusBarHidden()) alternateWindowMockScreen = screen diff --git a/changelog.d/pr-2065.bugfix b/changelog.d/pr-2065.bugfix new file mode 100644 index 000000000..492b60b86 --- /dev/null +++ b/changelog.d/pr-2065.bugfix @@ -0,0 +1 @@ +Fix for the status bar being visible during UI tests. \ No newline at end of file