mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Add UI tests for mandatory PIN setup flow. (#2049)
This commit is contained in:
parent
6ee3a7f99f
commit
1102beb3dd
@ -150,7 +150,7 @@ struct SecureBackupScreen_Previews: PreviewProvider, TestablePreview {
|
||||
}
|
||||
.previewDisplayName("Recovery incomplete")
|
||||
}
|
||||
.snapshot(delay: 0.25)
|
||||
.snapshot(delay: 0.5)
|
||||
}
|
||||
|
||||
static func viewModel(keyBackupState: SecureBackupKeyBackupState,
|
||||
|
@ -162,7 +162,7 @@ class MockScreen: Identifiable {
|
||||
let appLockService = AppLockService(keychainController: KeychainControllerMock(), appSettings: ServiceLocator.shared.settings)
|
||||
let coordinator = AppLockScreenCoordinator(parameters: .init(appLockService: appLockService))
|
||||
return coordinator
|
||||
case .appLockSetupFlow, .appLockSetupFlowUnlock:
|
||||
case .appLockSetupFlow, .appLockSetupFlowUnlock, .appLockSetupFlowMandatory:
|
||||
let navigationStackCoordinator = NavigationStackCoordinator()
|
||||
// The flow expects an existing root coordinator, use the placeholder as a placeholder 😅
|
||||
navigationStackCoordinator.setRootCoordinator(BlankFormCoordinator())
|
||||
@ -186,7 +186,8 @@ class MockScreen: Identifiable {
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
context: context)
|
||||
|
||||
let coordinator = AppLockSetupFlowCoordinator(presentingFlow: .settings,
|
||||
let flow: AppLockSetupFlowCoordinator.PresentationFlow = id == .appLockSetupFlowMandatory ? .onboarding : .settings
|
||||
let coordinator = AppLockSetupFlowCoordinator(presentingFlow: flow,
|
||||
appLockService: appLockService,
|
||||
navigationStackCoordinator: navigationStackCoordinator)
|
||||
coordinator.start()
|
||||
|
@ -32,6 +32,7 @@ enum UITestsScreenIdentifier: String {
|
||||
case appLockScreen
|
||||
case appLockSetupFlow
|
||||
case appLockSetupFlowUnlock
|
||||
case appLockSetupFlowMandatory
|
||||
case home
|
||||
case settings
|
||||
case bugReport
|
||||
|
@ -82,6 +82,30 @@ class AppLockSetupUITests: XCTestCase {
|
||||
try await app.assertScreenshot(.appLockSetupFlow, step: Step.clearedStack)
|
||||
}
|
||||
|
||||
func testMandatoryCreateFlow() async throws {
|
||||
app = Application.launch(.appLockSetupFlowMandatory)
|
||||
|
||||
// Create PIN screen (non-modal and no cancellation button).
|
||||
try await app.assertScreenshot(.appLockSetupFlowMandatory, step: Step.createPIN)
|
||||
|
||||
enterPIN()
|
||||
|
||||
// Confirm PIN screen (non-modal and no cancellation button).
|
||||
try await app.assertScreenshot(.appLockSetupFlowMandatory, step: Step.confirmPIN)
|
||||
|
||||
enterPIN()
|
||||
|
||||
// Setup biometrics screen (non-modal).
|
||||
try await app.assertScreenshot(.appLockSetupFlowMandatory, step: Step.setupBiometrics)
|
||||
|
||||
let allowButton = app.buttons[A11yIdentifiers.appLockSetupBiometricsScreen.allow]
|
||||
XCTAssertTrue(allowButton.exists, "The biometrics screen should be shown.")
|
||||
allowButton.tap()
|
||||
|
||||
// The stack should remain on biometrics for the presenting flow to take over navigation.
|
||||
try await app.assertScreenshot(.appLockSetupFlowMandatory, step: Step.setupBiometrics)
|
||||
}
|
||||
|
||||
func testUnlockFlow() async throws {
|
||||
app = Application.launch(.appLockSetupFlowUnlock)
|
||||
|
||||
|
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.appLockSetupFlowMandatory-0.png
(Stored with Git LFS)
Normal file
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.appLockSetupFlowMandatory-0.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.appLockSetupFlowMandatory-1.png
(Stored with Git LFS)
Normal file
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.appLockSetupFlowMandatory-1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.appLockSetupFlowMandatory-2.png
(Stored with Git LFS)
Normal file
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.appLockSetupFlowMandatory-2.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.appLockSetupFlowMandatory-0.png
(Stored with Git LFS)
Normal file
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.appLockSetupFlowMandatory-0.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.appLockSetupFlowMandatory-1.png
(Stored with Git LFS)
Normal file
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.appLockSetupFlowMandatory-1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.appLockSetupFlowMandatory-2.png
(Stored with Git LFS)
Normal file
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.appLockSetupFlowMandatory-2.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.appLockSetupFlowMandatory-0.png
(Stored with Git LFS)
Normal file
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.appLockSetupFlowMandatory-0.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.appLockSetupFlowMandatory-1.png
(Stored with Git LFS)
Normal file
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.appLockSetupFlowMandatory-1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.appLockSetupFlowMandatory-2.png
(Stored with Git LFS)
Normal file
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.appLockSetupFlowMandatory-2.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.appLockSetupFlowMandatory-0.png
(Stored with Git LFS)
Normal file
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.appLockSetupFlowMandatory-0.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.appLockSetupFlowMandatory-1.png
(Stored with Git LFS)
Normal file
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.appLockSetupFlowMandatory-1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.appLockSetupFlowMandatory-2.png
(Stored with Git LFS)
Normal file
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.appLockSetupFlowMandatory-2.png
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user