Skip to content

Commit

Permalink
Merge pull request #602 from usefulness/renovate/io.github.usefulness…
Browse files Browse the repository at this point in the history
…-screenshot-testing-core-1.x

Update dependency io.github.usefulness:screenshot-testing-core to v1
  • Loading branch information
mateuszkwiecinski authored May 19, 2024
2 parents 8fe35fa + fe9d249 commit 4f5a17a
Show file tree
Hide file tree
Showing 37 changed files with 55 additions and 81 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,6 @@ jobs:

- uses: gradle/actions/setup-gradle@v3

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: '.python-version'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install 'Pillow==9.1.1'
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
Expand Down
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

107 changes: 41 additions & 66 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ buildscript {
}
dependencies {
classpath "com.project.starter:android:0.73.0"
classpath "io.github.usefulness:screenshot-testing-plugin:0.17.5"
classpath "io.github.usefulness:screenshot-testing-plugin:1.0.2"
if (project.hasProperty("useMavenLocal")) {
classpath "com.project.starter.local:easylauncher:+"
} else {
Expand Down Expand Up @@ -91,6 +91,7 @@ subprojects {
}
}

String lastTask = null
android.applicationVariants.configureEach { variant ->
def recordTask = tasks.findByName("record${variant.name.capitalize()}AndroidTestScreenshotTest")

Expand All @@ -105,6 +106,17 @@ subprojects {

tasks.recordAll.dependsOn recordAndCopyTask
}

if (lastTask != null) {
if (gradle.gradleVersion.startsWith("8.0")) {
return
}
tasks.named { it == "record${variant.name.capitalize()}AndroidTestScreenshotTest" }.configureEach {
mustRunAfter("record${lastTask.capitalize()}AndroidTestScreenshotTest")
mustRunAfter("recordAndCopy${lastTask.capitalize()}AndroidTestScreenshotTest")
}
}
lastTask = variant.name
}

tasks.register("verifyAll") {
Expand All @@ -125,92 +137,55 @@ subprojects {
useJUnitPlatform()
}

screenshots {
addDeps = false
failureDir = layout.buildDirectory.dir("failedScreenshots").get().asFile.path
}

dependencies {
androidTestImplementation project(":screenshot-test-helpers")
}
}

pluginManager.withPlugin("com.android.library") {
pluginManager.apply("io.github.usefulness.screenshot-testing-plugin")

android {
testOptions.unitTests.includeAndroidResources true
pluginManager.withPlugin("io.github.usefulness.screenshot-testing-plugin") {
tasks.register("recordAll", Copy) {
group = 'screenshot test'

packagingOptions {
exclude "META-INF/LICENSE*"
}
def tempDir = layout.buildDirectory.map { it.dir("screenshots_tmp") }
from tempDir
into "screenshots/"

testVariants.configureEach { variant ->
variant.mergedFlavor.applicationIdSuffix = variant.name
if (variant.flavorName == "") {
variant.mergedFlavor.manifestPlaceholders += [appName: "$project.name"]
} else {
variant.mergedFlavor.manifestPlaceholders += [appName: "$variant.flavorName"]
doLast {
tempDir.get().asFile.deleteDir()
}
}

lintOptions {
disable("VectorPath", "HardcodedText", "IconDuplicates", "ContentDescription")
android.libraryVariants.configureEach { variant ->
def recordTask = tasks.findByName("record${variant.name.capitalize()}AndroidTestScreenshotTest")

if (agpVersion == "" || agpVersion.startsWith("8")) {
disable("MonochromeLauncherIcon")
}
if (recordTask != null) {
def recordAndCopyTask = "recordAndCopy${variant.name.capitalize()}AndroidTestScreenshotTest"

warningsAsErrors = true
}
}
tasks.register(recordAndCopyTask, Copy) {
from "screenshots/"
into layout.buildDirectory.dir("screenshots_tmp")
dependsOn recordTask
}

tasks.register("recordAll", Copy) {
group = 'screenshot test'

def tempDir = layout.buildDirectory.map { it.dir("screenshots_tmp") }
from tempDir
into "screenshots/"

doLast {
tempDir.get().asFile.deleteDir()
tasks.recordAll.dependsOn recordAndCopyTask
}
}
}

android.libraryVariants.configureEach { variant ->
def recordTask = tasks.findByName("record${variant.name.capitalize()}AndroidTestScreenshotTest")

if (recordTask != null) {
def recordAndCopyTask = "recordAndCopy${variant.name.capitalize()}AndroidTestScreenshotTest"

tasks.register(recordAndCopyTask, Copy) {
from "screenshots/"
into layout.buildDirectory.dir("screenshots_tmp")
dependsOn recordTask
tasks.register("verifyAll") {
group = 'screenshot test'
android.libraryVariants.configureEach { variant ->
dependsOn("verify${variant.flavorName.capitalize()}DebugAndroidTestScreenshotTest")
}

tasks.recordAll.dependsOn recordAndCopyTask
}
}

tasks.register("verifyAll") {
group = 'screenshot test'
android.libraryVariants.configureEach { variant ->
dependsOn("verify${variant.flavorName.capitalize()}DebugAndroidTestScreenshotTest")
tasks.withType(Test).configureEach {
useJUnitPlatform()
}
}

tasks.withType(Test).configureEach {
useJUnitPlatform()
}

screenshots {
addDeps = false
failureDir = layout.buildDirectory.map { it.dir("failedScreenshots") }.get().asFile
}

dependencies {
androidTestImplementation project(":screenshot-test-helpers")
dependencies {
androidTestImplementation project(":screenshot-test-helpers")
}
}
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/example-custom/screenshots/Icons_doScreenshot(qaAaa).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/example-custom/screenshots/Icons_doScreenshot(qaBbb).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions sample/example-library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
apply plugin: 'com.starter.library.android'
apply plugin: 'com.starter.easylauncher'
pluginManager.apply("io.github.usefulness.screenshot-testing-plugin")

android {
namespace "com.example.simple"

defaultConfig {
minSdk = 26
}

packagingOptions {
exclude "META-INF/LICENSE*"
}

testOptions.unitTests.includeAndroidResources true

testVariants.configureEach { variant ->
variant.mergedFlavor.manifestPlaceholders = [appName: ""]
}

unitTestVariants.configureEach { variant ->
variant.mergedFlavor.manifestPlaceholders = [appName: ""]
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/example-simple/screenshots/Icons_doScreenshot(debug).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/example-vector/screenshots/Icons_doScreenshot(alpha).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/example-webp/screenshots/Icons_doScreenshot(debug).png
2 changes: 1 addition & 1 deletion sample/screenshot-test-helpers/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {

dependencies {
implementation(project(":adaptive-support"))
api("io.github.usefulness:screenshot-testing-core:0.17.5")
api("io.github.usefulness:screenshot-testing-core:1.0.2")
api(platform("org.junit:junit-bom:5.10.2"))
api("org.junit.vintage:junit-vintage-engine:5.10.2")
api("androidx.test:rules:1.5.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import android.view.View
import androidx.annotation.DrawableRes
import androidx.test.core.app.ActivityScenario
import androidx.test.core.app.ApplicationProvider
import com.facebook.testing.screenshot.Screenshot
import com.facebook.testing.screenshot.TestNameDetector
import com.facebook.testing.screenshot.ViewHelpers
import io.github.usefulness.testing.screenshot.Screenshot
import io.github.usefulness.testing.screenshot.TestNameDetector
import io.github.usefulness.testing.screenshot.ViewHelpers
import kotlin.reflect.KClass
import com.example.custom.adaptive.R as AdaptiveR

Expand Down

0 comments on commit 4f5a17a

Please sign in to comment.