Skip to content
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

41: Refactor assertSame() to be a top-level function #170

Merged
merged 13 commits into from
Oct 9, 2023

Conversation

DanielJette
Copy link
Contributor

What does this change accomplish?

Follow-up to #169
Resolves #41

image

This PR completes the refactoring of ScreenshotRule into several modules. Specifically, this PR introduces a top-level function version of assertSame(). With this, additional screenshot methods can easily be built.

Scope of Impact and Testing instructions

Changed

  • ScreenshotRule.getScreenshotInstrumentationAnnotation() is now a top-level function.
  • Collection<Annotation>.getAnnotation() renamed to Collection<Annotation>.findAnnotation().
  • Package for getScreenshotAnnotationName() changed from dev.testify.internal.extensions to dev.testify.annotation.
  • ScreenshotRule.initializeView() is now a top-level function.
  • EspressoHelper now extends ScreenshotLifecycle and beforeScreenshot() has been replaced with afterInitializeView()

Added

  • isRunningOnUiThread() added as a top-level function.
  • outputFileName() added as an extension method for Context.
  • Interface AssertionState
  • Interface ScreenshotLifecycleHost
  • assertSame() is now available as a top-level function, decoupled from ScreenshotRule

Removed

  • open fun ScreenshotRule.generateHighContrastDiff(baselineBitmap: Bitmap, currentBitmap: Bitmap) has been removed. Use class HighContrastDiff directly.
  • ScreenshotRule.applyViewModifications() has been removed. Use TestifyConfiguration.applyViewModificationsMainThread() instead.

Notice

Warning
This change must keep main in a shippable state; it may be shipped without further notice.

@AndroidTestifyBot
Copy link
Contributor

AndroidTestifyBot commented Sep 16, 2023

✅ Success! - Legacy Sample screenshot test results

View build for commit b5b1ff0

@AndroidTestifyBot
Copy link
Contributor

AndroidTestifyBot commented Sep 16, 2023

✅ Success! - Flix Sample screenshot test results

View build for commit b5b1ff0

@DanielJette DanielJette marked this pull request as ready for review September 16, 2023 16:28
@DanielJette DanielJette requested review from AndroidTestifyBot and a team September 16, 2023 16:28
Base automatically changed from 41-capture-method to main September 23, 2023 22:35
@DanielJette
Copy link
Contributor Author

I will rebase this over the weekend

@DanielJette DanielJette merged commit accc8e1 into main Oct 9, 2023
3 checks passed
@DanielJette DanielJette deleted the 41-internal-state branch October 9, 2023 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separate the core screenshot functionality from the JUnit4 lifecycle & AndroidTestRule
2 participants