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

Update roborazzi to v1.36.0 #110

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update roborazzi to v1.36.0 #110

wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Nov 21, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
io.github.takahirom.roborazzi 1.32.2 -> 1.36.0 age adoption passing confidence
io.github.takahirom.roborazzi:roborazzi-junit-rule 1.32.2 -> 1.36.0 age adoption passing confidence
io.github.takahirom.roborazzi:roborazzi-compose 1.32.2 -> 1.36.0 age adoption passing confidence
io.github.takahirom.roborazzi:roborazzi 1.32.2 -> 1.36.0 age adoption passing confidence

Release Notes

takahirom/roborazzi (io.github.takahirom.roborazzi)

v1.36.0

Compare Source

Behavior Changes to roborazzi.outputDir.set(file("somedir")) in build.gradle

Previously, when modifying roborazzi.outputDir, such as setting it to src/screenshots, this option also affected the paths for comparison images, like foo_compare.png. This behavior often caused issues, such as unintentionally saving comparison images to version control systems (e.g., Git). To address this, we have discontinued this behavior. Comparison images are now saved in build/outputs/roborazzi by default, while the behavior for reference images remains unchanged.

For users who wish to customize the path for comparison images, we have introduced a new option: roborazzi.compare.outputDir.

While I don't believe there are strong use cases for this, if you want to save the comparison images in a custom directory as you did before, you can specify roborazzi.compare.outputDir as follows:

roborazzi {
  outputDir.set(file("src/screenshots"))
  compare {
    outputDir.set(file("src/screenshots"))
  }
}

I believe this adjustment will be highly beneficial for most use cases involving changes to outputDir.

[!NOTE]
By default, when you use captureRoboImage("image.png"), the image will be saved as module/image.png.
You can customize the file path strategy for the recorded image. The default strategy is relativePathFromCurrentDirectory. If you select relativePathFromRoborazziContextOutputDirectory, the file will be saved in the output directory specified by roborazzi.outputDir.
This can be configured in your gradle.properties file:

roborazzi.record.filePathStrategy=relativePathFromRoborazziContextOutputDirectory
What's Changed

Full Changelog: takahirom/roborazzi@1.35.0...1.36.0

v1.35.0

Compare Source

Add support for heightDp, widthDp, showBackground, and backgroundColor of Compose Preview parameters

We have introduced Experimental Compose Preview Support in 1.22.0, but it does not yet support all parameters of the @Preview annotation. Thanks to @​sergio-sastre 's pull request, the Experimental Compose Preview Support now includes support for heightDp, widthDp, showBackground, and backgroundColor.

Introduce RoborazziComposeOptions

To accommodate the changes in preview parameters, we’ve made the API more flexible.

We’ve added the RoborazziComposeOptions parameter to ComposablePreview<AndroidPreviewInfo>.captureRoboImage() and the composable function version, captureRoboImage{}. Previously, the API was limited; for example, you couldn’t access the ActivityScenario or the composable function directly. Now, you have full control over these components. Thank you for your code review @​sergio-sastre

Here’s an example of a custom option:

    captureRoboImage(
      roborazziComposeOptions = RoborazziComposeOptions {
        // We have several options to configure the test environment.
        fontScale(2f)
        // We can also configure the activity scenario and the composable content.
        addOption(
          object : RoborazziComposeComposableOption,
            RoborazziComposeActivityScenarioOption {
            override fun configureWithActivityScenario(scenario: ActivityScenario<out Activity>) {
              scenario.onActivity {
                it.window.decorView.setBackgroundColor(Color.BLUE)
              }
            }

            override fun configureWithComposable(content: @&#8203;Composable () -> Unit): @&#8203;Composable () -> Unit {
              return {
                Box(Modifier
                  .padding(10.dp)
                  .background(color = androidx.compose.ui.graphics.Color.Red)
                  .padding(10.dp)
                ) {
                  content()
                }
              }
            }
          }
        )
      },
    ) {
      Text("Hello Compose!")
    }

image

Breaking Change: fun ComposablePreview<AndroidPreviewInfo>.applyToRobolectricConfiguration() is now deprecated and marked as an error

As part of our updates to how composables are configured, the applyToRobolectricConfiguration() function is now deprecated and marked as an error. Instead, you can use one of the following alternatives:

  • previewInfo.toRoborazziComposeOptions().apply(scenario, composeContent)
  • ComposablePreview<AndroidPreviewInfo>.captureRoboImage(roborazziComposeOptions)

We believe this feature is not widely used, and the migration should be straightforward. However, if you encounter any issues, please don’t hesitate to reach out.

What's Changed

Full Changelog: takahirom/roborazzi@1.34.0...1.35.0

v1.34.0

Compare Source

Stabilize RoborazziOptions and RoborazziRule.Options

RoborazziOptions and RoborazziRule.Options were not annotated with ExperimentalRoborazziApi, but their constructor parameters had the annotation. This caused ExperimentalRoborazziApi to be unintentionally exposed. To address this, we have separated constructors for stable parameters. Additionally, within Roborazzi samples, we have enabled allWarningsAsErrors = true to ensure that any unexpected exposure can be promptly identified.
Thank you for reporting this issue and for your code review, @​colinrtwhite!

Fixes for Accessibility Checks

We introduced Experimental Accessibility Test Framework checks in version 1.33.0.
Thanks to @​yschimke's contribution, several fixes have been implemented for accessibility checks, including check suppression and improved logging.

What's Changed

Full Changelog: takahirom/roborazzi@1.33.0...1.34.0

v1.33.0

Compare Source

Experimental Accessibility Test Framework checks

Thanks to @​yschimke's contribution, we now have a library that integrates accessibility checks into Roborazzi. It uses the Accessibility Test Framework to ensure accessibility.

Please add the library dependency:

testImplementation("io.github.takahirom.roborazzi:roborazzi-accessibility-check:[version]")

https://github.com/takahirom/roborazzi/tree/main/roborazzi-accessibility-check

Configure in Junit Rule
  @&#8203;get:Rule
  val roborazziRule = RoborazziRule(
    composeRule = composeTestRule,
    captureRoot = composeTestRule.onRoot(),
    options = Options(
      roborazziAccessibilityOptions = RoborazziATFAccessibilityCheckOptions(
        checker = RoborazziATFAccessibilityChecker(
          checks = setOf(NoRedTextCheck()),
          suppressions = matchesElements(withTestTag("suppress"))
        ),
        failureLevel = RoborazziATFAccessibilityChecker.CheckLevel.Warning
      ),
      // If you want to automatically check accessibility after a test, use AccessibilityCheckAfterTestStrategy.
      accessibilityCheckStrategy = AccessibilityCheckAfterTestStrategy(),
    )
  )
Add accessibility checks
composeTestRule.onNodeWithTag("nothard").checkRoboAccessibility(
  // If you don't specify options, the options in RoborazziRule will be used.
  roborazziATFAccessibilityCheckOptions = RoborazziATFAccessibilityCheckOptions(
    checker = RoborazziATFAccessibilityChecker(
      preset = AccessibilityCheckPreset.LATEST,
    ),
    failureLevel = RoborazziATFAccessibilityChecker.CheckLevel.Warning
  )
)

Not only is this library designed to make our app accessible to everyone, but I also believe that AI agent testing will be a future trend, and we want to prepare for it. I think this could help make our app accessible to AI as well, enabling agents to interact with it, such as clicking on image buttons using content descriptions. Additionally, we can create custom checks, like NoRedTextCheck, specifically for AI.

What's Changed

Full Changelog: takahirom/roborazzi@1.32.2...1.33.0


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

Copy link

codecov bot commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.11%. Comparing base (d50a72b) to head (f2fde0a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #110   +/-   ##
=======================================
  Coverage   84.11%   84.11%           
=======================================
  Files          23       23           
  Lines        2821     2821           
  Branches      252      252           
=======================================
  Hits         2373     2373           
  Misses        221      221           
  Partials      227      227           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@renovate renovate bot changed the title Update dependency io.github.takahirom.roborazzi to v1.33.0 Update roborazzi to v1.33.0 Nov 21, 2024
@renovate renovate bot changed the title Update roborazzi to v1.33.0 Update roborazzi Nov 24, 2024
@renovate renovate bot force-pushed the renovate/roborazzi branch from a8433ec to f2fde0a Compare November 24, 2024 19:38
@renovate renovate bot changed the title Update roborazzi Update roborazzi to v1.34.0 Nov 24, 2024
@renovate renovate bot force-pushed the renovate/roborazzi branch from f2fde0a to ebaf5a2 Compare December 8, 2024 06:29
@renovate renovate bot changed the title Update roborazzi to v1.34.0 Update roborazzi to v1.35.0 Dec 8, 2024
@renovate renovate bot force-pushed the renovate/roborazzi branch from ebaf5a2 to e80c616 Compare December 9, 2024 10:59
@renovate renovate bot changed the title Update roborazzi to v1.35.0 Update roborazzi to v1.36.0 Dec 9, 2024
Copy link

sonarcloud bot commented Dec 9, 2024

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.

0 participants