Skip to content

Commit c2ad933

Browse files
authored
Fix CI UITest failure for iOS simulator (#341)
1 parent 2fbeabc commit c2ad933

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Example/OpenSwiftUIUITests/Layout/Stack/ZStackUITests.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ struct ZStackUITests {
8787
}
8888
}
8989
openSwiftUIAssertSnapshot(
90-
of: ContentView()
90+
of: ContentView(),
91+
// FIXME: Workaround #340
92+
perceptualPrecision: 0.99
9193
)
9294
}
9395
}

Example/OpenSwiftUIUITests/Shared/SnapshotTesting+Testing.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ let defaultSize = CGSize(width: 200, height: 200)
2424

2525
func openSwiftUIAssertSnapshot<V: View>(
2626
of value: @autoclosure () throws -> V,
27+
perceptualPrecision: Float = 1,
2728
size: CGSize = defaultSize,
2829
named name: String? = nil,
2930
record recording: Bool? = shouldRecord,
@@ -36,7 +37,7 @@ func openSwiftUIAssertSnapshot<V: View>(
3637
) {
3738
openSwiftUIAssertSnapshot(
3839
of: PlatformHostingController(rootView: try value()),
39-
as: .image(size: size),
40+
as: .image(perceptualPrecision: perceptualPrecision, size: size),
4041
named: (name.map { ".\($0)" } ?? "") + "\(Int(size.width))x\(Int(size.height))",
4142
record: recording,
4243
timeout: timeout,

0 commit comments

Comments
 (0)