From 208cb6bacb7c98df3421a4575e66a8a259fa9568 Mon Sep 17 00:00:00 2001 From: Mike Hardy Date: Tue, 4 Jan 2022 17:24:24 -0500 Subject: [PATCH] build(deps): forward-port tests to detox v19.4 they migrated one of our locally modified files to kotlin, ported our patch over to it --- tests/package.json | 2 +- tests/patches/detox+19.3.1.patch | 74 ------------------------- tests/patches/detox+19.4.1.patch | 95 ++++++++++++++++++++++++++++++++ yarn.lock | 8 +-- 4 files changed, 100 insertions(+), 79 deletions(-) delete mode 100644 tests/patches/detox+19.3.1.patch create mode 100644 tests/patches/detox+19.4.1.patch diff --git a/tests/package.json b/tests/package.json index 23e27d2bb8..68c53035bc 100644 --- a/tests/package.json +++ b/tests/package.json @@ -34,7 +34,7 @@ "@react-native-firebase/private-tests-helpers": "0.0.13", "a2a": "^0.2.0", "babel-plugin-istanbul": "^6.0.0", - "detox": "~19.3.1", + "detox": "^19.4.1", "firebase": "^9.6.1", "firebase-tools": "^10.0.1", "jest-circus": "^27.4.5", diff --git a/tests/patches/detox+19.3.1.patch b/tests/patches/detox+19.3.1.patch deleted file mode 100644 index fb800f7562..0000000000 --- a/tests/patches/detox+19.3.1.patch +++ /dev/null @@ -1,74 +0,0 @@ -diff --git a/node_modules/detox/android/detox/build.gradle b/node_modules/detox/android/detox/build.gradle -index 8bef864..3689459 100644 ---- a/node_modules/detox/android/detox/build.gradle -+++ b/node_modules/detox/android/detox/build.gradle -@@ -86,12 +86,12 @@ dependencies { - // Versions are in-sync with the 'androidx-test-1.2.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.2.0 - // Important: Should remain so when generator tag is replaced! -- api('androidx.test.espresso:espresso-core:3.3.0') { // Needed all across Detox but also makes Espresso seamlessly provided to Detox users with hybrid apps/E2E-tests. -+ api('androidx.test.espresso:espresso-core:3.4.0') { // Needed all across Detox but also makes Espresso seamlessly provided to Detox users with hybrid apps/E2E-tests. - exclude group: 'com.google.code.findbugs', module: 'jsr305' - } -- api 'androidx.test.espresso:espresso-web:3.3.0' // Web-View testing -- api 'androidx.test:rules:1.2.0' // Needed because of ActivityTestRule. Needed by users *and* internally used by Detox. -- api 'androidx.test.ext:junit:1.1.1' // Needed so as to seamlessly provide AndroidJUnit4 to Detox users. Depends on junit core. -+ api 'androidx.test.espresso:espresso-web:3.4.0' // Web-View testing -+ api 'androidx.test:rules:1.4.0' // Needed because of ActivityTestRule. Needed by users *and* internally used by Detox. -+ api 'androidx.test.ext:junit:1.1.3' // 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... -diff --git a/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/UIModuleIdlingResource.java b/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/UIModuleIdlingResource.java -index 2407926..65d17d8 100644 ---- a/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/UIModuleIdlingResource.java -+++ b/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/UIModuleIdlingResource.java -@@ -104,16 +104,19 @@ public class UIModuleIdlingResource extends DetoxBaseIdlingResource implements C - } - - boolean isOperationQueueEmpty = (Boolean) Reflect.on(uiOperationQueue).call(METHOD_IS_EMPTY).get(); -+ Log.d(LOG_TAG, "UIManagerModule queue status: runnables? / nonBatchesOps? / operationQueue? - " + runnablesAreEmpty + " / " + nonBatchesOpsEmpty + " / " + isOperationQueueEmpty); - - if (runnablesAreEmpty && nonBatchesOpsEmpty && isOperationQueueEmpty) { - notifyIdle(); -- // Log.i(LOG_TAG, "UIManagerModule is idle."); -+ Log.i(LOG_TAG, "UIManagerModule is idle."); - return true; - } - - Log.i(LOG_TAG, "UIManagerModule is busy"); -- Choreographer.getInstance().postFrameCallback(this); -- return false; -+ Log.w(LOG_TAG, "UIManagerModule is busy but damn the torpedoes!"); -+ return true; -+ // Choreographer.getInstance().postFrameCallback(this); -+ // return false; - } catch (ReflectException e) { - Log.e(LOG_TAG, "Can't set up RN UIModule listener", e.getCause()); - } -diff --git a/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt b/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt -index 70e7510..1aa2d33 100644 ---- a/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt -+++ b/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt -@@ -20,13 +20,14 @@ class TimersIdlingResource @JvmOverloads constructor( - } - - override fun checkIdle(): Boolean { -- return interrogationStrategy.isIdleNow().also { result -> -- if (result) { -- notifyIdle() -- } else { -- getChoreographer().postFrameCallback(this@TimersIdlingResource) -- } -- } -+ return true -+ // return interrogationStrategy.isIdleNow().also { result -> -+ // if (result) { -+ // notifyIdle() -+ // } else { -+ // getChoreographer().postFrameCallback(this@TimersIdlingResource) -+ // } -+ // } - } - - override fun doFrame(frameTimeNanos: Long) { diff --git a/tests/patches/detox+19.4.1.patch b/tests/patches/detox+19.4.1.patch new file mode 100644 index 0000000000..d1e13e223b --- /dev/null +++ b/tests/patches/detox+19.4.1.patch @@ -0,0 +1,95 @@ +diff --git a/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt b/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt +index ad3229f..c5e56e5 100644 +--- a/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt ++++ b/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt +@@ -25,13 +25,14 @@ class TimersIdlingResource @JvmOverloads constructor( + } + + override fun checkIdle(): Boolean { +- return interrogationStrategy.isIdleNow().also { result -> +- if (result) { +- notifyIdle() +- } else { +- getChoreographer().postFrameCallback(this@TimersIdlingResource) +- } +- } ++ return true ++ // return interrogationStrategy.isIdleNow().also { result -> ++ // if (result) { ++ // notifyIdle() ++ // } else { ++ // getChoreographer().postFrameCallback(this@TimersIdlingResource) ++ // } ++ // } + } + + override fun doFrame(frameTimeNanos: Long) { +diff --git a/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIModuleIdlingResource.kt b/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIModuleIdlingResource.kt +index fb4b820..d2dc87d 100644 +--- a/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIModuleIdlingResource.kt ++++ b/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIModuleIdlingResource.kt +@@ -28,36 +28,39 @@ class UIModuleIdlingResource(private val reactContext: ReactContext) + .build() + + override fun checkIdle(): Boolean { +- try { +- if (!reactContext.hasActiveCatalystInstance()) { +- Log.e(LOG_TAG, "No active CatalystInstance. Should never see this.") +- return false +- } ++ // try { ++ // if (!reactContext.hasActiveCatalystInstance()) { ++ // Log.e(LOG_TAG, "No active CatalystInstance. Should never see this.") ++ // return false ++ // } + +- if (RNHelpers.getNativeModule(reactContext, "com.facebook.react.uimanager.UIManagerModule") == null) { +- notifyIdle() +- return true +- } ++ // if (RNHelpers.getNativeModule(reactContext, "com.facebook.react.uimanager.UIManagerModule") == null) { ++ // notifyIdle() ++ // return true ++ // } + +- val runnablesAreEmpty = uiManagerModuleReflected.isRunnablesListEmpty() +- val nonBatchesOpsEmpty = uiManagerModuleReflected.isNonBatchOpsEmpty() +- var operationQueueEmpty = uiManagerModuleReflected.isOperationQueueEmpty() ++ // val runnablesAreEmpty = uiManagerModuleReflected.isRunnablesListEmpty() ++ // val nonBatchesOpsEmpty = uiManagerModuleReflected.isNonBatchOpsEmpty() ++ // var operationQueueEmpty = uiManagerModuleReflected.isOperationQueueEmpty() + +- if (!operationQueueEmpty) { +- operationQueueEmpty = rn66workaround.isScarceUISwitchCommandStuckInQueue(uiManagerModuleReflected) +- } ++ // if (!operationQueueEmpty) { ++ // operationQueueEmpty = rn66workaround.isScarceUISwitchCommandStuckInQueue(uiManagerModuleReflected) ++ // } + +- if (runnablesAreEmpty && nonBatchesOpsEmpty && operationQueueEmpty) { +- notifyIdle() +- return true +- } ++ // if (runnablesAreEmpty && nonBatchesOpsEmpty && operationQueueEmpty) { ++ // notifyIdle() ++ // return true ++ // } + +- Log.i(LOG_TAG, "UIManagerModule is busy") +- Choreographer.getInstance().postFrameCallback(this) +- return false +- } catch (e: ReflectException) { +- Log.e(LOG_TAG, "Can't set up RN UIModule listener", e.cause) +- } ++ // Log.i(LOG_TAG, "UIManagerModule is busy") ++ // Log.w(LOG_TAG, "UIManagerModule is busy but damn the torpedoes!"); ++ // notifyIdle() ++ // return true; ++ // // Choreographer.getInstance().postFrameCallback(this); ++ // // return false; ++ // } catch (e: ReflectException) { ++ // Log.e(LOG_TAG, "Can't set up RN UIModule listener", e.cause) ++ // } + notifyIdle() + return true + } diff --git a/yarn.lock b/yarn.lock index e93bb8278b..beb11bfd67 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5463,10 +5463,10 @@ detect-newline@^3.0.0: resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== -detox@~19.3.1: - version "19.3.1" - resolved "https://registry.yarnpkg.com/detox/-/detox-19.3.1.tgz#6848f977199f2c2767b313255a388fccdac23abe" - integrity sha512-Geg3l/Uetk4xrfRWUiGMrtiT+tKmmrsLwdXeagdTV01j6NnqmAUm3xDLLW3jEO7TKe7/ZOO846gZbMjAAZWiEw== +detox@^19.4.1: + version "19.4.1" + resolved "https://registry.yarnpkg.com/detox/-/detox-19.4.1.tgz#9981ef124dfc1a11a8da425daafc161ebfb60980" + integrity sha512-zEIM28HP79FkW0nc7FzVVw8l2+Di0mi7JHo8oQKbXhq8gx4QwcLdi697u8cUnmIiKlfgyECSbv279poFlub+DQ== dependencies: ajv "^8.6.3" bunyan "^1.8.12"