detox 19.12.2 → 19.12.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/Detox-android/com/wix/detox/{19.12.2/detox-19.12.2-javadoc.jar → 19.12.3/detox-19.12.3-javadoc.jar} +0 -0
  2. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3-javadoc.jar.md5 +1 -0
  3. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3-javadoc.jar.sha1 +1 -0
  4. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3-javadoc.jar.sha256 +1 -0
  5. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3-javadoc.jar.sha512 +1 -0
  6. package/Detox-android/com/wix/detox/{19.12.2/detox-19.12.2-sources.jar → 19.12.3/detox-19.12.3-sources.jar} +0 -0
  7. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3-sources.jar.md5 +1 -0
  8. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3-sources.jar.sha1 +1 -0
  9. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3-sources.jar.sha256 +1 -0
  10. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3-sources.jar.sha512 +1 -0
  11. package/Detox-android/com/wix/detox/{19.12.2/detox-19.12.2.aar → 19.12.3/detox-19.12.3.aar} +0 -0
  12. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3.aar.md5 +1 -0
  13. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3.aar.sha1 +1 -0
  14. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3.aar.sha256 +1 -0
  15. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3.aar.sha512 +1 -0
  16. package/Detox-android/com/wix/detox/{19.12.2/detox-19.12.2.pom → 19.12.3/detox-19.12.3.pom} +1 -1
  17. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3.pom.md5 +1 -0
  18. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3.pom.sha1 +1 -0
  19. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3.pom.sha256 +1 -0
  20. package/Detox-android/com/wix/detox/19.12.3/detox-19.12.3.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/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-javadoc.jar.md5 +0 -1
  33. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-javadoc.jar.sha1 +0 -1
  34. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-javadoc.jar.sha256 +0 -1
  35. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-javadoc.jar.sha512 +0 -1
  36. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-sources.jar.md5 +0 -1
  37. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-sources.jar.sha1 +0 -1
  38. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-sources.jar.sha256 +0 -1
  39. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2-sources.jar.sha512 +0 -1
  40. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.aar.md5 +0 -1
  41. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.aar.sha1 +0 -1
  42. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.aar.sha256 +0 -1
  43. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.aar.sha512 +0 -1
  44. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.pom.md5 +0 -1
  45. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.pom.sha1 +0 -1
  46. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.pom.sha256 +0 -1
  47. package/Detox-android/com/wix/detox/19.12.2/detox-19.12.2.pom.sha512 +0 -1
@@ -0,0 +1 @@
1
+ 6be640bbb26a68100ac9dc523a8968e2
@@ -0,0 +1 @@
1
+ c41568eb3c834b8637495b4e5e0cb1a009c5c885
@@ -0,0 +1 @@
1
+ a8679c6f6491725d8848c0544990477011148e16f58ea0df9b1e92980e59ff30
@@ -0,0 +1 @@
1
+ 67cb77995d9b1b38c0a56151c55265bbbc9b04efe546f6f8ce6e16af83e21c61a6825f4fc66e98880448b74f454223116dbe3856cd69ed30e19170afc73841f4
@@ -0,0 +1 @@
1
+ 7a6072a3ec1ebe22a490ec3fc828132e
@@ -0,0 +1 @@
1
+ b7fc93850b4c5927a53b349ce098367de13fa60e
@@ -0,0 +1 @@
1
+ 29ef40f0881caa19b79937690b21fcc90ba182de06618854b527f81718629ca5
@@ -0,0 +1 @@
1
+ 6fb34a891f06385672ac7395f8e2b8b7142437e279e4486b9c6ac96663b229343c3133d0e214de2e85c4b66d7687087a06683fc311efece0d6b5072c2997d856
@@ -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.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
+ 4457baf485c76fa55b2a381be247b377
@@ -0,0 +1 @@
1
+ 11f0a9cbc34082223f45c47b0e07add7f3a43ed2
@@ -0,0 +1 @@
1
+ dee5704c35164889242458000b7044f2f900c1d98e89e6aa90d3387af883b740
@@ -0,0 +1 @@
1
+ 4db7b2382132ff6f4456dd2a4e22d22af57205212234003e37c4539d624f6d1dd73bb11a5f792f57eb3575a983347668c629f87804b3fd2fb3b23432df3b93ed
@@ -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.3</latest>
7
+ <release>19.12.3</release>
8
8
  <versions>
9
- <version>19.12.2</version>
9
+ <version>19.12.3</version>
10
10
  </versions>
11
- <lastUpdated>20220928134821</lastUpdated>
11
+ <lastUpdated>20220929163901</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 19efa387d90dcb455f8185d17f32beb1
1
+ 99f562827b42a1dfca170dd13a9d2b9d
@@ -1 +1 @@
1
- d27ba2fcef2991b4ea2325d89be7129deab3893e
1
+ 297506da369f3558785d225ec4265a457d9b75a7
@@ -1 +1 @@
1
- 116c359028d06b12b1dc0dfe7900f526a40ca8911d34b78ebae55bc29c8b34fb
1
+ 12a12e3cc2f93e0a2cb3dd463224174f56d7cae8e2a7b726da43710216adfc59
@@ -1 +1 @@
1
- 4a7e060d05787a0c67420b3ca6f706c328386d65498422a716869fa12ceafe6a290a7b6819af791eedcd1671cd2bef6ce70f0bf555c07ca60311272b3bf806f0
1
+ 395c54bd07efdf7b403c5f8e19a0fb2ee698fa4bf51945095c061e53797903d8fddd6f93c1e69f37e5c77b84736e769d9f64cb82705e7a57a79e791c37bc1c2f
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.3",
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": "23bf330e395a488a6d7334db29a0fe289ce302f6"
181
181
  }
@@ -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