mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Fixing Tests for Xcode 14.3 (#888)
* settting macOS to 13, and let's runa test of... the tests * I want the artifacts of the test, might give me some more insight in Xcode * archive artifact * trying a thing with the xcode version * push notifications alert makes this test fail * test improvement * let's try with a very long time * let's disable autocorrection * sleep * 1 seconds fixed 90% of the issue, 2 should fix 100% * waiting some more time in flaky tests and updated the content of a test that was failing * updated a screenshot test that had a notification * this integration test is a bit so flaky increased the timing * controlled delay waited a bit moe for the timeline to settle * try await * MainActor everywhere * milliseconds fix * trying with a bit more waiting time after the tap and a slow velocity for the swipe * let's try waiting more time
This commit is contained in:
@@ -30,16 +30,21 @@ struct Application {
|
||||
}
|
||||
|
||||
extension XCUIApplication {
|
||||
@MainActor
|
||||
/// Assert screenshot for a screen with the given identifier. Does not fail if a screenshot is newly created.
|
||||
/// - Parameter identifier: Identifier of the UI test screen
|
||||
/// - Parameter step: An optional integer that can be used to take multiple snapshots per test identifier.
|
||||
/// - Parameter insets: Optional insets with which to crop the image by.
|
||||
func assertScreenshot(_ identifier: UITestsScreenIdentifier, step: Int? = nil, insets: UIEdgeInsets? = nil) {
|
||||
func assertScreenshot(_ identifier: UITestsScreenIdentifier, step: Int? = nil, insets: UIEdgeInsets? = nil, delayInMilliseconds: UInt = 2000, precision: Float = 0.99) async throws {
|
||||
var snapshotName = identifier.rawValue
|
||||
if let step {
|
||||
snapshotName += "-\(step)"
|
||||
}
|
||||
|
||||
|
||||
// Sometimes the CI might be too slow to load the content so let's wait the delay time
|
||||
if delayInMilliseconds > 0 {
|
||||
try await Task.sleep(for: .milliseconds(delayInMilliseconds))
|
||||
}
|
||||
var snapshot = XCUIScreen.main.screenshot().image
|
||||
|
||||
if let insets {
|
||||
@@ -47,7 +52,9 @@ extension XCUIApplication {
|
||||
}
|
||||
|
||||
let failure = verifySnapshot(matching: snapshot,
|
||||
as: .image(precision: 0.99, perceptualPrecision: 0.98, scale: nil),
|
||||
as: .image(precision: precision,
|
||||
perceptualPrecision: 0.98,
|
||||
scale: nil),
|
||||
named: snapshotName,
|
||||
testName: testName)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user