♻️ :: Fix snapshot tests

This commit is contained in:
Felix Mau
2022-08-17 22:50:03 +02:00
parent ea234f73bb
commit 3c82b1464c
2 changed files with 10 additions and 6 deletions
@@ -39,7 +39,7 @@ final class GradientLoadingBarControllerTestCase: XCTestCase {
let rootViewController = UIViewController()
window.rootViewController = rootViewController
let expectation = expectation(description: "Expect view to be completely fade in.")
let expectation = expectation(description: "Expect view to be completely visible.")
// When
let gradientLoadingBarController = GradientLoadingBarController()
@@ -48,7 +48,9 @@ final class GradientLoadingBarControllerTestCase: XCTestCase {
}
// Then
wait(for: [expectation], timeout: 0.1)
assertSnapshot(matching: window, as: .image)
wait(for: [expectation], timeout: 0.01)
// Workaround, as snapshotting a `UIWindow` is currently not supported and crashes when running all tests.
assertSnapshot(matching: window.layer, as: .image)
}
}
@@ -40,7 +40,7 @@ final class NotchGradientLoadingBarControllerTestCase: XCTestCase {
let rootViewController = UIViewController()
window.rootViewController = rootViewController
let expectation = expectation(description: "Expect view to be completely fade in.")
let expectation = expectation(description: "Expect view to be completely visible.")
// When
let gradientLoadingBarController = NotchGradientLoadingBarController()
@@ -49,7 +49,9 @@ final class NotchGradientLoadingBarControllerTestCase: XCTestCase {
}
// Then
wait(for: [expectation], timeout: 0.1)
assertSnapshot(matching: window, as: .image)
wait(for: [expectation], timeout: 0.01)
// Workaround, as snapshotting a `UIWindow` is currently not supported and crashes when running all tests.
assertSnapshot(matching: window.layer, as: .image)
}
}