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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) 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.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar} +0 -0
  2. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.md5 +1 -0
  3. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +1 -0
  4. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +1 -0
  5. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-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.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar} +0 -0
  7. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.md5 +1 -0
  8. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.sha1 +1 -0
  9. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.sha256 +1 -0
  10. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.sha512 +1 -0
  11. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar +0 -0
  12. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.md5 +1 -0
  13. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.sha1 +1 -0
  14. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.sha256 +1 -0
  15. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-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.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom} +2 -2
  17. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom.md5 +1 -0
  18. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom.sha1 +1 -0
  19. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom.sha256 +1 -0
  20. package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-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/internals.d.ts +3 -8
  50. package/local-cli/testCommand/TestRunnerCommand.js +2 -1
  51. package/package.json +4 -4
  52. package/src/DetoxWorker.js +5 -0
  53. package/src/artifacts/log/android/ADBLogcatRecording.js +11 -28
  54. package/src/configuration/composeAppsConfig.js +1 -1
  55. package/src/devices/allocation/drivers/android/genycloud/GenyAllocDriver.js +1 -0
  56. package/src/devices/common/drivers/android/exec/ADB.js +5 -0
  57. package/src/errors/DetoxConfigErrorComposer.js +1 -1
  58. package/src/ipc/IPCServer.js +7 -1
  59. package/src/ipc/state.js +10 -1
  60. package/src/realms/DetoxContext.js +1 -1
  61. package/src/realms/DetoxPrimaryContext.js +3 -2
  62. package/src/realms/DetoxSecondaryContext.js +2 -1
  63. package/src/utils/ChromeTracingExporter.js +6 -5
  64. package/src/utils/environment.js +30 -15
  65. 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
  66. 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
  67. 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
  68. 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
  69. 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
  70. 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
  71. 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
  72. 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
  73. 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
  74. 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
  75. 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
  76. 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
  77. 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
  78. 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
  79. 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
  80. 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
  81. 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
  82. package/android/detox/src/main/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +0 -36
  83. 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/internals.d.ts CHANGED
@@ -72,15 +72,10 @@ declare global {
72
72
  workerId: number;
73
73
  };
74
74
 
75
- type SessionState = Readonly<PrimarySessionState | SecondarySessionState>;
76
-
77
- type SecondarySessionState = {
78
- workersCount: number;
79
- };
80
-
81
- type PrimarySessionState = PrimarySessionState & {
75
+ type SessionState = Readonly<{
82
76
  failedTestFiles: string[];
83
- };
77
+ workersCount: number;
78
+ }>;
84
79
 
85
80
  type RuntimeConfig = Readonly<{
86
81
  configurationName: string;
@@ -99,6 +99,7 @@ class TestRunnerCommand {
99
99
  } catch (e) {
100
100
  launchError = e;
101
101
 
102
+ // @ts-ignore
102
103
  const { failedTestFiles } = detox.session;
103
104
  if (_.isEmpty(failedTestFiles)) {
104
105
  throw e;
@@ -106,7 +107,7 @@ class TestRunnerCommand {
106
107
 
107
108
  this._argv._ = failedTestFiles.slice();
108
109
  this._env.DETOX_RERUN_INDEX = 1 + (this._env.DETOX_RERUN_INDEX || 0);
109
- detox.session.failedTestFiles.splice(0, Infinity);
110
+ failedTestFiles.splice(0, Infinity);
110
111
  }
111
112
  } while (launchError && --runsLeft > 0);
112
113
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "detox",
3
3
  "description": "E2E tests and automation for mobile",
4
- "version": "20.0.0-breaking.new-global-lifecycle.0",
4
+ "version": "20.0.1-breaking.new-global-lifecycle.0",
5
5
  "bin": {
6
6
  "detox": "local-cli/cli.js"
7
7
  },
@@ -46,10 +46,10 @@
46
46
  "eslint-plugin-no-only-tests": "^2.6.0",
47
47
  "eslint-plugin-node": "^11.1.0",
48
48
  "eslint-plugin-unicorn": "^39.0.0",
49
- "jest": "^27.5.1",
49
+ "jest": "^28.0.0",
50
50
  "mockdate": "^2.0.1",
51
51
  "prettier": "1.7.0",
52
- "react-native": "0.67.2",
52
+ "react-native": "0.68.2",
53
53
  "react-native-codegen": "^0.0.8",
54
54
  "typescript": "^4.5.2",
55
55
  "wtfnode": "^0.9.1"
@@ -183,5 +183,5 @@
183
183
  }
184
184
  }
185
185
  },
186
- "gitHead": "e89c826fdbd09989dcb1cc82eb3cc7d821ffbf3e"
186
+ "gitHead": "b05792476b6eaedeb998b8625ecc78132aee361f"
187
187
  }
@@ -232,6 +232,11 @@ class DetoxWorker {
232
232
  if (this._isCleaningUp) return;
233
233
  await this.device.uninstallApp();
234
234
  if (this._isCleaningUp) return;
235
+ }
236
+
237
+ for (const appName of appNames) {
238
+ await this.device.selectApp(appName);
239
+ if (this._isCleaningUp) return;
235
240
  await this.device.installApp();
236
241
  if (this._isCleaningUp) return;
237
242
  }
@@ -1,6 +1,5 @@
1
1
  const DetoxRuntimeError = require('../../../errors/DetoxRuntimeError');
2
2
  const { interruptProcess } = require('../../../utils/childProcess');
3
- const log = require('../../../utils/logger').child({ __filename });
4
3
  const retry = require('../../../utils/retry');
5
4
  const sleep = require('../../../utils/sleep');
6
5
  const Artifact = require('../../templates/artifact/Artifact');
@@ -26,26 +25,18 @@ class ADBLogcatRecording extends Artifact {
26
25
  this._waitUntilLogFileIsCreated = null;
27
26
  }
28
27
 
29
- get hasRecordedFile() {
30
- return !!this._waitUntilLogFileIsCreated;
31
- }
32
-
33
28
  async doStart() {
34
29
  const pid = this.pid.get();
35
30
 
36
- if (pid > 0) {
37
- this.processPromise = this.adb.logcat(this.deviceId, {
38
- file: this.pathToLogOnDevice,
39
- time: this.since.get(),
40
- pid,
41
- });
31
+ this.processPromise = this.adb.logcat(this.deviceId, {
32
+ file: this.pathToLogOnDevice,
33
+ time: this.since.get(),
34
+ pid: pid > 0 ? pid : 0,
35
+ });
42
36
 
43
- this._waitUntilLogFileIsCreated = sleep(300).then(() => {
44
- return retry(() => this._assertLogIsCreated());
45
- });
46
- } else {
47
- log.debug('Ignoring a command to start recording, because PID of the app is missing');
48
- }
37
+ this._waitUntilLogFileIsCreated = sleep(300).then(() => {
38
+ return retry(() => this._assertLogIsCreated());
39
+ });
49
40
  }
50
41
 
51
42
  async doStop() {
@@ -61,20 +52,12 @@ class ADBLogcatRecording extends Artifact {
61
52
  }
62
53
 
63
54
  async doSave(artifactPath) {
64
- if (this.hasRecordedFile) {
65
- await this.adb.pull(this.deviceId, this.pathToLogOnDevice, artifactPath);
66
- await this.adb.rm(this.deviceId, this.pathToLogOnDevice);
67
- } else {
68
- log.debug(`Skipping saving artifact because the recording has not started: ${artifactPath}`);
69
- }
55
+ await this.adb.pull(this.deviceId, this.pathToLogOnDevice, artifactPath);
56
+ await this.adb.rm(this.deviceId, this.pathToLogOnDevice);
70
57
  }
71
58
 
72
59
  async doDiscard() {
73
- if (this.hasRecordedFile) {
74
- await this.adb.rm(this.deviceId, this.pathToLogOnDevice);
75
- } else {
76
- log.debug(`Skipping discarding artifact due to a not started recording: ${this.pathToLogOnDevice}`);
77
- }
60
+ await this.adb.rm(this.deviceId, this.pathToLogOnDevice);
78
61
  }
79
62
 
80
63
  async _assertLogIsCreated() {
@@ -1,6 +1,6 @@
1
1
  // @ts-nocheck
2
2
  const _ = require('lodash');
3
- const parse = require('yargs/yargs').Parser;
3
+ const parse = require('yargs-parser');
4
4
 
5
5
  const deviceAppTypes = require('./utils/deviceAppTypes');
6
6
 
@@ -40,6 +40,7 @@ class GenyAllocDriver extends AllocationDriverBase {
40
40
  const { adbName } = instance;
41
41
 
42
42
  await this._adb.disableAndroidAnimations(adbName);
43
+ await this._adb.setWiFiToggle(adbName, true);
43
44
  await this._adb.apiLevel(adbName);
44
45
  return new GenycloudEmulatorCookie(instance);
45
46
  }
@@ -206,6 +206,11 @@ class ADB {
206
206
  await this.shell(deviceId, `settings put global transition_animation_scale 0`);
207
207
  }
208
208
 
209
+ async setWiFiToggle(deviceId, state) {
210
+ const value = (state === true ? 'enable' : 'disable');
211
+ await this.shell(deviceId, `svc wifi ${value}`);
212
+ }
213
+
209
214
  async screencap(deviceId, path) {
210
215
  await this.shell(deviceId, `screencap ${path}`);
211
216
  }
@@ -409,7 +409,7 @@ Please check your Detox config${this._atPath()}`,
409
409
  case 'gpuMode':
410
410
  return this._unsupportedPropertyByDeviceType('gpuMode', ['android.emulator'], deviceAlias);
411
411
  case 'headless':
412
- return this._unsupportedPropertyByDeviceType('headless', ['android.emulator'], deviceAlias);
412
+ return this._unsupportedPropertyByDeviceType('headless', ['ios.simulator', 'android.emulator'], deviceAlias);
413
413
  case 'readonly':
414
414
  return this._unsupportedPropertyByDeviceType('readonly', ['android.emulator'], deviceAlias);
415
415
  case 'utilBinaryPaths':
@@ -55,7 +55,9 @@ class IPCServer {
55
55
  this._sessionState.logFiles.push(logFile);
56
56
  }
57
57
 
58
- this._ipc.server.emit(socket, 'registerContextDone', {});
58
+ this._ipc.server.emit(socket, 'registerContextDone', {
59
+ failedTestFiles: this._sessionState.failedTestFiles,
60
+ });
59
61
  }
60
62
 
61
63
  onRegisterWorker({ workerId }, socket) {
@@ -75,6 +77,10 @@ class IPCServer {
75
77
  if (socket) {
76
78
  this._ipc.server.emit(socket, 'failedTestsDone', {});
77
79
  }
80
+
81
+ this._ipc.server.broadcast('sessionStateUpdate', {
82
+ failedTestFiles: this._sessionState.failedTestFiles,
83
+ });
78
84
  }
79
85
  }
80
86
 
package/src/ipc/state.js CHANGED
@@ -38,13 +38,22 @@ class SessionState {
38
38
  }
39
39
 
40
40
  class SecondarySessionState extends SessionState {
41
- constructor({ id = uuid.UUID(), detoxConfigSnapshotPath = '', detoxConfig = null, detoxIPCServer = '', workerId = undefined, workersCount = 0 }) {
41
+ constructor({
42
+ id = uuid.UUID(),
43
+ detoxConfigSnapshotPath = '',
44
+ detoxConfig = null,
45
+ detoxIPCServer = '',
46
+ failedTestFiles = [],
47
+ workerId = undefined,
48
+ workersCount = 0
49
+ }) {
42
50
  super();
43
51
 
44
52
  this.id = id;
45
53
  this.detoxConfigSnapshotPath = detoxConfigSnapshotPath;
46
54
  this.detoxConfig = detoxConfig;
47
55
  this.detoxIPCServer = detoxIPCServer;
56
+ this.failedTestFiles = failedTestFiles;
48
57
  this.workerId = workerId;
49
58
  this.workersCount = workersCount;
50
59
  }