diff --git a/Example/ExampleSnapshotTests/GradientLoadingBarController/GradientLoadingBarControllerTestCase.swift b/Example/ExampleSnapshotTests/GradientLoadingBarController/GradientLoadingBarControllerTestCase.swift index fb7dfdf..e04c2f8 100644 --- a/Example/ExampleSnapshotTests/GradientLoadingBarController/GradientLoadingBarControllerTestCase.swift +++ b/Example/ExampleSnapshotTests/GradientLoadingBarController/GradientLoadingBarControllerTestCase.swift @@ -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) } } diff --git a/Example/ExampleSnapshotTests/GradientLoadingBarController/NotchGradientLoadingBarControllerTestCase.swift b/Example/ExampleSnapshotTests/GradientLoadingBarController/NotchGradientLoadingBarControllerTestCase.swift index e1c51f8..c2d9c6e 100644 --- a/Example/ExampleSnapshotTests/GradientLoadingBarController/NotchGradientLoadingBarControllerTestCase.swift +++ b/Example/ExampleSnapshotTests/GradientLoadingBarController/NotchGradientLoadingBarControllerTestCase.swift @@ -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) } }