-
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
148: Refactor output path into Destination #162
Conversation
d20188e
to
b02dcaa
Compare
Library/src/main/java/dev/testify/output/DataDirectoryDestination.kt
Outdated
Show resolved
Hide resolved
b02dcaa
to
ff59f02
Compare
ff59f02
to
34c1da7
Compare
✅ Success! - Legacy Sample screenshot test resultsView build for commit 4b07565 |
✅ Success! - Flix Sample screenshot test resultsView build for commit 4b07565 |
useSdCard = useSdCard(InstrumentationRegistry.getArguments()), | ||
path = getOutputDirectoryPath(this).absolutePath | ||
) | ||
private fun Destination.assureScreenshotDirectory(context: Context) { |
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.
shouldn't this method be part of Destination
class? 🤔
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.
This is a convenience wrapper around Destination.assureDestination()
which checks the return value of assureDestination()
and throws an exception if it's false.
What does this change accomplish?
Prerequisite for #148
How have you achieved it?
This PR introduces two core changes:
Destination
interface. This allows Testify to implement various alternative file output locations. The existingdata/data
andsdcard
output destinations have been ported to the new interface. This allows for future destinations to be easily supported in the future. This change is backwards compatible.build.gradle
are now visible to the Library code. So, advanced configuration options can now be set in thebuild.gradle
file and used by any Library code. In this PR, I have used this feature to pass theuseSdCard
configuration option to the Library and also to pass the current Gradle module name.📔 In addition, a small refactoring to
ErrorCause
was made to support the two new exceptions addedScope of Impact and Testing instructions
ScreenshotTest
andReporter
now use theDestination
interface. This should not affect users of Testify, but does impact developers and those who wish to subclass Testify classes.Notice