Skip to content

Commit b0cebf5

Browse files
jmartinespElementBotbmarty
authored
Improve screenshot testing with ComposablePreviewScanner (#3125)
* Use ComposablePreviewScanner to rework how screenshot testing works * Add test sharding * Update screenshots * Fixes for Element Gallery --------- Co-authored-by: ElementBot <[email protected]> Co-authored-by: Benoit Marty <[email protected]>
1 parent d68ddc6 commit b0cebf5

File tree

2,063 files changed

+1607
-1768
lines changed

Some content is hidden

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

2,063 files changed

+1607
-1768
lines changed

.github/workflows/scripts/recordScreenshots.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ echo "Deleting previous screenshots"
6565
./gradlew removeOldSnapshots --stacktrace --warn
6666

6767
echo "Record screenshots"
68-
./gradlew recordPaparazziDebug --stacktrace --warn
68+
./gradlew recordPaparazziDebug --stacktrace
6969

7070
echo "Committing changes"
7171
git config http.sslVerify false

app/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ plugins {
3131
id("io.element.android-compose-application")
3232
alias(libs.plugins.kotlin.android)
3333
alias(libs.plugins.anvil)
34-
alias(libs.plugins.ksp)
3534
alias(libs.plugins.kapt)
3635
// When using precompiled plugins, we need to apply the firebase plugin like this
3736
id(libs.plugins.firebaseAppDistribution.get().pluginId)
@@ -283,6 +282,5 @@ dependencies {
283282
testImplementation(libs.test.turbine)
284283
testImplementation(projects.libraries.matrix.test)
285284

286-
ksp(libs.showkase.processor)
287285
koverDependencies()
288286
}

appconfig/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
plugins {
1717
id("io.element.android-library")
1818
alias(libs.plugins.anvil)
19-
alias(libs.plugins.ksp)
2019
}
2120

2221
android {

appnav/build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import extension.allFeaturesApi
2121
plugins {
2222
id("io.element.android-compose-library")
2323
alias(libs.plugins.anvil)
24-
alias(libs.plugins.ksp)
2524
alias(libs.plugins.kapt)
2625
id("kotlin-parcelize")
2726
}
@@ -78,6 +77,4 @@ dependencies {
7877
testImplementation(projects.services.analytics.test)
7978
testImplementation(libs.test.appyx.junit)
8079
testImplementation(libs.test.arch.core)
81-
82-
ksp(libs.showkase.processor)
8380
}

build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,15 @@ allprojects {
160160
// Record all the languages?
161161
if (project.hasProperty("allLanguagesNoEnglish")) {
162162
// Do not record English language
163-
exclude("ui/S.class")
163+
exclude("ui/*.class")
164164
} else if (project.hasProperty("allLanguages").not()) {
165165
// Do not record other languages
166-
exclude("ui/T.class")
166+
exclude("translations/*.class")
167167
}
168168
} else {
169169
// Disable screenshot tests by default
170-
exclude("ui/S.class")
171-
exclude("ui/T.class")
170+
exclude("ui/*.class")
171+
exclude("translations/*.class")
172172
}
173173
}
174174
}

docs/screenshot_testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
## Overview
1414

1515
- Screenshot tests are tests which record the content of a rendered screen and verify subsequent runs to check if the screen renders differently.
16-
- Element X uses [Paparazzi](https://github.com/cashapp/paparazzi) to render, record and verify Composable. All Composable Preview will be use to make screenshot test, thanks to the usage of [Showkase](https://github.com/airbnb/Showkase).
16+
- Element X uses [Paparazzi](https://github.com/cashapp/paparazzi) to render, record and verify Composables. All internal/public Composable Preview will be used for screenshot tests, thanks to the usage of [ComposablePreviewScanner](https://github.com/sergio-sastre/ComposablePreviewScanner).
1717
- The screenshot verification occurs on every pull request as part of the `tests.yml` workflow.
1818

1919
## Setup

features/analytics/api/build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
plugins {
1717
id("io.element.android-compose-library")
18-
alias(libs.plugins.ksp)
1918
}
2019

2120
android {
@@ -27,6 +26,4 @@ dependencies {
2726
implementation(projects.libraries.designsystem)
2827
implementation(projects.libraries.androidutils)
2928
implementation(projects.libraries.uiStrings)
30-
31-
ksp(libs.showkase.processor)
3229
}

features/analytics/impl/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
plugins {
1818
id("io.element.android-compose-library")
1919
alias(libs.plugins.anvil)
20-
alias(libs.plugins.ksp)
2120
id("kotlin-parcelize")
2221
}
2322

@@ -42,7 +41,6 @@ dependencies {
4241
implementation(projects.appconfig)
4342
implementation(libs.androidx.datastore.preferences)
4443
implementation(libs.androidx.browser)
45-
ksp(libs.showkase.processor)
4644

4745
testImplementation(libs.test.junit)
4846
testImplementation(libs.coroutines.test)

features/call/impl/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
plugins {
1818
id("io.element.android-compose-library")
1919
alias(libs.plugins.anvil)
20-
alias(libs.plugins.ksp)
2120
id("kotlin-parcelize")
2221
alias(libs.plugins.kotlin.serialization)
2322
}
@@ -57,7 +56,6 @@ dependencies {
5756
implementation(libs.network.retrofit)
5857
implementation(libs.serialization.json)
5958
api(projects.features.call.api)
60-
ksp(libs.showkase.processor)
6159

6260
testImplementation(libs.coroutines.test)
6361
testImplementation(libs.molecule.runtime)

features/createroom/impl/build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
plugins {
1818
id("io.element.android-compose-library")
1919
alias(libs.plugins.anvil)
20-
alias(libs.plugins.ksp)
2120
id("kotlin-parcelize")
2221
}
2322

@@ -71,6 +70,4 @@ dependencies {
7170
testImplementation(projects.tests.testutils)
7271
testImplementation(libs.androidx.compose.ui.test.junit)
7372
testReleaseImplementation(libs.androidx.compose.ui.test.manifest)
74-
75-
ksp(libs.showkase.processor)
7673
}

0 commit comments

Comments
 (0)