Skip to content

Commit

Permalink
build(deps): forward-port tests to detox v19.4
Browse files Browse the repository at this point in the history
they migrated one of our locally modified files to kotlin,
ported our patch over to it
  • Loading branch information
mikehardy committed Jan 4, 2022
1 parent c2d2300 commit 208cb6b
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 79 deletions.
2 changes: 1 addition & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
74 changes: 0 additions & 74 deletions tests/patches/detox+19.3.1.patch

This file was deleted.

95 changes: 95 additions & 0 deletions tests/patches/detox+19.4.1.patch
Original file line number Diff line number Diff line change
@@ -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
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 208cb6b

Please sign in to comment.