mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
Decoupled screenshot test runner and screenshot comparison
This commit is contained in:
@@ -123,6 +123,7 @@ dependencies {
|
||||
|
||||
screenshotTests {
|
||||
enabled = project.hasProperty("screenshot-tests")
|
||||
enableComparison = project.hasProperty("screenshot-comparison")
|
||||
strictComparison = project.hasProperty("screenshot-strict-comparison")
|
||||
testAnnotations = ["com.yandex.test.screenshot.Screenshot"]
|
||||
deviceDir = "${android.defaultConfig.applicationId}/screenshots"
|
||||
|
||||
+6
-2
@@ -36,7 +36,11 @@ class ScreenshotTestPlugin : Plugin<Project> {
|
||||
}
|
||||
}
|
||||
project.tasks.register(ValidateTestResultsTask.NAME, ValidateTestResultsTask::class.java)
|
||||
project.tasks.register(PullScreenshotsTask.NAME, PullScreenshotsTask::class.java)
|
||||
project.tasks.register(PullScreenshotsTask.NAME, PullScreenshotsTask::class.java).configure {
|
||||
if (screenshotTests.enableComparison) {
|
||||
it.finalizedBy(CompareScreenshotsTask.NAME)
|
||||
}
|
||||
}
|
||||
project.tasks.register(CompareScreenshotsTask.NAME, CompareScreenshotsTask::class.java)
|
||||
|
||||
project.tasks.whenTaskAdded { task ->
|
||||
@@ -50,7 +54,7 @@ class ScreenshotTestPlugin : Plugin<Project> {
|
||||
val isDependentTask = task.name.run {
|
||||
startsWith("connected") && endsWith("AndroidTest")
|
||||
}
|
||||
if (enabled && isDependentTask) task.finalizedBy(CompareScreenshotsTask.NAME)
|
||||
if (enabled && isDependentTask) task.finalizedBy(PullScreenshotsTask.NAME)
|
||||
}
|
||||
|
||||
project.androidComponents.finalizeDsl {
|
||||
|
||||
+1
@@ -3,6 +3,7 @@ package com.yandex.test.screenshot
|
||||
open class ScreenshotTestPluginExtension {
|
||||
|
||||
var enabled: Boolean = true
|
||||
var enableComparison: Boolean = true
|
||||
var strictComparison: Boolean = false
|
||||
var testAnnotations = mutableListOf<String>()
|
||||
var deviceDir = "screenshots"
|
||||
|
||||
-1
@@ -29,7 +29,6 @@ open class CompareScreenshotsTask : DefaultTask() {
|
||||
|
||||
init {
|
||||
group = "verification"
|
||||
this.dependsOn(PullScreenshotsTask.NAME)
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
|
||||
Reference in New Issue
Block a user