mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Encryption Flow Coordinators. (#3471)
* Manage the secure backup screens with flow coordinators.
* Add UI tests for the EncryptionSettingsFlowCoordinator.
* Realise that the settings flow can't reset anymore and remove the sub-flow 🤦♂️
* Add UI tests for the EncryptionResetFlowCoordinator.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Copyright 2024 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
// Please see LICENSE in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class EncryptionResetUITests: XCTestCase {
|
||||
var app: XCUIApplication!
|
||||
|
||||
@MainActor enum Step {
|
||||
static let resetScreen = 0
|
||||
static let passwordScreen = 1
|
||||
static let resetingEncryption = 2
|
||||
}
|
||||
|
||||
func testPasswordFlow() async throws {
|
||||
app = Application.launch(.encryptionReset)
|
||||
|
||||
// Starting with the root screen.
|
||||
try await app.assertScreenshot(.encryptionReset, step: Step.resetScreen)
|
||||
|
||||
// Confirm the intent to reset.
|
||||
app.buttons[A11yIdentifiers.encryptionResetScreen.continueReset].tap()
|
||||
app.buttons[A11yIdentifiers.alertInfo.primaryButton].tap()
|
||||
try await app.assertScreenshot(.encryptionReset, step: Step.passwordScreen)
|
||||
|
||||
// Enter the password and submit.
|
||||
let passwordField = app.secureTextFields[A11yIdentifiers.encryptionResetPasswordScreen.passwordField]
|
||||
passwordField.clearAndTypeText("supersecurepassword", app: app)
|
||||
app.buttons[A11yIdentifiers.encryptionResetPasswordScreen.submit].tap()
|
||||
try await app.assertScreenshot(.encryptionReset, step: Step.resetingEncryption)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// Copyright 2024 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
// Please see LICENSE in the repository root for full details.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@MainActor
|
||||
class EncryptionSettingsUITests: XCTestCase {
|
||||
var app: XCUIApplication!
|
||||
|
||||
@MainActor enum Step {
|
||||
static let secureBackupScreenSetUp = 0
|
||||
static let keyBackupScreen = 1
|
||||
static let secureBackupScreenDisabled = 2
|
||||
static let setUpRecovery = 3
|
||||
static let changeRecovery = 4
|
||||
|
||||
static let secureBackupScreenOutOfSync = 5
|
||||
static let confirmRecovery = 6
|
||||
}
|
||||
|
||||
func testFlow() async throws {
|
||||
app = Application.launch(.encryptionSettings)
|
||||
|
||||
// Starting with key storage and recovery enabled.
|
||||
try await app.assertScreenshot(.encryptionSettings, step: Step.secureBackupScreenSetUp)
|
||||
|
||||
// Toggle key storage off.
|
||||
app.switches[A11yIdentifiers.secureBackupScreen.keyStorage].tap()
|
||||
try await app.assertScreenshot(.encryptionSettings, step: Step.keyBackupScreen)
|
||||
|
||||
// Confirm deletion of keys.
|
||||
app.buttons[A11yIdentifiers.secureBackupKeyBackupScreen.deleteKeyStorage].tap()
|
||||
app.buttons[A11yIdentifiers.alertInfo.primaryButton].tap()
|
||||
try await app.assertScreenshot(.encryptionSettings, step: Step.secureBackupScreenDisabled)
|
||||
|
||||
// Toggle key storage back on and set up recovery.
|
||||
app.switches[A11yIdentifiers.secureBackupScreen.keyStorage].tap()
|
||||
app.buttons[A11yIdentifiers.secureBackupScreen.recoveryKey].tap()
|
||||
try await app.assertScreenshot(.encryptionSettings, step: Step.setUpRecovery)
|
||||
|
||||
// Generate and copy a new recovery key.
|
||||
app.buttons[A11yIdentifiers.secureBackupRecoveryKeyScreen.generateRecoveryKey].tap()
|
||||
app.buttons[A11yIdentifiers.secureBackupRecoveryKeyScreen.copyRecoveryKey].tap()
|
||||
app.buttons[A11yIdentifiers.secureBackupRecoveryKeyScreen.done].tap()
|
||||
app.buttons[A11yIdentifiers.alertInfo.primaryButton].tap()
|
||||
try await app.assertScreenshot(.encryptionSettings, step: Step.secureBackupScreenSetUp)
|
||||
|
||||
// Change the recovery key.
|
||||
app.buttons[A11yIdentifiers.secureBackupScreen.recoveryKey].tap()
|
||||
try await app.assertScreenshot(.encryptionSettings, step: Step.changeRecovery)
|
||||
|
||||
// Generate and copy the updated recovery key.
|
||||
app.buttons[A11yIdentifiers.secureBackupRecoveryKeyScreen.generateRecoveryKey].tap()
|
||||
app.buttons[A11yIdentifiers.secureBackupRecoveryKeyScreen.copyRecoveryKey].tap()
|
||||
app.buttons[A11yIdentifiers.secureBackupRecoveryKeyScreen.done].tap()
|
||||
app.buttons[A11yIdentifiers.alertInfo.primaryButton].tap()
|
||||
try await app.assertScreenshot(.encryptionSettings, step: Step.secureBackupScreenSetUp)
|
||||
}
|
||||
|
||||
func testOutOfSyncFlow() async throws {
|
||||
app = Application.launch(.encryptionSettingsOutOfSync)
|
||||
|
||||
// Starting with key storage and recovery enabled.
|
||||
try await app.assertScreenshot(.encryptionSettings, step: Step.secureBackupScreenOutOfSync)
|
||||
|
||||
// Confirm the recovery key.
|
||||
app.buttons[A11yIdentifiers.secureBackupScreen.recoveryKey].tap()
|
||||
try await app.assertScreenshot(.encryptionSettings, step: Step.confirmRecovery)
|
||||
|
||||
// Enter the recovery key and submit.
|
||||
let recoveryKeyField = app.secureTextFields[A11yIdentifiers.secureBackupRecoveryKeyScreen.recoveryKeyField]
|
||||
recoveryKeyField.clearAndTypeText("sUpe RSec rEtR Ecov ERYk Ey12", app: app)
|
||||
app.buttons[A11yIdentifiers.secureBackupRecoveryKeyScreen.confirm].tap()
|
||||
try await app.assertScreenshot(.encryptionSettings, step: Step.secureBackupScreenSetUp)
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:83ebdd64a97d8cef02516cb5be9d5191077c8b3be41252e828a4b83d45004b6e
|
||||
size 133247
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e9dfc381ac69b5e415c4bdf05175ceb6df08cec2db54f3f4b02172eda1f6dd64
|
||||
size 162470
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9720f0cd45534c9699eef06f8a2afd1504d5b51a8773b2b76585002b23d67b77
|
||||
size 92574
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7170468705d17c9ba1c6062524d2ccc4cbbd54fd45f1056e53921b20fb6756f9
|
||||
size 98637
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:26acd80deba0bdd9babf133b0b015b6f21942fa02983b921da28925a92573f8e
|
||||
size 140798
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3618590fa6e84095976811f53bc283123654470c9aa15babfaec79cc16f19e88
|
||||
size 177016
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:28d3ae3eb6b7ed45c41e1381c052a080906ff767aad74562e09b34b432ba1f06
|
||||
size 119892
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9c7753ecb9a032c14ac1b53ec94dfaf055da89c3d053b0dd095b15b291129730
|
||||
size 141912
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:46a5294fe4bf36583b6a7f58602e2ea00761e6027d74e9c982a99f912bf28c26
|
||||
size 232922
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a6dc3f0216fa3281196281e997a5cceba862c8427ad352674b860b9d6c16ca02
|
||||
size 157003
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3fbf90b3889e39f75abb39bd5e92ec60dfe18968c85b5ba9c56addf0c4579e6d
|
||||
size 103188
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d9f4752e15127fd336156f09cd998b96931b1a04f85b3ada3c1cd043d2461195
|
||||
size 116493
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9690d135c26b3bef7c9e1ecd25fe5a45605bf1838f5f3d22f34ef4cc47cf59dc
|
||||
size 211322
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a3f5e7ccbc806ce6ef88e465be9bb879ef31fd3675822368c93126d66563e07b
|
||||
size 121844
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1bfdba161a6e974df12efd09a48cd905d8162c828c2e6af99eaed74a8631891b
|
||||
size 210352
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:db98e2b1dc6dc2c4f55aa46e783366c69e5ff4521cd0179be0028f47f0387688
|
||||
size 119868
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:59b95216f4ee18fa2b5c35fa237caf58ac7a976ef70c2a52c6a95ada9966c9c1
|
||||
size 76515
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:745a30111d340511f2be87af6df4ce85ec00baa7d1b085b1082c922337c59ca2
|
||||
size 72736
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ca24039f2eacc6517cb7131cfba469fc3db152e7fa28e63307047b170344c17b
|
||||
size 165666
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8b12eda65d7c9b472d156e7a964d6bf962810e881d5310bf04932a05a74a2443
|
||||
size 100696
|
||||
Reference in New Issue
Block a user