Session verification UI tests update (#5120)

session verification tests UI tests update
This commit is contained in:
Mauro
2026-02-18 10:57:04 +01:00
committed by GitHub
parent 67b8ef9641
commit cbeaaf02bb
40 changed files with 62 additions and 111 deletions

View File

@@ -19,6 +19,7 @@ extension SessionVerificationControllerProxyMock {
static func configureMock(actions: PassthroughSubject<SessionVerificationControllerProxyAction, Never> = .init(),
isVerified: Bool = false,
otherDeviceStartsSasVerification: Bool = false,
requestDelay: Duration = .seconds(1)) -> SessionVerificationControllerProxyMock {
let mock = SessionVerificationControllerProxyMock()
mock.underlyingActions = actions
@@ -29,6 +30,13 @@ extension SessionVerificationControllerProxyMock {
Task.detached {
try await Task.sleep(for: requestDelay)
mock.actions.send(.acceptedVerificationRequest)
if otherDeviceStartsSasVerification {
try await Task.sleep(for: requestDelay)
mock.actions.send(.startedSasVerification)
try await Task.sleep(for: requestDelay)
mock.actions.send(.receivedVerificationData(emojis))
}
}
return .success(())
@@ -65,7 +73,7 @@ extension SessionVerificationControllerProxyMock {
return .success(())
}
mock.cancelVerificationClosure = { [unowned mock] in
Task.detached {
try await Task.sleep(for: requestDelay)

View File

@@ -235,7 +235,6 @@ enum A11yIdentifiers {
let acceptVerificationRequest = "session_verification-accept_verification_request"
let ignoreVerificationRequest = "session_verification-ignore_verification_request"
let requestVerification = "session_verification-request_verification"
let startSasVerification = "session_verification-start_sas_verification"
let acceptChallenge = "session_verification-accept_challenge"
let declineChallenge = "session_verification-decline_challenge"
let emojiWrapper = "session_verification-emojis"

View File

@@ -575,7 +575,8 @@ class MockScreen: Identifiable {
navigationStackCoordinator.setRootCoordinator(coordinator)
return navigationStackCoordinator
case .sessionVerification:
var sessionVerificationControllerProxy = SessionVerificationControllerProxyMock.configureMock(requestDelay: .seconds(5))
var sessionVerificationControllerProxy = SessionVerificationControllerProxyMock.configureMock(otherDeviceStartsSasVerification: true,
requestDelay: .seconds(5))
let parameters = SessionVerificationScreenCoordinatorParameters(sessionVerificationControllerProxy: sessionVerificationControllerProxy,
flow: .deviceInitiator,
appSettings: ServiceLocator.shared.settings,

View File

@@ -13,13 +13,10 @@ class SessionVerificationUITests: XCTestCase {
enum Step {
static let initialState = 0
static let waitingForOtherDevice = 1
static let useEmojiComparisonPrompt = 2
static let waitingForEmojis = 3
static let compareEmojis = 4
static let acceptingEmojis = 5
static let verificationComplete = 6
static let verificationCancelled = 7
static let compareEmojis = 2
static let acceptingEmojis = 3
static let verificationComplete = 4
static let verificationCancelled = 5
}
func testChallengeMatches() async throws {
@@ -29,13 +26,7 @@ class SessionVerificationUITests: XCTestCase {
app.buttons[A11yIdentifiers.sessionVerificationScreen.requestVerification].tap()
try await app.assertScreenshot(step: Step.waitingForOtherDevice)
XCTAssert(app.buttons[A11yIdentifiers.sessionVerificationScreen.startSasVerification].waitForExistence(timeout: 10.0))
try await app.assertScreenshot(step: Step.useEmojiComparisonPrompt)
app.buttons[A11yIdentifiers.sessionVerificationScreen.startSasVerification].tap()
try await app.assertScreenshot(step: Step.waitingForEmojis)
XCTAssert(app.buttons[A11yIdentifiers.sessionVerificationScreen.acceptChallenge].waitForExistence(timeout: 10.0))
XCTAssert(app.buttons[A11yIdentifiers.sessionVerificationScreen.acceptChallenge].waitForExistence(timeout: 20.0))
try await app.assertScreenshot(step: Step.compareEmojis)
app.buttons[A11yIdentifiers.sessionVerificationScreen.acceptChallenge].tap()
@@ -52,13 +43,7 @@ class SessionVerificationUITests: XCTestCase {
app.buttons[A11yIdentifiers.sessionVerificationScreen.requestVerification].tap()
try await app.assertScreenshot(step: Step.waitingForOtherDevice)
XCTAssert(app.buttons[A11yIdentifiers.sessionVerificationScreen.startSasVerification].waitForExistence(timeout: 10.0))
try await app.assertScreenshot(step: Step.useEmojiComparisonPrompt)
app.buttons[A11yIdentifiers.sessionVerificationScreen.startSasVerification].tap()
try await app.assertScreenshot(step: Step.waitingForEmojis)
XCTAssert(app.buttons[A11yIdentifiers.sessionVerificationScreen.acceptChallenge].waitForExistence(timeout: 10.0))
XCTAssert(app.buttons[A11yIdentifiers.sessionVerificationScreen.acceptChallenge].waitForExistence(timeout: 20.0))
try await app.assertScreenshot(step: Step.compareEmojis)
app.buttons[A11yIdentifiers.sessionVerificationScreen.declineChallenge].tap()
@@ -72,13 +57,7 @@ class SessionVerificationUITests: XCTestCase {
app.buttons[A11yIdentifiers.sessionVerificationScreen.requestVerification].tap()
try await app.assertScreenshot(step: Step.waitingForOtherDevice)
XCTAssert(app.buttons[A11yIdentifiers.sessionVerificationScreen.startSasVerification].waitForExistence(timeout: 10.0))
try await app.assertScreenshot(step: Step.useEmojiComparisonPrompt)
app.buttons[A11yIdentifiers.sessionVerificationScreen.startSasVerification].tap()
try await app.assertScreenshot(step: Step.waitingForEmojis)
XCTAssert(app.buttons[A11yIdentifiers.sessionVerificationScreen.acceptChallenge].waitForExistence(timeout: 10.0))
XCTAssert(app.buttons[A11yIdentifiers.sessionVerificationScreen.acceptChallenge].waitForExistence(timeout: 20.0))
try await app.assertScreenshot(step: Step.compareEmojis)
}
}

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2e1c5c3583910c6442c9f75c96874c292e8722ad70423deddbaf3fd46e960f46
size 76889
oid sha256:b6cd3dee6a121b6ca50ba5e66f3cbccaf67a9cf75c9714568f12867df34ae1a6
size 90187

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2e1c5c3583910c6442c9f75c96874c292e8722ad70423deddbaf3fd46e960f46
size 76889

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:38d40be22599a822651a853b281f426fda6bf4b0e962d5a66f870d54878f1d6c
size 83122

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2e1c5c3583910c6442c9f75c96874c292e8722ad70423deddbaf3fd46e960f46
size 76889
oid sha256:9f2e7cbd6ee0008628c88d6ec9f41267dd2d5cd72d7e5284b602f87a9ac35e99
size 90182

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2e1c5c3583910c6442c9f75c96874c292e8722ad70423deddbaf3fd46e960f46
size 76889

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:38d40be22599a822651a853b281f426fda6bf4b0e962d5a66f870d54878f1d6c
size 83122