-
Notifications
You must be signed in to change notification settings - Fork 5
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
ISSUE-88: Add ScreenshotScenarioRule #201
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Success! - Legacy Sample screenshot test resultsView build for commit e20121f |
✅ Success! - Flix Sample screenshot test resultsView build for commit e20121f |
✅ Success! - Flix Library screenshot test resultsView build for commit e20121f |
534a21a
to
f94a0a0
Compare
f2f91ed
to
62c2de4
Compare
b4668cc
to
5d44ea8
Compare
62c2de4
to
528aef4
Compare
5d44ea8
to
ec7f4ce
Compare
lwise
approved these changes
Mar 25, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the screenshot file for testUnexpectedDevice
shouldn't be included but otherwise LGTM
ec7f4ce
to
6eca560
Compare
ScreenshotScenarioRule is an alternative to ScreenshotRule that is based on ActivityScenario @see https://developer.android.com/reference/androidx/test/core/app/ActivityScenario
Subclass of ScreenshotScenarioRule for testing composables
6eca560
to
f67e475
Compare
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this change accomplish?
Resolves #88
Resolves #72
Adds
ScreenshotScenarioRule
which works in conjunction with Android'sActivityScenario
.How have you achieved it?
As ActivityTestRule is deprecated, the Android SDK now recommends the usage of
ActivityScenario
as the modern alternative. Testify providesScreenshotScenarioRule
which works in conjunction withActivityScenario
to easily add screenshot tests to scenario-based UI tests.ScreenshotScenarioRule
is more flexible than the olderScreenshotTestRule
as it no longer requires you to couple the rule's instantiatiation with a specific Activity subclass. This allows the flexibility of testing multiple different activities in the same test class.Screenshot test integration with
ActivityScenario
is achieved via thewithScenario()
function. An active instance of a scenario must be provided to Testify prior to callingassertSame()
. Typically, this is done by passing the scaneario instance returned byActivityScenario.launch
to theScreenshotScenarioRule
instance within ause {}
block.Tip
To enable Android Studio Plugin integration with your tests, each test method should be annotated with the
@ScreenshotInstrumentation
annotation.Scope of Impact and Testing instructions
The best way to test this is to pull down this branch and read through the documentation.
The samples have been updated to include Scenario-based tests. The documentation explains how to use all of the Testify features with Scenarios.
You can view the documentation locally by running
yarn start
from thedocs
directory.Notice
Warning
This change must keep
main
in a shippable state; it may be shipped without further notice.