Merge pull request #12589 from nextcloud/excludeShot
Exclude shot for normal builds
4
.github/workflows/screenShotTest.yml
vendored
|
@ -8,7 +8,7 @@ permissions:
|
||||||
contents: read
|
contents: read
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: screenshot-test-${{ github.head_ref || github.run_id }}
|
group: screenshot-test-${{ github.head_ref || github.run_id }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
@ -73,6 +73,8 @@ jobs:
|
||||||
run: scripts/deleteOldComments.sh "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}}
|
run: scripts/deleteOldComments.sh "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}}
|
||||||
|
|
||||||
- name: Run screenshot tests
|
- name: Run screenshot tests
|
||||||
|
env:
|
||||||
|
SHOT_TEST: "true"
|
||||||
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1
|
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1
|
||||||
with:
|
with:
|
||||||
api-level: ${{ matrix.api-level }}
|
api-level: ${{ matrix.api-level }}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import com.github.spotbugs.snom.SpotBugsTask
|
|
||||||
import com.github.spotbugs.snom.Confidence
|
import com.github.spotbugs.snom.Confidence
|
||||||
import com.github.spotbugs.snom.Effort
|
import com.github.spotbugs.snom.Effort
|
||||||
|
import com.github.spotbugs.snom.SpotBugsTask
|
||||||
import org.gradle.internal.jvm.Jvm
|
import org.gradle.internal.jvm.Jvm
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
|
@ -32,7 +32,12 @@ apply plugin: 'pmd'
|
||||||
apply from: "$rootProject.projectDir/jacoco.gradle"
|
apply from: "$rootProject.projectDir/jacoco.gradle"
|
||||||
apply plugin: 'com.github.spotbugs'
|
apply plugin: 'com.github.spotbugs'
|
||||||
apply plugin: 'io.gitlab.arturbosch.detekt'
|
apply plugin: 'io.gitlab.arturbosch.detekt'
|
||||||
apply plugin: 'shot'
|
|
||||||
|
// needed to make renovate run without shot, as shot requires Android SDK
|
||||||
|
// https://github.com/pedrovgs/Shot/issues/300
|
||||||
|
if (shotTest) {
|
||||||
|
apply plugin: 'shot'
|
||||||
|
}
|
||||||
apply plugin: 'com.google.devtools.ksp'
|
apply plugin: 'com.google.devtools.ksp'
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,7 +104,11 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
// arguments to be passed to functional tests
|
// arguments to be passed to functional tests
|
||||||
testInstrumentationRunner "com.nextcloud.client.ScreenshotTestRunner"
|
if (shotTest) {
|
||||||
|
testInstrumentationRunner "com.karumi.shot.ShotTestRunner"
|
||||||
|
} else {
|
||||||
|
testInstrumentationRunner "com.nextcloud.client.TestRunner"
|
||||||
|
}
|
||||||
testInstrumentationRunnerArgument "TEST_SERVER_URL", "${NC_TEST_SERVER_BASEURL}"
|
testInstrumentationRunnerArgument "TEST_SERVER_URL", "${NC_TEST_SERVER_BASEURL}"
|
||||||
testInstrumentationRunnerArgument "TEST_SERVER_USERNAME", "${NC_TEST_SERVER_USERNAME}"
|
testInstrumentationRunnerArgument "TEST_SERVER_USERNAME", "${NC_TEST_SERVER_USERNAME}"
|
||||||
testInstrumentationRunnerArgument "TEST_SERVER_PASSWORD", "${NC_TEST_SERVER_PASSWORD}"
|
testInstrumentationRunnerArgument "TEST_SERVER_PASSWORD", "${NC_TEST_SERVER_PASSWORD}"
|
||||||
|
@ -431,11 +440,13 @@ detekt {
|
||||||
config.setFrom("detekt.yml")
|
config.setFrom("detekt.yml")
|
||||||
}
|
}
|
||||||
|
|
||||||
shot {
|
if (shotTest) {
|
||||||
showOnlyFailingTestsInReports = ciBuild
|
shot {
|
||||||
// CI environment renders some shadows slightly different from local VMs
|
showOnlyFailingTestsInReports = ciBuild
|
||||||
// Add a 0.5% tolerance to account for that
|
// CI environment renders some shadows slightly different from local VMs
|
||||||
tolerance = ciBuild ? 0.5 : 0
|
// Add a 0.5% tolerance to account for that
|
||||||
|
tolerance = ciBuild ? 0.5 : 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jacoco {
|
jacoco {
|
||||||
|
|
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 8 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 8 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 8.5 KiB |
|
@ -137,7 +137,7 @@ class FileDisplayActivityIT : AbstractOnServerIT() {
|
||||||
.perform(NavigationViewActions.navigateTo(R.id.nav_shared))
|
.perform(NavigationViewActions.navigateTo(R.id.nav_shared))
|
||||||
shortSleep()
|
shortSleep()
|
||||||
shortSleep()
|
shortSleep()
|
||||||
screenshot(sut)
|
// screenshot(sut) // todo run without real server
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -27,11 +27,11 @@ import android.app.Application
|
||||||
import android.app.Instrumentation
|
import android.app.Instrumentation
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import androidx.test.runner.AndroidJUnitRunner
|
||||||
import com.github.tmurakami.dexopener.DexOpener
|
import com.github.tmurakami.dexopener.DexOpener
|
||||||
import com.karumi.shot.ShotTestRunner
|
|
||||||
import com.nextcloud.test.TestMainApp
|
import com.nextcloud.test.TestMainApp
|
||||||
|
|
||||||
class ScreenshotTestRunner : ShotTestRunner() {
|
class TestRunner : AndroidJUnitRunner() {
|
||||||
@Throws(ClassNotFoundException::class, IllegalAccessException::class, InstantiationException::class)
|
@Throws(ClassNotFoundException::class, IllegalAccessException::class, InstantiationException::class)
|
||||||
override fun newApplication(cl: ClassLoader, className: String, context: Context): Application {
|
override fun newApplication(cl: ClassLoader, className: String, context: Context): Application {
|
||||||
/*
|
/*
|
|
@ -25,6 +25,7 @@ package com.owncloud.android.ui.dialog;
|
||||||
import com.owncloud.android.AbstractIT;
|
import com.owncloud.android.AbstractIT;
|
||||||
import com.owncloud.android.datamodel.OCFile;
|
import com.owncloud.android.datamodel.OCFile;
|
||||||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||||
|
import com.owncloud.android.utils.ScreenshotTest;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -41,6 +42,7 @@ public class SyncFileNotEnoughSpaceDialogFragmentTest extends AbstractIT {
|
||||||
false);
|
false);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ScreenshotTest
|
||||||
public void showNotEnoughSpaceDialogForFolder() {
|
public void showNotEnoughSpaceDialogForFolder() {
|
||||||
FileDisplayActivity test = activityRule.launchActivity(null);
|
FileDisplayActivity test = activityRule.launchActivity(null);
|
||||||
OCFile ocFile = new OCFile("/Document/");
|
OCFile ocFile = new OCFile("/Document/");
|
||||||
|
@ -56,6 +58,7 @@ public class SyncFileNotEnoughSpaceDialogFragmentTest extends AbstractIT {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ScreenshotTest
|
||||||
public void showNotEnoughSpaceDialogForFile() {
|
public void showNotEnoughSpaceDialogForFile() {
|
||||||
FileDisplayActivity test = activityRule.launchActivity(null);
|
FileDisplayActivity test = activityRule.launchActivity(null);
|
||||||
OCFile ocFile = new OCFile("/Video.mp4");
|
OCFile ocFile = new OCFile("/Video.mp4");
|
||||||
|
|
|
@ -26,6 +26,7 @@ import com.owncloud.android.AbstractIT;
|
||||||
import com.owncloud.android.datamodel.OCFile;
|
import com.owncloud.android.datamodel.OCFile;
|
||||||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||||
import com.owncloud.android.utils.MimeTypeUtil;
|
import com.owncloud.android.utils.MimeTypeUtil;
|
||||||
|
import com.owncloud.android.utils.ScreenshotTest;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -41,7 +42,7 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
|
||||||
false);
|
false);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// @ScreenshotTest // todo run without real server
|
@ScreenshotTest
|
||||||
public void displaySimpleTextFile() throws IOException {
|
public void displaySimpleTextFile() throws IOException {
|
||||||
FileDisplayActivity sut = activityRule.launchActivity(null);
|
FileDisplayActivity sut = activityRule.launchActivity(null);
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// @ScreenshotTest // todo run without real server
|
@ScreenshotTest
|
||||||
public void displayJavaSnippetFile() throws IOException {
|
public void displayJavaSnippetFile() throws IOException {
|
||||||
FileDisplayActivity sut = activityRule.launchActivity(null);
|
FileDisplayActivity sut = activityRule.launchActivity(null);
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ class TrashbinActivityIT : AbstractIT() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ScreenshotTest
|
||||||
fun normalUser() {
|
fun normalUser() {
|
||||||
val sut: TrashbinActivity = activityRule.launchActivity(null)
|
val sut: TrashbinActivity = activityRule.launchActivity(null)
|
||||||
|
|
||||||
|
@ -124,6 +125,7 @@ class TrashbinActivityIT : AbstractIT() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ScreenshotTest
|
||||||
fun differentUser() {
|
fun differentUser() {
|
||||||
val temp = Account("differentUser@https://nextcloud.localhost", MainApp.getAccountType(targetContext))
|
val temp = Account("differentUser@https://nextcloud.localhost", MainApp.getAccountType(targetContext))
|
||||||
|
|
||||||
|
|
|
@ -235,14 +235,19 @@ public class TrashbinListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
thumbnailView.setImageBitmap(thumbnail);
|
thumbnailView.setImageBitmap(thumbnail);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
thumbnailView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(file.getMimeType(),
|
||||||
|
file.getFileName(),
|
||||||
|
context,
|
||||||
|
viewThemeUtils));
|
||||||
|
|
||||||
// generate new thumbnail
|
// generate new thumbnail
|
||||||
if (ThumbnailsCacheManager.cancelPotentialThumbnailWork(file, thumbnailView)) {
|
if (ThumbnailsCacheManager.cancelPotentialThumbnailWork(file, thumbnailView)) {
|
||||||
try {
|
try {
|
||||||
final ThumbnailsCacheManager.ThumbnailGenerationTask task =
|
final ThumbnailsCacheManager.ThumbnailGenerationTask task =
|
||||||
new ThumbnailsCacheManager.ThumbnailGenerationTask(thumbnailView,
|
new ThumbnailsCacheManager.ThumbnailGenerationTask(thumbnailView,
|
||||||
storageManager,
|
storageManager,
|
||||||
user,
|
user,
|
||||||
asyncTasks);
|
asyncTasks);
|
||||||
|
|
||||||
final ThumbnailsCacheManager.AsyncThumbnailDrawable asyncDrawable =
|
final ThumbnailsCacheManager.AsyncThumbnailDrawable asyncDrawable =
|
||||||
new ThumbnailsCacheManager.AsyncThumbnailDrawable(context.getResources(),
|
new ThumbnailsCacheManager.AsyncThumbnailDrawable(context.getResources(),
|
||||||
|
|
|
@ -21,6 +21,7 @@ buildscript {
|
||||||
roomVersion = "2.6.1"
|
roomVersion = "2.6.1"
|
||||||
|
|
||||||
ciBuild = System.getenv("CI") == "true"
|
ciBuild = System.getenv("CI") == "true"
|
||||||
|
shotTest = System.getenv("SHOT_TEST") == "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ fi
|
||||||
if [[ $4 = "all" ]]; then
|
if [[ $4 = "all" ]]; then
|
||||||
scripts/runAllScreenshotCombinations "noCI" "$1" "-Pandroid.testInstrumentationRunnerArguments.class=$class$method"
|
scripts/runAllScreenshotCombinations "noCI" "$1" "-Pandroid.testInstrumentationRunnerArguments.class=$class$method"
|
||||||
else
|
else
|
||||||
./gradlew --offline gplayDebugExecuteScreenshotTests $record \
|
SHOT_TEST=true ./gradlew --offline gplayDebugExecuteScreenshotTests $record \
|
||||||
-Dorg.gradle.jvmargs="--add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.nio.channels=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED" \
|
-Dorg.gradle.jvmargs="--add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.nio.channels=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED" \
|
||||||
-Pscreenshot=true \
|
-Pscreenshot=true \
|
||||||
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
|
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
|
||||||
|
|