Skip to content

Commit 6df6aa2

Browse files
committed
[Update] using roborazzi for the screenshot tests
1 parent d336f85 commit 6df6aa2

52 files changed

Lines changed: 194 additions & 61 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ Wait until gradle finishes and press the play button.
3333

3434
To run the unit tests: `./gradlew lint testDebug --continue --rerun-tasks`
3535

36-
To run the UI tests: `./gradlew connectedDebugAndroidTest`
36+
To run instrumented tests: `./gradlew connectedDebugAndroidTest`
3737

38-
To record the screenshots test: `./gradlew executeScreenshotTests -Precord`
38+
To record the screenshots test: `./gradlew recordRoborazziDebug`
3939

40-
To execute the screenshots test: `./gradlew executeScreenshotTests`
40+
To execute the screenshots test: `./gradlew verifyRoborazziDebug`
4141

4242
## Screenshots
4343

@@ -70,4 +70,4 @@ To execute the screenshots test: `./gradlew executeScreenshotTests`
7070

7171
- [Compose UI testing](https://developer.android.com/jetpack/compose/testing) - Compose UI tests
7272

73-
- [Shot](https://github.com/pedrovgs/Shot) - Screenshot tests
73+
- [Roborazzi](https://github.com/takahirom/roborazzi) - Screenshot tests

build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ buildscript {
44
mavenCentral()
55
maven(url = "https://plugins.gradle.org/m2/")
66
}
7-
dependencies {
8-
classpath(libs.shot)
9-
}
107
}
118

129
plugins {

feature-characters/build.gradle.kts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
alias(libs.plugins.kotlin.parcelize)
55
alias(libs.plugins.ksp)
66
alias(libs.plugins.hilt)
7-
id("shot")
7+
alias(libs.plugins.roborazzi)
88
alias(libs.plugins.kotlin.serialization)
99
}
1010

@@ -16,7 +16,7 @@ android {
1616
testOptions.targetSdk = libs.versions.android.targetSdk.get().toInt()
1717

1818
testApplicationId = "com.rumosoft.marvelcomposetest"
19-
testInstrumentationRunner = "com.karumi.shot.ShotTestRunner"
19+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2020
consumerProguardFiles("consumer-rules.pro")
2121
}
2222

@@ -40,6 +40,9 @@ android {
4040
unitTests {
4141
isReturnDefaultValues = true
4242
isIncludeAndroidResources = true
43+
all {
44+
it.systemProperties["robolectric.pixelCopyRenderMode"] = "hardware"
45+
}
4346
}
4447
}
4548
namespace = "com.rumosoft.characters"
@@ -84,6 +87,15 @@ dependencies {
8487
testImplementation(libs.junitparams)
8588
testImplementation(libs.junit.platform.launcher)
8689
testImplementation(libs.junit.platform.engine)
90+
testImplementation(libs.roborazzi)
91+
testImplementation(libs.roborazzi.compose)
92+
testImplementation(libs.roborazzi.rule)
93+
testImplementation(libs.robolectric)
94+
testImplementation(libs.ui.test.junit4)
95+
testImplementation(libs.androidx.test.ext.junit)
96+
97+
// JUnit Vintage Engine to run JUnit 4 tests on JUnit 5 platform
98+
testImplementation(libs.junit.vintage.engine)
8799

88100
androidTestImplementation(platform(libs.compose.bom))
89101
androidTestImplementation(libs.androidx.test.core)
@@ -97,11 +109,10 @@ dependencies {
97109
debugImplementation(libs.ui.test.manifest)
98110
}
99111

100-
shot {
101-
applicationId = "com.rumosoft.marvelcomposeshot"
112+
tasks.withType<Test>().configureEach {
113+
useJUnitPlatform()
102114
}
103115

104-
// Ensure JUnit Jupiter tests are run
105-
tasks.withType<Test> {
106-
useJUnitPlatform()
116+
roborazzi {
117+
outputDir.set(file("screenshots"))
107118
}
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)