detox 20.25.1 → 20.25.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. package/Detox-android/com/wix/detox/{20.25.1/detox-20.25.1-sources.jar → 20.25.3/detox-20.25.3-sources.jar} +0 -0
  2. package/Detox-android/com/wix/detox/20.25.3/detox-20.25.3-sources.jar.md5 +1 -0
  3. package/Detox-android/com/wix/detox/20.25.3/detox-20.25.3-sources.jar.sha1 +1 -0
  4. package/Detox-android/com/wix/detox/20.25.3/detox-20.25.3-sources.jar.sha256 +1 -0
  5. package/Detox-android/com/wix/detox/20.25.3/detox-20.25.3-sources.jar.sha512 +1 -0
  6. package/Detox-android/com/wix/detox/{20.25.1/detox-20.25.1.aar → 20.25.3/detox-20.25.3.aar} +0 -0
  7. package/Detox-android/com/wix/detox/20.25.3/detox-20.25.3.aar.md5 +1 -0
  8. package/Detox-android/com/wix/detox/20.25.3/detox-20.25.3.aar.sha1 +1 -0
  9. package/Detox-android/com/wix/detox/20.25.3/detox-20.25.3.aar.sha256 +1 -0
  10. package/Detox-android/com/wix/detox/20.25.3/detox-20.25.3.aar.sha512 +1 -0
  11. package/Detox-android/com/wix/detox/{20.25.1/detox-20.25.1.pom → 20.25.3/detox-20.25.3.pom} +1 -1
  12. package/Detox-android/com/wix/detox/20.25.3/detox-20.25.3.pom.md5 +1 -0
  13. package/Detox-android/com/wix/detox/20.25.3/detox-20.25.3.pom.sha1 +1 -0
  14. package/Detox-android/com/wix/detox/20.25.3/detox-20.25.3.pom.sha256 +1 -0
  15. package/Detox-android/com/wix/detox/20.25.3/detox-20.25.3.pom.sha512 +1 -0
  16. package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
  17. package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
  18. package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
  19. package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
  20. package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
  21. package/Detox-android/com/wix/detox-legacy/{20.25.1/detox-legacy-20.25.1-sources.jar → 20.25.3/detox-legacy-20.25.3-sources.jar} +0 -0
  22. package/Detox-android/com/wix/detox-legacy/20.25.3/detox-legacy-20.25.3-sources.jar.md5 +1 -0
  23. package/Detox-android/com/wix/detox-legacy/20.25.3/detox-legacy-20.25.3-sources.jar.sha1 +1 -0
  24. package/Detox-android/com/wix/detox-legacy/20.25.3/detox-legacy-20.25.3-sources.jar.sha256 +1 -0
  25. package/Detox-android/com/wix/detox-legacy/20.25.3/detox-legacy-20.25.3-sources.jar.sha512 +1 -0
  26. package/Detox-android/com/wix/detox-legacy/{20.25.1/detox-legacy-20.25.1.aar → 20.25.3/detox-legacy-20.25.3.aar} +0 -0
  27. package/Detox-android/com/wix/detox-legacy/20.25.3/detox-legacy-20.25.3.aar.md5 +1 -0
  28. package/Detox-android/com/wix/detox-legacy/20.25.3/detox-legacy-20.25.3.aar.sha1 +1 -0
  29. package/Detox-android/com/wix/detox-legacy/20.25.3/detox-legacy-20.25.3.aar.sha256 +1 -0
  30. package/Detox-android/com/wix/detox-legacy/20.25.3/detox-legacy-20.25.3.aar.sha512 +1 -0
  31. package/Detox-android/com/wix/detox-legacy/{20.25.1/detox-legacy-20.25.1.pom → 20.25.3/detox-legacy-20.25.3.pom} +1 -1
  32. package/Detox-android/com/wix/detox-legacy/20.25.3/detox-legacy-20.25.3.pom.md5 +1 -0
  33. package/Detox-android/com/wix/detox-legacy/20.25.3/detox-legacy-20.25.3.pom.sha1 +1 -0
  34. package/Detox-android/com/wix/detox-legacy/20.25.3/detox-legacy-20.25.3.pom.sha256 +1 -0
  35. package/Detox-android/com/wix/detox-legacy/20.25.3/detox-legacy-20.25.3.pom.sha512 +1 -0
  36. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml +4 -4
  37. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.md5 +1 -1
  38. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.sha1 +1 -1
  39. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.sha256 +1 -1
  40. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.sha512 +1 -1
  41. package/Detox-ios-framework.tbz +0 -0
  42. package/Detox-ios-src.tbz +0 -0
  43. package/Detox-ios-xcuitest.tbz +0 -0
  44. package/android/detox/src/main/java/com/wix/detox/espresso/scroll/ScrollHelper.java +7 -6
  45. package/android/detox/src/testFull/java/com/wix/detox/espresso/scroll/ScrollHelperTest.kt +2 -1
  46. package/detox.d.ts +6 -2
  47. package/local-cli/build.js +23 -2
  48. package/package.json +2 -2
  49. package/src/devices/allocation/DeviceAllocator.js +7 -0
  50. package/src/devices/allocation/drivers/AllocationDriverBase.d.ts +1 -0
  51. package/src/devices/allocation/drivers/android/genycloud/GenyAllocDriver.js +11 -0
  52. package/src/realms/DetoxPrimaryContext.js +20 -1
  53. package/Detox-android/com/wix/detox/20.25.1/detox-20.25.1-sources.jar.md5 +0 -1
  54. package/Detox-android/com/wix/detox/20.25.1/detox-20.25.1-sources.jar.sha1 +0 -1
  55. package/Detox-android/com/wix/detox/20.25.1/detox-20.25.1-sources.jar.sha256 +0 -1
  56. package/Detox-android/com/wix/detox/20.25.1/detox-20.25.1-sources.jar.sha512 +0 -1
  57. package/Detox-android/com/wix/detox/20.25.1/detox-20.25.1.aar.md5 +0 -1
  58. package/Detox-android/com/wix/detox/20.25.1/detox-20.25.1.aar.sha1 +0 -1
  59. package/Detox-android/com/wix/detox/20.25.1/detox-20.25.1.aar.sha256 +0 -1
  60. package/Detox-android/com/wix/detox/20.25.1/detox-20.25.1.aar.sha512 +0 -1
  61. package/Detox-android/com/wix/detox/20.25.1/detox-20.25.1.pom.md5 +0 -1
  62. package/Detox-android/com/wix/detox/20.25.1/detox-20.25.1.pom.sha1 +0 -1
  63. package/Detox-android/com/wix/detox/20.25.1/detox-20.25.1.pom.sha256 +0 -1
  64. package/Detox-android/com/wix/detox/20.25.1/detox-20.25.1.pom.sha512 +0 -1
  65. package/Detox-android/com/wix/detox-legacy/20.25.1/detox-legacy-20.25.1-sources.jar.md5 +0 -1
  66. package/Detox-android/com/wix/detox-legacy/20.25.1/detox-legacy-20.25.1-sources.jar.sha1 +0 -1
  67. package/Detox-android/com/wix/detox-legacy/20.25.1/detox-legacy-20.25.1-sources.jar.sha256 +0 -1
  68. package/Detox-android/com/wix/detox-legacy/20.25.1/detox-legacy-20.25.1-sources.jar.sha512 +0 -1
  69. package/Detox-android/com/wix/detox-legacy/20.25.1/detox-legacy-20.25.1.aar.md5 +0 -1
  70. package/Detox-android/com/wix/detox-legacy/20.25.1/detox-legacy-20.25.1.aar.sha1 +0 -1
  71. package/Detox-android/com/wix/detox-legacy/20.25.1/detox-legacy-20.25.1.aar.sha256 +0 -1
  72. package/Detox-android/com/wix/detox-legacy/20.25.1/detox-legacy-20.25.1.aar.sha512 +0 -1
  73. package/Detox-android/com/wix/detox-legacy/20.25.1/detox-legacy-20.25.1.pom.md5 +0 -1
  74. package/Detox-android/com/wix/detox-legacy/20.25.1/detox-legacy-20.25.1.pom.sha1 +0 -1
  75. package/Detox-android/com/wix/detox-legacy/20.25.1/detox-legacy-20.25.1.pom.sha256 +0 -1
  76. package/Detox-android/com/wix/detox-legacy/20.25.1/detox-legacy-20.25.1.pom.sha512 +0 -1
@@ -0,0 +1 @@
1
+ 05bbe39ab4e9fa7d7b7c20096102f140
@@ -0,0 +1 @@
1
+ 4a17e97e71282e4f5af1e75c92b94ab0709e7565
@@ -0,0 +1 @@
1
+ fc67d95bffff1696685328cc5d41401c77e2fa47d8403a71b330b11703599fbc
@@ -0,0 +1 @@
1
+ d9c0e90e6f69ea218d75f3b58d5ebf55e8c95c045b902abb4fa0da1875073b6843ecf394b95eeefd9a299a2b6a35563b94a9b2e96cf30c12b6304cc60fab5517
@@ -0,0 +1 @@
1
+ f8f2a2bd622fadc1baf0d5be4f21622f
@@ -0,0 +1 @@
1
+ 3ce2c636fb75e7758525c444e9b19f7a69ff7aa2
@@ -0,0 +1 @@
1
+ b6d5ba6221494632ff63d50785be381add4d688d167e1696d3f027d76a768042
@@ -0,0 +1 @@
1
+ 0b22922e5fb5f7c8d8851661cf96982870f7a942939f5648ad4f72da1711515be0a6198fd9d789c2d45deedb0129452a6167f7068ab68b92c39d890fd2e467aa
@@ -3,7 +3,7 @@
3
3
  <modelVersion>4.0.0</modelVersion>
4
4
  <groupId>com.wix</groupId>
5
5
  <artifactId>detox</artifactId>
6
- <version>20.25.1</version>
6
+ <version>20.25.3</version>
7
7
  <packaging>aar</packaging>
8
8
  <name>Detox</name>
9
9
  <description>Gray box end-to-end testing and automation library for mobile apps</description>
@@ -0,0 +1 @@
1
+ 2b74b7f77d59ddfea8a0ded380fe703b
@@ -0,0 +1 @@
1
+ 11cd9d557ca0f51d33288c41be8ee2237139be62
@@ -0,0 +1 @@
1
+ ab415b2511f374fb2d8f0bce9a2d5ec94cabd9641d1218c0cd77a55056f76226
@@ -0,0 +1 @@
1
+ bed74b0e2e4fb244ce7723a9e5f98884cbdc755e0fd63ecf9cb049865bcb0649cad74e7a78b11a9a59cf7a7506cfae7d6c6ba715ee7a5720302afc533c142c07
@@ -3,11 +3,11 @@
3
3
  <groupId>com.wix</groupId>
4
4
  <artifactId>detox</artifactId>
5
5
  <versioning>
6
- <latest>20.25.1</latest>
7
- <release>20.25.1</release>
6
+ <latest>20.25.3</latest>
7
+ <release>20.25.3</release>
8
8
  <versions>
9
- <version>20.25.1</version>
9
+ <version>20.25.3</version>
10
10
  </versions>
11
- <lastUpdated>20240716121904</lastUpdated>
11
+ <lastUpdated>20240813134430</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 275ff0123e1dbaa1aed3a7e91e9ae762
1
+ 364f63ad7f9dd0eef84f759985bb5656
@@ -1 +1 @@
1
- f986a8170fefe76b9f4efd0b755aaccde8b51bdd
1
+ e2ed7d575674dcc76f30033f928ec939c4617d5a
@@ -1 +1 @@
1
- 779e3063806e639cd380893e02fe5a902fbdad0f12d6eb06b09819f07a863272
1
+ 04081e0350df6f2bc8f71e6d25094031997980f52dc6c2f142d7abf5a71c746a
@@ -1 +1 @@
1
- 8c0fae16887da6da5fa405a62587e05612fa0b27a8d4e047419dfeb0bf3889b83c4c367941056b92b309b327c3f9aa28f1b26cc882ce6dda96ec2564a0836089
1
+ 912b5f8c201d54b630a479c3093b7d72b2ba9bdecb31916e16278c6923905b145e624c9b3eb1f53c66eb39f80631b94bd5af56dad3c5ca9b69bd7f0a673273ee
@@ -0,0 +1 @@
1
+ 441bca6dbe4e6176412d3992667779b2
@@ -0,0 +1 @@
1
+ 291d08350a0443c2de8e1a87aaaed1dbfe923814
@@ -0,0 +1 @@
1
+ 083e8320aeef4738885309c7528ac5f6f95e75d817ed21950dae032886be41fe
@@ -0,0 +1 @@
1
+ 5577657a488a730c2b5b2bc7fbd83bde8a962adcb35d27f077bd4c1d7ceac71fdf26a3e65953d4eeca2a65b6136b71f59853af7aef7cf960893c844a038aa4ec
@@ -0,0 +1 @@
1
+ d271489c0570c8529c634b79843bc0a0
@@ -0,0 +1 @@
1
+ e0bceb0063fccfb5b5a0c173587a33720eca9d8d
@@ -0,0 +1 @@
1
+ 328f2d83c0c54a3ac3e8cc0aadadd27f622c79d5c6f4490c2852ca8ef5f76b8f
@@ -0,0 +1 @@
1
+ 22fe1aa0a7686ab99c4c5cb81bbf8c16e35c79039fc2dc070c9c6c14687042cd3182cc554ee0da4c48b5ec8330fa98b9887a8e7cf06f04c66f30612e919cbc2a
@@ -3,7 +3,7 @@
3
3
  <modelVersion>4.0.0</modelVersion>
4
4
  <groupId>com.wix</groupId>
5
5
  <artifactId>detox-legacy</artifactId>
6
- <version>20.25.1</version>
6
+ <version>20.25.3</version>
7
7
  <packaging>aar</packaging>
8
8
  <name>Detox</name>
9
9
  <description>Gray box end-to-end testing and automation library for mobile apps</description>
@@ -0,0 +1 @@
1
+ 917ecc4f3a8760c42a818bdcc1134f76
@@ -0,0 +1 @@
1
+ c8ea430bb5c1d2ccddddce213f8179a816ff6285
@@ -0,0 +1 @@
1
+ 1a0eda98b44d5464ef4ecf103c0b16352df1c787f0dc60e6c173d83bd7c7c925
@@ -0,0 +1 @@
1
+ ff480574686f6aa3a7fb661720fcca5e38d60b4ea972f539f988b5bc8e7d4f41f6ac34251e585cdb6511b16d1b6fa59da86367f26c11539adca0a50fe2bfa183
@@ -3,11 +3,11 @@
3
3
  <groupId>com.wix</groupId>
4
4
  <artifactId>detox-legacy</artifactId>
5
5
  <versioning>
6
- <latest>20.25.1</latest>
7
- <release>20.25.1</release>
6
+ <latest>20.25.3</latest>
7
+ <release>20.25.3</release>
8
8
  <versions>
9
- <version>20.25.1</version>
9
+ <version>20.25.3</version>
10
10
  </versions>
11
- <lastUpdated>20240716121940</lastUpdated>
11
+ <lastUpdated>20240813134444</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 39a5211574c6847cfa8ba0c843d19419
1
+ 1a353da96c3f636aaac50b60b438b564
@@ -1 +1 @@
1
- 03853c1e7b6181d8a82d09756d5ffeb0894d2883
1
+ f6fc15cde77f46eee3f2540de7afafc14f3888cc
@@ -1 +1 @@
1
- 3c07d8c65169a75189c32e72f195d09399c059a0a42a5d42e0a54e06a9c1af8e
1
+ 3299d4c0a170418ad6e076b87642b3ce656c25fb524384af0f4f5745c7c517cb
@@ -1 +1 @@
1
- 01a09bb5c4de685f4a81bb7b11d211230808546068b486ca51e3889dfb74ad278c18f7a330c6b1898d73a8b993d91884e36336fcb84054e1a923b93f6578613f
1
+ 365ab22c220f58af97628116838db44615f8e8503be483c7383abaf09012cb328a6c6b814459096fa178dbb312591157ea37f87ba13b8d8146a86f843f0dcc31
Binary file
package/Detox-ios-src.tbz CHANGED
Binary file
Binary file
@@ -194,16 +194,17 @@ public class ScrollHelper {
194
194
  * @return a Point object, denoting the scroll start point.
195
195
  */
196
196
  private static Point getScrollStartPoint(View view, @MotionDir int direction, Float startOffsetPercentX, Float startOffsetPercentY) {
197
- Point result = getGlobalViewLocation(view);
197
+ Point globalViewPoint = getGlobalViewLocation(view);
198
198
 
199
199
  // 1. Calculate the scroll start point, with respect to the view's location.
200
200
  int[] coordinates = getScrollStartOffsetInView(view, direction, startOffsetPercentX, startOffsetPercentY);
201
201
 
202
+ globalViewPoint.offset(coordinates[0], coordinates[1]);
203
+
202
204
  // 2. Make sure that the start point is within the scrollable area, taking into account the system gesture insets.
203
- coordinates = applyScreenInsets(view, direction, coordinates[0], coordinates[1]);
205
+ coordinates = applyScreenInsets(view, direction, globalViewPoint.x, globalViewPoint.y);
204
206
 
205
- result.offset(coordinates[0], coordinates[1]);
206
- return result;
207
+ return new Point(coordinates[0], coordinates[1]);
207
208
  }
208
209
 
209
210
  /**
@@ -237,8 +238,8 @@ public class ScrollHelper {
237
238
  Log.w(LOG_TAG, "Could not get root window insets");
238
239
  } else {
239
240
  Insets gestureInsets = rootWindowInsets.getSystemGestureInsets();
240
- minX = gestureInsets.left;
241
- minY = gestureInsets.top;
241
+ minX += gestureInsets.left;
242
+ minY += gestureInsets.top;
242
243
  maxX -= gestureInsets.right;
243
244
  maxY -= gestureInsets.bottom;
244
245
 
@@ -27,7 +27,6 @@ private const val SCROLL_RANGE_SAFE_PERCENT = 0.9f // ScrollHelper.SCROLL_RANGE_
27
27
 
28
28
  @Config(
29
29
  qualifiers = "xxxhdpi", // 1280x1880
30
- sdk = [33]
31
30
  )
32
31
  @RunWith(RobolectricTestRunner::class)
33
32
  class ScrollHelperTest {
@@ -95,6 +94,7 @@ class ScrollHelperTest {
95
94
  // Calculate where the scroll should end
96
95
  val targetX = amountInPx +
97
96
  touchSlopPx +
97
+ safetyMarginPx +
98
98
  INSETS_SIZE
99
99
 
100
100
  assertEquals(targetX, upEvent.x, 0.0f)
@@ -110,6 +110,7 @@ class ScrollHelperTest {
110
110
  // Calculate where the scroll should end
111
111
  val targetY = amountInPx +
112
112
  touchSlopPx +
113
+ safetyMarginPx +
113
114
  INSETS_SIZE
114
115
 
115
116
  assertEquals(displayWidth / 2.0, upEvent.x.toDouble(), 0.0)
package/detox.d.ts CHANGED
@@ -762,7 +762,7 @@ declare global {
762
762
  uninstallApp(bundle?: string): Promise<void>;
763
763
 
764
764
  /**
765
- * Mock opening the app from URL. sourceApp is an optional parameter to specify source application bundle id.
765
+ * Mock opening the app from URL. `sourceApp` is an optional parameter to specify source application bundle id (iOS only).
766
766
  */
767
767
  openURL(url: { url: string; sourceApp?: string }): Promise<void>;
768
768
 
@@ -1905,7 +1905,11 @@ declare global {
1905
1905
  * Launch from URL
1906
1906
  * Mock opening the app from URL to test your app's deep link handling mechanism.
1907
1907
  */
1908
- url?: any;
1908
+ url?: string;
1909
+ /**
1910
+ * Optional parameter to specify source application bundle id when opening the app from URL (iOS Only).
1911
+ */
1912
+ sourceApp?: string;
1909
1913
  /**
1910
1914
  * Launch with user notifications
1911
1915
  */
@@ -34,8 +34,29 @@ module.exports.builder = {
34
34
  },
35
35
  };
36
36
 
37
+ function checkAppsExist(appsConfig, commands) {
38
+ const result = { '*': true };
39
+
40
+ for (const { appName } of commands) {
41
+ if (appName) {
42
+ result[appName] = true;
43
+
44
+ const app = appsConfig[appName] || {};
45
+ if (app.binaryPath && !fs.existsSync(app.binaryPath)) {
46
+ result[appName] = result['*'] = false;
47
+ }
48
+ if (app.testBinaryPath && !fs.existsSync(app.testBinaryPath)) {
49
+ result[appName] = result['*'] = false;
50
+ }
51
+ }
52
+ }
53
+
54
+ return result;
55
+ }
56
+
37
57
  module.exports.handler = async function build(argv) {
38
58
  const { apps, commands, errorComposer } = await detox.resolveConfig({ argv });
59
+ const appsExist = checkAppsExist(apps, commands);
39
60
 
40
61
  let seenBuildCommands = false;
41
62
 
@@ -45,8 +66,8 @@ module.exports.handler = async function build(argv) {
45
66
  if (build) {
46
67
  seenBuildCommands = true;
47
68
 
48
- if (argv['if-missing'] && app.binaryPath && fs.existsSync(app.binaryPath)) {
49
- detox.log.info(`Skipping build for "${appName}" app...`);
69
+ if (argv['if-missing'] && appsExist[appName || '*']) {
70
+ detox.log.info(appName ? `Skipping build for "${appName}" app...` : 'Skipping build...');
50
71
  continue;
51
72
  }
52
73
 
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.25.1",
4
+ "version": "20.25.3",
5
5
  "bin": {
6
6
  "detox": "local-cli/cli.js"
7
7
  },
@@ -115,5 +115,5 @@
115
115
  "browserslist": [
116
116
  "node 14"
117
117
  ],
118
- "gitHead": "f25468f5b0cf6e2895fb6b51b96ffc14263f2084"
118
+ "gitHead": "a070850c8535f58c082158f08bbc3902f1f178c7"
119
119
  }
@@ -92,6 +92,13 @@ class DeviceAllocator {
92
92
  this._driver.emergencyCleanup();
93
93
  }
94
94
  }
95
+
96
+ isRecoverableError(error) {
97
+ if (typeof this._driver.isRecoverableError !== 'function') {
98
+ return false;
99
+ }
100
+ return this._driver.isRecoverableError(error);
101
+ }
95
102
  }
96
103
 
97
104
  module.exports = DeviceAllocator;
@@ -12,4 +12,5 @@ export interface AllocationDriverBase {
12
12
  free(cookie: DeviceCookie, options: DeallocOptions): Promise<void>;
13
13
  cleanup?(): Promise<void>;
14
14
  emergencyCleanup?(): void;
15
+ isRecoverableError?(error: any): boolean;
15
16
  }
@@ -125,6 +125,17 @@ class GenyAllocDriver {
125
125
  this._reportGlobalCleanupSummary(deletionLeaks);
126
126
  }
127
127
 
128
+ /**
129
+ * The current error we could recover from in the context of Genymotion Cloud is when the device is not found.
130
+ * The error message will contain the following text adb: device 'localhost:xxxxx' not found
131
+ * @param error
132
+ * @returns {boolean}
133
+ */
134
+ isRecoverableError(error) {
135
+ const errorStr = JSON.stringify(error);
136
+ return errorStr.indexOf('adb: device \'localhost:') !== -1;
137
+ }
138
+
128
139
  emergencyCleanup() {
129
140
  const instances = this._genyRegistry.getInstances();
130
141
  this._reportGlobalCleanupSummary(instances);
@@ -7,6 +7,7 @@ const temporary = require('../artifacts/utils/temporaryPath');
7
7
  const { DetoxRuntimeError } = require('../errors');
8
8
  const SessionState = require('../ipc/SessionState');
9
9
  const { getCurrentCommand } = require('../utils/argparse');
10
+ const retry = require('../utils/retry');
10
11
  const uuid = require('../utils/uuid');
11
12
 
12
13
  const DetoxContext = require('./DetoxContext');
@@ -27,6 +28,7 @@ const _cookieAllocators = Symbol('cookieAllocators');
27
28
  const _deviceAllocators = Symbol('deviceAllocators');
28
29
  const _createDeviceAllocator = Symbol('createDeviceAllocator');
29
30
  const _createDeviceAllocatorInstance = Symbol('createDeviceAllocatorInstance');
31
+ const _allocateDeviceOnce = Symbol('allocateDeviceOnce');
30
32
  //#endregion
31
33
 
32
34
  class DetoxPrimaryContext extends DetoxContext {
@@ -154,6 +156,20 @@ class DetoxPrimaryContext extends DetoxContext {
154
156
  /** @override */
155
157
  async [symbols.allocateDevice](deviceConfig) {
156
158
  const deviceAllocator = await this[_createDeviceAllocator](deviceConfig);
159
+
160
+ const retryOptions = {
161
+ backoff: 'none',
162
+ retries: 5,
163
+ interval: 25000,
164
+ conditionFn: (e) => deviceAllocator.isRecoverableError(e),
165
+ };
166
+
167
+ return await retry(retryOptions, async () => {
168
+ return await this[_allocateDeviceOnce](deviceAllocator, deviceConfig);
169
+ });
170
+ }
171
+
172
+ async [_allocateDeviceOnce](deviceAllocator, deviceConfig) {
157
173
  const deviceCookie = await deviceAllocator.allocate(deviceConfig);
158
174
  this[_cookieAllocators][deviceCookie.id] = deviceAllocator;
159
175
 
@@ -163,7 +179,10 @@ class DetoxPrimaryContext extends DetoxContext {
163
179
  try {
164
180
  await deviceAllocator.free(deviceCookie, { shutdown: true });
165
181
  } catch (e2) {
166
- this[symbols.logger].error({ cat: 'device', err: e2 }, `Failed to free ${deviceCookie.name || deviceCookie.id} after a failed allocation attempt`);
182
+ this[symbols.logger].error({
183
+ cat: 'device',
184
+ err: e2
185
+ }, `Failed to free ${deviceCookie.name || deviceCookie.id} after a failed allocation attempt`);
167
186
  } finally {
168
187
  delete this[_cookieAllocators][deviceCookie.id];
169
188
  }
@@ -1 +0,0 @@
1
- ef152eed43d99abecc781d2c5581ed2c
@@ -1 +0,0 @@
1
- a00c63f1d6864fe3684aabdc4addaf251db4f12d
@@ -1 +0,0 @@
1
- 9d2842e3781dc8085a80c2029c5d63cac9b382181371e3d715e71248ae81e619
@@ -1 +0,0 @@
1
- 9f993e109ac46d9ec4132ad900b0eee9e4f5604909c69496ebc364ba1bc32ceb19fca9b5adbfe6a9e61c4c489e6a21e61efd58ec6a0602a4c8dd35c0f1897c72
@@ -1 +0,0 @@
1
- c30ab5e84a5014b0b81d4faabde6a700
@@ -1 +0,0 @@
1
- 5bb074cd595fd75e357176cbd1427eb75ed4e8d5
@@ -1 +0,0 @@
1
- 5fc6ee2c1a19b885d28766a68f924162061b405d79aec808d7c41eb3165bc2b1
@@ -1 +0,0 @@
1
- 844af749105ed914beb68383c07baf6fd4bdc33b053073f0bd29de638e7474cd66a31bf2df6a0f7824d0f322b742eed9d9376da5ada807a5cd539dd217fe2ab5
@@ -1 +0,0 @@
1
- 5a378650b3fb1fc751bad1924a05e988
@@ -1 +0,0 @@
1
- a2d652e833f0d7a91a8f05e2232a4ca964992a66
@@ -1 +0,0 @@
1
- 97b5030e5db6c3d762c9a24ecc11a6989f4079591ddab23d2b8c67e4ac20bfb7
@@ -1 +0,0 @@
1
- 37ab0fe6dec997c70fdff5e0f76acf744c487d150a70954bffa0467042c861b2bfe3711d53762c1ea0efce1a6fc8c29b82bfb822435cac2756474fcec24c4d5e
@@ -1 +0,0 @@
1
- 5faf79ea736df2cf512a937df79bec2a
@@ -1 +0,0 @@
1
- 834508470595778511d3f3b564de2d31413e57ff
@@ -1 +0,0 @@
1
- 3d5e951f611b30a5d85d3535db3152824f019c4cd99972ff304b76d0c46b1038
@@ -1 +0,0 @@
1
- ff7bf763835d49aa17a6ba58b738cf47e5577038c10de0e6af0c629be076970895540b02ee8ba9d431c277f28aa1458c617d95b9df0adb0a32d0fa3afb67972c
@@ -1 +0,0 @@
1
- 374341065754bd6af3cb6dfb12797043
@@ -1 +0,0 @@
1
- 697e735f9b859cf2cf8097e9ea2b99ed1b018ef4
@@ -1 +0,0 @@
1
- b5fa97662e36dee60aa838e47f457705d0145b0243dd2f7eb0076ec53ea42127
@@ -1 +0,0 @@
1
- cb3be83d53a83577894d9ed9fe8d96c86ebfa960c3be707684d82eb911871aebe33dcfc5fff988dc9a40e99135962a8ac8ac4c9f1be02ac957eb1fd0ddbb2277
@@ -1 +0,0 @@
1
- 275a026938b603bc63c62aa9105660ab
@@ -1 +0,0 @@
1
- 38f52f7d5a0616f1ea0c7fd7831197ebda6b4df9
@@ -1 +0,0 @@
1
- 92ee50857ac9fb128bd30d6079ed09ef71e53526fe45581baec69d72bc05c5a4
@@ -1 +0,0 @@
1
- e6ca3c09f9026d4e0c54b71f8b1c78506fc6a2005c3f41e6df65b4f8f36fb4bea770cca153c887f140ce338200397777168a55e52bd51c4894dbe11677d422b6