migrating ui tests using swift 6.2

This commit is contained in:
Mauro Romito
2026-06-24 15:02:35 +02:00
committed by Mauro
parent 057b8728d3
commit 31a9f2c961
4 changed files with 11 additions and 1 deletions
+4
View File
@@ -9936,6 +9936,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.ui.tests";
PRODUCT_NAME = UITests;
SDKROOT = iphoneos;
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_VERSION = 6.2;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = ElementX;
};
@@ -9957,6 +9959,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.ui.tests";
PRODUCT_NAME = UITests;
SDKROOT = iphoneos;
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_VERSION = 6.2;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = ElementX;
};
@@ -60,6 +60,7 @@ enum UITestsSignalling {
/// - Within the app, create a `Client` in `app` mode. This will check that the tests are ready and echo back that the app is too.
/// - Call `waitForApp()` in the tests when you need to send the signal. This will suspend execution until the app has signalled it is ready.
/// - The two `Client` objects can now be used for two-way signalling.
@MainActor
class Client {
/// The file watcher responsible for receiving signals.
private let fileWatcher: FileWatcher.Local
+4 -1
View File
@@ -156,7 +156,10 @@ class RoomScreenUITests: XCTestCase {
private func performOperation(_ operation: UITestsSignal.Timeline, using client: UITestsSignalling.Client) async throws {
try client.send(.timeline(operation))
await _ = client.signals.values.first { $0 == .success }
// The type is not sendable so we can't use the first function directly on the values.
// So we need to make an async iterator which allows us to await a value on the same isolation context.
var iterator = client.signals.values.makeAsyncIterator()
while let signal = await iterator.next(isolation: #isolation), signal != .success { }
try await Task.sleep(for: .seconds(2)) // Allow the timeline to update
}
+2
View File
@@ -48,6 +48,8 @@ targets:
base:
PRODUCT_NAME: UITests
PRODUCT_BUNDLE_IDENTIFIER: ${BASE_BUNDLE_IDENTIFIER}.ui.tests
SWIFT_VERSION: 6.2
SWIFT_APPROACHABLE_CONCURRENCY: YES
configs:
# This is required to remove the $(inherited) flags
# which would prevent SnapshotTesting to be imported in UI Tests