Skip to content

Commit

Permalink
Update roborazzi to v1.36.0 (#1115)
Browse files Browse the repository at this point in the history
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[io.github.takahirom.roborazzi](https://redirect.github.com/takahirom/roborazzi)
| plugin | minor | `1.32.2` -> `1.36.0` |
|
[io.github.takahirom.roborazzi:roborazzi-core](https://redirect.github.com/takahirom/roborazzi)
| dependencies | minor | `1.32.2` -> `1.36.0` |
|
[io.github.takahirom.roborazzi:roborazzi-compose](https://redirect.github.com/takahirom/roborazzi)
| dependencies | minor | `1.32.2` -> `1.36.0` |
|
[io.github.takahirom.roborazzi:roborazzi-junit-rule](https://redirect.github.com/takahirom/roborazzi)
| dependencies | minor | `1.32.2` -> `1.36.0` |
|
[io.github.takahirom.roborazzi:roborazzi](https://redirect.github.com/takahirom/roborazzi)
| dependencies | minor | `1.32.2` -> `1.36.0` |
|
[io.github.takahirom.roborazzi:roborazzi-compose-desktop](https://redirect.github.com/takahirom/roborazzi)
| dependencies | minor | `1.32.2` -> `1.36.0` |

---

### Release Notes

<details>
<summary>takahirom/roborazzi (io.github.takahirom.roborazzi)</summary>

###
[`v1.36.0`](https://redirect.github.com/takahirom/roborazzi/releases/tag/1.36.0)

[Compare
Source](https://redirect.github.com/takahirom/roborazzi/compare/1.35.0...1.36.0)

##### 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:

```kotlin
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:
>
> ```properties
>
roborazzi.record.filePathStrategy=relativePathFromRoborazziContextOutputDirectory
> ```

##### What's Changed

- \[Not library dependency update for users] Update dependency
org.robolectric:robolectric to v4.14.1 by
[@&#8203;renovate](https://redirect.github.com/renovate) in
[https://github.com/takahirom/roborazzi/pull/583](https://redirect.github.com/takahirom/roborazzi/pull/583)
- Add roborazzi.compare.output.dir gradle.properties by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/592](https://redirect.github.com/takahirom/roborazzi/pull/592)
- Add README section of outputDir by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/593](https://redirect.github.com/takahirom/roborazzi/pull/593)
- Fix documentation README tag problem by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/594](https://redirect.github.com/takahirom/roborazzi/pull/594)

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

###
[`v1.35.0`](https://redirect.github.com/takahirom/roborazzi/releases/tag/1.35.0)

[Compare
Source](https://redirect.github.com/takahirom/roborazzi/compare/1.34.0...1.35.0)

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

We have introduced [**Experimental Compose Preview Support in
1.22.0**](https://takahirom.github.io/roborazzi/preview-support.html),
but it does not yet support all parameters of the `@Preview` annotation.
Thanks to
[@&#8203;sergio-sastre](https://redirect.github.com/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
[@&#8203;sergio-sastre](https://redirect.github.com/sergio-sastre)

Here’s an example of a custom option:

```kotlin
    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](https://redirect.github.com/user-attachments/assets/5ef30741-b9de-42a5-8d40-a146ac0453bd)

##### 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

- \[Not Library dependency Update] Update dependency
androidx.compose.runtime:runtime to v1.7.5 by
[@&#8203;renovate](https://redirect.github.com/renovate) in
[https://github.com/takahirom/roborazzi/pull/548](https://redirect.github.com/takahirom/roborazzi/pull/548)
- Add .gitignore by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/578](https://redirect.github.com/takahirom/roborazzi/pull/578)
- Refactor Add support for heightDp, widthDp, showBackground,
backgroundColor by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/577](https://redirect.github.com/takahirom/roborazzi/pull/577)
- Add support for heightDp, widthDp, showBackground, backgroundColor by
[@&#8203;sergio-sastre](https://redirect.github.com/sergio-sastre) in
[https://github.com/takahirom/roborazzi/pull/576](https://redirect.github.com/takahirom/roborazzi/pull/576)
- Rename Applier to Config by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/579](https://redirect.github.com/takahirom/roborazzi/pull/579)
- Refactor naming by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/582](https://redirect.github.com/takahirom/roborazzi/pull/582)
- Add Assertion for minus or zero fontScale by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/584](https://redirect.github.com/takahirom/roborazzi/pull/584)
- Add a deprecated method of
ComposablePreview<AndroidPreviewInfo>.applyToRobolectricConfiguration()
as it was a ExperimentalApi by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/585](https://redirect.github.com/takahirom/roborazzi/pull/585)
- Adjustment for compose preview config by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/586](https://redirect.github.com/takahirom/roborazzi/pull/586)
- Refactor RoborazziComposeConfigBuilder by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/590](https://redirect.github.com/takahirom/roborazzi/pull/590)

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

###
[`v1.34.0`](https://redirect.github.com/takahirom/roborazzi/releases/tag/1.34.0)

[Compare
Source](https://redirect.github.com/takahirom/roborazzi/compare/1.33.0...1.34.0)

##### 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,
[@&#8203;colinrtwhite](https://redirect.github.com/colinrtwhite)!

##### Fixes for Accessibility Checks

We introduced [Experimental Accessibility Test Framework
checks](https://redirect.github.com/takahirom/roborazzi/tree/main/roborazzi-accessibility-check)
in [version
1.33.0](https://redirect.github.com/takahirom/roborazzi/releases/tag/1.33.0).\
Thanks to [@&#8203;yschimke](https://redirect.github.com/yschimke)'s
contribution, several fixes have been implemented for accessibility
checks, including check suppression and improved logging.

##### What's Changed

- Update accessibility sample to show presets by
[@&#8203;yschimke](https://redirect.github.com/yschimke) in
[https://github.com/takahirom/roborazzi/pull/562](https://redirect.github.com/takahirom/roborazzi/pull/562)
- Log warnings when Accessibility checks not configured correctly by
[@&#8203;yschimke](https://redirect.github.com/yschimke) in
[https://github.com/takahirom/roborazzi/pull/572](https://redirect.github.com/takahirom/roborazzi/pull/572)
- Fix: Restore Robolectric fingerprint after accessibility checks by
[@&#8203;yschimke](https://redirect.github.com/yschimke) in
[https://github.com/takahirom/roborazzi/pull/574](https://redirect.github.com/takahirom/roborazzi/pull/574)
- \[Idea Plugin] Fix wrong variable naming in Roborazzi IntelliJ Plugin
by [@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/571](https://redirect.github.com/takahirom/roborazzi/pull/571)
- Apply suppressions to AccessibilityViewCheckResult instead of
filtering by [@&#8203;yschimke](https://redirect.github.com/yschimke) in
[https://github.com/takahirom/roborazzi/pull/573](https://redirect.github.com/takahirom/roborazzi/pull/573)
- Fix the issue where the experimental annotation was exposed when using
stable APIs in Roborazzi options by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/566](https://redirect.github.com/takahirom/roborazzi/pull/566)

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

###
[`v1.33.0`](https://redirect.github.com/takahirom/roborazzi/releases/tag/1.33.0)

[Compare
Source](https://redirect.github.com/takahirom/roborazzi/compare/1.32.2...1.33.0)

##### Experimental Accessibility Test Framework checks

Thanks to [@&#8203;yschimke](https://redirect.github.com/yschimke)'s
contribution, we now have a library that integrates accessibility checks
into Roborazzi. It uses the [Accessibility Test
Framework](https://redirect.github.com/google/Accessibility-Test-Framework-for-Android)
to ensure accessibility.

Please add the library dependency:

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


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

##### Configure in Junit Rule

```kotlin
  @&#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

```kotlin
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

- Include AI assertion results in the Roborazzi test report by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/552](https://redirect.github.com/takahirom/roborazzi/pull/552)
- Add modules and configurations to dependency diff by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/558](https://redirect.github.com/takahirom/roborazzi/pull/558)
- Update Robolectric 4.14 by
[@&#8203;takahirom](https://redirect.github.com/takahirom) in
[https://github.com/takahirom/roborazzi/pull/426](https://redirect.github.com/takahirom/roborazzi/pull/426)
- Add basic ATF A11y checks via AccessibilityCheckAfterTestStrategy and
checkRoboAccessibility by
[@&#8203;yschimke](https://redirect.github.com/yschimke) in
[https://github.com/takahirom/roborazzi/pull/557](https://redirect.github.com/takahirom/roborazzi/pull/557)
- \[Dependency for sample in Roborazzi, Not a library dependency
change]Update dependency androidx.compose.foundation:foundation to
v1.7.5 by [@&#8203;renovate](https://redirect.github.com/renovate) in
[https://github.com/takahirom/roborazzi/pull/520](https://redirect.github.com/takahirom/roborazzi/pull/520)

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

</details>

---

### Configuration

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

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

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

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://redirect.github.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNi4zIiwidXBkYXRlZEluVmVyIjoiMzkuNTguMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
  • Loading branch information
slack-oss-bot authored Dec 10, 2024
1 parent 7156004 commit bdf5c34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ nullawayGradle = "2.1.0"
okhttp = "5.0.0-alpha.12"
okio = "3.9.1"
retrofit = "2.11.0"
roborazzi = "1.32.2"
roborazzi = "1.36.0"
slack-lint = "0.8.2"
sortDependencies = "0.13"
spotless = "7.0.0.BETA4"
Expand Down

0 comments on commit bdf5c34

Please sign in to comment.