mirror of
https://github.com/fxm90/GradientLoadingBar.git
synced 2026-06-16 12:24:31 +00:00
♻️ :: Fix snapshot tests
This commit is contained in:
+5
-3
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user