mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
migrating ui tests using swift 6.2
This commit is contained in:
@@ -9936,6 +9936,8 @@
|
|||||||
PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.ui.tests";
|
PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.ui.tests";
|
||||||
PRODUCT_NAME = UITests;
|
PRODUCT_NAME = UITests;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
|
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||||
|
SWIFT_VERSION = 6.2;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
TEST_TARGET_NAME = ElementX;
|
TEST_TARGET_NAME = ElementX;
|
||||||
};
|
};
|
||||||
@@ -9957,6 +9959,8 @@
|
|||||||
PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.ui.tests";
|
PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.ui.tests";
|
||||||
PRODUCT_NAME = UITests;
|
PRODUCT_NAME = UITests;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
|
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||||
|
SWIFT_VERSION = 6.2;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
TEST_TARGET_NAME = ElementX;
|
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.
|
/// - 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.
|
/// - 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.
|
/// - The two `Client` objects can now be used for two-way signalling.
|
||||||
|
@MainActor
|
||||||
class Client {
|
class Client {
|
||||||
/// The file watcher responsible for receiving signals.
|
/// The file watcher responsible for receiving signals.
|
||||||
private let fileWatcher: FileWatcher.Local
|
private let fileWatcher: FileWatcher.Local
|
||||||
|
|||||||
@@ -156,7 +156,10 @@ class RoomScreenUITests: XCTestCase {
|
|||||||
|
|
||||||
private func performOperation(_ operation: UITestsSignal.Timeline, using client: UITestsSignalling.Client) async throws {
|
private func performOperation(_ operation: UITestsSignal.Timeline, using client: UITestsSignalling.Client) async throws {
|
||||||
try client.send(.timeline(operation))
|
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
|
try await Task.sleep(for: .seconds(2)) // Allow the timeline to update
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ targets:
|
|||||||
base:
|
base:
|
||||||
PRODUCT_NAME: UITests
|
PRODUCT_NAME: UITests
|
||||||
PRODUCT_BUNDLE_IDENTIFIER: ${BASE_BUNDLE_IDENTIFIER}.ui.tests
|
PRODUCT_BUNDLE_IDENTIFIER: ${BASE_BUNDLE_IDENTIFIER}.ui.tests
|
||||||
|
SWIFT_VERSION: 6.2
|
||||||
|
SWIFT_APPROACHABLE_CONCURRENCY: YES
|
||||||
configs:
|
configs:
|
||||||
# This is required to remove the $(inherited) flags
|
# This is required to remove the $(inherited) flags
|
||||||
# which would prevent SnapshotTesting to be imported in UI Tests
|
# which would prevent SnapshotTesting to be imported in UI Tests
|
||||||
|
|||||||
Reference in New Issue
Block a user