drone/ updateScreenshot update

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2020-04-28 17:39:39 +02:00
parent ee6e5311b8
commit d0f3a00637
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
75 changed files with 127 additions and 49 deletions

View file

@ -29,7 +29,7 @@ steps:
- ./gradlew installGplayDebugAndroidTest
- scripts/wait_for_server.sh "server-stable"
- ./gradlew createGplayDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable-IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew executeScreenshotTests || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable-Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew gplayDebugExecuteScreenshotTests -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable-Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew combinedTestReport
- name: notify
image: drillster/drone-email
@ -58,6 +58,7 @@ services:
image: nextcloudci/server:server-17 # also change in updateScreenshots.sh
commands:
- BRANCH='stable18' /usr/local/bin/initnc.sh
- su www-data -c "echo 127.0.0.1 server >> /etc/hosts"
- su www-data -c "OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1"
- su www-data -c "OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2"
- su www-data -c "OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3"
@ -109,7 +110,7 @@ steps:
- ./gradlew installGplayDebugAndroidTest
- scripts/wait_for_server.sh "server-master"
- ./gradlew createGplayDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "master-IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew executeScreenshotTests || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "master-Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew gplayDebugExecuteScreenshotTests -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "master-Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew combinedTestReport
- curl -o codecov.sh https://codecov.io/bash
- bash ./codecov.sh -t fc506ba4-33c3-43e4-a760-aada38c24fd5
@ -140,7 +141,7 @@ services:
image: nextcloudci/server:server-17 # also change in updateScreenshots.sh
commands:
- /usr/local/bin/initnc.sh
- su www-data -c "php /var/www/html/occ status"
- su www-data -c "echo 127.0.0.1 server >> /etc/hosts"
- su www-data -c "OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1"
- su www-data -c "OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2"
- su www-data -c "OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3"

View file

@ -272,7 +272,7 @@ Source code of app:
#### UI tests
We use [shot](https://github.com/Karumi/Shot) for taking screenshots and compare them
- check screenshots: ```./gradlew executeScreenshotTests ```
- check screenshots: ```./gradlew gplayDebugExecuteScreenshotTests ```
- update/generate new screenshots: ```scripts/updateScreenshots.sh ```
- in this script are samples how to only execute a given class/test
- this will fire up docker & emulator to ensure that screenshots look the same

View file

@ -91,7 +91,7 @@ def versionBuild = 0 // 0-50=Alpha / 51-98=RC / 90-99=stable
for (TaskExecutionRequest tr : getGradle().getStartParameter().getTaskRequests()) {
for (String arg : tr.args) {
// any gplay, but only exact "build", as e.g. buildGeneric shall not apply gplay.grade
if (arg.contains("Gplay") || arg.contains("lint") || arg.contains("executeScreenshot") || arg == "build") {
if (arg.contains("Gplay") || arg.contains("lint") || arg.contains("ExecuteScreenshot") || arg == "build") {
apply from: 'gplay.gradle'
System.console().println("Applying gplay.gradle")
break
@ -103,11 +103,6 @@ spotbugs {
toolVersion = '3.1.12'
}
shot {
appId = 'com.nextcloud.client'
instrumentationTestTask = 'connectedGplayDebugAndroidTest'
}
android {
lintOptions {
abortOnError false

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View file

@ -1,22 +1,22 @@
#!/usr/bin/env bash
if ( [[ $(grep NC_TEST_SERVER_BASEURL ~/.gradle/gradle.properties | grep -v "#" -c) -gt 0 ]] ); then
if [[ $(grep NC_TEST_SERVER_BASEURL ~/.gradle/gradle.properties | grep -v "#" -c) -gt 0 ]]; then
echo "This will not use server in docker. Please comment in .gradle/gradle.properties. Aborting!"
exit 1
fi
## emulator
if ( [[ ! $(emulator -list-avds | grep uiComparison -c) -eq 0 ]] ); then
if [[ ! $(emulator -list-avds | grep uiComparison -c) -eq 0 ]]; then
avdmanager delete avd -n uiComparison
(sleep 5; echo "no") | avdmanager create avd -n uiComparison -c 100M -k "system-images;android-27;google_apis;x86" --abi "google_apis/x86"
fi
if [ $1 == "debug" ]; then
emulator -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-audio -skin 500x833 1>/dev/null &
if [ "$1" == "debug" ]; then
emulator -writable-system -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-audio -skin 500x833 1>/dev/null &
else
emulator -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 1>/dev/null &
emulator -writable-system -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 1>/dev/null &
fi
PID=$(echo $!)
PID=$!
## server
docker run --name=uiComparison nextcloudci/server --entrypoint '/usr/local/bin/initnc.sh' 1>/dev/null &
@ -29,14 +29,10 @@ if [[ $IP = "" ]]; then
fi
## wait for server to finish
scripts/wait_for_server.sh $IP
## run on server
cp gradle.properties gradle.properties_
sed -i s"/server/$IP/" gradle.properties
scripts/wait_for_emulator.sh
scripts/wait_for_server.sh "$IP"
# setup test server
docker exec uiComparison /bin/sh -c "echo $IP server >> /etc/hosts"
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1\""
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2\""
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3\""
@ -44,40 +40,57 @@ docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ user
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:add users\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:adduser users user1\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:adduser users user2\""
docker exec uiComparison /bin/sh -c "su www-data -c \"git clone -b master https://github.com/nextcloud/activity.git /var/www/html/apps/activity/\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ app:enable activity\""
docker exec uiComparison /bin/sh -c "su www-data -c \"git clone -b master https://github.com/nextcloud/text.git /var/www/html/apps/text/\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ app:enable text\""
docker exec uiComparison /bin/sh -c "su www-data -c \"git clone -b master https://github.com/nextcloud/circles.git /var/www/html/apps/circles/\""
docker exec uiComparison /bin/sh -c "apt-get update; apt-get -y install composer"
docker exec uiComparison /bin/sh -c "su www-data -c \"cd /var/www/html/apps/circles; composer install\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ app:enable -f circles\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ config:app:set circles --value 1 allow_non_ssl_links\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ config:app:set circles --value 1 local_is_non_ssl\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ config:system:set allow_local_remote_servers --value true --type bool\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ circles:manage:create test public publicCircle\""
docker exec uiComparison /bin/sh -c "su www-data -c \"git clone -b master https://github.com/nextcloud/end_to_end_encryption/ /var/www/html/apps/end_to_end_encryption/\""
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ app:enable end_to_end_encryption\""
#docker exec uiComparison /bin/sh -c "su www-data -c \"git clone -b master https://github.com/nextcloud/circles.git /var/www/html/apps/circles/\""
#docker exec uiComparison /bin/sh -c "apt-get update; apt-get -y install composer"
#docker exec uiComparison /bin/sh -c "su www-data -c \"cd /var/www/html/apps/circles; composer install\""
#docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ app:enable -f circles\""
#docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ config:app:set circles --value 1 allow_non_ssl_links\""
#docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ config:app:set circles --value 1 local_is_non_ssl\""
#docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ config:system:set allow_local_remote_servers --value true --type bool\""
#docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ circles:manage:create test public publicCircle\""
docker exec uiComparison /bin/sh -c "/usr/local/bin/run.sh"
## wait for server to finish
scripts/wait_for_server.sh "$IP"
scripts/wait_for_emulator.sh
# change server to ip on emulator
adb root
sleep 2
adb remount
sleep 2
adb shell "mount -o remount,rw /system"
sleep 2
adb shell "echo $IP server >> /system/etc/hosts"
## update/create all screenshots
./gradlew executeScreenshotTests -Precord
./gradlew gplayDebugExecuteScreenshotTests -Precord \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest
## update screenshots in a class
#./gradlew executeScreenshotTests \
#./gradlew gplayDebugExecuteScreenshotTests \
#-Precord \
#-Pandroid.testInstrumentationRunnerArguments.class=\
#com.owncloud.android.ui.dialog.SyncFileNotEnoughSpaceDialogFragmentTest
## update single screenshot within a class
#./gradlew executeScreenshotTests \
#./gradlew gplayDebugExecuteScreenshotTests \
#-Precord \
#-Pandroid.testInstrumentationRunnerArguments.class=\
#com.owncloud.android.ui.dialog.SyncFileNotEnoughSpaceDialogFragmentTest#showNotEnoughSpaceDialogForFile
mv gradle.properties_ gradle.properties
if [ $1 == "debug" ]; then
if [ "$1" == "debug" ]; then
exit
fi
# tidy up
kill $PID
kill "$PID"
docker stop uiComparison
docker rm uiComparison

View file

@ -10,7 +10,7 @@ until [[ $status = "false" ]]; do
if [[ "$status" =~ "false" || "$status" = "" ]]; then
let "counter += 1"
if [[ $counter -gt 30 ]]; then
if [[ $counter -gt 50 ]]; then
echo "Failed to wait for server"
exit 1
fi

View file

@ -26,6 +26,7 @@ import android.Manifest;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.ui.activities.ActivitiesActivity;
import com.owncloud.android.utils.ScreenshotTest;
import org.junit.Rule;
import org.junit.Test;
@ -44,7 +45,8 @@ public class ActivitiesActivityIT extends AbstractIT {
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void openDrawer() throws InterruptedException {
@ScreenshotTest
public void openDrawer() {
super.openDrawer(activityRule);
}
}

View file

@ -38,6 +38,7 @@ import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.operations.CreateFolderOperation;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.events.SearchEvent;
import com.owncloud.android.utils.ScreenshotTest;
import org.greenrobot.eventbus.EventBus;
import org.junit.Assert;
@ -56,7 +57,6 @@ import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentat
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertTrue;
public class FileDisplayActivityIT extends AbstractIT {
@Rule public IntentsTestRule<FileDisplayActivity> activityRule = new IntentsTestRule<>(FileDisplayActivity.class,
true,
@ -67,6 +67,7 @@ public class FileDisplayActivityIT extends AbstractIT {
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
@ScreenshotTest
public void open() {
Activity sut = activityRule.launchActivity(null);
@ -76,15 +77,19 @@ public class FileDisplayActivityIT extends AbstractIT {
}
@Test
@ScreenshotTest
public void drawer() {
Activity sut = activityRule.launchActivity(null);
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
waitForIdleSync();
Screenshot.snapActivity(sut).record();
}
@Test
@ScreenshotTest
public void showShares() {
assertTrue(new ExistenceCheckRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess());
assertTrue(new CreateFolderRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess());
@ -148,6 +153,7 @@ public class FileDisplayActivityIT extends AbstractIT {
}
@Test
@ScreenshotTest
public void showAccounts() {
Activity sut = activityRule.launchActivity(null);

View file

@ -28,6 +28,7 @@ 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;
import org.junit.Rule;
import org.junit.Test;
@ -46,6 +47,7 @@ public class FirstRunActivityIT extends AbstractIT {
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
@ScreenshotTest
public void open() {
Activity sut = activityRule.launchActivity(null);

View file

@ -26,6 +26,7 @@ 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;
@ -44,7 +45,8 @@ public class NotificationsActivityIT extends AbstractIT {
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void openDrawer() throws InterruptedException {
@ScreenshotTest
public void openDrawer() {
super.openDrawer(activityRule);
}
}

View file

@ -28,6 +28,7 @@ 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;
import org.junit.Rule;
import org.junit.Test;
@ -46,6 +47,7 @@ public class SettingsActivityIT extends AbstractIT {
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
@ScreenshotTest
public void open() {
Activity test = activityRule.launchActivity(null);

View file

@ -26,6 +26,7 @@ import android.Manifest;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.ui.activity.SyncedFoldersActivity;
import com.owncloud.android.utils.ScreenshotTest;
import org.junit.Rule;
import org.junit.Test;
@ -44,7 +45,8 @@ public class SyncedFoldersActivityIT extends AbstractIT {
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void openDrawer() throws InterruptedException {
@ScreenshotTest
public void openDrawer() {
super.openDrawer(activityRule);
}
}

View file

@ -26,6 +26,7 @@ import android.Manifest;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.ui.activity.UploadListActivity;
import com.owncloud.android.utils.ScreenshotTest;
import org.junit.Rule;
import org.junit.Test;
@ -44,7 +45,8 @@ public class UploadListActivityActivityIT extends AbstractIT {
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void openDrawer() throws InterruptedException {
@ScreenshotTest
public void openDrawer() {
super.openDrawer(activityRule);
}
}

View file

@ -27,6 +27,7 @@ import androidx.test.espresso.intent.rule.IntentsTestRule
import androidx.test.internal.runner.junit4.statement.UiThreadStatement
import com.facebook.testing.screenshot.Screenshot
import com.owncloud.android.AbstractIT
import com.owncloud.android.utils.ScreenshotTest
import org.junit.Rule
import org.junit.Test
@ -35,6 +36,7 @@ class EtmActivityTest : AbstractIT() {
var activityRule = IntentsTestRule(EtmActivity::class.java, true, false)
@Test
@ScreenshotTest
fun overview() {
val sut: Activity = activityRule.launchActivity(null)
@ -44,6 +46,7 @@ class EtmActivityTest : AbstractIT() {
}
@Test
@ScreenshotTest
fun preferences() {
val sut: EtmActivity = activityRule.launchActivity(null)
@ -53,6 +56,7 @@ class EtmActivityTest : AbstractIT() {
}
@Test
@ScreenshotTest
fun accounts() {
val sut: EtmActivity = activityRule.launchActivity(null)

View file

@ -68,7 +68,6 @@ import static org.junit.Assert.assertTrue;
* Common base for all integration tests
*/
//@RunWith(AndroidJUnit4.class)
public abstract class AbstractIT {
@Rule public RetryTestRule retryTestRule = new RetryTestRule();
@ -221,7 +220,7 @@ public abstract class AbstractIT {
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
}
protected void openDrawer(IntentsTestRule activityRule) throws InterruptedException {
protected void openDrawer(IntentsTestRule activityRule) {
Activity sut = activityRule.launchActivity(null);
shortSleep();

View file

@ -29,11 +29,10 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
@RunWith(AndroidJUnit4.class)
@LargeTest
//@LargeTest
public class FolderPickerActivityIT {
@Rule
public ActivityTestRule<FolderPickerActivity> activityRule =

View file

@ -27,6 +27,7 @@ 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;
import org.junit.Rule;
import org.junit.Test;
@ -40,6 +41,7 @@ public class ManageAccountsActivityIT extends AbstractIT {
false);
@Test
@ScreenshotTest
public void open() {
Activity sut = activityRule.launchActivity(null);
@ -49,6 +51,7 @@ public class ManageAccountsActivityIT extends AbstractIT {
}
@Test
@ScreenshotTest
public void userInfoDetail() {
ManageAccountsActivity sut = activityRule.launchActivity(null);

View file

@ -49,6 +49,7 @@ import com.owncloud.android.operations.RefreshFolderOperation
import com.owncloud.android.operations.UploadFileOperation
import com.owncloud.android.ui.activity.FileDisplayActivity
import com.owncloud.android.utils.FileStorageUtils
import com.owncloud.android.utils.ScreenshotTest
import junit.framework.TestCase
import org.junit.Assert.assertTrue
import org.junit.Rule
@ -88,6 +89,7 @@ class OCFileListFragmentIT : AbstractIT() {
}
@Test
@ScreenshotTest
fun showRichWorkspace() {
assertTrue(CreateFolderOperation("/test/", account, targetContext).execute(client, storageManager).isSuccess)
@ -155,6 +157,7 @@ class OCFileListFragmentIT : AbstractIT() {
}
@Test
@ScreenshotTest
fun createAndShowShareToUser() {
val path = "/shareToAdmin/"
TestCase.assertTrue(CreateFolderOperation(path, account, targetContext)
@ -179,6 +182,7 @@ class OCFileListFragmentIT : AbstractIT() {
}
@Test
@ScreenshotTest
fun createAndShowShareToGroup() {
val path = "/shareToGroup/"
TestCase.assertTrue(CreateFolderOperation(path, account, targetContext)
@ -203,6 +207,7 @@ class OCFileListFragmentIT : AbstractIT() {
}
// @Test
// @ScreenshotTest
// fun createAndShowShareToCircle() {
// val path = "/shareToCircle/"
// TestCase.assertTrue(CreateFolderOperation(path, account, targetContext)
@ -234,6 +239,7 @@ class OCFileListFragmentIT : AbstractIT() {
// }
@Test
@ScreenshotTest
fun createAndShowShareViaLink() {
val path = "/shareViaLink/"
TestCase.assertTrue(CreateFolderOperation(path, account, targetContext)

View file

@ -30,6 +30,7 @@ import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.ScreenshotTest;
import org.junit.Rule;
import org.junit.Test;
@ -50,7 +51,8 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void displaySimpleTextFile() throws InterruptedException {
@ScreenshotTest
public void displaySimpleTextFile() {
FileDisplayActivity sut = activityRule.launchActivity(null);
shortSleep();
@ -67,7 +69,8 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
}
@Test
public void displayJavaSnippetFile() throws IOException, InterruptedException {
@ScreenshotTest
public void displayJavaSnippetFile() throws IOException {
FileDisplayActivity sut = activityRule.launchActivity(null);
shortSleep();

View file

@ -0,0 +1,37 @@
/*
*
* 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 <https://www.gnu.org/licenses/>.
*/
package com.owncloud.android.utils;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotate any screenshot test with this so it is run only when updating/testing screenshots
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ScreenshotTest {
}