-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Element Screenshot #2012
Comments
The problem with such tests is that you are relying on many different systems, and the results are bound to be flaky. You are relying on two different layout systems (UIKit/Android and RN) and two different drawing systems (UIKit/Android and RN). Other technical limitations will make it even worse for you: iOS, for example, is unable to properly screenshot certain elements, and screenshots change with every version of iOS. |
We'll start with Android to see if it even makes sense, as an experimental feature. It's fairly easy to create such a screenshot with Android |
It's not a problem to support on iOS as well. XCUITest supports it too. I'm just not sure it's wise to encourage something as part of detox which is flaky in nature. We've resisted this in the past for good reason. |
@LeoNatan Regarding what you said
Clearly we will have separate screenshot for each system. |
I don't mean comparing between Android and iOS. I mean comparing across iOS versions and across RN versions is already too flaky. iOS simulator now uses Metal to render, so even different GPU drivers for the host (VM GPU driver) may have influence on the output. Too flaky. |
You may be right, but it's still worth a try |
FWIW, an automated system that takes the artifacts, uploads them to S3 and then allows designers to review changes to components would be useful for my organisation. Automated visual testing is probably going to have levels of flakiness, allowing designers to review changes to components in a similar fashion to Code Review is useful. It's quite common for component libraries to be designed in Figma, and then implemented as a separate NPM repository e.g. |
Why snapshot tests are bad: |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions! For more information on bots in this reporsitory, read this discussion. |
Hey @LeoNatan @rotemmiz Btw, the whole purpose of this specific feature request is take snapshot of specific element which should reduce visual background noise and give better results. |
Providing the element snapshot is not a problem in and of itself. The problem is encouraging bad practice, which I don't want to do in Detox. This is by all means our responsibility to argue. We're already seeing issues on Android where same problems occur as iOS: |
Is your feature request related to a problem? Please describe.
Recently we used screenshot tests with detox to detect breaking UI changes in our components.
In order to do that we compared screenshots of the entire screen that showcase the component.
Unfortunately, our showcase screens contain other elements other than the tested component (titles, controls, etc..).
If something has changed with those elements the screenshot test failed.
It turned those tests to be very flaky so we turned them off for now.
Describe the solution you'd like
A great solution will be to capture a screenshot of a specific element (by testID), this will help isolate to test case and prevent flakiness.
Describe alternatives you've considered
none.
Additional context
I discussed this some time ago with @amitdwix and @rotemmiz, I understand this is applicable.
Would be very beneficial for UI testing.
The text was updated successfully, but these errors were encountered: