detox 19.12.2 → 19.12.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/Detox-android/com/wix/detox/{19.12.2/detox-19.12.2-javadoc.jar → 19.12.4/detox-19.12.4-javadoc.jar} +0 -0
  2. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4-javadoc.jar.md5 +1 -0
  3. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4-javadoc.jar.sha1 +1 -0
  4. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4-javadoc.jar.sha256 +1 -0
  5. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4-javadoc.jar.sha512 +1 -0
  6. package/Detox-android/com/wix/detox/{19.12.2/detox-19.12.2-sources.jar → 19.12.4/detox-19.12.4-sources.jar} +0 -0
  7. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4-sources.jar.md5 +1 -0
  8. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4-sources.jar.sha1 +1 -0
  9. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4-sources.jar.sha256 +1 -0
  10. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4-sources.jar.sha512 +1 -0
  11. package/Detox-android/com/wix/detox/{19.12.2/detox-19.12.2.aar → 19.12.4/detox-19.12.4.aar} +0 -0
  12. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4.aar.md5 +1 -0
  13. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4.aar.sha1 +1 -0
  14. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4.aar.sha256 +1 -0
  15. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4.aar.sha512 +1 -0
  16. package/Detox-android/com/wix/detox/{19.12.2/detox-19.12.2.pom → 19.12.4/detox-19.12.4.pom} +1 -1
  17. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4.pom.md5 +1 -0
  18. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4.pom.sha1 +1 -0
  19. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4.pom.sha256 +1 -0
  20. package/Detox-android/com/wix/detox/19.12.4/detox-19.12.4.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/detox/src/full/java/com/wix/detox/reactnative/idlingresources/IdlingResourceDescription.kt +19 -13
  29. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResource.java +33 -30
  30. package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResourcesTest.kt +61 -0
  31. package/package.json +2 -2
  32. package/src/devices/allocation/drivers/android/emulator/AVDValidator.js +4 -4
  33. package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +1 -1
  34. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-javadoc.jar.md5 +0 -1
  35. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-javadoc.jar.sha1 +0 -1
  36. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-javadoc.jar.sha256 +0 -1
  37. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-javadoc.jar.sha512 +0 -1
  38. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-sources.jar.md5 +0 -1
  39. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-sources.jar.sha1 +0 -1
  40. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-sources.jar.sha256 +0 -1
  41. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-sources.jar.sha512 +0 -1
  42. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.aar.md5 +0 -1
  43. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.aar.sha1 +0 -1
  44. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.aar.sha256 +0 -1
  45. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.aar.sha512 +0 -1
  46. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.pom.md5 +0 -1
  47. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.pom.sha1 +0 -1
  48. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.pom.sha256 +0 -1
  49. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.pom.sha512 +0 -1
@@ -0,0 +1 @@
1
+ 671298cf2dc888f4476e9197939e7440
@@ -0,0 +1 @@
1
+ 390b99e7856d4eeeaacf6c7bbc7d6063c4e490fa
@@ -0,0 +1 @@
1
+ b836bab28218e9f608a9a18e15f03f73f7301ee6452c5118dcf6fb1aa09475f7
@@ -0,0 +1 @@
1
+ dbe0b26cad0891d0ca9b8c3c21308edf1d49837b8c88e5e58c3445d188caf03c4e7f4fa400015bd108874265d322f5627e06c4642b41da05623a6435ce1710cc
@@ -0,0 +1 @@
1
+ bef1893ab60972fd154ae30543c2d51e
@@ -0,0 +1 @@
1
+ 97c5c25283e00cbed7c2e25bd23e8748fc093991
@@ -0,0 +1 @@
1
+ 10e14cbe96b1c5ab0f1118ec33e86d543b820f1e8c9aa29a79fde433ecd819b7
@@ -0,0 +1 @@
1
+ 0c38ffe84dabb90fd36270e31ea9f2ef4bec0c1e378e784928ad235645fb103897970f9a01842247b14fdd1328947638c6a08c3481266ec533aec89a1b56ae4a
@@ -0,0 +1 @@
1
+ 2c7931e2f81f1c416737d98c54c5ec03
@@ -0,0 +1 @@
1
+ ff7ab3b06537dedb033cdef008d5754ccd657085
@@ -0,0 +1 @@
1
+ 841142d217e137188dda87896be9a2fbc02516b9d289477f57afca3a2576dc63
@@ -0,0 +1 @@
1
+ 82a2c3f1ac41a8d5da57c7435f05ae23fedf75425b30125873d8f96aaba53b6c3a77ce1faff0973df8a31db16864ed8ec00480f3272489ca49d8e88e2ec7d46a
@@ -3,7 +3,7 @@
3
3
  <modelVersion>4.0.0</modelVersion>
4
4
  <groupId>com.wix</groupId>
5
5
  <artifactId>detox</artifactId>
6
- <version>19.12.2</version>
6
+ <version>19.12.4</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
+ 98fbe2cf9907711ff531f5b7c70ca1eb
@@ -0,0 +1 @@
1
+ 1a46fcaec460c5363049ae2e8f8272cc4e172641
@@ -0,0 +1 @@
1
+ 2327f91c89c6973146b21acd11a0206be0197cbc1acff6f1f140d6d54f400639
@@ -0,0 +1 @@
1
+ cc28a6faa28909a5a0c8383b1876fa6ddf1d92efad46b479dce807d8ea9887df1e62a5ca6caf3e0af6d4d15a2fcef3be3007b5d793b6d28cf49748afebd349a0
@@ -3,11 +3,11 @@
3
3
  <groupId>com.wix</groupId>
4
4
  <artifactId>detox</artifactId>
5
5
  <versioning>
6
- <latest>19.12.2</latest>
7
- <release>19.12.2</release>
6
+ <latest>19.12.4</latest>
7
+ <release>19.12.4</release>
8
8
  <versions>
9
- <version>19.12.2</version>
9
+ <version>19.12.4</version>
10
10
  </versions>
11
- <lastUpdated>20220928134821</lastUpdated>
11
+ <lastUpdated>20221003084717</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 19efa387d90dcb455f8185d17f32beb1
1
+ 7ac53f8b3e2ea2c09901e2123b5e7dcd
@@ -1 +1 @@
1
- d27ba2fcef2991b4ea2325d89be7129deab3893e
1
+ 748eb47a8911f673dd9243270dcea5b75e633423
@@ -1 +1 @@
1
- 116c359028d06b12b1dc0dfe7900f526a40ca8911d34b78ebae55bc29c8b34fb
1
+ 5f18cd20b60056039e88de2ed8571b550b006aaabd4fca31a7e517b8ae20030a
@@ -1 +1 @@
1
- 4a7e060d05787a0c67420b3ca6f706c328386d65498422a716869fa12ceafe6a290a7b6819af791eedcd1671cd2bef6ce70f0bf555c07ca60311272b3bf806f0
1
+ 806b2af84be3824ab1cb62c1aabbc45052c1778ef538557955aff26c175655eb3855bd6618117ad695448cf91ecfefbf3677fab5cdddcbca8edb37111b6107d6
package/Detox-ios-src.tbz CHANGED
Binary file
package/Detox-ios.tbz CHANGED
Binary file
@@ -1,20 +1,26 @@
1
1
  package com.wix.detox.reactnative.idlingresources
2
2
 
3
3
  class IdlingResourceDescription private constructor(
4
- private val name: String,
5
- private val description: Map<String, Any>) {
6
- fun json(): Map<String, Any> = mutableMapOf<String, Any>("name" to name)
7
- .apply { if (description.isNotEmpty()) put("description", description) }
4
+ private val name: String,
5
+ private val description: Map<String, Any>) {
8
6
 
9
- override fun equals(other: Any?): Boolean = other is IdlingResourceDescription &&
10
- other.json() == this.json()
7
+ fun json() =
8
+ mutableMapOf<String, Any>("name" to name)
9
+ .apply {
10
+ if (description.isNotEmpty()) put("description", description)
11
+ }.toMap()
11
12
 
12
- data class Builder(
13
- var name: String = "unknown",
14
- var description: MutableMap<String, Any> = mutableMapOf()) {
13
+ override fun equals(other: Any?) =
14
+ (other is IdlingResourceDescription && other.json() == this.json())
15
+
16
+ override fun hashCode(): Int =
17
+ (31 * name.hashCode() + description.hashCode())
15
18
 
16
- fun name(name: String) = apply { this.name = name }
17
- fun addDescription(key: String, value: Any) = apply { this.description[key] = value }
18
- fun build() = IdlingResourceDescription(name, description)
19
- }
19
+ data class Builder(
20
+ var name: String = "unknown",
21
+ var description: MutableMap<String, Any> = mutableMapOf()) {
22
+ fun name(value: String) = apply { name = value }
23
+ fun addDescription(key: String, value: Any) = apply { description[key] = value }
24
+ fun build() = IdlingResourceDescription(name, description)
25
+ }
20
26
  }
@@ -69,42 +69,13 @@ public class NetworkIdlingResource extends DetoxBaseIdlingResource implements Ch
69
69
 
70
70
  @NotNull
71
71
  @Override
72
- public IdlingResourceDescription getDescription() {
72
+ public synchronized IdlingResourceDescription getDescription() {
73
73
  return new IdlingResourceDescription.Builder()
74
74
  .name("network")
75
75
  .addDescription("urls", new ArrayList<>(busyResources))
76
76
  .build();
77
77
  }
78
78
 
79
- @Override
80
- protected boolean checkIdle() {
81
- boolean idle = true;
82
- busyResources.clear();
83
- List<Call> calls = dispatcher.runningCalls();
84
- for (Call call : calls) {
85
- idle = false;
86
- String url = call.request().url().toString();
87
- for (Pattern pattern : blacklist) {
88
- if (pattern.matcher(url).matches()) {
89
- idle = true;
90
- break;
91
- }
92
- }
93
- if (!idle) {
94
- busyResources.add(call.request().url().toString());
95
- }
96
- }
97
- if (!idle) {
98
- Choreographer.getInstance().postFrameCallback(this);
99
- Log.i(LOG_TAG, "Network is busy");
100
- } else {
101
- if (callback != null) {
102
- callback.onTransitionToIdle();
103
- }
104
- }
105
- return idle;
106
- }
107
-
108
79
  @Override
109
80
  public void registerIdleTransitionCallback(ResourceCallback callback) {
110
81
  this.callback = callback;
@@ -116,10 +87,42 @@ public class NetworkIdlingResource extends DetoxBaseIdlingResource implements Ch
116
87
  isIdleNow();
117
88
  }
118
89
 
90
+ @Override
91
+ protected synchronized boolean checkIdle() {
92
+ busyResources.clear();
93
+
94
+ List<Call> calls = dispatcher.runningCalls();
95
+ for (Call call: calls) {
96
+ final String url = call.request().url().toString();
97
+
98
+ if (!isUrlBlacklisted(url)) {
99
+ busyResources.add(url);
100
+ }
101
+ }
102
+
103
+ if (!busyResources.isEmpty()) {
104
+ Log.i(LOG_TAG, "Network is busy, with " + busyResources.size() + " in-flight calls");
105
+ Choreographer.getInstance().postFrameCallback(this);
106
+ return false;
107
+ }
108
+
109
+ notifyIdle();
110
+ return true;
111
+ }
112
+
119
113
  @Override
120
114
  protected void notifyIdle() {
121
115
  if (callback != null) {
122
116
  callback.onTransitionToIdle();
123
117
  }
124
118
  }
119
+
120
+ private boolean isUrlBlacklisted(String url) {
121
+ for (Pattern pattern: blacklist) {
122
+ if (pattern.matcher(url).matches()) {
123
+ return true;
124
+ }
125
+ }
126
+ return false;
127
+ }
125
128
  }
@@ -0,0 +1,61 @@
1
+ package com.wix.detox.reactnative.idlingresources
2
+
3
+ import com.wix.detox.UTHelpers.yieldToOtherThreads
4
+ import org.assertj.core.api.Assertions.assertThat
5
+
6
+ import okhttp3.Dispatcher
7
+ import org.junit.Before
8
+ import org.junit.Test
9
+ import org.junit.runner.RunWith
10
+ import org.robolectric.RobolectricTestRunner
11
+ import java.util.concurrent.Executors
12
+
13
+ @RunWith(RobolectricTestRunner::class)
14
+ class NetworkIdlingResourcesTest {
15
+ lateinit var dispatcher: Dispatcher
16
+ lateinit var uut: NetworkIdlingResource
17
+
18
+ @Before
19
+ fun setup() {
20
+ dispatcher = Dispatcher()
21
+ uut = NetworkIdlingResource(dispatcher)
22
+ }
23
+
24
+ // Note: Ideally, we should test that the list of busy resources is protected,
25
+ // rather than testing thread-safety as a whole.
26
+ @Test
27
+ fun `should return the description in a thread-safe way`() {
28
+ val localExecutor = Executors.newSingleThreadExecutor()
29
+ var description: IdlingResourceDescription? = null
30
+
31
+ synchronized(uut) {
32
+ localExecutor.submit {
33
+ description = uut.getDescription()
34
+ }
35
+
36
+ yieldToOtherThreads(localExecutor)
37
+ assertThat(description).isNull()
38
+ }
39
+ yieldToOtherThreads(localExecutor)
40
+ assertThat(description).isNotNull()
41
+ }
42
+
43
+ // Note: Ideally, we should test that the list of busy resources is protected,
44
+ // rather than testing thread-safety as a whole.
45
+ @Test
46
+ fun `should check for idle in a thread-safe way`() {
47
+ val localExecutor = Executors.newSingleThreadExecutor()
48
+ var idle = false
49
+
50
+ synchronized(uut) {
51
+ localExecutor.submit {
52
+ idle = uut.isIdleNow
53
+ }
54
+
55
+ yieldToOtherThreads(localExecutor)
56
+ assertThat(idle).isFalse
57
+ }
58
+ yieldToOtherThreads(localExecutor)
59
+ assertThat(idle).isTrue
60
+ }
61
+ }
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": "19.12.2",
4
+ "version": "19.12.4",
5
5
  "bin": {
6
6
  "detox": "local-cli/cli.js"
7
7
  },
@@ -177,5 +177,5 @@
177
177
  }
178
178
  }
179
179
  },
180
- "gitHead": "6f4bf5c666865e71a7a83937482f065661ec467e"
180
+ "gitHead": "ed8f49d2128cf1d5cb2ed4cc6d5da9d1ec5c9bc5"
181
181
  }
@@ -12,11 +12,11 @@ class AVDValidator {
12
12
  this._emulatorVersionResolver = emulatorVersionResolver;
13
13
  }
14
14
 
15
- async validate(avdName) {
15
+ async validate(avdName, isHeadless) {
16
16
  const avds = await this._avdsResolver.resolve(avdName);
17
17
  this._assertAVDs(avds);
18
18
  await this._assertAVDMatch(avds, avdName);
19
- await this._validateEmulatorVer();
19
+ await this._validateEmulatorVer(isHeadless);
20
20
  }
21
21
 
22
22
  _assertAVDs(avds) {
@@ -37,8 +37,8 @@ class AVDValidator {
37
37
  }
38
38
  }
39
39
 
40
- async _validateEmulatorVer() {
41
- const emulatorVersion = await this._emulatorVersionResolver.resolve();
40
+ async _validateEmulatorVer(isHeadless) {
41
+ const emulatorVersion = await this._emulatorVersionResolver.resolve(isHeadless);
42
42
  if (!emulatorVersion) {
43
43
  logger.warn({ event: 'AVD_VALIDATION' }, 'Emulator version detection failed (See previous logs)');
44
44
  return;
@@ -31,7 +31,7 @@ class EmulatorAllocDriver extends AllocationDriverBase {
31
31
  async allocate(deviceConfig) {
32
32
  const avdName = deviceConfig.device.avdName;
33
33
 
34
- await this._avdValidator.validate(avdName);
34
+ await this._avdValidator.validate(avdName, deviceConfig.headless);
35
35
  await this._fixAvdConfigIniSkinNameIfNeeded(avdName, deviceConfig.headless);
36
36
 
37
37
  const allocResult = await this._allocationHelper.allocateDevice(avdName);
@@ -1 +0,0 @@
1
- 0cb8fdd5ed1ab73354fe86d5930f61de
@@ -1 +0,0 @@
1
- 0ed1af9ededffc5d54fdd1a8054109e21216f35c
@@ -1 +0,0 @@
1
- 0d6a20ace6f9dd16b2d0d529294fec49be91e4152ed51e584f6abec5263e2b6d
@@ -1 +0,0 @@
1
- b35ebf75afc6f2920b039dd97077396f441804419993cfcc89d1e7562a0db8fd8fe5fd8ca9301ace3c86d40383e4cb107cbb3de2b4ba1a63eff69e002978bfa2
@@ -1 +0,0 @@
1
- 6283c6c8d9518224cdfe63c320a1d4b4
@@ -1 +0,0 @@
1
- 9bf84803ea961f48c9fdb9ba84ee58e73cdb92d5
@@ -1 +0,0 @@
1
- e1a04bed2c690093f9c9a48489ff6cd960e467fa5381a7a4f03e48c1235a966e
@@ -1 +0,0 @@
1
- fea293ce8eb983f617e9a97324126a8975dd4d670cc67ef85bd6bcfe410afe0d6103b120181076dc4998631f494a4391a0d60fa5f220de34edad36008593676d
@@ -1 +0,0 @@
1
- 8089fbd8f7caa919cdbedfc086a2c66d
@@ -1 +0,0 @@
1
- e8bfe347b39f22bb020b39bb622c76c5c3f0015d
@@ -1 +0,0 @@
1
- 494862f977fb6769223ef896d51577e87c26a08e37afb6904a228fff4fb5021f
@@ -1 +0,0 @@
1
- a4cf7f4166dbc0230d682218ff3efbd59551ec57da51bb94aafe12a2e33443440401a63a697af13a55dabab6a66dbe4d1c0d4778c0ffcbcaca6e2062ffacfe97
@@ -1 +0,0 @@
1
- 55dcfffe204d0994e193c4250359236f
@@ -1 +0,0 @@
1
- d3e83bdf179e7ea0b65059bfd19f8acaf46f1ca5
@@ -1 +0,0 @@
1
- 5c4157413276e6bc253fa185147b3ad2c07aef9fccd4d93c780cc5f8805dea0e
@@ -1 +0,0 @@
1
- 7b0886cc17b871ec35cc1f48d2ed9ccadbd2c25ed00308a7bc8bc56ba23e29649e4a4296bf637609ae2afe83200f2908124fe8734c4465d864853d2e526f7320