diff --git a/build.gradle b/build.gradle index 479a6b6e25..0e87ab51be 100644 --- a/build.gradle +++ b/build.gradle @@ -296,3 +296,25 @@ dependencyAnalysis { } } } + +task recordScreenshots(type: GradleBuild) { + startParameter.projectProperties.screenshot = "" + tasks = [':vector:recordPaparazziGplayDebug'] +} + +task verifyScreenshots(type: GradleBuild) { + startParameter.projectProperties.screenshot = "" + tasks = [':vector:verifyPaparazziGplayDebug'] +} + +ext.initScreenshotTests = { project -> + project.apply plugin: 'app.cash.paparazzi' + project.android.testOptions.unitTests.all { + def screenshotTestCapture = "**/*ScreenshotTest*" + if (project.hasProperty("screenshot")) { + include screenshotTestCapture + } else { + exclude screenshotTestCapture + } + } +} diff --git a/vector/build.gradle b/vector/build.gradle index 61190a2fa2..ff0d907212 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -3,7 +3,6 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-parcelize' apply plugin: 'kotlin-kapt' apply plugin: 'dagger.hilt.android.plugin' -apply plugin: 'app.cash.paparazzi' if (project.hasProperty("coverage")) { apply plugin: 'jacoco' @@ -25,6 +24,8 @@ project.android.buildTypes.all { buildType -> ] } +initScreenshotTests(project) + android { // Due to a bug introduced in Android gradle plugin 3.6.0, we have to specify the ndk version to use // Ref: https://issuetracker.google.com/issues/144111441