detox 20.25.0 → 20.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/Detox-android/com/wix/detox/{20.25.0/detox-20.25.0-sources.jar → 20.25.2/detox-20.25.2-sources.jar} +0 -0
  2. package/Detox-android/com/wix/detox/20.25.2/detox-20.25.2-sources.jar.md5 +1 -0
  3. package/Detox-android/com/wix/detox/20.25.2/detox-20.25.2-sources.jar.sha1 +1 -0
  4. package/Detox-android/com/wix/detox/20.25.2/detox-20.25.2-sources.jar.sha256 +1 -0
  5. package/Detox-android/com/wix/detox/20.25.2/detox-20.25.2-sources.jar.sha512 +1 -0
  6. package/Detox-android/com/wix/detox/{20.25.0/detox-20.25.0.aar → 20.25.2/detox-20.25.2.aar} +0 -0
  7. package/Detox-android/com/wix/detox/20.25.2/detox-20.25.2.aar.md5 +1 -0
  8. package/Detox-android/com/wix/detox/20.25.2/detox-20.25.2.aar.sha1 +1 -0
  9. package/Detox-android/com/wix/detox/20.25.2/detox-20.25.2.aar.sha256 +1 -0
  10. package/Detox-android/com/wix/detox/20.25.2/detox-20.25.2.aar.sha512 +1 -0
  11. package/Detox-android/com/wix/detox/{20.25.0/detox-20.25.0.pom → 20.25.2/detox-20.25.2.pom} +1 -1
  12. package/Detox-android/com/wix/detox/20.25.2/detox-20.25.2.pom.md5 +1 -0
  13. package/Detox-android/com/wix/detox/20.25.2/detox-20.25.2.pom.sha1 +1 -0
  14. package/Detox-android/com/wix/detox/20.25.2/detox-20.25.2.pom.sha256 +1 -0
  15. package/Detox-android/com/wix/detox/20.25.2/detox-20.25.2.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.0/detox-legacy-20.25.0-sources.jar → 20.25.2/detox-legacy-20.25.2-sources.jar} +0 -0
  22. package/Detox-android/com/wix/detox-legacy/20.25.2/detox-legacy-20.25.2-sources.jar.md5 +1 -0
  23. package/Detox-android/com/wix/detox-legacy/20.25.2/detox-legacy-20.25.2-sources.jar.sha1 +1 -0
  24. package/Detox-android/com/wix/detox-legacy/20.25.2/detox-legacy-20.25.2-sources.jar.sha256 +1 -0
  25. package/Detox-android/com/wix/detox-legacy/20.25.2/detox-legacy-20.25.2-sources.jar.sha512 +1 -0
  26. package/Detox-android/com/wix/detox-legacy/{20.25.0/detox-legacy-20.25.0.aar → 20.25.2/detox-legacy-20.25.2.aar} +0 -0
  27. package/Detox-android/com/wix/detox-legacy/20.25.2/detox-legacy-20.25.2.aar.md5 +1 -0
  28. package/Detox-android/com/wix/detox-legacy/20.25.2/detox-legacy-20.25.2.aar.sha1 +1 -0
  29. package/Detox-android/com/wix/detox-legacy/20.25.2/detox-legacy-20.25.2.aar.sha256 +1 -0
  30. package/Detox-android/com/wix/detox-legacy/20.25.2/detox-legacy-20.25.2.aar.sha512 +1 -0
  31. package/Detox-android/com/wix/detox-legacy/{20.25.0/detox-legacy-20.25.0.pom → 20.25.2/detox-legacy-20.25.2.pom} +1 -1
  32. package/Detox-android/com/wix/detox-legacy/20.25.2/detox-legacy-20.25.2.pom.md5 +1 -0
  33. package/Detox-android/com/wix/detox-legacy/20.25.2/detox-legacy-20.25.2.pom.sha1 +1 -0
  34. package/Detox-android/com/wix/detox-legacy/20.25.2/detox-legacy-20.25.2.pom.sha256 +1 -0
  35. package/Detox-android/com/wix/detox-legacy/20.25.2/detox-legacy-20.25.2.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/package.json +2 -2
  48. package/src/devices/allocation/DeviceAllocator.js +7 -0
  49. package/src/devices/allocation/drivers/AllocationDriverBase.d.ts +1 -0
  50. package/src/devices/allocation/drivers/android/genycloud/GenyAllocDriver.js +11 -0
  51. package/src/devices/allocation/drivers/android/genycloud/exec/GenyCloudExec.js +1 -1
  52. package/src/devices/allocation/drivers/android/genycloud/services/GenyInstanceLifecycleService.js +27 -3
  53. package/src/devices/allocation/factories/android.js +1 -1
  54. package/src/devices/common/drivers/android/exec/ADB.js +2 -6
  55. package/src/realms/DetoxPrimaryContext.js +20 -1
  56. package/Detox-android/com/wix/detox/20.25.0/detox-20.25.0-sources.jar.md5 +0 -1
  57. package/Detox-android/com/wix/detox/20.25.0/detox-20.25.0-sources.jar.sha1 +0 -1
  58. package/Detox-android/com/wix/detox/20.25.0/detox-20.25.0-sources.jar.sha256 +0 -1
  59. package/Detox-android/com/wix/detox/20.25.0/detox-20.25.0-sources.jar.sha512 +0 -1
  60. package/Detox-android/com/wix/detox/20.25.0/detox-20.25.0.aar.md5 +0 -1
  61. package/Detox-android/com/wix/detox/20.25.0/detox-20.25.0.aar.sha1 +0 -1
  62. package/Detox-android/com/wix/detox/20.25.0/detox-20.25.0.aar.sha256 +0 -1
  63. package/Detox-android/com/wix/detox/20.25.0/detox-20.25.0.aar.sha512 +0 -1
  64. package/Detox-android/com/wix/detox/20.25.0/detox-20.25.0.pom.md5 +0 -1
  65. package/Detox-android/com/wix/detox/20.25.0/detox-20.25.0.pom.sha1 +0 -1
  66. package/Detox-android/com/wix/detox/20.25.0/detox-20.25.0.pom.sha256 +0 -1
  67. package/Detox-android/com/wix/detox/20.25.0/detox-20.25.0.pom.sha512 +0 -1
  68. package/Detox-android/com/wix/detox-legacy/20.25.0/detox-legacy-20.25.0-sources.jar.md5 +0 -1
  69. package/Detox-android/com/wix/detox-legacy/20.25.0/detox-legacy-20.25.0-sources.jar.sha1 +0 -1
  70. package/Detox-android/com/wix/detox-legacy/20.25.0/detox-legacy-20.25.0-sources.jar.sha256 +0 -1
  71. package/Detox-android/com/wix/detox-legacy/20.25.0/detox-legacy-20.25.0-sources.jar.sha512 +0 -1
  72. package/Detox-android/com/wix/detox-legacy/20.25.0/detox-legacy-20.25.0.aar.md5 +0 -1
  73. package/Detox-android/com/wix/detox-legacy/20.25.0/detox-legacy-20.25.0.aar.sha1 +0 -1
  74. package/Detox-android/com/wix/detox-legacy/20.25.0/detox-legacy-20.25.0.aar.sha256 +0 -1
  75. package/Detox-android/com/wix/detox-legacy/20.25.0/detox-legacy-20.25.0.aar.sha512 +0 -1
  76. package/Detox-android/com/wix/detox-legacy/20.25.0/detox-legacy-20.25.0.pom.md5 +0 -1
  77. package/Detox-android/com/wix/detox-legacy/20.25.0/detox-legacy-20.25.0.pom.sha1 +0 -1
  78. package/Detox-android/com/wix/detox-legacy/20.25.0/detox-legacy-20.25.0.pom.sha256 +0 -1
  79. package/Detox-android/com/wix/detox-legacy/20.25.0/detox-legacy-20.25.0.pom.sha512 +0 -1
@@ -0,0 +1 @@
1
+ 8be260ed431dd80220ec971cd14a52f2
@@ -0,0 +1 @@
1
+ be493c48ec0cf24829d1544fdc8936097d242264
@@ -0,0 +1 @@
1
+ 38623b8fbbd012cb5ed50de515aa63e309d82925c95ff7babf0ace9bedd75f2e
@@ -0,0 +1 @@
1
+ 2807b748948796846e1cbd4f8b340177682c2e6e754ef7da752543420585c118228be2b74f7ed425770aa48933138122cce1cffc03bb17abe34e1dec6f74fe32
@@ -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.0</version>
6
+ <version>20.25.2</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
+ cc7565f6f1213ab6dbdf5c485eb1cbaa
@@ -0,0 +1 @@
1
+ 2447bf326fab1e01e393ad23f926d2e614579850
@@ -0,0 +1 @@
1
+ 9747f4a68ae5039e654cf0c82e75d15bc6293118fa23e16af4b4f52a057e1039
@@ -0,0 +1 @@
1
+ 92cb25f64a6fe596de00c6e00c1e737bcf3c8e8b60cc62dbc073be061b580493338ca844cbc7a0a1575297d42ed829eb18a26a7fcc58498fee61f5e1a589de47
@@ -3,11 +3,11 @@
3
3
  <groupId>com.wix</groupId>
4
4
  <artifactId>detox</artifactId>
5
5
  <versioning>
6
- <latest>20.25.0</latest>
7
- <release>20.25.0</release>
6
+ <latest>20.25.2</latest>
7
+ <release>20.25.2</release>
8
8
  <versions>
9
- <version>20.25.0</version>
9
+ <version>20.25.2</version>
10
10
  </versions>
11
- <lastUpdated>20240715205614</lastUpdated>
11
+ <lastUpdated>20240805163219</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 7190e56ff7f9476749c4b80df18b904f
1
+ 7cd9588dc68b68dea3bee5364ca46be3
@@ -1 +1 @@
1
- 3dd6be11b5dfc415e669f7dae9b3a64d1c175366
1
+ a00bad654567f900410ef9a7d331567bc8604e11
@@ -1 +1 @@
1
- 1410ac33039127064c7d3e49dadc668c0f7e473f41d2cc900904d50340652623
1
+ d03f61e1b56090e8779ab1deb126ea281669f0cf3b1c59b45c89fc23e0c7c5cd
@@ -1 +1 @@
1
- ded5ced73efe397aba118e65aef95bb92b5de64ea19065c918bcfec049416209b07a08da188f221da3d57a666ee2c3446e8e197ce19d09802b4b4d8f7e7bcdd2
1
+ 79557e49e5999b6c92c0e94e5dd8118fe05c8e9f6a72d253871ce26b1bea1bde9b1881b89fbf96665655d8c8d4e919bdba36005382839b30e7e2d8fc7a205a1c
@@ -0,0 +1 @@
1
+ e80488900da4bdd797b6dc2b59e4ff37
@@ -0,0 +1 @@
1
+ a25da8d466897199433147104cb5646f196675cf
@@ -0,0 +1 @@
1
+ 8877104c70dbecb529267352869ed57821e2fae952344ecb76a9d016df146f3c
@@ -0,0 +1 @@
1
+ c85429a5a1285fb06a3439ba988a05d4e425a54927e76c0f122226a39479babd11d5279693f2b20c2ae476d3df67724c9f2137125f1753c305e2140941567b09
@@ -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.0</version>
6
+ <version>20.25.2</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
+ b59b2eab82417664e580ea2e0be81f19
@@ -0,0 +1 @@
1
+ 3282ac5ca9f73d915a098df13fa5ac15882fea2a
@@ -0,0 +1 @@
1
+ 86e28808b7576fcd744254f3f2cf9347968b85be71f80a82f2770ba95b549706
@@ -0,0 +1 @@
1
+ 982b35d8386dd13de291ba0dfadb8b8f196a1b067c0a89a6ddea362cc2d6667e9b0104e770d72f3489b0f6d5c99a4b907aaeaf08138e25683ee4e482d1f97a1f
@@ -3,11 +3,11 @@
3
3
  <groupId>com.wix</groupId>
4
4
  <artifactId>detox-legacy</artifactId>
5
5
  <versioning>
6
- <latest>20.25.0</latest>
7
- <release>20.25.0</release>
6
+ <latest>20.25.2</latest>
7
+ <release>20.25.2</release>
8
8
  <versions>
9
- <version>20.25.0</version>
9
+ <version>20.25.2</version>
10
10
  </versions>
11
- <lastUpdated>20240715205632</lastUpdated>
11
+ <lastUpdated>20240805163419</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- dade265a6ab1e6c2805c7c514248c301
1
+ 2fddd03343cf20895dffa20c96778d8a
@@ -1 +1 @@
1
- 2f0e11145b8c19b7d690ac624dded2d174b5d73d
1
+ 049a05d72e4bbaadc3c490ec9e87b5b113a016e9
@@ -1 +1 @@
1
- 4bc8b1de62674a27c93222c12a83391a17162ebd7eb724d98d4963a367a529d1
1
+ de03e00c811fc925d073f9771b3f8470ce94599d40ce44ff772adda52bac1dd4
@@ -1 +1 @@
1
- 7b65922619711eceecefd19ecc74f38b37f99d3356eb3c562084311c4fd65a80bae64ca6766da2db270856e83d92ca067103043ec4394d6e8fed84307f2a424b
1
+ d36cdf827ef1aa9c30c747ba35cf1c2250fa89abe6d3554766c8d0d10f5ca1d9eb7b30229ec51cb07822078fb946fe348346565543fd22a5b276235be1903b7c
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
  */
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.0",
4
+ "version": "20.25.2",
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": "cc035471e072da19c16fc9e49983e00eddfe411b"
118
+ "gitHead": "32cc7b350941193caea9eb50f9d888a6bc7695c2"
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);
@@ -28,7 +28,7 @@ class GenyCloudExec {
28
28
  }
29
29
 
30
30
  adbConnect(instanceUUID) {
31
- return this._exec(`instances adbconnect ${instanceUUID}`);
31
+ return this._exec(`instances adbconnect ${instanceUUID}`, { retries: 0 });
32
32
  }
33
33
 
34
34
  stopInstance(instanceUUID) {
@@ -1,8 +1,16 @@
1
+ const log = require('../../../../../../utils/logger').child({ cat: 'device' });
2
+ const retry = require('../../../../../../utils/retry');
3
+
1
4
  const Instance = require('./dto/GenyInstance');
2
5
 
3
6
  class GenyInstanceLifecycleService {
4
- constructor(genyCloudExec) {
7
+ /**
8
+ * @param { import('../exec/GenyCloudExec') } genyCloudExec
9
+ * @param { import('../../../../../common/drivers/android/exec/ADB') } adb
10
+ */
11
+ constructor(genyCloudExec, adb) {
5
12
  this._genyCloudExec = genyCloudExec;
13
+ this._adb = adb;
6
14
  }
7
15
 
8
16
  async createInstance(recipeUUID, instanceName) {
@@ -10,8 +18,24 @@ class GenyInstanceLifecycleService {
10
18
  return new Instance(result.instance);
11
19
  }
12
20
 
13
- async adbConnectInstance(instanceUUID) {
14
- const result = (await this._genyCloudExec.adbConnect(instanceUUID));
21
+ async adbConnectInstance(instanceUUID){
22
+ const doAdbConnect = async () =>
23
+ this._genyCloudExec.adbConnect(instanceUUID);
24
+ const beforeEachRetry = async () => {
25
+ try {
26
+ const { stdout } = await this._adb.devices({ retries: 0, verbosity: 'low' });
27
+ log.warn('adb-connect command failed, current ADB devices list:\n', stdout);
28
+ } catch (e) {
29
+ log.warn('adb-connect command failed; couldn\'t get the list of current devices (see error)', e);
30
+ }
31
+ return true;
32
+ };
33
+ const options = {
34
+ conditionFn: beforeEachRetry,
35
+ retries: 2,
36
+ };
37
+
38
+ const result = await retry(options, doAdbConnect);
15
39
  return new Instance(result.instance);
16
40
  }
17
41
 
@@ -66,7 +66,7 @@ class Genycloud extends DeviceAllocatorFactory {
66
66
  const recipeService = new RecipesService(exec);
67
67
 
68
68
  const InstanceLifecycleService = require('../drivers/android/genycloud/services/GenyInstanceLifecycleService');
69
- const instanceLifecycleService = new InstanceLifecycleService(exec);
69
+ const instanceLifecycleService = new InstanceLifecycleService(exec, adb);
70
70
 
71
71
  const RecipeQuerying = require('../drivers/android/genycloud/GenyRecipeQuerying');
72
72
  const recipeQuerying = new RecipeQuerying(recipeService);
@@ -20,12 +20,8 @@ class ADB {
20
20
  await this.adbCmd('', 'start-server', { retries: 0, verbosity: 'high' });
21
21
  }
22
22
 
23
- async killDaemon() {
24
- await this.adbCmd('', 'kill-server', { retries: 0, verbosity: 'high' });
25
- }
26
-
27
- async devices() {
28
- const { stdout } = await this.adbCmd('', 'devices', { verbosity: 'high' });
23
+ async devices(options) {
24
+ const { stdout } = await this.adbCmd('', 'devices', { verbosity: 'high', ...options });
29
25
  /** @type {DeviceHandle[]} */
30
26
  const devices = _.chain(stdout)
31
27
  .trim()
@@ -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
- 1ef4d5de8e6a4ecba3ed72380b788a83
@@ -1 +0,0 @@
1
- bf218e51fdffafef09dbfc843a4e78a280e65d89
@@ -1 +0,0 @@
1
- 6fc99e94e5a63dcfdec73700425a79685a1379d89894df57063ece91822a9e4d
@@ -1 +0,0 @@
1
- 78ba7a9072d2a529054068b59f43da93616ffe5bce9cb99aacded5caf0aac926a3b68afa19dac3e714cf82bb74259a1dc94bf7de277296ea6843c6417676c712
@@ -1 +0,0 @@
1
- c30ab5e84a5014b0b81d4faabde6a700
@@ -1 +0,0 @@
1
- 5bb074cd595fd75e357176cbd1427eb75ed4e8d5
@@ -1 +0,0 @@
1
- 5fc6ee2c1a19b885d28766a68f924162061b405d79aec808d7c41eb3165bc2b1
@@ -1 +0,0 @@
1
- 844af749105ed914beb68383c07baf6fd4bdc33b053073f0bd29de638e7474cd66a31bf2df6a0f7824d0f322b742eed9d9376da5ada807a5cd539dd217fe2ab5
@@ -1 +0,0 @@
1
- 957806b8f4d6b7cc51959522d64dcb7f
@@ -1 +0,0 @@
1
- feb3185877ed9e49f252ceba89b9a338a8780a7e
@@ -1 +0,0 @@
1
- 720aecc2ad5d50ce4c088fb9c22477d7e1682f19b865e64b5f3bb40f316a471d
@@ -1 +0,0 @@
1
- aeb1ef3a386a2214a8d59b5cfd6941167a3482a2037a0578d9508791784c7687c75ff3cfc8d344d4ed475e2d25f39c588243ea3e0b49371c02ffd0f340ad7a1d
@@ -1 +0,0 @@
1
- 65c4c13e340925f4aab9a63f04e0421d
@@ -1 +0,0 @@
1
- 7fe9a252f0ff18215ca79bcae96b29b15e819711
@@ -1 +0,0 @@
1
- aeb521a3fd006873fa3f0c7252b6fdc772d9264ede1f2ce85e3de69eafc0b136
@@ -1 +0,0 @@
1
- 73329439f480b60ffca53d8244d27883adddba2b4d18c3753b8e6247cee9499674921b522c51fd2f1a2cd59dd84448e22dc7005f8b7c047d61a7aeaf515d8924
@@ -1 +0,0 @@
1
- 374341065754bd6af3cb6dfb12797043
@@ -1 +0,0 @@
1
- 697e735f9b859cf2cf8097e9ea2b99ed1b018ef4
@@ -1 +0,0 @@
1
- b5fa97662e36dee60aa838e47f457705d0145b0243dd2f7eb0076ec53ea42127
@@ -1 +0,0 @@
1
- cb3be83d53a83577894d9ed9fe8d96c86ebfa960c3be707684d82eb911871aebe33dcfc5fff988dc9a40e99135962a8ac8ac4c9f1be02ac957eb1fd0ddbb2277
@@ -1 +0,0 @@
1
- 20f9a40218510a8b583767d4fe5c5b2b
@@ -1 +0,0 @@
1
- 30587cdeead2f48ccc50d83c3a7e9f3f29aa3266
@@ -1 +0,0 @@
1
- 6801fa55201f5da99902aef7e9b8e769128742421215ddc0838df2b42e06f539
@@ -1 +0,0 @@
1
- a68a395358cf5998b6f531d3845189b2c3091d2d2ad84e96557458a413a3c891d5fcab1f21fee134422463a011473dfe472353d4b7b2f1e98cccda4537634346