detox 20.15.0 → 20.16.0

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 (42) hide show
  1. package/Detox-android/com/wix/detox/{20.15.0/detox-20.15.0-javadoc.jar → 20.16.0/detox-20.16.0-javadoc.jar} +0 -0
  2. package/Detox-android/com/wix/detox/20.16.0/detox-20.16.0-javadoc.jar.md5 +1 -0
  3. package/Detox-android/com/wix/detox/20.16.0/detox-20.16.0-javadoc.jar.sha1 +1 -0
  4. package/Detox-android/com/wix/detox/20.16.0/detox-20.16.0-javadoc.jar.sha256 +1 -0
  5. package/Detox-android/com/wix/detox/20.16.0/detox-20.16.0-javadoc.jar.sha512 +1 -0
  6. package/Detox-android/com/wix/detox/{20.15.0/detox-20.15.0-sources.jar → 20.16.0/detox-20.16.0-sources.jar} +0 -0
  7. package/Detox-android/com/wix/detox/20.16.0/detox-20.16.0-sources.jar.md5 +1 -0
  8. package/Detox-android/com/wix/detox/20.16.0/detox-20.16.0-sources.jar.sha1 +1 -0
  9. package/Detox-android/com/wix/detox/20.16.0/detox-20.16.0-sources.jar.sha256 +1 -0
  10. package/Detox-android/com/wix/detox/20.16.0/detox-20.16.0-sources.jar.sha512 +1 -0
  11. package/Detox-android/com/wix/detox/{20.15.0/detox-20.15.0.pom → 20.16.0/detox-20.16.0.pom} +1 -1
  12. package/Detox-android/com/wix/detox/20.16.0/detox-20.16.0.pom.md5 +1 -0
  13. package/Detox-android/com/wix/detox/20.16.0/detox-20.16.0.pom.sha1 +1 -0
  14. package/Detox-android/com/wix/detox/20.16.0/detox-20.16.0.pom.sha256 +1 -0
  15. package/Detox-android/com/wix/detox/20.16.0/detox-20.16.0.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-ios-src.tbz +0 -0
  22. package/Detox-ios.tbz +0 -0
  23. package/detox.d.ts +20 -17
  24. package/package.json +2 -2
  25. package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +110 -15
  26. package/Detox-android/com/wix/detox/20.15.0/detox-20.15.0-javadoc.jar.md5 +0 -1
  27. package/Detox-android/com/wix/detox/20.15.0/detox-20.15.0-javadoc.jar.sha1 +0 -1
  28. package/Detox-android/com/wix/detox/20.15.0/detox-20.15.0-javadoc.jar.sha256 +0 -1
  29. package/Detox-android/com/wix/detox/20.15.0/detox-20.15.0-javadoc.jar.sha512 +0 -1
  30. package/Detox-android/com/wix/detox/20.15.0/detox-20.15.0-sources.jar.md5 +0 -1
  31. package/Detox-android/com/wix/detox/20.15.0/detox-20.15.0-sources.jar.sha1 +0 -1
  32. package/Detox-android/com/wix/detox/20.15.0/detox-20.15.0-sources.jar.sha256 +0 -1
  33. package/Detox-android/com/wix/detox/20.15.0/detox-20.15.0-sources.jar.sha512 +0 -1
  34. package/Detox-android/com/wix/detox/20.15.0/detox-20.15.0.pom.md5 +0 -1
  35. package/Detox-android/com/wix/detox/20.15.0/detox-20.15.0.pom.sha1 +0 -1
  36. package/Detox-android/com/wix/detox/20.15.0/detox-20.15.0.pom.sha256 +0 -1
  37. package/Detox-android/com/wix/detox/20.15.0/detox-20.15.0.pom.sha512 +0 -1
  38. /package/Detox-android/com/wix/detox/{20.15.0/detox-20.15.0.aar → 20.16.0/detox-20.16.0.aar} +0 -0
  39. /package/Detox-android/com/wix/detox/{20.15.0/detox-20.15.0.aar.md5 → 20.16.0/detox-20.16.0.aar.md5} +0 -0
  40. /package/Detox-android/com/wix/detox/{20.15.0/detox-20.15.0.aar.sha1 → 20.16.0/detox-20.16.0.aar.sha1} +0 -0
  41. /package/Detox-android/com/wix/detox/{20.15.0/detox-20.15.0.aar.sha256 → 20.16.0/detox-20.16.0.aar.sha256} +0 -0
  42. /package/Detox-android/com/wix/detox/{20.15.0/detox-20.15.0.aar.sha512 → 20.16.0/detox-20.16.0.aar.sha512} +0 -0
@@ -0,0 +1 @@
1
+ 56f5ec5b7efbb230f3238c004a5fe715
@@ -0,0 +1 @@
1
+ 64494abc41fe95ddfa2592069865471684bee013
@@ -0,0 +1 @@
1
+ a59fe4333df991b4188fe010b85fd8cd739ea7244d8feb096ed77b42ec178d63
@@ -0,0 +1 @@
1
+ 623c51f747c437bd88a7421ac94e30d1c4d9c11f7aca8066746213c80e79eb7aba7a1d067dbf1033ae710deb021fdaf503304f387e43ae6333c763786a64bf9f
@@ -0,0 +1 @@
1
+ 65e9a1e222c5bd2d0d8f1adbb87e81dc
@@ -0,0 +1 @@
1
+ a619619716feca26448febd692de8dac38314100
@@ -0,0 +1 @@
1
+ 5aa3a4be5939728a238f7ed475ee6e6d55d0eef81d1f84fc842029a7ba597c58
@@ -0,0 +1 @@
1
+ 61cf8afa304f860372a728279633e767070bddea071a2de58ff6b23fac2ef61e472ba4191704a8175cbd8cf1b10c526fae02db7205b8dcc5696d8f76e9441ab2
@@ -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.15.0</version>
6
+ <version>20.16.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
+ 6e8623d17be32c1363d08aa89e5fd3b2
@@ -0,0 +1 @@
1
+ 2b12affbd8b37c465ddc003dd59c224c83eb31fa
@@ -0,0 +1 @@
1
+ 1c812b8cb14e877335790a3dbf0ffd4db6e85c311e56050aa14853f1c78a7c90
@@ -0,0 +1 @@
1
+ 27641bf294e773373fa00156c73180d0260f0ee0611d5bb3f3e40001560a0a1537eed5807196397be5742d513974f7281bb682b0c09d2865888863080b305a05
@@ -3,11 +3,11 @@
3
3
  <groupId>com.wix</groupId>
4
4
  <artifactId>detox</artifactId>
5
5
  <versioning>
6
- <latest>20.15.0</latest>
7
- <release>20.15.0</release>
6
+ <latest>20.16.0</latest>
7
+ <release>20.16.0</release>
8
8
  <versions>
9
- <version>20.15.0</version>
9
+ <version>20.16.0</version>
10
10
  </versions>
11
- <lastUpdated>20240111111712</lastUpdated>
11
+ <lastUpdated>20240114094649</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 9e22bc0ea12d6e5775b68bde874bdf22
1
+ 3a7cd4da4ea3dd3e5cf31ee3a0c6ad4b
@@ -1 +1 @@
1
- add0ba9ace5604f9bad42acfe204f32728323ce4
1
+ d32146f04f20a32ac69562f7fec718954e1f925d
@@ -1 +1 @@
1
- 8d6d198043d40230347ae63f85625557fd6b2f45494d80c14e19e7e8e2f19fd2
1
+ 9440532f25a30a2d2c025159b566348219724e16f627e1c2cf80e384c9b40141
@@ -1 +1 @@
1
- 7411bfbd2cbeb1e65e91618e520b083f54253f8b5e8f17f8b187de2716d3bf809c45246eb2bca80a9011f439f65f08053442daa846c4833bcb28f378a42e18b6
1
+ ff53b142b83374497a6450075bf40da6df3996a77522efb5555d59b61b17e39c59b3891250a9c53789845add208bd28cfdbc975cd9e6a262ff47dead71e1dd74
package/Detox-ios-src.tbz CHANGED
Binary file
package/Detox-ios.tbz CHANGED
Binary file
package/detox.d.ts CHANGED
@@ -644,10 +644,11 @@ declare global {
644
644
  */
645
645
  selectApp(app: string): Promise<void>;
646
646
 
647
+ // TODO: document permissions types.
647
648
  /**
648
649
  * Launch the app.
649
650
  *
650
- * <p>For info regarding launch arguments, refer to the [dedicated guide](https://wix.github.io/Detox/docs/api/launch-args).
651
+ * <p>For info regarding launch arguments, refer to the [dedicated guide](https://wix.github.io/Detox/docs/guide/launch-args).
651
652
  *
652
653
  * @example
653
654
  * // Terminate the app and launch it again. If set to false, the simulator will try to bring app from background,
@@ -1624,23 +1625,25 @@ declare global {
1624
1625
  userTracking?: UserTrackingPermission;
1625
1626
  }
1626
1627
 
1628
+ type BasicPermissionState = 'YES' | 'NO' | 'unset';
1629
+ type ExtendedPermissionState = 'YES' | 'NO' | 'unset' | 'limited';
1627
1630
  type LocationPermission = 'always' | 'inuse' | 'never' | 'unset';
1628
- type PermissionState = 'YES' | 'NO' | 'unset';
1629
- type CameraPermission = PermissionState;
1630
- type ContactsPermission = PermissionState;
1631
- type CalendarPermission = PermissionState;
1632
- type HealthPermission = PermissionState;
1633
- type HomekitPermission = PermissionState;
1634
- type MediaLibraryPermission = PermissionState;
1635
- type MicrophonePermission = PermissionState;
1636
- type MotionPermission = PermissionState;
1637
- type PhotosPermission = PermissionState;
1638
- type RemindersPermission = PermissionState;
1639
- type SiriPermission = PermissionState;
1640
- type SpeechPermission = PermissionState;
1641
- type NotificationsPermission = PermissionState;
1642
- type FaceIDPermission = PermissionState;
1643
- type UserTrackingPermission = PermissionState;
1631
+
1632
+ type CameraPermission = BasicPermissionState;
1633
+ type ContactsPermission = ExtendedPermissionState;
1634
+ type CalendarPermission = BasicPermissionState;
1635
+ type HealthPermission = BasicPermissionState;
1636
+ type HomekitPermission = BasicPermissionState;
1637
+ type MediaLibraryPermission = BasicPermissionState;
1638
+ type MicrophonePermission = BasicPermissionState;
1639
+ type MotionPermission = BasicPermissionState;
1640
+ type PhotosPermission = ExtendedPermissionState;
1641
+ type RemindersPermission = BasicPermissionState;
1642
+ type SiriPermission = BasicPermissionState;
1643
+ type SpeechPermission = BasicPermissionState;
1644
+ type NotificationsPermission = BasicPermissionState;
1645
+ type FaceIDPermission = BasicPermissionState;
1646
+ type UserTrackingPermission = BasicPermissionState;
1644
1647
 
1645
1648
  interface DeviceLaunchAppConfig {
1646
1649
  /**
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.15.0",
4
+ "version": "20.16.0",
5
5
  "bin": {
6
6
  "detox": "local-cli/cli.js"
7
7
  },
@@ -109,5 +109,5 @@
109
109
  "browserslist": [
110
110
  "node 14"
111
111
  ],
112
- "gitHead": "bed7b965b2180bd3c628e242b9f78a80660c371f"
112
+ "gitHead": "3d7cb5de27cf768dca7216e60806819672553f4a"
113
113
  }
@@ -10,21 +10,123 @@ const environment = require('../../../../../utils/environment');
10
10
  const log = require('../../../../../utils/logger').child({ cat: 'device' });
11
11
  const { quote } = require('../../../../../utils/shellQuote');
12
12
 
13
+ const PERMISSIONS_VALUES = {
14
+ YES: 'YES',
15
+ NO: 'NO',
16
+ UNSET: 'unset',
17
+ LIMITED: 'limited',
18
+ };
19
+
20
+ const SIMCTL_SET_PERMISSION_ACTIONS ={
21
+ GRANT: 'grant',
22
+ REVOKE: 'revoke',
23
+ RESET: 'reset',
24
+ };
25
+
13
26
  class AppleSimUtils {
14
27
  async setPermissions(udid, bundleId, permissionsObj) {
15
- let permissions = [];
16
- _.forEach(permissionsObj, function (shouldAllow, permission) {
17
- permissions.push(permission + '=' + shouldAllow);
18
- });
28
+ for (const [service, value] of Object.entries(permissionsObj)) {
29
+ switch (service) {
30
+ case 'location':
31
+ switch (value) {
32
+ case 'always':
33
+ await this.setPermissionWithSimctl(udid, bundleId, SIMCTL_SET_PERMISSION_ACTIONS.GRANT, 'location-always');
34
+ break;
35
+
36
+ case 'inuse':
37
+ await this.setPermissionWithSimctl(udid, bundleId, SIMCTL_SET_PERMISSION_ACTIONS.GRANT, 'location');
38
+ break;
39
+
40
+ case 'never':
41
+ await this.setPermissionWithSimctl(udid, bundleId, SIMCTL_SET_PERMISSION_ACTIONS.REVOKE, 'location');
42
+ break;
43
+
44
+ case 'unset':
45
+ await this.setPermissionWithSimctl(udid, bundleId, SIMCTL_SET_PERMISSION_ACTIONS.RESET, 'location');
46
+ break;
47
+ }
48
+
49
+ break;
50
+
51
+ case 'contacts':
52
+ if (value === PERMISSIONS_VALUES.LIMITED) {
53
+ await this.setPermissionWithSimctl(udid, bundleId, SIMCTL_SET_PERMISSION_ACTIONS.GRANT, 'contacts-limited');
54
+ } else {
55
+ await this.setPermissionWithAppleSimUtils(udid, bundleId, service, value);
56
+ }
57
+ break;
58
+
59
+ case 'photos':
60
+ if (value === PERMISSIONS_VALUES.LIMITED) {
61
+ await this.setPermissionWithSimctl(udid, bundleId, SIMCTL_SET_PERMISSION_ACTIONS.GRANT, 'photos-add');
62
+ } else {
63
+ await this.setPermissionWithAppleSimUtils(udid, bundleId, service, value);
64
+ }
65
+ break;
66
+
67
+ // eslint-disable-next-line no-fallthrough
68
+ case 'calendar':
69
+ case 'camera':
70
+ case 'medialibrary':
71
+ case 'microphone':
72
+ case 'motion':
73
+ case 'reminders':
74
+ case 'siri':
75
+ // Simctl uses kebab-case for service names.
76
+ const simctlService = service.replace('medialibrary', 'media-library');
77
+ await this.setPermissionWithSimctl(udid, bundleId, this.basicPermissionValueToSimctlAction(value), simctlService);
78
+ break;
79
+
80
+ // Requires AppleSimUtils: unsupported by latest Simctl at the moment of writing this code.
81
+ // eslint-disable-next-line no-fallthrough
82
+ case 'notifications':
83
+ case 'health':
84
+ case 'homekit':
85
+ case 'speech':
86
+ case 'faceid':
87
+ case 'userTracking':
88
+ await this.setPermissionWithAppleSimUtils(udid, bundleId, service, value);
89
+ break;
90
+ }
91
+ }
92
+ }
93
+
94
+ basicPermissionValueToSimctlAction(value) {
95
+ switch (value) {
96
+ case PERMISSIONS_VALUES.YES:
97
+ return SIMCTL_SET_PERMISSION_ACTIONS.GRANT;
98
+
99
+ case PERMISSIONS_VALUES.NO:
100
+ return SIMCTL_SET_PERMISSION_ACTIONS.REVOKE;
101
+
102
+ case PERMISSIONS_VALUES.UNSET:
103
+ return SIMCTL_SET_PERMISSION_ACTIONS.RESET;
104
+ }
105
+ }
19
106
 
107
+ async setPermissionWithSimctl(udid, bundleId, action, service) {
20
108
  const options = {
21
- args: `--byId ${udid} --bundle ${bundleId} --restartSB --setPermissions ${_.join(permissions, ',')}`,
109
+ cmd: `privacy ${udid} ${action} ${service} ${bundleId}`,
22
110
  statusLogs: {
23
- trying: `Trying to set permissions...`,
24
- successful: 'Permissions are set'
111
+ trying: `Trying to set permissions with Simctl: ${action} ${service}...`,
112
+ successful: `${service} permissions are set`
25
113
  },
26
114
  retries: 1,
27
115
  };
116
+
117
+ await this._execSimctl(options);
118
+ }
119
+
120
+ async setPermissionWithAppleSimUtils(udid, bundleId, service, value) {
121
+ const options = {
122
+ args: `--byId ${udid} --bundle ${bundleId} --restartSB --setPermissions ${service}=${value}`,
123
+ statusLogs: {
124
+ trying: `Trying to set permissions with AppleSimUtils: ${service}=${value}...`,
125
+ successful: `${service} permissions are set`
126
+ },
127
+ retries: 1,
128
+ };
129
+
28
130
  await this._execAppleSimUtils(options);
29
131
  }
30
132
 
@@ -319,14 +421,7 @@ class AppleSimUtils {
319
421
  }
320
422
 
321
423
  async setLocation(udid, lat, lon) {
322
- const result = await childProcess.execWithRetriesAndLogs(`which fbsimctl`, { retries: 1 });
323
- if (_.get(result, 'stdout')) {
324
- await childProcess.execWithRetriesAndLogs(`fbsimctl ${udid} set_location ${lat} ${lon}`, { retries: 1 });
325
- } else {
326
- throw new DetoxRuntimeError(`setLocation currently supported only through fbsimctl.
327
- Install fbsimctl using:
328
- "brew tap facebook/fb && export CODE_SIGNING_REQUIRED=NO && brew install fbsimctl"`);
329
- }
424
+ await this._execSimctl({ cmd: `location ${udid} set ${lat},${lon}` });
330
425
  }
331
426
 
332
427
  async resetContentAndSettings(udid) {
@@ -1 +0,0 @@
1
- 6af6a1128b61c579b4a5c82d2865f585
@@ -1 +0,0 @@
1
- 4dba1aa3f352698d234cccc7f69d8d3e69350458
@@ -1 +0,0 @@
1
- 0d73e6570afca6e11cefdb63125dd01bdd0f33143089402c752c506b5acf85a3
@@ -1 +0,0 @@
1
- cda5ab07eac2a8371056647e4b6391a1c42e2d4a5b1a6a7a810a398ed4f29946441ea9da132a236cee7e523b09b6b6ea8f1510e5faaec0061193c84767e1d849
@@ -1 +0,0 @@
1
- b912691ddb7318d42de9431f7435bc9a
@@ -1 +0,0 @@
1
- 5c90afac3b3a7d5fa2ba83e650604f6f9bc00682
@@ -1 +0,0 @@
1
- 5eabd613ae0284bc97755f7e29cf0d233e281ae7635afeeb0875437401c3ddb8
@@ -1 +0,0 @@
1
- 5ef628faf38474b46638efc54f932b15824f5735497279f0153fe9c6afc2f7de9a151ee46e51724ce93ff22515bf43b86147f8330c67a49b34dd45ce3b129c5d
@@ -1 +0,0 @@
1
- b214c6ec949dbb966c2ab104243efbb5
@@ -1 +0,0 @@
1
- 91c5ac02c59420f8a6eaca4af5fa5a5d40901b92
@@ -1 +0,0 @@
1
- 8e39181294f58719e0d42ea4b6220526012c229b47ab6db988acd904a8bba64c
@@ -1 +0,0 @@
1
- c919a336c80ca89a3d41975a6b8574539f93234105f7762870afdd1540ef44763b00ecf7860b6cb22457ff9c714047f5c78f9a341c9ad923fc8beb25fd1d1331