Bladeren bron

Merge pull request #11704 from nextcloud/fixScreenshotTestsOnJDK17

Fix screenshot test on jdk17
Andy Scherzinger 2 jaren geleden
bovenliggende
commit
ffcb15e3b4

+ 1 - 1
.github/workflows/screenShotTest.yml

@@ -77,7 +77,7 @@ jobs:
                     sdcard-path-or-size: 100M
                     target: google_apis
                     emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -skin 500x833
-                    script: ./gradlew uninstallAll gplayDebugExecuteScreenshotTests -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest -Pandroid.testInstrumentationRunnerArguments.COLOR=${{ matrix.color }} -Pandroid.testInstrumentationRunnerArguments.DARKMODE=${{ matrix.scheme }}
+                    script: ./gradlew uninstallAll gplayDebugExecuteScreenshotTests -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" -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest -Pandroid.testInstrumentationRunnerArguments.COLOR=${{ matrix.color }} -Pandroid.testInstrumentationRunnerArguments.DARKMODE=${{ matrix.scheme }}
             -   name: upload failing results
                 if: ${{ failure() }}
                 env:

+ 7 - 3
app/src/androidTest/java/com/owncloud/android/AbstractIT.java

@@ -14,7 +14,6 @@ import android.view.View;
 
 import com.facebook.testing.screenshot.Screenshot;
 import com.facebook.testing.screenshot.internal.TestNameDetector;
-import com.nextcloud.test.GrantStoragePermissionRule;
 import com.nextcloud.client.account.User;
 import com.nextcloud.client.account.UserAccountManager;
 import com.nextcloud.client.account.UserAccountManagerImpl;
@@ -26,6 +25,7 @@ import com.nextcloud.client.preferences.AppPreferencesImpl;
 import com.nextcloud.client.preferences.DarkMode;
 import com.nextcloud.common.NextcloudClient;
 import com.nextcloud.java.util.Optional;
+import com.nextcloud.test.GrantStoragePermissionRule;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.datamodel.UploadsStorageManager;
@@ -36,6 +36,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.CapabilityBooleanType;
 import com.owncloud.android.lib.resources.status.OCCapability;
 import com.owncloud.android.operations.CreateFolderOperation;
 import com.owncloud.android.operations.UploadFileOperation;
@@ -168,11 +169,14 @@ public abstract class AbstractIT {
                     break;
             }
 
+            OCCapability capability = fileDataStorageManager.getCapability(account.name);
+            capability.setGroupfolders(CapabilityBooleanType.TRUE);
+
             if (colorHex != null) {
-                OCCapability capability = fileDataStorageManager.getCapability(account.name);
                 capability.setServerColor(colorHex);
-                fileDataStorageManager.saveCapabilities(capability);
             }
+
+            fileDataStorageManager.saveCapabilities(capability);
         }
 
         // dark / light

+ 1 - 4
app/src/gplay/java/com/nextcloud/android/appReview/InAppReviewHelperImpl.kt

@@ -23,11 +23,9 @@ package com.nextcloud.android.appReview
 
 import androidx.appcompat.app.AppCompatActivity
 import com.google.android.gms.tasks.Task
-import com.google.android.play.core.review.ReviewException
 import com.google.android.play.core.review.ReviewInfo
 import com.google.android.play.core.review.ReviewManager
 import com.google.android.play.core.review.ReviewManagerFactory
-import com.google.android.play.core.review.model.ReviewErrorCode
 import com.nextcloud.appReview.AppReviewShownModel
 import com.nextcloud.appReview.InAppReviewHelper
 import com.nextcloud.client.preferences.AppPreferences
@@ -96,8 +94,7 @@ class InAppReviewHelperImpl(val appPreferences: AppPreferences) : InAppReviewHel
                 launchAppReviewFlow(manager, activity, reviewInfo)
             } else {
                 // There was some problem, log or handle the error code.
-                @ReviewErrorCode val reviewErrorCode = (task.exception as ReviewException).errorCode
-                Log_OC.e(TAG, "Failed to get ReviewInfo: $reviewErrorCode")
+                Log_OC.e(TAG, "Failed to get ReviewInfo: ${task.exception?.message}")
             }
         }
     }

+ 1 - 0
scripts/androidScreenshotTest

@@ -74,6 +74,7 @@ if [[ $4 = "all" ]]; then
     scripts/runAllScreenshotCombinations "noCI" "$1" "-Pandroid.testInstrumentationRunnerArguments.class=$class$method"
 else
     ./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" \
     -Pscreenshot=true \
     -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
     -Pandroid.testInstrumentationRunnerArguments.class=$class$method \

+ 4 - 1
scripts/runCombinedTest.sh

@@ -28,7 +28,10 @@ scripts/wait_for_server.sh "server"
 adb logcat -c
 adb logcat > logcat.txt &
 LOGCAT_PID=$!
-./gradlew createGplayDebugCoverageReport -Pcoverage -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.owncloud.android.utils.ScreenshotTest
+./gradlew createGplayDebugCoverageReport \
+-Pcoverage -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.owncloud.android.utils.ScreenshotTest \
+-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"
+
 stat=$?
 # stop saving logcat
 kill $LOGCAT_PID