Adds ScreenshotScenarioRule which works in conjunction with Android's ActivityScenario.
How have you achieved it?
As ActivityTestRule is deprecated, the Android SDK now recommends the usage of ActivityScenario as the modern alternative. Testify provides ScreenshotScenarioRule which works in conjunction with ActivityScenario to easily add screenshot tests to scenario-based UI tests.
ScreenshotScenarioRule is more flexible than the older ScreenshotTestRule 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 the withScenario() function. An active instance of a scenario must be provided to Testify prior to calling assertSame(). Typically, this is done by passing the scaneario instance returned by ActivityScenario.launch to the ScreenshotScenarioRule instance within a use {} block.
[!TIP]
To enable Android Studio Plugin integration with your tests, each test method should be annotated with the @ScreenshotInstrumentation annotation.
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 the docs directory.
Notice
[!WARNING]
This change must keep main in a shippable state; it may be shipped without further notice.
What does this change accomplish?
Resolves #88 Resolves https://github.com/ndtp/android-testify/issues/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.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