Skip to content

Commit

Permalink
Merge pull request #4566 from wix/upgrade_dependencies
Browse files Browse the repository at this point in the history
Upgraded dependencies
  • Loading branch information
gosha212 authored Sep 4, 2024
2 parents c432726 + fe7485e commit b3ae7df
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 38 deletions.
17 changes: 8 additions & 9 deletions detox/android/detox/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: '../rninfo.gradle'

def _kotlinMinVersion = '1.2.0'
def _kotlinMinVersion = '1.8.0'
def _materialMinVersion = '1.11.0'

def _ext = rootProject.ext
Expand Down Expand Up @@ -111,7 +111,7 @@ android {

// Fundamental deps.
dependencies {
implementation "org.jetbrains.kotlin:$_kotlinStdlib:$_kotlinMinVersion"
api "org.jetbrains.kotlin:$_kotlinStdlib:$_kotlinVersion"

compileOnly "${_rnNativeArtifact}"
}
Expand All @@ -123,29 +123,28 @@ dependencies {
// Versions are in-sync with the 'androidx-test-1.4.0' release/tag of the android-test github repo,
// used by the Detox generator. See https://github.com/android/android-test/releases/tag/androidx-test-1.4.0
// Important: Should remain so when generator tag is replaced!
api('androidx.test.espresso:espresso-core:3.5.1') {
api('androidx.test.espresso:espresso-core:3.6.1') {
because 'Needed all across Detox but also makes Espresso seamlessly provided to Detox users with hybrid apps/E2E-tests.'
}
api('androidx.test.espresso:espresso-web:3.5.1') {
api('androidx.test.espresso:espresso-web:3.6.1') {
because 'Web-View testing'
}
api('androidx.test.espresso:espresso-contrib:3.5.1') {
api('androidx.test.espresso:espresso-contrib:3.6.1') {
because 'Android datepicker support'
exclude group: "org.checkerframework", module: "checker"
}
api('org.hamcrest:hamcrest:2.2') {
because 'See https://github.com/wix/Detox/issues/3920. Need to force hamcrest 2.2 win in battle of 2.2 vs. 1.3 (specified by Espresso).'
}
api('androidx.test:rules:1.5.0') {
api('androidx.test:rules:1.6.1') {
because 'of ActivityTestRule. Needed by users *and* internally used by Detox.'
}
api('androidx.test.ext:junit:1.1.5') {
api('androidx.test.ext:junit:1.2.1') {
because 'Needed so as to seamlessly provide AndroidJUnit4 to Detox users. Depends on junit core.'
}

// Version is the latest; Cannot sync with the Github repo (e.g. android/android-test) because the androidx
// packaging version of associated classes is simply not there...
api('androidx.test.uiautomator:uiautomator:2.2.0') {
api('androidx.test.uiautomator:uiautomator:2.3.0') {
because 'Needed by Detox but also makes UIAutomator seamlessly provided to Detox users with hybrid apps/E2E-tests.'
}
}
Expand Down
3 changes: 3 additions & 0 deletions detox/android/detox/proguard-rules-app.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
-keep class com.reactnativecommunity.slider.** { *; }
-keep class com.reactnativecommunity.asyncstorage.** { *; }

-keep class kotlin.reflect.** { *; }
-keep class kotlin.coroutines.CoroutineDispatcher { *; }
-keep class kotlin.jvm.** { *; }
-keep class kotlin.collections.** { *; }
-keep class kotlin.text.** { *; }
-keep class kotlin.io.** { *; }
-keep class okhttp3.** { *; }
-keep class kotlin.LazyKt { *; }

-keep class androidx.concurrent.futures.** { *; }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package com.wix.detox.espresso.assertion;

import androidx.annotation.NonNull;
import android.view.View;
import static androidx.test.espresso.matcher.ViewMatchers.assertThat;

import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.test.espresso.NoMatchingViewException;
import androidx.test.espresso.ViewAssertion;

import static androidx.test.espresso.core.internal.deps.guava.base.Preconditions.checkNotNull;
import static androidx.test.espresso.matcher.ViewMatchers.assertThat;
import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;

/**
* A custom extension of {@link androidx.test.espresso.assertion.ViewAssertions}.
Expand All @@ -24,9 +23,8 @@ public class ViewAssertions {
* which is more suitable for Detox' separated interaction-matcher architecture.
* See {@link MatchesViewAssertion} for more details.
*/
@SuppressWarnings("unchecked")
public static ViewAssertion matches(final Matcher<? super View> viewMatcher) {
return new MatchesViewAssertion((Matcher<? super View>) checkNotNull(viewMatcher));
return new MatchesViewAssertion(viewMatcher);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion detox/test/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {

ext {
isOfficialDetoxApp = true
kotlinVersion = '1.8.0'
kotlinVersion = '1.8.21'
buildToolsVersion = '34.0.0'
compileSdkVersion = 34
targetSdkVersion = 34
Expand Down
2 changes: 1 addition & 1 deletion detox/test/e2e/29.webview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('WebView', () => {
describe('single web-view scenario', () => {
const expectWebViewToMatchSnapshot = async (snapshotName) => {
const webViewElement = element(by.id('webViewFormWithScrolling'));
await expectElementSnapshotToMatch(webViewElement, snapshotName);
await expectElementSnapshotToMatch(webViewElement, snapshotName, 0.993);
};

describe('matchers', () => {
Expand Down
12 changes: 6 additions & 6 deletions detox/test/e2e/utils/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ const jestExpect = require('expect').default;
// Threshold for SSIM comparison, if two images have SSIM score below this threshold, they are considered different.
const SSIM_SCORE_THRESHOLD = 0.997;

async function expectElementSnapshotToMatch (elementOrDevice, snapshotName) {
async function expectElementSnapshotToMatch (elementOrDevice, snapshotName, ssimThreshold = SSIM_SCORE_THRESHOLD) {
const bitmapPath = await elementOrDevice.takeScreenshot(snapshotName);
const expectedBitmapPath = `./e2e/assets/${snapshotName}.${device.getPlatform()}.png`;

if (await fs.pathExists(expectedBitmapPath) === false || process.env.UPDATE_SNAPSHOTS === 'true') {
await fs.copy(bitmapPath, expectedBitmapPath, {overwrite: true});
} else {
await expectSSIMToBeClose(bitmapPath, expectedBitmapPath);
await expectSSIMToBeClose(bitmapPath, expectedBitmapPath, ssimThreshold);
}
}

async function expectDeviceSnapshotToMatch (snapshotName) {
async function expectDeviceSnapshotToMatch (snapshotName, ssimThreshold = SSIM_SCORE_THRESHOLD) {
// Set status bar to consistent state for snapshot. Currently, doesn't work on iOS 17.
await device.setStatusBar({time: '2024-03-08T09:41:00-07:00'});

await expectElementSnapshotToMatch(device, snapshotName);
await expectElementSnapshotToMatch(device, snapshotName, ssimThreshold);
}

async function expectSSIMToBeClose (bitmapPath, expectedBitmapPath) {
async function expectSSIMToBeClose (bitmapPath, expectedBitmapPath, ssimThreshold) {
const image = loadImage(bitmapPath);
const expectedImage = loadImage(expectedBitmapPath);

const { mssim, performance } = ssim(image, expectedImage);

if (mssim < SSIM_SCORE_THRESHOLD) {
if (mssim < ssimThreshold) {
throw new Error(
`Expected bitmaps at '${bitmapPath}' and '${expectedBitmapPath}' to have an SSIM score ` +
`of at least ${SSIM_SCORE_THRESHOLD}, but got ${mssim}. This means the snapshots are different ` +
Expand Down
29 changes: 16 additions & 13 deletions examples/demo-react-native/detox.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ module.exports = {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -",
"start": "scripts/start-rn.sh android",
reversePorts: [8081]
},
"android.release": {
"type": "android.apk",
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
"build": "cd android ; ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release ; cd -",
"build": "cd android ; ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release ; cd -"
}
},
devices: {
Expand All @@ -54,29 +55,31 @@ module.exports = {
headless: Boolean(process.env.CI),
gpuMode: process.env.CI ? 'off' : undefined,
device: {
avdName: "Pixel_API_28"
avdName: "Pixel_3a_API_34"
},
utilBinaryPaths: [
"./cache/test-butler-app.apk"
],
reversePorts: [8081],

// utilBinaryPaths: [
// "../../detox/test/e2e/util-binary/detoxbutler-1.0.4-aosp-release.apk"
// ],
},
"genymotion.emulator.uuid": {
type: "android.genycloud",
device: {
recipeUUID: "a50a71d6-da90-4c67-bdfa-5b602b0bbd15"
recipeUUID: "9baf12f9-a645-4ffa-a688-0e92584d6194"
},
utilBinaryPaths: [
"./cache/test-butler-app.apk"
],
// utilBinaryPaths: [
// "../../detox/test/e2e/util-binary/detoxbutler-1.0.4-genymotion-release.apk"
// ],
},
"genymotion.emulator.name": {
type: "android.genycloud",
device: {
recipeName: "Detox_Pixel_API_29"
recipeName: "Detox_Pixel_3a_API_34"
},
utilBinaryPaths: [
"./cache/test-butler-app.apk"
],
// utilBinaryPaths: [
// "../../detox/test/e2e/util-binary/detoxbutler-1.0.4-genymotion-release.apk"
// ],
}
},
configurations: {
Expand Down

0 comments on commit b3ae7df

Please sign in to comment.