Skip to content

Commit 603764c

Browse files
authored
Fix failing Pillow library used in snapshot testing (#452)
* Install Pillow package from local storage * Fix .travis.yml * Bump snapshot framework dependency * Update travis script to compile with SDK 30 * Change MiPush dependency only for unit tests, because build fails with dex error otherwise.
1 parent 270ce91 commit 603764c

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

.travis.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ language: android
22

33
env:
44
global:
5-
- BUILD_API=29
6-
- BUILD_TOOLS=29.0.3
5+
- BUILD_API=30
6+
- BUILD_TOOLS=30.0.3
77
- ABI=x86
88
- EMU_API=22
99
- EMU_FLAVOR=default
@@ -24,8 +24,7 @@ licenses:
2424
before_install:
2525
- sudo wget "https://bouncycastle.org/download/bcprov-ext-jdk15on-165.jar" -O "${JAVA_HOME}/jre/lib/ext/bcprov-ext-jdk15on-165.jar"
2626
- sudo echo "security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider" | sudo tee -a ${JAVA_HOME}/jre/lib/security/java.security
27-
# Shapshot tests and emulator are commented
28-
# - python -m pip install Pillow --user # library for image manipulation in snapshot tests
27+
- python -m pip install Tools/Pillow-6.2.2-cp27-cp27mu-manylinux1_x86_64.whl --user # library for image manipulation in snapshot tests
2928

3029
before_script:
3130
# Install Android SDK and run emulator
@@ -37,16 +36,16 @@ before_script:
3736
- echo y | sdkmanager "platforms;android-$BUILD_API" >/dev/null
3837
- echo y | sdkmanager "extras;android;m2repository" >/dev/null
3938
- echo y | sdkmanager "system-images;android-$EMU_API;$EMU_FLAVOR;$ABI"
40-
# - echo no | avdmanager create avd --force -n test -k "system-images;android-$EMU_API;$EMU_FLAVOR;$ABI" -c 100M
41-
# - emulator -verbose -avd test -no-accel -no-snapshot -no-window -no-audio -camera-back none -camera-front none -selinux permissive -qemu -m 2048 &
39+
- echo no | avdmanager create avd --force -n test -k "system-images;android-$EMU_API;$EMU_FLAVOR;$ABI" -c 100M
40+
- emulator -verbose -avd test -no-accel -no-snapshot -no-window -no-audio -camera-back none -camera-front none -selinux permissive -qemu -m 2048 &
4241

4342
script:
4443
- ./gradlew assembleRelease testReleaseUnitTest
4544

4645
# wait emulator to come alive and start snapshot tests
47-
# - android-wait-for-emulator
48-
# - adb shell input keyevent 82 &
49-
# - ./gradlew verifyDebugAndroidTestScreenshotTest
46+
- android-wait-for-emulator
47+
- adb shell input keyevent 82 &
48+
- ./gradlew verifyDebugAndroidTestScreenshotTest
5049

5150
before_deploy:
5251
- ./Tools/verifyTag.sh

AndroidSDKTests/build.gradle

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
mavenCentral()
88
}
99
dependencies {
10-
classpath 'com.facebook.testing.screenshot:plugin:0.12.0'
10+
classpath 'com.facebook.testing.screenshot:plugin:0.14.0'
1111
}
1212
}
1313

@@ -45,12 +45,6 @@ android {
4545
logger.lifecycle("Running test: " + descriptor)
4646
}
4747

48-
// MiPush jar is causing java.lang.VerifyError in Robolectric. Possible cause is that
49-
// the library was proguarded like app instead of library.
50-
// Check https://github.com/robolectric/robolectric/issues/2750 for details.
51-
// To fix tests in Android Studio add "-noverify" jvm option to JUnit run configuration template.
52-
jvmArgs '-noverify'
53-
5448
}
5549
unitTests {
5650
includeAndroidResources = true
@@ -67,7 +61,7 @@ dependencies {
6761
implementation project(':AndroidSDKPush')
6862
implementation project(':AndroidSDKLocation')
6963
implementation project(':AndroidSDKFcm')
70-
implementation project(':AndroidSDKMiPush')
64+
testImplementation project(':AndroidSDKMiPush') // add dep for unit tests only, fails otherwise
7165
implementation "androidx.appcompat:appcompat:${APPCOMPAT_LIBRARY_VERSION}"
7266
implementation 'com.google.android.gms:play-services-location:17.0.0'
7367

@@ -93,7 +87,7 @@ dependencies {
9387
androidTestImplementation "com.crittercism.dexmaker:dexmaker:1.4"
9488
androidTestImplementation "com.crittercism.dexmaker:dexmaker-mockito:1.4"
9589
androidTestImplementation "com.crittercism.dexmaker:dexmaker-dx:1.4"
96-
implementation 'com.facebook.testing.screenshot:core:0.12.0'
90+
implementation 'com.facebook.testing.screenshot:core:0.14.0'
9791
}
9892

9993
task jarTests(type: Jar, dependsOn: "assembleDebugUnitTest") {
2 MB
Binary file not shown.

0 commit comments

Comments
 (0)