Comments (4)
This is most likely due to running tests on CI in a different simulator than what you run locally. You should try to keep them the same because there can be differences, like screen sizes and small rendering artifacts.
In this case of this .333333
, that is most likely coming up because CI is running on a 3x device. You probably captured the snapshot locally on a 2x device, and so you will see:
320 = (3/2) * 213.33333333333334
44 = (3/2) * 29.333333333333332
The 3/2
factor is because you snapshot at 2x and are verifying on 3x.
Hope that helps!
from swift-snapshot-testing.
Thanks!!! Yes, that is the case, but this error message is very misleading.
Shouldn't it be something like
Expected snapshot@(960.0, 132.0) to match reference@(640, 88.0)
Instead of
Expected snapshot@(320.0, 44.0) to match reference@(213.33333333333334, 29.333333333333332)
Don't understand what lib trying to do with that 3/2 factor if it wants to make the test compatible with all device regardless of a device running the test it should apply that factor against the result of testing device 960x132 (3x device)
so it would be 960 x 2/3 = 640 which equal recorded reference size.
And I don't see any 1x 2x 3x information in the reference image name, how can lib assume 2x in form factor?
from swift-snapshot-testing.
Yeah, that failure message isn't great and we can try to make it better.
Don't understand what lib trying to do with that 3/2 factor if it wants to make the test compatible with all device regardless of a device running the test it should apply that factor against the result of testing device 960x132 (3x device)
When we say that you can take device agnostic screenshots, we mean that in one test suite you can take screenshots for various screen sizes, like small iPhone's and iPad's, and we'll override the trait environment to make it seem like it's really that device. This means you don't have to boot up multiple simulators just to capture those different sizes. However, if you run that test suite on different simulators you will get subtly different results. Bugs have been filed with Apple to try to bridge that gap, but they claim it works as expected.
from swift-snapshot-testing.
This issue has gotten a bit stale so I'm going to close it out, @sarunw. If it's still an issue, or if you have suggestions to improve the error messaging, please let us know!
from swift-snapshot-testing.
Related Issues (20)
- Timeout Error During Snapshot Testing with WKWebView
- Snapshots tests fail when Json returns in different order, HOT 1
- macCatalyst: Snapshots generated differ a lot between local computer and a MacStadium M1 mac mini HOT 1
- Run success on local and xcode on CI Runner but test failed when using fastlane run_tests HOT 5
- Text-based snapshots break across platforms due to line ending differences HOT 2
- Undefined symbols Linker command failed with exit code 1. HOT 1
- Snapshot adds imported module's name that fails match with reference shapshot
- Deadlock in inline snapshot testing HOT 4
- What's the way to use `assertSnapshot` in async test? HOT 3
- How to snapshot on special iOS version? HOT 1
- Optimizing Image Handling in Swift Snapshot Testing
- Snapshot of table view with combine receiver happens too late HOT 1
- swift-syntax 510.0.0 update not possible HOT 1
- How to generate iPhone 15 Snapshots with Xcode 15, as view.swift doesn't contain those dimensions HOT 1
- I get "Process completed with exit code 65" when I use "assertSnapshot(of: vc, as: .image)" function on GitHub Actions.
- `diffTool` have a Swift 6 warning on Xcode 15.3 with Strict Concurrency Checking set to Complete
- Privacy manifest for AppStore releases HOT 1
- "The file “...” couldn’t be opened because you don’t have permission to view it" after switching branch
- Privacy manifest file / Privacy Rules HOT 1
- Blank diff snapshot
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-snapshot-testing.