detox 20.0.0-breaking.new-global-lifecycle.0 → 20.0.3-breaking.new-global-lifecycle.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. package/Detox-android/com/wix/detox/{20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar → 20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar} +0 -0
  2. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar.md5 +1 -0
  3. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +1 -0
  4. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +1 -0
  5. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +1 -0
  6. package/Detox-android/com/wix/detox/{20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar → 20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar} +0 -0
  7. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar.md5 +1 -0
  8. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar.sha1 +1 -0
  9. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar.sha256 +1 -0
  10. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar.sha512 +1 -0
  11. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar +0 -0
  12. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar.md5 +1 -0
  13. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar.sha1 +1 -0
  14. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar.sha256 +1 -0
  15. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar.sha512 +1 -0
  16. package/Detox-android/com/wix/detox/{20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom → 20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom} +2 -2
  17. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom.md5 +1 -0
  18. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom.sha1 +1 -0
  19. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom.sha256 +1 -0
  20. package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom.sha512 +1 -0
  21. package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
  22. package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
  23. package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
  24. package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
  25. package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
  26. package/Detox-ios-src.tbz +0 -0
  27. package/Detox-ios.tbz +0 -0
  28. package/android/build.gradle +2 -2
  29. package/android/detox/build.gradle +2 -2
  30. package/android/detox/publish-pom.gradle +5 -1
  31. package/android/detox/publishing.gradle +9 -7
  32. package/android/detox/src/full/java/com/wix/detox/adapters/server/WebSocketClient.java +3 -1
  33. package/android/detox/src/full/java/com/wix/detox/espresso/DetoxAction.java +1 -3
  34. package/android/detox/src/full/java/com/wix/detox/espresso/UiAutomatorHelper.java +1 -1
  35. package/android/detox/src/full/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +22 -0
  36. package/android/detox/src/{main → full}/java/com/wix/detox/espresso/action/GetAttributesAction.kt +13 -1
  37. package/android/detox/src/full/java/com/wix/detox/espresso/common/SliderHelper.kt +75 -0
  38. package/android/detox/src/full/java/com/wix/detox/espresso/matcher/ViewMatchers.kt +16 -23
  39. package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeLoadingMonitor.kt +54 -8
  40. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/RN66Workaround.kt +13 -4
  41. package/android/detox/src/main/java/com/wix/detox/common/DetoxErrors.java +4 -1
  42. package/android/detox/src/main/java/com/wix/detox/espresso/UiControllerSpy.kt +2 -1
  43. package/android/detox/src/main/java/com/wix/detox/espresso/action/common/ReflectUtils.kt +10 -0
  44. package/android/detox/src/main/java/com/wix/detox/espresso/action/common/utils/UiControllerUtils.kt +1 -1
  45. package/android/detox/src/testFull/java/com/wix/detox/espresso/action/GetAttributesActionTest.kt +15 -3
  46. package/android/detox/src/testFull/java/com/wix/detox/espresso/common/SliderHelperTest.kt +39 -0
  47. package/android/gradle/wrapper/gradle-wrapper.properties +2 -1
  48. package/android/gradlew +181 -107
  49. package/index.d.ts +5 -0
  50. package/internals.d.ts +25 -18
  51. package/local-cli/build.js +1 -1
  52. package/local-cli/build.test.js +14 -14
  53. package/local-cli/test.js +3 -3
  54. package/local-cli/test.test.js +20 -14
  55. package/local-cli/testCommand/TestRunnerCommand.js +6 -6
  56. package/package.json +4 -4
  57. package/runners/jest/testEnvironment/index.js +1 -1
  58. package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +5 -9
  59. package/runners/jest/testEnvironment/listeners/SpecReporter.js +1 -1
  60. package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +1 -1
  61. package/src/DetoxWorker.js +12 -1
  62. package/src/artifacts/log/android/ADBLogcatRecording.js +11 -28
  63. package/src/configuration/composeAppsConfig.js +1 -1
  64. package/src/configuration/composeRunnerConfig.js +49 -1
  65. package/src/configuration/index.js +9 -8
  66. package/src/devices/allocation/drivers/android/genycloud/GenyAllocDriver.js +1 -0
  67. package/src/devices/common/drivers/android/exec/ADB.js +5 -0
  68. package/src/errors/DetoxConfigErrorComposer.js +5 -3
  69. package/src/ipc/IPCClient.js +3 -2
  70. package/src/ipc/IPCServer.js +16 -3
  71. package/src/ipc/state.js +24 -2
  72. package/src/realms/DetoxContext.js +3 -3
  73. package/src/realms/DetoxPrimaryContext.js +13 -7
  74. package/src/realms/DetoxSecondaryContext.js +4 -3
  75. package/src/utils/ChromeTracingExporter.js +6 -5
  76. package/src/utils/environment.js +30 -15
  77. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar.md5 +0 -1
  78. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +0 -1
  79. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +0 -1
  80. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +0 -1
  81. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar.md5 +0 -1
  82. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar.sha1 +0 -1
  83. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar.sha256 +0 -1
  84. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar.sha512 +0 -1
  85. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar +0 -0
  86. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar.md5 +0 -1
  87. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar.sha1 +0 -1
  88. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar.sha256 +0 -1
  89. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar.sha512 +0 -1
  90. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom.md5 +0 -1
  91. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom.sha1 +0 -1
  92. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom.sha256 +0 -1
  93. package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom.sha512 +0 -1
  94. package/android/detox/src/main/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +0 -36
  95. package/android/detox/src/testFull/java/com/wix/detox/espresso/action/AdjustSliderToPositionActionTest.kt +0 -59
@@ -4,6 +4,7 @@ import android.view.View
4
4
  import android.widget.CheckBox
5
5
  import android.widget.ProgressBar
6
6
  import android.widget.TextView
7
+ import com.facebook.react.views.slider.ReactSlider
7
8
  import com.google.android.material.slider.Slider
8
9
  import org.assertj.core.api.Assertions.assertThat
9
10
  import org.json.JSONObject
@@ -179,7 +180,7 @@ class GetAttributesActionTest {
179
180
  }
180
181
 
181
182
  @Test
182
- fun `should return ProgressBar (or SeekBar) "progress" via value attribute`() {
183
+ fun `should return raw ProgressBar or SeekBar 'progress' via value attribute`() {
183
184
  val progressBar: ProgressBar = mock {
184
185
  on { progress } doReturn 42
185
186
  }
@@ -189,7 +190,18 @@ class GetAttributesActionTest {
189
190
  }
190
191
 
191
192
  @Test
192
- fun `should return Slider state through value attribute`() {
193
+ fun `should return RN-Slider via value attribute`() {
194
+ val progressBar: ReactSlider = mock {
195
+ on { max } doReturn 100
196
+ on { progress } doReturn 50
197
+ }
198
+
199
+ val resultJson = perform(progressBar)
200
+ assertThat(resultJson.opt("value")).isEqualTo(0.5)
201
+ }
202
+
203
+ @Test
204
+ fun `should return material-Slider state through value attribute`() {
193
205
  val slider: Slider = mock {
194
206
  on { value } doReturn 0.42f
195
207
  }
@@ -225,7 +237,7 @@ class GetAttributesActionTest {
225
237
  }
226
238
 
227
239
  @Test
228
- fun `should return text hint via "placeholder" attribute, if applicable`() {
240
+ fun `should return text hint via 'placeholder' attribute, if applicable`() {
229
241
  val textViewWithHint: TextView = mock {
230
242
  on { hint } doReturn "hint-text-mock"
231
243
  }
@@ -0,0 +1,39 @@
1
+ package com.wix.detox.espresso.common
2
+
3
+ import com.facebook.react.views.slider.ReactSlider
4
+ import org.assertj.core.api.Assertions.assertThat
5
+ import org.junit.Before
6
+ import org.junit.Test
7
+ import org.junit.runner.RunWith
8
+ import org.mockito.kotlin.doReturn
9
+ import org.mockito.kotlin.mock
10
+ import org.mockito.kotlin.whenever
11
+ import org.robolectric.RobolectricTestRunner
12
+
13
+ /**
14
+ * Note: This only tests against the react *legacy* (non-community) slider in order
15
+ * to avoid having to install the community slider under node_modules just for this.
16
+ */
17
+ @RunWith(RobolectricTestRunner::class)
18
+ class SliderHelperTest {
19
+ lateinit var slider: ReactSlider
20
+ lateinit var uut: SliderHelper
21
+
22
+ @Before
23
+ fun setup() {
24
+ slider = mock()
25
+ uut = SliderHelper.create(slider)
26
+ }
27
+
28
+ private fun givenNativeProgressTraits(current: Int, max: Int) {
29
+ whenever(slider.progress).doReturn(current)
30
+ whenever(slider.max).doReturn(max)
31
+ }
32
+
33
+ @Test
34
+ fun `should properly calculate current progress, in percentage`() {
35
+ givenNativeProgressTraits(current = 20, max = 100)
36
+
37
+ assertThat(uut.getCurrentProgressPct()).isEqualTo(0.2)
38
+ }
39
+ }
@@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
3
3
  distributionPath=wrapper/dists
4
4
  zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
6
- distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
6
+ distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
7
+
package/android/gradlew CHANGED
@@ -1,74 +1,129 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
+ #
4
+ # Copyright © 2015-2021 the original authors.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # https://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
3
19
  ##############################################################################
4
- ##
5
- ## Gradle start up script for UN*X
6
- ##
20
+ #
21
+ # Gradle start up script for POSIX generated by Gradle.
22
+ #
23
+ # Important for running:
24
+ #
25
+ # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26
+ # noncompliant, but you have some other compliant shell such as ksh or
27
+ # bash, then to run this script, type that shell name before the whole
28
+ # command line, like:
29
+ #
30
+ # ksh Gradle
31
+ #
32
+ # Busybox and similar reduced shells will NOT work, because this script
33
+ # requires all of these POSIX shell features:
34
+ # * functions;
35
+ # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36
+ # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37
+ # * compound commands having a testable exit status, especially «case»;
38
+ # * various built-in commands including «command», «set», and «ulimit».
39
+ #
40
+ # Important for patching:
41
+ #
42
+ # (2) This script targets any POSIX shell, so it avoids extensions provided
43
+ # by Bash, Ksh, etc; in particular arrays are avoided.
44
+ #
45
+ # The "traditional" practice of packing multiple parameters into a
46
+ # space-separated string is a well documented source of bugs and security
47
+ # problems, so this is (mostly) avoided, by progressively accumulating
48
+ # options in "$@", and eventually passing that to Java.
49
+ #
50
+ # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51
+ # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52
+ # see the in-line comments for details.
53
+ #
54
+ # There are tweaks for specific operating systems such as AIX, CygWin,
55
+ # Darwin, MinGW, and NonStop.
56
+ #
57
+ # (3) This script is generated from the Groovy template
58
+ # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59
+ # within the Gradle project.
60
+ #
61
+ # You can find Gradle at https://github.com/gradle/gradle/.
62
+ #
7
63
  ##############################################################################
8
64
 
9
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10
- DEFAULT_JVM_OPTS=""
65
+ # Attempt to set APP_HOME
66
+
67
+ # Resolve links: $0 may be a link
68
+ app_path=$0
69
+
70
+ # Need this for daisy-chained symlinks.
71
+ while
72
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73
+ [ -h "$app_path" ]
74
+ do
75
+ ls=$( ls -ld "$app_path" )
76
+ link=${ls#*' -> '}
77
+ case $link in #(
78
+ /*) app_path=$link ;; #(
79
+ *) app_path=$APP_HOME$link ;;
80
+ esac
81
+ done
82
+
83
+ APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
11
84
 
12
85
  APP_NAME="Gradle"
13
- APP_BASE_NAME=`basename "$0"`
86
+ APP_BASE_NAME=${0##*/}
87
+
88
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
14
90
 
15
91
  # Use the maximum available, or set MAX_FD != -1 to use that value.
16
- MAX_FD="maximum"
92
+ MAX_FD=maximum
17
93
 
18
- warn ( ) {
94
+ warn () {
19
95
  echo "$*"
20
- }
96
+ } >&2
21
97
 
22
- die ( ) {
98
+ die () {
23
99
  echo
24
100
  echo "$*"
25
101
  echo
26
102
  exit 1
27
- }
103
+ } >&2
28
104
 
29
105
  # OS specific support (must be 'true' or 'false').
30
106
  cygwin=false
31
107
  msys=false
32
108
  darwin=false
33
- case "`uname`" in
34
- CYGWIN* )
35
- cygwin=true
36
- ;;
37
- Darwin* )
38
- darwin=true
39
- ;;
40
- MINGW* )
41
- msys=true
42
- ;;
109
+ nonstop=false
110
+ case "$( uname )" in #(
111
+ CYGWIN* ) cygwin=true ;; #(
112
+ Darwin* ) darwin=true ;; #(
113
+ MSYS* | MINGW* ) msys=true ;; #(
114
+ NONSTOP* ) nonstop=true ;;
43
115
  esac
44
116
 
45
- # Attempt to set APP_HOME
46
- # Resolve links: $0 may be a link
47
- PRG="$0"
48
- # Need this for relative symlinks.
49
- while [ -h "$PRG" ] ; do
50
- ls=`ls -ld "$PRG"`
51
- link=`expr "$ls" : '.*-> \(.*\)$'`
52
- if expr "$link" : '/.*' > /dev/null; then
53
- PRG="$link"
54
- else
55
- PRG=`dirname "$PRG"`"/$link"
56
- fi
57
- done
58
- SAVED="`pwd`"
59
- cd "`dirname \"$PRG\"`/" >/dev/null
60
- APP_HOME="`pwd -P`"
61
- cd "$SAVED" >/dev/null
62
-
63
117
  CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64
118
 
119
+
65
120
  # Determine the Java command to use to start the JVM.
66
121
  if [ -n "$JAVA_HOME" ] ; then
67
122
  if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68
123
  # IBM's JDK on AIX uses strange locations for the executables
69
- JAVACMD="$JAVA_HOME/jre/sh/java"
124
+ JAVACMD=$JAVA_HOME/jre/sh/java
70
125
  else
71
- JAVACMD="$JAVA_HOME/bin/java"
126
+ JAVACMD=$JAVA_HOME/bin/java
72
127
  fi
73
128
  if [ ! -x "$JAVACMD" ] ; then
74
129
  die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -77,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
77
132
  location of your Java installation."
78
133
  fi
79
134
  else
80
- JAVACMD="java"
135
+ JAVACMD=java
81
136
  which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82
137
 
83
138
  Please set the JAVA_HOME variable in your environment to match the
@@ -85,76 +140,95 @@ location of your Java installation."
85
140
  fi
86
141
 
87
142
  # Increase the maximum file descriptors if we can.
88
- if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89
- MAX_FD_LIMIT=`ulimit -H -n`
90
- if [ $? -eq 0 ] ; then
91
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92
- MAX_FD="$MAX_FD_LIMIT"
93
- fi
94
- ulimit -n $MAX_FD
95
- if [ $? -ne 0 ] ; then
96
- warn "Could not set maximum file descriptor limit: $MAX_FD"
97
- fi
98
- else
99
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100
- fi
143
+ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144
+ case $MAX_FD in #(
145
+ max*)
146
+ MAX_FD=$( ulimit -H -n ) ||
147
+ warn "Could not query maximum file descriptor limit"
148
+ esac
149
+ case $MAX_FD in #(
150
+ '' | soft) :;; #(
151
+ *)
152
+ ulimit -n "$MAX_FD" ||
153
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
154
+ esac
101
155
  fi
102
156
 
103
- # For Darwin, add options to specify how the application appears in the dock
104
- if $darwin; then
105
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106
- fi
157
+ # Collect all arguments for the java command, stacking in reverse order:
158
+ # * args from the command line
159
+ # * the main class name
160
+ # * -classpath
161
+ # * -D...appname settings
162
+ # * --module-path (only if needed)
163
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
164
+
165
+ # For Cygwin or MSYS, switch paths to Windows format before running java
166
+ if "$cygwin" || "$msys" ; then
167
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
168
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
169
+
170
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
107
171
 
108
- # For Cygwin, switch paths to Windows format before running java
109
- if $cygwin ; then
110
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112
- JAVACMD=`cygpath --unix "$JAVACMD"`
113
-
114
- # We build the pattern for arguments to be converted via cygpath
115
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116
- SEP=""
117
- for dir in $ROOTDIRSRAW ; do
118
- ROOTDIRS="$ROOTDIRS$SEP$dir"
119
- SEP="|"
120
- done
121
- OURCYGPATTERN="(^($ROOTDIRS))"
122
- # Add a user-defined pattern to the cygpath arguments
123
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125
- fi
126
172
  # Now convert the arguments - kludge to limit ourselves to /bin/sh
127
- i=0
128
- for arg in "$@" ; do
129
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131
-
132
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134
- else
135
- eval `echo args$i`="\"$arg\""
173
+ for arg do
174
+ if
175
+ case $arg in #(
176
+ -*) false ;; # don't mess with options #(
177
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
178
+ [ -e "$t" ] ;; #(
179
+ *) false ;;
180
+ esac
181
+ then
182
+ arg=$( cygpath --path --ignore --mixed "$arg" )
136
183
  fi
137
- i=$((i+1))
184
+ # Roll the args list around exactly as many times as the number of
185
+ # args, so each arg winds up back in the position where it started, but
186
+ # possibly modified.
187
+ #
188
+ # NB: a `for` loop captures its iteration list before it begins, so
189
+ # changing the positional parameters here affects neither the number of
190
+ # iterations, nor the values presented in `arg`.
191
+ shift # remove old arg
192
+ set -- "$@" "$arg" # push replacement arg
138
193
  done
139
- case $i in
140
- (0) set -- ;;
141
- (1) set -- "$args0" ;;
142
- (2) set -- "$args0" "$args1" ;;
143
- (3) set -- "$args0" "$args1" "$args2" ;;
144
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150
- esac
151
194
  fi
152
195
 
153
- # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154
- function splitJvmOpts() {
155
- JVM_OPTS=("$@")
156
- }
157
- eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158
- JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159
-
160
- exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
196
+ # Collect all arguments for the java command;
197
+ # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198
+ # shell script including quotes and variable substitutions, so put them in
199
+ # double quotes to make sure that they get re-expanded; and
200
+ # * put everything else in single quotes, so that it's not re-expanded.
201
+
202
+ set -- \
203
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
204
+ -classpath "$CLASSPATH" \
205
+ org.gradle.wrapper.GradleWrapperMain \
206
+ "$@"
207
+
208
+ # Use "xargs" to parse quoted args.
209
+ #
210
+ # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
211
+ #
212
+ # In Bash we could simply go:
213
+ #
214
+ # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
215
+ # set -- "${ARGS[@]}" "$@"
216
+ #
217
+ # but POSIX shell has neither arrays nor command substitution, so instead we
218
+ # post-process each arg (as a line of input to sed) to backslash-escape any
219
+ # character that might be a shell metacharacter, then use eval to reverse
220
+ # that process (while maintaining the separation between arguments), and wrap
221
+ # the whole thing up as a single "set" statement.
222
+ #
223
+ # This will of course break if any of these variables contains a newline or
224
+ # an unmatched quote.
225
+ #
226
+
227
+ eval "set -- $(
228
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
229
+ xargs -n1 |
230
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
231
+ tr '\n' ' '
232
+ )" '"$@"'
233
+
234
+ exec "$JAVACMD" "$@"
package/index.d.ts CHANGED
@@ -141,6 +141,11 @@ declare global {
141
141
  * Device init timeout
142
142
  */
143
143
  initTimeout?: number | undefined;
144
+ /**
145
+ * Insist on CLI-based retry mechanism even when the failed tests have been handled
146
+ * by jest.retryTimes(n) mechanism from Jest Circus.
147
+ */
148
+ retryAfterCircusRetries?: boolean;
144
149
  reportSpecs?: boolean | undefined;
145
150
  reportWorkerAssign?: boolean | undefined;
146
151
  };
package/internals.d.ts CHANGED
@@ -47,9 +47,14 @@ declare global {
47
47
  onRunFinish(event: unknown): Promise<void>;
48
48
 
49
49
  /**
50
- * Powers the "--retries <N>" of Detox CLI under the hood.
50
+ * Reports to Detox CLI about failed tests that could have been re-run if
51
+ * {@link Detox.DetoxTestRunnerConfig#retries} is set to a non-zero.
52
+ *
53
+ * @param testFilePaths array of failed test files' paths
54
+ * @param permanent whether the failure is permanent, and the tests
55
+ * should not be re-run.
51
56
  */
52
- reportFailedTests(testFilePaths: string[]): Promise<void>;
57
+ reportFailedTests(testFilePaths: string[], permanent?: boolean): Promise<void>;
53
58
  // endregion
54
59
 
55
60
  readonly config: RuntimeConfig;
@@ -72,27 +77,29 @@ declare global {
72
77
  workerId: number;
73
78
  };
74
79
 
75
- type SessionState = Readonly<PrimarySessionState | SecondarySessionState>;
76
-
77
- type SecondarySessionState = {
78
- workersCount: number;
79
- };
80
-
81
- type PrimarySessionState = PrimarySessionState & {
80
+ type SessionState = Readonly<{
82
81
  failedTestFiles: string[];
83
- };
82
+ testFilesToRetry: string[];
83
+ testSessionIndex: number;
84
+ workersCount: number;
85
+ }>;
84
86
 
85
87
  type RuntimeConfig = Readonly<{
86
88
  configurationName: string;
87
89
 
88
- appsConfig: Record<string, Readonly<Detox.DetoxAppConfig>>;
89
- artifactsConfig: Detox.DetoxArtifactsConfig;
90
- behaviorConfig: Detox.DetoxBehaviorConfig;
91
- cliConfig: DetoxCLIConfig;
92
- deviceConfig: Detox.DetoxDeviceConfig;
93
- loggerConfig: Detox.DetoxLoggerConfig;
94
- runnerConfig: Detox.DetoxTestRunnerConfig;
95
- sessionConfig: Detox.DetoxSessionConfig;
90
+ /**
91
+ * Dictionary of app configurations,
92
+ * where the keys are defined by {@link Detox.DetoxAppConfig#name}
93
+ * or equal to "default" if the name is not configured.
94
+ */
95
+ apps: Record<string, Readonly<Detox.DetoxAppConfig>>;
96
+ artifacts: Readonly<Detox.DetoxArtifactsConfig>;
97
+ behavior: Readonly<Detox.DetoxBehaviorConfig>;
98
+ cli: Readonly<DetoxCLIConfig>;
99
+ device: Readonly<Detox.DetoxDeviceConfig>;
100
+ logger: Readonly<Detox.DetoxLoggerConfig>;
101
+ testRunner: Readonly<Detox.DetoxTestRunnerConfig>;
102
+ session: Readonly<Detox.DetoxSessionConfig>;
96
103
  }>;
97
104
 
98
105
  type DetoxCLIConfig = Readonly<Partial<{
@@ -37,7 +37,7 @@ module.exports.builder = {
37
37
  };
38
38
 
39
39
  module.exports.handler = async function build(argv) {
40
- const { appsConfig, errorComposer } = await detox.resolveConfig({ argv });
40
+ const { apps: appsConfig, errorComposer } = await detox.resolveConfig({ argv });
41
41
  const apps = _.entries(appsConfig);
42
42
 
43
43
  for (const [appName, app] of apps) {
@@ -14,12 +14,12 @@ describe('build', () => {
14
14
  const DetoxConfigErrorComposer = require('../src/errors/DetoxConfigErrorComposer');
15
15
 
16
16
  const config = {
17
- appsConfig: {},
18
- artifactsConfig: {},
19
- behaviorConfig: {},
17
+ apps: {},
18
+ artifacts: {},
19
+ behavior: {},
20
20
  errorComposer: new DetoxConfigErrorComposer(),
21
- deviceConfig: {},
22
- sessionConfig: {}
21
+ device: {},
22
+ session: {}
23
23
  };
24
24
 
25
25
  return ({
@@ -44,14 +44,14 @@ describe('build', () => {
44
44
  });
45
45
 
46
46
  it('runs the build script from the composed device config', async () => {
47
- detox.config.appsConfig.default = { build: 'yet another command' };
47
+ detox.config.apps.default = { build: 'yet another command' };
48
48
 
49
49
  await callCli('./build', 'build');
50
50
  expect(execSync).toHaveBeenCalledWith('yet another command', expect.anything());
51
51
  });
52
52
 
53
53
  it('skips building the app if the binary exists and --if-missing flag is set', async () => {
54
- detox.config.appsConfig.default = { build: 'yet another command', binaryPath: __filename };
54
+ detox.config.apps.default = { build: 'yet another command', binaryPath: __filename };
55
55
 
56
56
  await callCli('./build', 'build -i');
57
57
  expect(execSync).not.toHaveBeenCalled();
@@ -63,32 +63,32 @@ describe('build', () => {
63
63
  });
64
64
 
65
65
  it('fails with an error if a build script has not been found', async () => {
66
- detox.config.appsConfig.default = {};
66
+ detox.config.apps.default = {};
67
67
  await expect(callCli('./build', 'build')).rejects.toThrowError(/Failed to build/);
68
68
  });
69
69
 
70
70
  it('should ignore missing build command with -s, --silent flag', async () => {
71
- detox.config.appsConfig.default = {};
71
+ detox.config.apps.default = {};
72
72
  await expect(callCli('./build', 'build -s')).resolves.not.toThrowError();
73
73
  expect(detox.log.warn).not.toHaveBeenCalled();
74
74
  });
75
75
 
76
76
  it('should print a warning upon user build script failure', async () => {
77
- detox.config.appsConfig.default = { build: 'a command' };
77
+ detox.config.apps.default = { build: 'a command' };
78
78
  execSync.mockImplementation(() => { throw new Error('Build failure'); });
79
79
  await expect(callCli('./build', 'build')).rejects.toThrowError(/Build failure/);
80
80
  expect(detox.log.warn).toHaveBeenCalledWith(expect.stringContaining('You are responsible'));
81
81
  });
82
82
 
83
83
  it('should print a warning if app is not found at binary path', async () => {
84
- detox.config.appsConfig.default = { binaryPath: tempfile() };
84
+ detox.config.apps.default = { binaryPath: tempfile() };
85
85
  await expect(callCli('./build', 'build -s')).resolves.not.toThrowError();
86
86
  expect(detox.log.warn).toHaveBeenCalledWith(expect.stringContaining('could not find your app at the given binary path'));
87
87
  });
88
88
 
89
89
  it('should print extra message with the app name before building (in a multi-app configuration)', async () => {
90
- detox.config.appsConfig.app1 = { binaryPath: tempfile(), build: ':' };
91
- detox.config.appsConfig.app2 = { binaryPath: tempfile(), build: ':' };
90
+ detox.config.apps.app1 = { binaryPath: tempfile(), build: ':' };
91
+ detox.config.apps.app2 = { binaryPath: tempfile(), build: ':' };
92
92
 
93
93
  await expect(callCli('./build', 'build -s')).resolves.not.toThrowError();
94
94
  expect(detox.log.info).toHaveBeenCalledWith(expect.stringContaining('app1'));
@@ -96,7 +96,7 @@ describe('build', () => {
96
96
  });
97
97
 
98
98
  it('should not print that extra message when the app is single', async () => {
99
- detox.config.appsConfig.default = { binaryPath: tempfile(), build: ':' };
99
+ detox.config.apps.default = { binaryPath: tempfile(), build: ':' };
100
100
 
101
101
  await expect(callCli('./build', 'build -s')).resolves.not.toThrowError();
102
102
  expect(detox.log.info).not.toHaveBeenCalledWith(expect.stringContaining('default'));
package/local-cli/test.js CHANGED
@@ -15,9 +15,9 @@ module.exports.handler = async function test({ detoxArgs, runnerArgs }) {
15
15
  });
16
16
 
17
17
  const runnerCommand = new TestRunnerCommand()
18
- .setRunnerConfig(detox.config.runnerConfig)
19
- .setDeviceConfig(detox.config.deviceConfig)
20
- .replicateCLIConfig(detox.config.cliConfig);
18
+ .setRunnerConfig(detox.config.testRunner)
19
+ .setDeviceConfig(detox.config.device)
20
+ .replicateCLIConfig(detox.config.cli);
21
21
 
22
22
  await runnerCommand.execute();
23
23
  } finally {