mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Attempt to make the EncryptionSettings UI tests more resilient
The secure backup disabling sheet doesn't show up in the snapshots. No idea what the actual problem is though, completely unreproducible locally.
This commit is contained in:
committed by
Stefan Ceriu
parent
bc7ced11cb
commit
9ffb9a22e3
+12
-14
@@ -55,7 +55,7 @@ class SecureBackupScreenViewModel: SecureBackupScreenViewModelType, SecureBackup
|
||||
switch (keyBackupState, enable) {
|
||||
case (.unknown, true):
|
||||
state.bindings.keyStorageEnabled = keyBackupState.keyStorageToggleState // Reset the toggle in case enabling fails
|
||||
enableBackup()
|
||||
Task { await enableBackup() }
|
||||
case (.enabled, false):
|
||||
state.bindings.keyStorageEnabled = keyBackupState.keyStorageToggleState // Reset the toggle in case the user cancels
|
||||
actionsSubject.send(.disableKeyBackup)
|
||||
@@ -67,20 +67,18 @@ class SecureBackupScreenViewModel: SecureBackupScreenViewModelType, SecureBackup
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func enableBackup() {
|
||||
Task {
|
||||
let loadingIndicatorIdentifier = "SecureBackupScreenLoading"
|
||||
userIndicatorController.submitIndicator(.init(id: loadingIndicatorIdentifier, type: .modal, title: L10n.commonLoading, persistent: true))
|
||||
switch await secureBackupController.enable() {
|
||||
case .success:
|
||||
break
|
||||
case .failure(let error):
|
||||
MXLog.error("Failed enabling key backup with error: \(error)")
|
||||
state.bindings.alertInfo = .init(id: .init())
|
||||
}
|
||||
|
||||
userIndicatorController.retractIndicatorWithId(loadingIndicatorIdentifier)
|
||||
private func enableBackup() async {
|
||||
let loadingIndicatorIdentifier = "SecureBackupScreenLoading"
|
||||
userIndicatorController.submitIndicator(.init(id: loadingIndicatorIdentifier, type: .modal, title: L10n.commonLoading, persistent: true))
|
||||
switch await secureBackupController.enable() {
|
||||
case .success:
|
||||
break
|
||||
case .failure(let error):
|
||||
MXLog.error("Failed enabling key backup with error: \(error)")
|
||||
state.bindings.alertInfo = .init(id: .init())
|
||||
}
|
||||
|
||||
userIndicatorController.retractIndicatorWithId(loadingIndicatorIdentifier)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@ class EncryptionSettingsUITests: XCTestCase {
|
||||
// Broken by https://github.com/element-hq/compound-ios/pull/140
|
||||
app.switches[A11yIdentifiers.secureBackupScreen.keyStorage].switches.firstMatch.tap()
|
||||
|
||||
try await app.assertScreenshot(step: Step.keyBackupScreen)
|
||||
// Has been failing often on CI, reasons unclear.
|
||||
try await app.assertScreenshot(step: Step.keyBackupScreen, delay: .seconds(1))
|
||||
|
||||
// Confirm deletion of keys.
|
||||
app.buttons[A11yIdentifiers.secureBackupKeyBackupScreen.deleteKeyStorage].tap()
|
||||
|
||||
Reference in New Issue
Block a user