diff --git a/.drone.yml b/.drone.yml index 29bdb3a652..8207b89d17 100644 --- a/.drone.yml +++ b/.drone.yml @@ -192,7 +192,7 @@ steps: - ./gradlew assembleGplayDebug - scripts/wait_for_emulator.sh - ./gradlew installGplayDebugAndroidTest - - ./gradlew gplayDebugExecuteScreenshotTests -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest && scripts/deleteOutdatedComments.sh "stable" "Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN + - scripts/runAllScreenshotCombinations "stable" false - name: notify image: drillster/drone-email settings: @@ -247,7 +247,7 @@ steps: - scripts/wait_for_emulator.sh - ./gradlew installGplayDebugAndroidTest - sed -i s"#5#1#" ./src/androidTest/java/com/nextcloud/client/RetryTestRule.kt - - ./gradlew gplayDebugExecuteScreenshotTests -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest && scripts/deleteOutdatedComments.sh "master" "Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "master" "Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN + - scripts/runAllScreenshotCombinations "master" false - name: notify image: drillster/drone-email settings: diff --git a/scripts/androidScreenshotTest b/scripts/androidScreenshotTest index 25673116f0..af75e64abc 100755 --- a/scripts/androidScreenshotTest +++ b/scripts/androidScreenshotTest @@ -3,11 +3,17 @@ if [ $# -lt 2 ]; then echo "1: record: true/false 2: class name -3: method name" +3: method name +4: darkMode / \"all\" to run all screenshot combinations +5: color" exit fi +sed -i s'#false#true#'g src/main/res/values/setup.xml + +emulator -writable-system -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-audio -skin 500x833 & + cd src/androidTest/java class=$(find | grep $2 | grep -E "java$|kt$" | head -n1|sed s'/\//\./'g | sed s'#^\.\.##' | sed s'#\.java##'| sed s'#\.kt##') @@ -37,8 +43,27 @@ else fi fi -./gradlew gplayDebugExecuteScreenshotTests $record \ --Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \ --Pandroid.testInstrumentationRunnerArguments.class=$class$method +if [ -e $4 ] ; then + darkMode="" +else + darkMode="-Pandroid.testInstrumentationRunnerArguments.DARKMODE=$4" +fi + +if [ -e $5 ] ; then + color="" +else + color="-Pandroid.testInstrumentationRunnerArguments.COLOR=$5" +fi + +if [[ $4 = "all" ]]; then + scripts/runAllScreenshotCombinations "noCI" "$1" "-Pandroid.testInstrumentationRunnerArguments.class=$class$method" +else + ./gradlew gplayDebugExecuteScreenshotTests $record \ + -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \ + -Pandroid.testInstrumentationRunnerArguments.class=$class$method \ + $darkMode \ + $color +fi + sed -i s'#true#false#'g src/main/res/values/setup.xml diff --git a/scripts/runAllScreenshotCombinations b/scripts/runAllScreenshotCombinations new file mode 100755 index 0000000000..01206011f8 --- /dev/null +++ b/scripts/runAllScreenshotCombinations @@ -0,0 +1,43 @@ +#!/bin/bash + +## $1 noCI/stable/master: wether to run deleteOutdatedComments.sh or uploadReport.sh +## $2 true/false: record or verify screenshots +## $3 classMethod: piped from androidScreenshotTest + +if [[ $2 = "true" ]]; then + record="-Precord" +else + record="" +fi + +classMethod=$3 + +while read line +do + darkMode=$(echo "$line" | cut -d" " -f1) + color=$(echo "$line" | cut -d" " -f2) + + echo "Run $color on $darkMode mode" + + if [[ $1 = "noCI" ]]; then + ./gradlew --console plain gplayDebugExecuteScreenshotTests \ + $record \ + -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \ + -Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \ + -Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" \ + $classMethod /dev/null + if [[ $? -ne 0 ]]; then + exit + fi + else + ./gradlew gplayDebugExecuteScreenshotTests \ + $record \ + -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \ + -Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \ + -Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" \ + && scripts/deleteOutdatedComments.sh "$1-$darkMode-$color" "Screenshot" "$DRONE_PULL_REQUEST" \ + "$GIT_USERNAME" "$GIT_TOKEN" \ + || scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$DRONE_BUILD_NUMBER" \ + "$1-$darkMode-$color" "Screenshot" "$DRONE_PULL_REQUEST" "$GIT_USERNAME" "$GIT_TOKEN" + fi +done < scripts/screenshotCombinations diff --git a/scripts/screenshotCombinations b/scripts/screenshotCombinations new file mode 100644 index 0000000000..1f697d792b --- /dev/null +++ b/scripts/screenshotCombinations @@ -0,0 +1 @@ +light blue diff --git a/src/androidTest/java/com/nextcloud/client/ActivitiesActivityIT.java b/src/androidTest/java/com/nextcloud/client/ActivitiesActivityIT.java index ed2c4495e7..035a870a7f 100644 --- a/src/androidTest/java/com/nextcloud/client/ActivitiesActivityIT.java +++ b/src/androidTest/java/com/nextcloud/client/ActivitiesActivityIT.java @@ -25,7 +25,6 @@ package com.nextcloud.client; import android.Manifest; import android.view.View; -import com.facebook.testing.screenshot.Screenshot; import com.owncloud.android.AbstractIT; import com.owncloud.android.R; import com.owncloud.android.ui.activities.ActivitiesActivity; @@ -60,16 +59,13 @@ public class ActivitiesActivityIT extends AbstractIT { onView(withId(R.id.drawer_layout)).perform(DrawerActions.open()); - sut.runOnUiThread(new Runnable() { - @Override - public void run() { - sut.emptyContentContainer.setVisibility(View.VISIBLE); - sut.recyclerView.setVisibility(View.INVISIBLE); - } + sut.runOnUiThread(() -> { + sut.emptyContentContainer.setVisibility(View.VISIBLE); + sut.recyclerView.setVisibility(View.INVISIBLE); }); waitForIdleSync(); - Screenshot.snapActivity(sut).record(); + screenshot(sut); } } diff --git a/src/androidTest/java/com/nextcloud/client/FileDisplayActivityIT.java b/src/androidTest/java/com/nextcloud/client/FileDisplayActivityIT.java index ae37f4f630..353d2daa1f 100644 --- a/src/androidTest/java/com/nextcloud/client/FileDisplayActivityIT.java +++ b/src/androidTest/java/com/nextcloud/client/FileDisplayActivityIT.java @@ -25,7 +25,6 @@ package com.nextcloud.client; import android.Manifest; import android.app.Activity; -import com.facebook.testing.screenshot.Screenshot; import com.owncloud.android.AbstractOnServerIT; import com.owncloud.android.R; import com.owncloud.android.datamodel.OCFile; @@ -126,7 +125,7 @@ public class FileDisplayActivityIT extends AbstractOnServerIT { shortSleep(); shortSleep(); - Screenshot.snapActivity(sut).record(); + screenshot(sut); } @Test diff --git a/src/androidTest/java/com/nextcloud/client/FileDisplayActivityScreenshotIT.java b/src/androidTest/java/com/nextcloud/client/FileDisplayActivityScreenshotIT.java index a934270309..e603f4dc7f 100644 --- a/src/androidTest/java/com/nextcloud/client/FileDisplayActivityScreenshotIT.java +++ b/src/androidTest/java/com/nextcloud/client/FileDisplayActivityScreenshotIT.java @@ -24,7 +24,6 @@ package com.nextcloud.client; import android.Manifest; -import com.facebook.testing.screenshot.Screenshot; import com.owncloud.android.AbstractIT; import com.owncloud.android.R; import com.owncloud.android.ui.activity.FileDisplayActivity; @@ -57,7 +56,7 @@ public class FileDisplayActivityScreenshotIT extends AbstractIT { sut.getListOfFilesFragment().setFabEnabled(false); sut.getListOfFilesFragment().setEmptyListLoadingMessage(); - Screenshot.snapActivity(sut).record(); + screenshot(sut); } @Test @@ -70,6 +69,6 @@ public class FileDisplayActivityScreenshotIT extends AbstractIT { sut.getListOfFilesFragment().setFabEnabled(false); sut.getListOfFilesFragment().setEmptyListLoadingMessage(); - Screenshot.snapActivity(sut).record(); + screenshot(sut); } } diff --git a/src/androidTest/java/com/nextcloud/client/FirstRunActivityIT.java b/src/androidTest/java/com/nextcloud/client/FirstRunActivityIT.java index c28cc56fa3..2f2be8d372 100644 --- a/src/androidTest/java/com/nextcloud/client/FirstRunActivityIT.java +++ b/src/androidTest/java/com/nextcloud/client/FirstRunActivityIT.java @@ -25,7 +25,6 @@ package com.nextcloud.client; import android.Manifest; import android.app.Activity; -import com.facebook.testing.screenshot.Screenshot; import com.nextcloud.client.onboarding.FirstRunActivity; import com.owncloud.android.AbstractIT; import com.owncloud.android.utils.ScreenshotTest; @@ -51,7 +50,7 @@ public class FirstRunActivityIT extends AbstractIT { public void open() { Activity sut = activityRule.launchActivity(null); - Screenshot.snapActivity(sut).record(); + screenshot(sut); } } diff --git a/src/androidTest/java/com/nextcloud/client/NotificationsActivityIT.java b/src/androidTest/java/com/nextcloud/client/NotificationsActivityIT.java deleted file mode 100644 index f4ba1bc39e..0000000000 --- a/src/androidTest/java/com/nextcloud/client/NotificationsActivityIT.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * Nextcloud Android client application - * - * @author Tobias Kaminsky - * Copyright (C) 2020 Tobias Kaminsky - * Copyright (C) 2020 Nextcloud GmbH - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package com.nextcloud.client; - -import android.Manifest; - -import com.owncloud.android.AbstractIT; -import com.owncloud.android.ui.activity.NotificationsActivity; -import com.owncloud.android.utils.ScreenshotTest; - -import org.junit.Rule; -import org.junit.Test; - -import androidx.test.espresso.intent.rule.IntentsTestRule; -import androidx.test.rule.GrantPermissionRule; - - -public class NotificationsActivityIT extends AbstractIT { - @Rule public IntentsTestRule activityRule = new IntentsTestRule<>(NotificationsActivity.class, - true, - false); - - @Rule - public final GrantPermissionRule permissionRule = GrantPermissionRule.grant( - Manifest.permission.WRITE_EXTERNAL_STORAGE); - - @Test - @ScreenshotTest - public void openDrawer() { - super.openDrawer(activityRule); - } -} diff --git a/src/androidTest/java/com/nextcloud/client/SettingsActivityIT.java b/src/androidTest/java/com/nextcloud/client/SettingsActivityIT.java index b850f81339..516a2d3061 100644 --- a/src/androidTest/java/com/nextcloud/client/SettingsActivityIT.java +++ b/src/androidTest/java/com/nextcloud/client/SettingsActivityIT.java @@ -25,7 +25,6 @@ package com.nextcloud.client; import android.Manifest; import android.app.Activity; -import com.facebook.testing.screenshot.Screenshot; import com.owncloud.android.AbstractIT; import com.owncloud.android.ui.activity.SettingsActivity; import com.owncloud.android.utils.ScreenshotTest; @@ -49,8 +48,8 @@ public class SettingsActivityIT extends AbstractIT { @Test @ScreenshotTest public void open() { - Activity test = activityRule.launchActivity(null); + Activity sut = activityRule.launchActivity(null); - Screenshot.snapActivity(test).record(); + screenshot(sut); } } diff --git a/src/androidTest/java/com/nextcloud/client/SyncedFoldersActivityIT.java b/src/androidTest/java/com/nextcloud/client/SyncedFoldersActivityIT.java index 5da5318c7d..8231e2fad0 100644 --- a/src/androidTest/java/com/nextcloud/client/SyncedFoldersActivityIT.java +++ b/src/androidTest/java/com/nextcloud/client/SyncedFoldersActivityIT.java @@ -25,7 +25,6 @@ package com.nextcloud.client; import android.Manifest; import android.content.Intent; -import com.facebook.testing.screenshot.Screenshot; import com.owncloud.android.AbstractIT; import com.owncloud.android.datamodel.MediaFolderType; import com.owncloud.android.datamodel.SyncedFolderDisplayItem; @@ -87,6 +86,6 @@ public class SyncedFoldersActivityIT extends AbstractIT { getInstrumentation().waitForIdleSync(); shortSleep(); - Screenshot.snap(Objects.requireNonNull(sut.requireDialog().getWindow()).getDecorView()).record(); + screenshot(Objects.requireNonNull(sut.requireDialog().getWindow()).getDecorView()); } } diff --git a/src/androidTest/java/com/owncloud/android/AbstractIT.java b/src/androidTest/java/com/owncloud/android/AbstractIT.java index eef413b24d..e9c9f8c747 100644 --- a/src/androidTest/java/com/owncloud/android/AbstractIT.java +++ b/src/androidTest/java/com/owncloud/android/AbstractIT.java @@ -7,8 +7,12 @@ import android.accounts.OperationCanceledException; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Context; +import android.os.Bundle; +import android.text.TextUtils; +import android.view.View; import com.facebook.testing.screenshot.Screenshot; +import com.facebook.testing.screenshot.internal.TestNameDetector; import com.nextcloud.client.account.User; import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.client.account.UserAccountManagerImpl; @@ -16,6 +20,8 @@ import com.nextcloud.client.device.BatteryStatus; import com.nextcloud.client.device.PowerManagementService; import com.nextcloud.client.network.Connectivity; import com.nextcloud.client.network.ConnectivityService; +import com.nextcloud.client.preferences.AppPreferencesImpl; +import com.nextcloud.client.preferences.DarkMode; import com.nextcloud.java.util.Optional; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; @@ -26,6 +32,7 @@ import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.OwnCloudClientFactory; import com.owncloud.android.lib.common.accounts.AccountUtils; import com.owncloud.android.lib.common.operations.RemoteOperationResult; +import com.owncloud.android.lib.resources.status.OCCapability; import com.owncloud.android.operations.CreateFolderOperation; import com.owncloud.android.operations.UploadFileOperation; import com.owncloud.android.utils.FileStorageUtils; @@ -65,6 +72,8 @@ public abstract class AbstractIT { protected static Account account; protected static User user; protected static Context targetContext; + protected static String DARK_MODE = ""; + protected static String COLOR = ""; protected Activity currentActivity; @@ -107,6 +116,63 @@ public abstract class AbstractIT { } catch (AccountUtils.AccountNotFoundException e) { e.printStackTrace(); } + + Bundle arguments = androidx.test.platform.app.InstrumentationRegistry.getArguments(); + + // color + String colorParameter = arguments.getString("COLOR"); + if (!TextUtils.isEmpty(colorParameter)) { + FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(account, + targetContext.getContentResolver()); + + String colorHex = null; + COLOR = colorParameter; + switch (colorParameter) { + case "red": + colorHex = "#7c0000"; + break; + + case "green": + colorHex = "#00ff00"; + break; + + case "white": + colorHex = "#ffffff"; + break; + + case "black": + colorHex = "#000000"; + break; + + default: + break; + } + + if (colorHex != null) { + OCCapability capability = fileDataStorageManager.getCapability(account.name); + capability.setServerColor(colorHex); + fileDataStorageManager.saveCapabilities(capability); + } + } + + // dark / light + String darkModeParameter = arguments.getString("DARKMODE"); + + if (darkModeParameter != null) { + if (darkModeParameter.equalsIgnoreCase("dark")) { + DARK_MODE = "dark"; + AppPreferencesImpl.fromContext(targetContext).setDarkThemeMode(DarkMode.DARK); + MainApp.setAppTheme(DarkMode.DARK); + } else { + DARK_MODE = "light"; + } + } + + if (DARK_MODE.equalsIgnoreCase("light") && COLOR.equalsIgnoreCase("blue")) { + // use already existing names + DARK_MODE = ""; + COLOR = ""; + } } protected FileDataStorageManager getStorageManager() { @@ -151,7 +217,7 @@ public abstract class AbstractIT { waitForIdleSync(); - Screenshot.snapActivity(sut).record(); + screenshot(sut); } protected Activity getCurrentActivity() { @@ -249,4 +315,26 @@ public abstract class AbstractIT { RemoteOperationResult result = newUpload.execute(client, getStorageManager()); assertTrue(result.getLogMessage(), result.isSuccess()); } + + protected void screenshot(View view) { + Screenshot.snap(view).setName(createName()).record(); + } + + protected void screenshot(Activity sut) { + Screenshot.snapActivity(sut).setName(createName()).record(); + } + + private String createName() { + String name = TestNameDetector.getTestClass() + "_" + TestNameDetector.getTestName(); + + if (!DARK_MODE.isEmpty()) { + name = name + "_" + DARK_MODE; + } + + if (!COLOR.isEmpty()) { + name = name + "_" + COLOR; + } + + return name; + } } diff --git a/src/androidTest/java/com/owncloud/android/ui/activity/ConflictsResolveActivityIT.java b/src/androidTest/java/com/owncloud/android/ui/activity/ConflictsResolveActivityIT.java index 1a7785099b..eef927cb14 100644 --- a/src/androidTest/java/com/owncloud/android/ui/activity/ConflictsResolveActivityIT.java +++ b/src/androidTest/java/com/owncloud/android/ui/activity/ConflictsResolveActivityIT.java @@ -24,7 +24,6 @@ package com.owncloud.android.ui.activity; import android.content.Intent; -import com.facebook.testing.screenshot.Screenshot; import com.nextcloud.client.account.UserAccountManagerImpl; import com.owncloud.android.AbstractIT; import com.owncloud.android.R; @@ -38,6 +37,8 @@ import com.owncloud.android.utils.ScreenshotTest; import org.junit.Rule; import org.junit.Test; +import java.util.Objects; + import androidx.fragment.app.DialogFragment; import androidx.test.espresso.intent.rule.IntentsTestRule; @@ -87,7 +88,7 @@ public class ConflictsResolveActivityIT extends AbstractIT { shortSleep(); - Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record(); + screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView()); } // @Test @@ -141,7 +142,7 @@ public class ConflictsResolveActivityIT extends AbstractIT { // getInstrumentation().waitForIdleSync(); // shortSleep(); // -// Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record(); +// screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView()); // } @Test @@ -222,7 +223,7 @@ public class ConflictsResolveActivityIT extends AbstractIT { onView(withId(R.id.existing_checkbox)).perform(click()); DialogFragment dialog = (DialogFragment) sut.getSupportFragmentManager().findFragmentByTag("conflictDialog"); - Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record(); + screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView()); onView(withText("OK")).perform(click()); @@ -267,7 +268,7 @@ public class ConflictsResolveActivityIT extends AbstractIT { onView(withId(R.id.new_checkbox)).perform(click()); DialogFragment dialog = (DialogFragment) sut.getSupportFragmentManager().findFragmentByTag("conflictDialog"); - Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record(); + screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView()); onView(withText("OK")).perform(click()); @@ -313,7 +314,7 @@ public class ConflictsResolveActivityIT extends AbstractIT { onView(withId(R.id.new_checkbox)).perform(click()); DialogFragment dialog = (DialogFragment) sut.getSupportFragmentManager().findFragmentByTag("conflictDialog"); - Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record(); + screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView()); onView(withText("OK")).perform(click()); diff --git a/src/androidTest/java/com/owncloud/android/ui/activity/ManageAccountsActivityIT.java b/src/androidTest/java/com/owncloud/android/ui/activity/ManageAccountsActivityIT.java index 0169fee467..9dd3de0956 100644 --- a/src/androidTest/java/com/owncloud/android/ui/activity/ManageAccountsActivityIT.java +++ b/src/androidTest/java/com/owncloud/android/ui/activity/ManageAccountsActivityIT.java @@ -24,7 +24,6 @@ package com.owncloud.android.ui.activity; import android.app.Activity; -import com.facebook.testing.screenshot.Screenshot; import com.nextcloud.client.account.User; import com.owncloud.android.AbstractIT; import com.owncloud.android.utils.ScreenshotTest; @@ -47,7 +46,7 @@ public class ManageAccountsActivityIT extends AbstractIT { shortSleep(); - Screenshot.snapActivity(sut).record(); + screenshot(sut); } @Test @@ -61,6 +60,6 @@ public class ManageAccountsActivityIT extends AbstractIT { shortSleep(); shortSleep(); - Screenshot.snapActivity(getCurrentActivity()).record(); + screenshot(getCurrentActivity()); } } diff --git a/src/androidTest/java/com/owncloud/android/ui/activity/NotificationsActivityIT.kt b/src/androidTest/java/com/owncloud/android/ui/activity/NotificationsActivityIT.kt index 1bbf2fdeaa..84cf501563 100644 --- a/src/androidTest/java/com/owncloud/android/ui/activity/NotificationsActivityIT.kt +++ b/src/androidTest/java/com/owncloud/android/ui/activity/NotificationsActivityIT.kt @@ -53,7 +53,7 @@ class NotificationsActivityIT : AbstractIT() { shortSleep() - Screenshot.snapActivity(sut).record() + screenshot(sut) } @Test @@ -114,7 +114,7 @@ class NotificationsActivityIT : AbstractIT() { shortSleep() - Screenshot.snapActivity(sut).record() + screenshot(sut) } @Test @@ -126,6 +126,6 @@ class NotificationsActivityIT : AbstractIT() { sut.runOnUiThread { sut.setEmptyContent("Error", "Error! Please try again later!") } - Screenshot.snapActivity(sut).record() + screenshot(sut) } } diff --git a/src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.java b/src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.java index 9c65527c68..8ad0ff3761 100644 --- a/src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.java +++ b/src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.java @@ -28,7 +28,6 @@ import android.accounts.AccountManager; import android.content.Intent; import android.os.Looper; -import com.facebook.testing.screenshot.Screenshot; import com.nextcloud.client.account.RegisteredUser; import com.nextcloud.client.account.Server; import com.nextcloud.ui.ChooseAccountDialogFragment; @@ -162,6 +161,6 @@ public class DialogFragmentIT extends AbstractIT { getInstrumentation().waitForIdleSync(); shortSleep(); - Screenshot.snap(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView()).record(); + screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView()); } } diff --git a/src/androidTest/java/com/owncloud/android/ui/dialog/SyncFileNotEnoughSpaceDialogFragmentTest.java b/src/androidTest/java/com/owncloud/android/ui/dialog/SyncFileNotEnoughSpaceDialogFragmentTest.java index 0f03f54a0f..434f199e76 100644 --- a/src/androidTest/java/com/owncloud/android/ui/dialog/SyncFileNotEnoughSpaceDialogFragmentTest.java +++ b/src/androidTest/java/com/owncloud/android/ui/dialog/SyncFileNotEnoughSpaceDialogFragmentTest.java @@ -24,7 +24,6 @@ package com.owncloud.android.ui.dialog; import android.Manifest; -import com.facebook.testing.screenshot.Screenshot; import com.owncloud.android.AbstractIT; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.ui.activity.FileDisplayActivity; @@ -32,6 +31,8 @@ import com.owncloud.android.ui.activity.FileDisplayActivity; import org.junit.Rule; import org.junit.Test; +import java.util.Objects; + import androidx.test.espresso.intent.rule.IntentsTestRule; import androidx.test.rule.GrantPermissionRule; @@ -58,7 +59,7 @@ public class SyncFileNotEnoughSpaceDialogFragmentTest extends AbstractIT { getInstrumentation().waitForIdleSync(); - Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record(); + screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView()); } @Test @@ -72,6 +73,6 @@ public class SyncFileNotEnoughSpaceDialogFragmentTest extends AbstractIT { getInstrumentation().waitForIdleSync(); - Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record(); + screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView()); } } diff --git a/src/androidTest/java/com/owncloud/android/ui/preview/PreviewTextFileFragmentTest.java b/src/androidTest/java/com/owncloud/android/ui/preview/PreviewTextFileFragmentTest.java index 1839217947..436234b74c 100644 --- a/src/androidTest/java/com/owncloud/android/ui/preview/PreviewTextFileFragmentTest.java +++ b/src/androidTest/java/com/owncloud/android/ui/preview/PreviewTextFileFragmentTest.java @@ -24,7 +24,6 @@ package com.owncloud.android.ui.preview; import android.Manifest; -import com.facebook.testing.screenshot.Screenshot; import com.owncloud.android.AbstractIT; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.ui.activity.FileDisplayActivity; @@ -64,7 +63,7 @@ public class PreviewTextFileFragmentTest extends AbstractIT { shortSleep(); - Screenshot.snapActivity(sut).record(); + screenshot(sut); } @Test @@ -82,6 +81,6 @@ public class PreviewTextFileFragmentTest extends AbstractIT { shortSleep(); - Screenshot.snapActivity(sut).record(); + screenshot(sut); } }