detox 20.22.0-smoke.0 → 20.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. package/Detox-android/com/wix/detox/{20.22.0-smoke.0/detox-20.22.0-smoke.0-sources.jar → 20.22.0/detox-20.22.0-sources.jar} +0 -0
  2. package/Detox-android/com/wix/detox/20.22.0/detox-20.22.0-sources.jar.md5 +1 -0
  3. package/Detox-android/com/wix/detox/20.22.0/detox-20.22.0-sources.jar.sha1 +1 -0
  4. package/Detox-android/com/wix/detox/20.22.0/detox-20.22.0-sources.jar.sha256 +1 -0
  5. package/Detox-android/com/wix/detox/20.22.0/detox-20.22.0-sources.jar.sha512 +1 -0
  6. package/Detox-android/com/wix/detox/{20.22.0-smoke.0/detox-20.22.0-smoke.0.pom → 20.22.0/detox-20.22.0.pom} +1 -1
  7. package/Detox-android/com/wix/detox/20.22.0/detox-20.22.0.pom.md5 +1 -0
  8. package/Detox-android/com/wix/detox/20.22.0/detox-20.22.0.pom.sha1 +1 -0
  9. package/Detox-android/com/wix/detox/20.22.0/detox-20.22.0.pom.sha256 +1 -0
  10. package/Detox-android/com/wix/detox/20.22.0/detox-20.22.0.pom.sha512 +1 -0
  11. package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
  12. package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
  13. package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
  14. package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
  15. package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
  16. package/Detox-android/com/wix/detox-legacy/{20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0-sources.jar → 20.22.0/detox-legacy-20.22.0-sources.jar} +0 -0
  17. package/Detox-android/com/wix/detox-legacy/20.22.0/detox-legacy-20.22.0-sources.jar.md5 +1 -0
  18. package/Detox-android/com/wix/detox-legacy/20.22.0/detox-legacy-20.22.0-sources.jar.sha1 +1 -0
  19. package/Detox-android/com/wix/detox-legacy/20.22.0/detox-legacy-20.22.0-sources.jar.sha256 +1 -0
  20. package/Detox-android/com/wix/detox-legacy/20.22.0/detox-legacy-20.22.0-sources.jar.sha512 +1 -0
  21. package/Detox-android/com/wix/detox-legacy/{20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0.pom → 20.22.0/detox-legacy-20.22.0.pom} +1 -1
  22. package/Detox-android/com/wix/detox-legacy/20.22.0/detox-legacy-20.22.0.pom.md5 +1 -0
  23. package/Detox-android/com/wix/detox-legacy/20.22.0/detox-legacy-20.22.0.pom.sha1 +1 -0
  24. package/Detox-android/com/wix/detox-legacy/20.22.0/detox-legacy-20.22.0.pom.sha256 +1 -0
  25. package/Detox-android/com/wix/detox-legacy/20.22.0/detox-legacy-20.22.0.pom.sha512 +1 -0
  26. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml +4 -4
  27. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.md5 +1 -1
  28. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.sha1 +1 -1
  29. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.sha256 +1 -1
  30. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.sha512 +1 -1
  31. package/Detox-ios-framework.tbz +0 -0
  32. package/Detox-ios-src.tbz +0 -0
  33. package/Detox-ios-xcuitest.tbz +0 -0
  34. package/detox.d.ts +78 -3
  35. package/globals.d.ts +2 -0
  36. package/local-cli/build-framework-cache.js +19 -11
  37. package/local-cli/clean-framework-cache.js +19 -14
  38. package/local-cli/rebuild-framework-cache.js +20 -16
  39. package/local-cli/utils/frameworkUtils.js +77 -0
  40. package/package.json +4 -4
  41. package/scripts/build_framework.ios.sh +26 -60
  42. package/scripts/build_local_framework.ios.sh +62 -0
  43. package/scripts/build_local_xcuitest.ios.sh +53 -0
  44. package/scripts/build_xcuitest.ios.sh +18 -0
  45. package/scripts/pack_ios.sh +18 -9
  46. package/scripts/postinstall.js +11 -4
  47. package/src/android/AndroidExpect.js +5 -0
  48. package/src/android/matchers/index.js +7 -0
  49. package/src/client/Client.js +0 -4
  50. package/src/client/actions/actions.js +0 -19
  51. package/src/devices/runtime/RuntimeDevice.js +0 -5
  52. package/src/devices/runtime/drivers/DeviceDriverBase.js +0 -4
  53. package/src/devices/runtime/drivers/ios/SimulatorDriver.js +0 -11
  54. package/src/ios/XCUITestRunner.js +52 -0
  55. package/src/ios/expectTwo.js +49 -28
  56. package/src/ios/system.js +124 -0
  57. package/src/ios/web.js +3 -4
  58. package/src/matchers/factories/index.js +15 -8
  59. package/src/utils/assertArgument.js +11 -2
  60. package/src/utils/environment.js +34 -14
  61. package/src/utils/invocationTraceDescriptions.js +4 -0
  62. package/Detox-android/com/wix/detox/20.22.0-smoke.0/detox-20.22.0-smoke.0-sources.jar.md5 +0 -1
  63. package/Detox-android/com/wix/detox/20.22.0-smoke.0/detox-20.22.0-smoke.0-sources.jar.sha1 +0 -1
  64. package/Detox-android/com/wix/detox/20.22.0-smoke.0/detox-20.22.0-smoke.0-sources.jar.sha256 +0 -1
  65. package/Detox-android/com/wix/detox/20.22.0-smoke.0/detox-20.22.0-smoke.0-sources.jar.sha512 +0 -1
  66. package/Detox-android/com/wix/detox/20.22.0-smoke.0/detox-20.22.0-smoke.0.pom.md5 +0 -1
  67. package/Detox-android/com/wix/detox/20.22.0-smoke.0/detox-20.22.0-smoke.0.pom.sha1 +0 -1
  68. package/Detox-android/com/wix/detox/20.22.0-smoke.0/detox-20.22.0-smoke.0.pom.sha256 +0 -1
  69. package/Detox-android/com/wix/detox/20.22.0-smoke.0/detox-20.22.0-smoke.0.pom.sha512 +0 -1
  70. package/Detox-android/com/wix/detox-legacy/20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0-sources.jar.md5 +0 -1
  71. package/Detox-android/com/wix/detox-legacy/20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0-sources.jar.sha1 +0 -1
  72. package/Detox-android/com/wix/detox-legacy/20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0-sources.jar.sha256 +0 -1
  73. package/Detox-android/com/wix/detox-legacy/20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0-sources.jar.sha512 +0 -1
  74. package/Detox-android/com/wix/detox-legacy/20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0.pom.md5 +0 -1
  75. package/Detox-android/com/wix/detox-legacy/20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0.pom.sha1 +0 -1
  76. package/Detox-android/com/wix/detox-legacy/20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0.pom.sha256 +0 -1
  77. package/Detox-android/com/wix/detox-legacy/20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0.pom.sha512 +0 -1
  78. package/Detox-ios.tbz +0 -0
  79. package/scripts/build_universal_framework.sh +0 -14
  80. package/scripts/build_universal_framework_legacy.sh +0 -76
  81. package/scripts/build_universal_framework_modern.sh +0 -28
  82. /package/Detox-android/com/wix/detox/{20.22.0-smoke.0/detox-20.22.0-smoke.0.aar → 20.22.0/detox-20.22.0.aar} +0 -0
  83. /package/Detox-android/com/wix/detox/{20.22.0-smoke.0/detox-20.22.0-smoke.0.aar.md5 → 20.22.0/detox-20.22.0.aar.md5} +0 -0
  84. /package/Detox-android/com/wix/detox/{20.22.0-smoke.0/detox-20.22.0-smoke.0.aar.sha1 → 20.22.0/detox-20.22.0.aar.sha1} +0 -0
  85. /package/Detox-android/com/wix/detox/{20.22.0-smoke.0/detox-20.22.0-smoke.0.aar.sha256 → 20.22.0/detox-20.22.0.aar.sha256} +0 -0
  86. /package/Detox-android/com/wix/detox/{20.22.0-smoke.0/detox-20.22.0-smoke.0.aar.sha512 → 20.22.0/detox-20.22.0.aar.sha512} +0 -0
  87. /package/Detox-android/com/wix/detox-legacy/{20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0.aar → 20.22.0/detox-legacy-20.22.0.aar} +0 -0
  88. /package/Detox-android/com/wix/detox-legacy/{20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0.aar.md5 → 20.22.0/detox-legacy-20.22.0.aar.md5} +0 -0
  89. /package/Detox-android/com/wix/detox-legacy/{20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0.aar.sha1 → 20.22.0/detox-legacy-20.22.0.aar.sha1} +0 -0
  90. /package/Detox-android/com/wix/detox-legacy/{20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0.aar.sha256 → 20.22.0/detox-legacy-20.22.0.aar.sha256} +0 -0
  91. /package/Detox-android/com/wix/detox-legacy/{20.22.0-smoke.0/detox-legacy-20.22.0-smoke.0.aar.sha512 → 20.22.0/detox-legacy-20.22.0.aar.sha512} +0 -0
@@ -0,0 +1 @@
1
+ 61ac8392e81161cdbbc8240f97219093
@@ -0,0 +1 @@
1
+ 7523caea958c0b32bc02a9fb74dd95ee638b208f
@@ -0,0 +1 @@
1
+ 955485da78898b1b373cca4d6f06caf0977854e02021c0536ca53c560f655f67
@@ -0,0 +1 @@
1
+ 26e663bb8b69d5c6b9f577be299ab69faf9df88c5fcc8eb772b0df11ba1117b8f714fcd3dc8695479b2bded512f72346e3e34dce817e6983589a3f1dcc3a3a08
@@ -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.22.0-smoke.0</version>
6
+ <version>20.22.0</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
+ 9f2f806dc7ecf60cc3db0497c3bec65f
@@ -0,0 +1 @@
1
+ adb9f759913881670da1f63d0f7979427084adcc
@@ -0,0 +1 @@
1
+ 59f6207164fd3dcfe42fb75eb11281d2cf75396a0f42e817ab8c419bda29e231
@@ -0,0 +1 @@
1
+ 6a28a617043b3bf9264b6a48bb9065348ccd8969202e187db4941240b9b1d1cd5698d01f8e6ff59f62786b0eaab384d2fd36f30033e003d4e6a323d28db1ac27
@@ -3,11 +3,11 @@
3
3
  <groupId>com.wix</groupId>
4
4
  <artifactId>detox</artifactId>
5
5
  <versioning>
6
- <latest>20.22.0-smoke.0</latest>
7
- <release>20.22.0-smoke.0</release>
6
+ <latest>20.22.0</latest>
7
+ <release>20.22.0</release>
8
8
  <versions>
9
- <version>20.22.0-smoke.0</version>
9
+ <version>20.22.0</version>
10
10
  </versions>
11
- <lastUpdated>20240514185910</lastUpdated>
11
+ <lastUpdated>20240522132420</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 2f252337cdd9e99fda1427c0b8d2429e
1
+ d621af8e16f708933ed8eba41b789957
@@ -1 +1 @@
1
- 60932dda2bb669edd352f0926db961a8d9574c17
1
+ d6f2b06d79202624d62152611d83e60bc074a52a
@@ -1 +1 @@
1
- 264d462afccbf63addf6c8cc7febfbea7ec6579e93cb7458b4f145ee0f0b55fa
1
+ 107bee57f450bf9b11826827c66f32b463d72ccfb1783e108b4574ac7ff5e6cb
@@ -1 +1 @@
1
- 2b805fcc5c243a2ae845367b8e473ac354391f457bfcc6eea30405588a0314f8b2ce5add7c171b347c580130e4ecdf58ab525e6e4ba5b38f082fae597cd8bd53
1
+ ec3248d7eb1b4ea2b27acb8bc1e1dfe15524949c1a15d2b53c6ad6e2c812e53d869ffef974addabd7183b97fa66863cf846e7fe532217d9aa911397983a7c7f2
@@ -0,0 +1 @@
1
+ f15d0c8cfacf96de4d7f9e69e58eef16
@@ -0,0 +1 @@
1
+ 4ea4897d23d3189f29fb41a541a1e196e0bffc87
@@ -0,0 +1 @@
1
+ 5c458c894dce8fa5b8f103b17c67034324c0b566bb691cd5b3db394ab9caeb62
@@ -0,0 +1 @@
1
+ 4fba34b8672c7576ab39b9bdb2e0057a8ef00bad74481213a1d047599394a49050b2bcda9d7808a42c62dbd8c9694b96c6b0bad15ffbf5abaec9549563384dfc
@@ -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.22.0-smoke.0</version>
6
+ <version>20.22.0</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
+ 23e762ff16c0fdb2f6b1eac85493c79a
@@ -0,0 +1 @@
1
+ 0cfa88adc7968b442452ee1d800bd1086212adb2
@@ -0,0 +1 @@
1
+ ab4cb9f0cf85c81224673fb040d1fd466c0275ee587e1813d385954c33348346
@@ -0,0 +1 @@
1
+ af95f08b0ff5f4d5a18a6b1a2eaac0c69d9a620d065553077a723f0e42f52e788f5ebb292426002dd9df412e36635f6878aef388837a2ed0beaf8d0dfd7a79db
@@ -3,11 +3,11 @@
3
3
  <groupId>com.wix</groupId>
4
4
  <artifactId>detox-legacy</artifactId>
5
5
  <versioning>
6
- <latest>20.22.0-smoke.0</latest>
7
- <release>20.22.0-smoke.0</release>
6
+ <latest>20.22.0</latest>
7
+ <release>20.22.0</release>
8
8
  <versions>
9
- <version>20.22.0-smoke.0</version>
9
+ <version>20.22.0</version>
10
10
  </versions>
11
- <lastUpdated>20240514185937</lastUpdated>
11
+ <lastUpdated>20240522132608</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 59c51736cc7ed9113f52d8fafe5d43cb
1
+ bd89e93daae88ce7fe209137de8e7c13
@@ -1 +1 @@
1
- 07b1ac117cfd7a7c4df5140ce727cc9966884a68
1
+ 2f6374f5c157c84b8ecaa208f62313c443c825cb
@@ -1 +1 @@
1
- df526f5a8da04d9f4672cf14cf2cf872d32a5ac94afcab23ac9099d1ccbbe5a4
1
+ 6dcdf757d11699455189af9056c954867684698d9fca94a9dd440357bfcf9224
@@ -1 +1 @@
1
- 8cd91f48d22cc01a90673b85b0f2840f3b84a7cba386524bbda9b9f4cea043074f87d43bfed711fee33baec91804f5c0b49d4a9d5ab461f890c3a980e31ebd30
1
+ 7bfd055a9c93069f9216963151e51ce9e24fef8be735b07e94f341bffd01fb107c6bd64e9dfdf3ecc73b5d1f527e78d2b9236225dbf202ba67870fa9f8f5b138
Binary file
package/Detox-ios-src.tbz CHANGED
Binary file
Binary file
package/detox.d.ts CHANGED
@@ -431,6 +431,8 @@ declare global {
431
431
 
432
432
  readonly web: WebFacade;
433
433
 
434
+ readonly system: SystemFacade;
435
+
434
436
  readonly DetoxConstants: {
435
437
  userNotificationTriggers: {
436
438
  push: 'push';
@@ -903,8 +905,6 @@ declare global {
903
905
  */
904
906
  captureViewHierarchy(name?: string): Promise<string>;
905
907
 
906
- getUIHierarchy(): Promise<string>;
907
-
908
908
  /**
909
909
  * Simulate shake (iOS Only)
910
910
  */
@@ -1040,6 +1040,12 @@ declare global {
1040
1040
  * Collection of web matchers
1041
1041
  */
1042
1042
  readonly web: ByWebFacade;
1043
+
1044
+ /**
1045
+ * Collection of system-level matchers
1046
+ * @note System APIs are still in experimental phase and are subject to changes in the near future.
1047
+ */
1048
+ readonly system: BySystemFacade;
1043
1049
  }
1044
1050
 
1045
1051
  interface ByWebFacade {
@@ -1108,6 +1114,24 @@ declare global {
1108
1114
  tag(tagName: string): WebMatcher;
1109
1115
  }
1110
1116
 
1117
+ interface BySystemFacade {
1118
+ /**
1119
+ * Find an element on the System-level by its label
1120
+ * @note System APIs are still in experimental phase and are subject to changes in the near future.
1121
+ * @example
1122
+ * system.element(by.system.text('Allow'))
1123
+ */
1124
+ label(text: string): SystemMatcher;
1125
+
1126
+ /**
1127
+ * Find an element on the System-level by its type
1128
+ * @note System APIs are still in experimental phase and are subject to changes in the near future.
1129
+ * @example
1130
+ * system.element(by.system.type('button'))
1131
+ */
1132
+ type(type: string): SystemMatcher;
1133
+ }
1134
+
1111
1135
  interface NativeMatcher {
1112
1136
  /**
1113
1137
  * Find an element satisfying all the matchers
@@ -1129,13 +1153,19 @@ declare global {
1129
1153
  }
1130
1154
 
1131
1155
  interface WebMatcher {
1132
- __web__: any; // prevent type coersion
1156
+ __web__: any; // prevent type coercion
1157
+ }
1158
+
1159
+ interface SystemMatcher {
1160
+ __system__: any; // prevent type coercion
1133
1161
  }
1134
1162
 
1135
1163
  interface ExpectFacade {
1136
1164
  (element: NativeElement): Expect;
1137
1165
 
1138
1166
  (webElement: WebElement): WebExpect;
1167
+
1168
+ (systemElement: SystemElement): SystemExpect;
1139
1169
  }
1140
1170
 
1141
1171
  interface WebViewElement {
@@ -1166,6 +1196,35 @@ declare global {
1166
1196
  (matcher?: NativeMatcher): WebViewElement;
1167
1197
  }
1168
1198
 
1199
+ interface SystemFacade {
1200
+ /**
1201
+ * Find an element on the System-level using a system matcher.
1202
+ * @param systemMatcher a system matcher for the system element.
1203
+ * @note System APIs are still in experimental phase and are subject to changes in the near future.
1204
+ * @example
1205
+ * system.element(by.system.label('Allow'))
1206
+ */
1207
+ element(systemMatcher: SystemMatcher): IndexableSystemElement;
1208
+ }
1209
+
1210
+ interface IndexableSystemElement extends SystemElement {
1211
+ /**
1212
+ * Choose from multiple elements matching the same matcher using index
1213
+ * @note System APIs are still in experimental phase and are subject to changes in the near future.
1214
+ * @example await system.element(by.system.type('button')).atIndex(1).tap();
1215
+ */
1216
+ atIndex(index: number): SystemElement;
1217
+ }
1218
+
1219
+ interface SystemElement {
1220
+ /**
1221
+ * Simulate a tap on the element.
1222
+ * @note System APIs are still in experimental phase and are subject to changes in the near future.
1223
+ * @example await system.element(by.system.label('Allow')).tap();
1224
+ */
1225
+ tap(): Promise<void>;
1226
+ }
1227
+
1169
1228
  interface Expect<R = Promise<void>> {
1170
1229
 
1171
1230
  /**
@@ -1533,6 +1592,22 @@ declare global {
1533
1592
  toExist(): R;
1534
1593
  }
1535
1594
 
1595
+ interface SystemExpect<R = Promise<void>> {
1596
+ /**
1597
+ * Negate the expectation.
1598
+ * @note System APIs are still in experimental phase and are subject to changes in the near future.
1599
+ * @example await expect(system.element(by.system.text('Allow'))).not.toExist();
1600
+ */
1601
+ not: this;
1602
+
1603
+ /**
1604
+ * Expect the view to exist in the system-level.
1605
+ * @note System APIs are still in experimental phase and are subject to changes in the near future.
1606
+ * @example await expect(system.element(by.system.text('Allow'))).toExist();
1607
+ */
1608
+ toExist(): R;
1609
+ }
1610
+
1536
1611
  interface IndexableWebElement extends WebElement {
1537
1612
  /**
1538
1613
  * Choose from multiple elements matching the same matcher using index.
package/globals.d.ts CHANGED
@@ -8,6 +8,7 @@ declare global {
8
8
  const expect: Detox.DetoxExportWrapper['expect'];
9
9
  const by: Detox.DetoxExportWrapper['by'];
10
10
  const web: Detox.DetoxExportWrapper['web'];
11
+ const system: Detox.DetoxExportWrapper['system'];
11
12
 
12
13
  namespace NodeJS {
13
14
  interface Global {
@@ -18,6 +19,7 @@ declare global {
18
19
  expect: Detox.DetoxExportWrapper['expect'];
19
20
  by: Detox.DetoxExportWrapper['by'];
20
21
  web: Detox.DetoxExportWrapper['web'];
22
+ system: Detox.DetoxExportWrapper['system'];
21
23
  }
22
24
  }
23
25
  }
@@ -1,16 +1,24 @@
1
- const cp = require('child_process');
2
- const os = require('os');
3
- const path = require('path');
1
+ const { build } = require('./utils/frameworkUtils');
4
2
 
5
- const detox = require('../internals');
3
+ module.exports = {
4
+ command: 'build-framework-cache',
5
+ desc: 'Builds cached versions of the Detox framework and XCUITest-runner in ~/Library/Detox. ' +
6
+ 'Use the `--detox` and `--xcuitest` flags to selectively build the framework components. ' +
7
+ 'By default, both the injected Detox library and the XCUITest test runner are built. (MacOS only)',
6
8
 
7
- module.exports.command = 'build-framework-cache';
8
- module.exports.desc = 'Builds a cached Detox framework for the current environment in ~/Library/Detox. The cached framework is unique for each combination of Xcode and Detox version. (macOS only)';
9
+ builder: yargs => yargs
10
+ .option('detox', {
11
+ describe: 'Build only the injected Detox library',
12
+ type: 'boolean',
13
+ default: false
14
+ })
15
+ .option('xcuitest', {
16
+ describe: 'Build only the XCUITest test runner',
17
+ type: 'boolean',
18
+ default: false
19
+ }),
9
20
 
10
- module.exports.handler = async function buildFrameworkCache() {
11
- if (os.platform() === 'darwin') {
12
- cp.execSync(path.join(__dirname, '../scripts/build_framework.ios.sh'), { stdio: 'inherit' });
13
- } else {
14
- detox.log.info(`The command is supported only on macOS, skipping the execution.`);
21
+ handler: async function(argv) {
22
+ await build(argv.detox, argv.xcuitest);
15
23
  }
16
24
  };
@@ -1,19 +1,24 @@
1
- const os = require('os');
2
- const path = require('path');
1
+ const { clean } = require('./utils/frameworkUtils');
3
2
 
4
- const fs = require('fs-extra');
3
+ module.exports = {
4
+ command: 'clean-framework-cache',
5
+ desc: 'Cleans cached versions of the Detox framework and XCUITest-runner in ~/Library/Detox. ' +
6
+ 'Use the `--detox` and `--xcuitest` flags to selectively clean the framework components. ' +
7
+ 'By default, both the injected Detox library and the XCUITest test runner are cleaned. (MacOS only)',
5
8
 
6
- const detox = require('../internals');
9
+ builder: yargs => yargs
10
+ .option('detox', {
11
+ describe: 'Clean only the injected Detox library',
12
+ type: 'boolean',
13
+ default: false
14
+ })
15
+ .option('xcuitest', {
16
+ describe: 'Clean only the XCUITest test runner',
17
+ type: 'boolean',
18
+ default: false
19
+ }),
7
20
 
8
- module.exports.command = 'clean-framework-cache';
9
- module.exports.desc = "Deletes all Detox cached frameworks from ~/Library/Detox. Cached framework can be rebuilt using the 'build-framework-cache' command. (macOS only)";
10
-
11
- module.exports.handler = async function cleanFrameworkCache() {
12
- if (os.platform() === 'darwin') {
13
- const frameworkPath = path.join(os.homedir(), '/Library/Detox');
14
- detox.log.info(`Removing framework binaries from ${frameworkPath}`);
15
- await fs.remove(frameworkPath);
16
- } else {
17
- detox.log.info(`The command is supported only on macOS, skipping the execution.`);
21
+ handler: async function(argv) {
22
+ await clean(argv.detox, argv.xcuitest);
18
23
  }
19
24
  };
@@ -1,21 +1,25 @@
1
- const cp = require('child_process');
2
- const os = require('os');
3
- const path = require('path');
1
+ const { build, clean } = require('./utils/frameworkUtils');
4
2
 
5
- const fs = require('fs-extra');
3
+ module.exports = {
4
+ command: 'rebuild-framework-cache',
5
+ desc: 'Rebuilds cached versions of the Detox framework and XCUITest-runner in ~/Library/Detox. ' +
6
+ 'Use the `--detox` and `--xcuitest` flags to selectively rebuild the framework components. ' +
7
+ 'By default, both the injected Detox library and the XCUITest test runner are rebuilt. (MacOS only)',
6
8
 
7
- const log = require('../src/utils/logger').child({ cat: 'cli' });
9
+ builder: yargs => yargs
10
+ .option('detox', {
11
+ describe: 'Rebuild only the injected Detox library',
12
+ type: 'boolean',
13
+ default: false
14
+ })
15
+ .option('xcuitest', {
16
+ describe: 'Rebuild only the XCUITest test runner',
17
+ type: 'boolean',
18
+ default: false
19
+ }),
8
20
 
9
- module.exports.command = 'rebuild-framework-cache';
10
- module.exports.desc = 'Rebuilds a cached Detox framework for the current environment in ~/Library/Detox. The cached framework is unique for each combination of Xcode and Detox version. (macOS only)';
11
-
12
- module.exports.handler = async function buildFrameworkCache() {
13
- if (os.platform() === 'darwin') {
14
- const frameworkPath = path.join(os.homedir(), '/Library/Detox');
15
- log.info(`Removing framework binaries from ${frameworkPath}`);
16
- await fs.remove(frameworkPath);
17
- cp.execSync(path.join(__dirname, '../scripts/build_framework.ios.sh'), { stdio: 'inherit' });
18
- } else {
19
- log.info(`The command is supported only on macOS, skipping the execution.`);
21
+ handler: async function(argv) {
22
+ await clean(argv.detox, argv.xcuitest);
23
+ await build(argv.detox, argv.xcuitest);
20
24
  }
21
25
  };
@@ -0,0 +1,77 @@
1
+ const os = require('os');
2
+ const path = require('path');
3
+
4
+ const { spawn } = require('child-process-promise');
5
+ const fs = require('fs-extra');
6
+
7
+ const detox = require('../../internals');
8
+ const { getFrameworkDirPath, getXCUITestRunnerDirPath } = require('../../src/utils/environment');
9
+
10
+
11
+ const frameworkBuildScript = '../../scripts/build_local_framework.ios.sh';
12
+ const xcuitestBuildScript = '../../scripts/build_local_xcuitest.ios.sh';
13
+
14
+ function shouldSkipExecution() {
15
+ if (os.platform() !== 'darwin') {
16
+ detox.log.info('The command is supported only on macOS, skipping the execution.');
17
+ return true;
18
+ }
19
+
20
+ return false;
21
+ }
22
+
23
+ async function execBuildScript(targetPath, scriptPath, descriptor) {
24
+ detox.log.info(`Building ${descriptor} cache at ${targetPath}..`);
25
+
26
+ const scriptFullPath = path.join(__dirname, scriptPath);
27
+
28
+ try {
29
+ await spawn(scriptFullPath, [], { stdio: 'inherit' });
30
+ } catch (error) {
31
+ detox.log.error(`Error while building ${descriptor}:\n${error}`);
32
+ throw error;
33
+ }
34
+ }
35
+
36
+ async function removeTarget(targetPath, descriptor) {
37
+ detox.log.info(`Cleaning ${descriptor} cache at ${targetPath}..`);
38
+ await fs.remove(targetPath);
39
+ detox.log.info(`Done\n`);
40
+ }
41
+
42
+ async function build(framework, xcuitest) {
43
+ if (shouldSkipExecution()) {
44
+ return;
45
+ }
46
+
47
+ const shouldBuildBoth = !framework && !xcuitest;
48
+
49
+ if (framework || shouldBuildBoth) {
50
+ await execBuildScript(getFrameworkDirPath, frameworkBuildScript, 'Detox framework');
51
+ }
52
+
53
+ if (xcuitest || shouldBuildBoth) {
54
+ await execBuildScript(getXCUITestRunnerDirPath, xcuitestBuildScript, 'XCUITest runner');
55
+ }
56
+ }
57
+
58
+ async function clean(framework, xcuitest) {
59
+ if (shouldSkipExecution()) {
60
+ return;
61
+ }
62
+
63
+ const shouldCleanBoth = !framework && !xcuitest;
64
+
65
+ if (framework || shouldCleanBoth) {
66
+ await removeTarget(getXCUITestRunnerDirPath, 'Detox framework');
67
+ }
68
+
69
+ if (xcuitest || shouldCleanBoth) {
70
+ await removeTarget(getXCUITestRunnerDirPath, 'XCUITest runner');
71
+ }
72
+ }
73
+
74
+ module.exports = {
75
+ build,
76
+ clean
77
+ };
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.22.0-smoke.0",
4
+ "version": "20.22.0",
5
5
  "bin": {
6
6
  "detox": "local-cli/cli.js"
7
7
  },
@@ -56,7 +56,7 @@
56
56
  "eslint-plugin-node": "^11.1.0",
57
57
  "eslint-plugin-unicorn": "^50.0.1",
58
58
  "jest": "^29.6.3",
59
- "jest-allure2-reporter": "^2.0.0-beta.15",
59
+ "jest-allure2-reporter": "^2.0.0-beta.18",
60
60
  "metro-react-native-babel-preset": "0.76.8",
61
61
  "prettier": "^3.1.1",
62
62
  "react-native": "0.73.2",
@@ -77,7 +77,7 @@
77
77
  "funpermaproxy": "^1.1.0",
78
78
  "glob": "^8.0.3",
79
79
  "ini": "^1.3.4",
80
- "jest-environment-emit": "^1.0.5",
80
+ "jest-environment-emit": "^1.0.8",
81
81
  "json-cycle": "^1.3.0",
82
82
  "lodash": "^4.17.11",
83
83
  "multi-sort-stream": "^1.0.3",
@@ -115,5 +115,5 @@
115
115
  "browserslist": [
116
116
  "node 14"
117
117
  ],
118
- "gitHead": "ef55a3cdc2c199fb501fa660e3f691b2565af5e2"
118
+ "gitHead": "2943ff0e27105eab989dee8f206a1a12cf558d4b"
119
119
  }
@@ -1,62 +1,28 @@
1
1
  #!/bin/bash -e
2
2
 
3
- # Ensure Xcode is installed or print a warning message and return.
4
- xcodebuild -version &>/dev/null || { echo "WARNING: Xcode is not installed on this machine. Skipping iOS framework build phase"; exit 0; }
5
-
6
- detoxRootPath="$(dirname "$(dirname "$0")")"
7
- detoxVersion=`node -p "require('${detoxRootPath}/package.json').version"`
8
-
9
- sha1=`(echo "${detoxVersion}" && xcodebuild -version) | shasum | awk '{print $1}' #"${2}"`
10
- detoxFrameworkDirPath="$HOME/Library/Detox/ios/${sha1}"
11
- detoxFrameworkPath="${detoxFrameworkDirPath}/Detox.framework"
12
-
13
-
14
- function prepareAndBuildFramework () {
15
- if [ -d "$detoxRootPath"/ios ]; then
16
- detoxSourcePath="${detoxRootPath}"/ios
17
- echo "Dev mode, building from ${detoxSourcePath}"
18
- buildFramework "${detoxSourcePath}"
19
- else
20
- extractFramework
21
- fi
22
- }
23
-
24
- function extractFramework () {
25
- echo "Extracting Detox framework..."
26
- mkdir -p "${detoxFrameworkDirPath}"
27
- tar -xjf "${detoxRootPath}"/Detox-ios.tbz -C "${detoxFrameworkDirPath}"
28
- }
29
-
30
- function buildFramework () {
31
- detoxSourcePath="${1}"
32
- echo "Building Detox.framework from ${detoxSourcePath} into ${detoxFrameworkDirPath}"
33
- mkdir -p "${detoxFrameworkDirPath}"
34
- logPath="${detoxFrameworkDirPath}"/detox_ios.log
35
- echo "Build log: ${logPath}"
36
- echo -n "" > "${logPath}"
37
- "${detoxRootPath}"/scripts/build_universal_framework.sh "${detoxSourcePath}"/Detox.xcodeproj "${detoxFrameworkDirPath}" &> "${logPath}" || {
38
- echo -e "#################################\nError building Detox.framework:\n----------------------------------\n"
39
- cat "${logPath}"
40
- echo "#################################"
41
- exit 1
42
- }
43
- }
44
-
45
- function main () {
46
- if [ -d "${detoxFrameworkDirPath}" ]; then
47
- if [ ! -d "${detoxFrameworkPath}" ]; then
48
- echo "${detoxFrameworkDirPath} was found, but could not find Detox.framework inside it. This means that the Detox framework build process was interrupted.
49
- deleting ${detoxFrameworkDirPath} and trying to rebuild."
50
- rm -rf "${detoxFrameworkDirPath}"
51
- prepareAndBuildFramework
52
- else
53
- echo "Detox.framework exists, skipping..."
54
- fi
55
- else
56
- prepareAndBuildFramework
57
- fi
58
-
59
- echo "Done"
60
- }
61
-
62
- main
3
+ PROJECT=$1
4
+ FRAMEWORK_OUTPUT_DIR=$2
5
+ CONFIGURATION=Release
6
+ PROJECT_NAME=Detox
7
+
8
+ # Make sure the output directory exists
9
+
10
+ rm -fr "${FRAMEWORK_OUTPUT_DIR}"
11
+ mkdir -p "${FRAMEWORK_OUTPUT_DIR}"
12
+
13
+ # Step 0. Xcode version
14
+
15
+ USE_NEW_BUILD_SYSTEM="YES"
16
+ echo "Using -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM}"
17
+
18
+ # Step 1. Build Device and Simulator versions
19
+
20
+ BUILD_SIM=`xcodebuild -project "${PROJECT}" -scheme "Detox" -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM} -configuration "${CONFIGURATION}" -sdk iphonesimulator -destination "generic/platform=iOS Simulator" build -showBuildSettings | awk -F= '/TARGET_BUILD_DIR/{x=$NF; gsub(/^[ \t]+|[ \t]+$/,"",x); print x}'`
21
+
22
+ echo ${BUILD_SIM}
23
+
24
+ xcodebuild -project "${PROJECT}" -scheme "Detox" -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM} -configuration "${CONFIGURATION}" -sdk iphonesimulator -destination "generic/platform=iOS Simulator" build -quiet
25
+
26
+ # Step 2. Copy the framework to output folder
27
+
28
+ cp -fR "${BUILD_SIM}/${PROJECT_NAME}.framework" "${FRAMEWORK_OUTPUT_DIR}"/