Skip to content

Commit 7640cbd

Browse files
authored
Small Note on Simulator/OS Discrepancies (#162)
* Update README.md * Update Available-Snapshot-Strategies.md * Update README.md
1 parent 06963d6 commit 7640cbd

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Documentation/Available-Snapshot-Strategies.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ assertSnapshot(matching: image, as: .image(precision: 0.99)
259259

260260
A snapshot strategy for comparing layers based on pixel equality.
261261

262+
> Note: Snapshots must be compared on the same OS as the device that originally took the reference to avoid discrepancies between images.
263+
262264
**Format:** `NSImage`
263265

264266
**Note:** Includes `SCNView`, `SKView`, `WKWebView`.
@@ -322,6 +324,8 @@ A=autoresizesSubviews, C=canDrawConcurrently, D=needsDisplay, F=flipped, G=gstat
322324

323325
## NSViewController
324326

327+
> Note: Snapshots must be compared on the same OS as the device that originally took the reference to avoid discrepancies between images.
328+
325329
### `.image`
326330

327331
A snapshot strategy for comparing layers based on pixel equality.
@@ -485,6 +489,8 @@ assertSnapshot(matching: image, as: .image(precision: 0.99)
485489

486490
A snapshot strategy for comparing layers based on pixel equality.
487491

492+
> Note: Snapshots must be compared using a simulator with the same OS, device gamut, and scale as the simulator that originally took the reference to avoid discrepancies between images.
493+
488494
**Format:** `UIImage`
489495

490496
**Note:** Includes `SCNView`, `SKView`, `WKWebView`.
@@ -602,6 +608,8 @@ Records:
602608

603609
A snapshot strategy for comparing layers based on pixel equality.
604610

611+
> Note: Snapshots must be compared using a simulator with the same OS, device gamut, and scale as the simulator that originally took the reference to avoid discrepancies between images.
612+
605613
**Format:** `UIImage`
606614

607615
#### Parameters:

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ assertSnapshot(matching: vc, as: .image(on: .iPadMini(.portrait)))
7373
assertSnapshot(matching: vc, as: .recursiveDescription(on: .iPadMini(.portrait)))
7474
```
7575

76+
> Note: Snapshots must be compared using a simulator with the same OS, device gamut, and scale as the simulator that originally took the reference to avoid discrepancies between images.
77+
7678
Better yet, SnapshotTesting isn't limited to views and view controllers! There are [a number of available snapshot strategies](Documentation/Available-Snapshot-Strategies.md) to choose from.
7779

7880
For example, you can snapshot test URL requests (_e.g._, those that your API client prepares).

0 commit comments

Comments
 (0)