detox 20.14.4 → 20.14.6
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.
- package/Detox-android/com/wix/detox/{20.14.4/detox-20.14.4-javadoc.jar → 20.14.6/detox-20.14.6-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.14.6/detox-20.14.6-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.14.6/detox-20.14.6-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.14.6/detox-20.14.6-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.14.6/detox-20.14.6-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.14.4/detox-20.14.4-sources.jar → 20.14.6/detox-20.14.6-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.14.6/detox-20.14.6-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.14.6/detox-20.14.6-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.14.6/detox-20.14.6-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.14.6/detox-20.14.6-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.14.4/detox-20.14.4.pom → 20.14.6/detox-20.14.6.pom} +1 -1
- package/Detox-android/com/wix/detox/20.14.6/detox-20.14.6.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.14.6/detox-20.14.6.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.14.6/detox-20.14.6.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.14.6/detox-20.14.6.pom.sha512 +1 -0
- package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
- package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
- package/Detox-ios-src.tbz +0 -0
- package/Detox-ios.tbz +0 -0
- package/android/detox/proguard-rules-app.pro +1 -2
- package/detox.d.ts +1 -1
- package/jest.config.js +1 -1
- package/local-cli/init.js +1 -1
- package/package.json +6 -5
- package/runners/jest/testEnvironment/index.js +23 -9
- package/src/DetoxWorker.js +1 -1
- package/src/devices/common/drivers/android/tools/ApkValidator.js +1 -1
- package/src/devices/runtime/drivers/android/AndroidDriver.js +1 -1
- package/src/ipc/IPCClient.js +2 -2
- package/src/ipc/IPCServer.js +3 -3
- package/src/realms/DetoxContext.js +2 -2
- package/src/realms/DetoxPrimaryContext.js +74 -26
- package/src/realms/DetoxSecondaryContext.js +2 -2
- package/Detox-android/com/wix/detox/20.14.4/detox-20.14.4-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.14.4/detox-20.14.4-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.14.4/detox-20.14.4-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.14.4/detox-20.14.4-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.14.4/detox-20.14.4-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.14.4/detox-20.14.4-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.14.4/detox-20.14.4-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.14.4/detox-20.14.4-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.14.4/detox-20.14.4.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.14.4/detox-20.14.4.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.14.4/detox-20.14.4.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.14.4/detox-20.14.4.pom.sha512 +0 -1
- /package/Detox-android/com/wix/detox/{20.14.4/detox-20.14.4.aar → 20.14.6/detox-20.14.6.aar} +0 -0
- /package/Detox-android/com/wix/detox/{20.14.4/detox-20.14.4.aar.md5 → 20.14.6/detox-20.14.6.aar.md5} +0 -0
- /package/Detox-android/com/wix/detox/{20.14.4/detox-20.14.4.aar.sha1 → 20.14.6/detox-20.14.6.aar.sha1} +0 -0
- /package/Detox-android/com/wix/detox/{20.14.4/detox-20.14.4.aar.sha256 → 20.14.6/detox-20.14.6.aar.sha256} +0 -0
- /package/Detox-android/com/wix/detox/{20.14.4/detox-20.14.4.aar.sha512 → 20.14.6/detox-20.14.6.aar.sha512} +0 -0
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
41fe7597fc91cef56a970ce36e1947dd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f0c6385bd03f1ca7cde9eb0ee10aa87bc583ba0c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
de6832e43ad96840f5231e028982dd44742765d2a385706beb95bd7dfbedce37
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5511678c6182985267910a2f1318eda59f4d6483235c7b6a80be362e31719016d3e4b2f4669d6ceb1cdc85f232e7deb4b4bccb7bb3cf4887b2db19cd9e610633
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
131a67c2ff6d50fb5c70facc1f37c1dd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5c854f3314e2012f849ff2dbd3bf31cbedebedf1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
795cc8048628577eccc74dbe3f8782bdf1f1ad7c9d5296b31ee0db505b323fd3
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2d9b697f65d0ab4efb934f12ff1cac70ca8a1fe3d9471f11ca4d6073558ff94365c02d83d099bac31167542633c382fd54d8accee11e5e31cb496128e4547481
|
|
@@ -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.14.
|
|
6
|
+
<version>20.14.6</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
|
+
ca7f0ba78d30abe2f89e34115ef7e386
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
39dbf9358b9ce31252f861c23b7dcb6fde1b4122
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
8769d69e473f95377f2c7a8f491488994c6b40a290751f0b17c0930616afc6bf
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f5367ebd7e55eeff0f4d3eec4e522a5959e6fcfa85c90f66d3d7ff129a2d18c455581520014677aec397fcf58efc91c6441ee5543cf20d3ec60beec45d4aa785
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>com.wix</groupId>
|
|
4
4
|
<artifactId>detox</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>20.14.
|
|
7
|
-
<release>20.14.
|
|
6
|
+
<latest>20.14.6</latest>
|
|
7
|
+
<release>20.14.6</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>20.14.
|
|
9
|
+
<version>20.14.6</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20231228113250</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
e246abca05b05658f3638d3bcb578f87
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
c764f25216e2352efe7a3b70d6a0777d3f2f1932
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
5ddd6ab77f6cdaedc23e661ddd0dea0a833ff3c7f9a9adddd7b37187c0fa16e0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d3472cfee8606dd4d43b6745b376f38f2eb200cf9b4a000f607d366a4b5e03544d9616be14d68f7e7f3abe43805cf29f52c155729374da11090e62d53d603837
|
package/Detox-ios-src.tbz
CHANGED
|
Binary file
|
package/Detox-ios.tbz
CHANGED
|
Binary file
|
|
@@ -20,5 +20,4 @@
|
|
|
20
20
|
-keep class kotlin.io.** { *; }
|
|
21
21
|
-keep class okhttp3.** { *; }
|
|
22
22
|
|
|
23
|
-
-keep class androidx.concurrent.futures
|
|
24
|
-
-keep class androidx.concurrent.futures.CallbackToFutureAdapter { *; }
|
|
23
|
+
-keep class androidx.concurrent.futures.** { *; }
|
package/detox.d.ts
CHANGED
|
@@ -214,7 +214,7 @@ declare global {
|
|
|
214
214
|
* This flag tells Detox to print messages like these every time the device gets assigned to a specific suite:
|
|
215
215
|
*
|
|
216
216
|
* ```plain text
|
|
217
|
-
* 18:03:29.869 detox[40125] i starter.test.js is assigned to 4EC84833-C7EA-4CA3-A6E9-5C30A29EA596 (iPhone
|
|
217
|
+
* 18:03:29.869 detox[40125] i starter.test.js is assigned to 4EC84833-C7EA-4CA3-A6E9-5C30A29EA596 (iPhone 15)
|
|
218
218
|
* ```
|
|
219
219
|
*
|
|
220
220
|
* @default true
|
package/jest.config.js
CHANGED
package/local-cli/init.js
CHANGED
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.14.
|
|
4
|
+
"version": "20.14.6",
|
|
5
5
|
"bin": {
|
|
6
6
|
"detox": "local-cli/cli.js"
|
|
7
7
|
},
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@types/bunyan": "^1.8.8",
|
|
38
38
|
"@types/child-process-promise": "^2.2.1",
|
|
39
39
|
"@types/fs-extra": "^9.0.13",
|
|
40
|
-
"@types/jest": "^
|
|
40
|
+
"@types/jest": "^29.0.0",
|
|
41
41
|
"@types/node": "^14.18.33",
|
|
42
42
|
"@types/node-ipc": "^9.2.0",
|
|
43
43
|
"@types/ws": "^7.4.0",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
51
51
|
"eslint-plugin-node": "^11.1.0",
|
|
52
52
|
"eslint-plugin-unicorn": "^47.0.0",
|
|
53
|
-
"jest": "^
|
|
54
|
-
"jest-allure2-reporter": "2.0.0-
|
|
53
|
+
"jest": "^29.0.0",
|
|
54
|
+
"jest-allure2-reporter": "^2.0.0-beta.2",
|
|
55
55
|
"mockdate": "^2.0.1",
|
|
56
56
|
"prettier": "^2.4.1",
|
|
57
57
|
"react-native": "0.71.10",
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"funpermaproxy": "^1.1.0",
|
|
73
73
|
"glob": "^8.0.3",
|
|
74
74
|
"ini": "^1.3.4",
|
|
75
|
+
"jest-environment-emit": "^1.0.3",
|
|
75
76
|
"json-cycle": "^1.3.0",
|
|
76
77
|
"lodash": "^4.17.11",
|
|
77
78
|
"multi-sort-stream": "^1.0.3",
|
|
@@ -109,5 +110,5 @@
|
|
|
109
110
|
"browserslist": [
|
|
110
111
|
"node 14"
|
|
111
112
|
],
|
|
112
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "80bff595538780c7b8019c7db796142414600cf9"
|
|
113
114
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
|
|
3
|
+
const WithEmitter = require('jest-environment-emit');
|
|
3
4
|
const resolveFrom = require('resolve-from');
|
|
4
5
|
const maybeNodeEnvironment = require(resolveFrom(process.cwd(), 'jest-environment-node'));
|
|
5
6
|
/** @type {typeof import('@jest/environment').JestEnvironment} */
|
|
@@ -31,7 +32,7 @@ const log = detox.log.child({ cat: 'lifecycle,jest-environment' });
|
|
|
31
32
|
/**
|
|
32
33
|
* @see https://www.npmjs.com/package/jest-circus#overview
|
|
33
34
|
*/
|
|
34
|
-
class DetoxCircusEnvironment extends NodeEnvironment {
|
|
35
|
+
class DetoxCircusEnvironment extends WithEmitter(NodeEnvironment) {
|
|
35
36
|
constructor(config, context) {
|
|
36
37
|
super(assertJestCircus27(config), assertExistingContext(context));
|
|
37
38
|
|
|
@@ -62,6 +63,8 @@ class DetoxCircusEnvironment extends NodeEnvironment {
|
|
|
62
63
|
SpecReporter,
|
|
63
64
|
WorkerAssignReporter,
|
|
64
65
|
});
|
|
66
|
+
|
|
67
|
+
this.testEvents.on('*', this._onTestEvent.bind(this));
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
/** @override */
|
|
@@ -72,19 +75,13 @@ class DetoxCircusEnvironment extends NodeEnvironment {
|
|
|
72
75
|
|
|
73
76
|
// @ts-expect-error TS2425
|
|
74
77
|
async handleTestEvent(event, state) {
|
|
78
|
+
await super.handleTestEvent(event, state);
|
|
79
|
+
|
|
75
80
|
if (detox.session.unsafe_earlyTeardown) {
|
|
76
81
|
if (event.name === 'test_fn_start' || event.name === 'hook_start') {
|
|
77
82
|
throw new Error('Detox halted test execution due to an early teardown request');
|
|
78
83
|
}
|
|
79
84
|
}
|
|
80
|
-
|
|
81
|
-
this._timer.schedule(state.testTimeout != null ? state.testTimeout : this.setupTimeout);
|
|
82
|
-
|
|
83
|
-
if (SYNC_CIRCUS_EVENTS.has(event.name)) {
|
|
84
|
-
this._handleTestEventSync(event, state);
|
|
85
|
-
} else {
|
|
86
|
-
await this._handleTestEventAsync(event, state);
|
|
87
|
-
}
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
/** @override */
|
|
@@ -147,6 +144,23 @@ class DetoxCircusEnvironment extends NodeEnvironment {
|
|
|
147
144
|
}
|
|
148
145
|
}
|
|
149
146
|
|
|
147
|
+
/** @private */
|
|
148
|
+
_onTestEvent({ type, event, state }) {
|
|
149
|
+
const timeout = state && state.testTimeout != null ? state.testTimeout : this.setupTimeout;
|
|
150
|
+
|
|
151
|
+
this._timer.schedule(timeout);
|
|
152
|
+
|
|
153
|
+
if (event) {
|
|
154
|
+
if (SYNC_CIRCUS_EVENTS.has(event.name)) {
|
|
155
|
+
this._handleTestEventSync(event, state);
|
|
156
|
+
} else {
|
|
157
|
+
return this._handleTestEventAsync(event, state);
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
return this._handleTestEventAsync({ name: type }, null);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
150
164
|
/** @private */
|
|
151
165
|
async _handleTestEventAsync(event, state = null) {
|
|
152
166
|
const description = `handling ${state ? 'jest-circus' : 'jest-environment'} "${event.name}" event`;
|
package/src/DetoxWorker.js
CHANGED
|
@@ -132,7 +132,7 @@ class DetoxWorker {
|
|
|
132
132
|
};
|
|
133
133
|
|
|
134
134
|
this._artifactsManager = artifactsManagerFactory.createArtifactsManager(this._artifactsConfig, commonDeps);
|
|
135
|
-
this._deviceCookie = yield this._context[symbols.allocateDevice]();
|
|
135
|
+
this._deviceCookie = yield this._context[symbols.allocateDevice](this._deviceConfig);
|
|
136
136
|
|
|
137
137
|
this.device = runtimeDeviceFactory.createRuntimeDevice(
|
|
138
138
|
this._deviceCookie,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const DetoxRuntimeError = require('../../../../../errors/DetoxRuntimeError');
|
|
2
2
|
|
|
3
|
-
const setupGuideHint = 'For further assistance, visit the
|
|
3
|
+
const setupGuideHint = 'For further assistance, visit the project setup guide (select the Android tabs): https://wix.github.io/Detox/docs/introduction/project-setup';
|
|
4
4
|
|
|
5
5
|
class ApkValidator {
|
|
6
6
|
constructor(aapt) {
|
|
@@ -280,7 +280,7 @@ class AndroidDriver extends DeviceDriverBase {
|
|
|
280
280
|
throw new DetoxRuntimeError({
|
|
281
281
|
message: `The test APK could not be found at path: '${testApkPath}'`,
|
|
282
282
|
hint: 'Try running the detox build command, and make sure it was configured to execute a build command (e.g. \'./gradlew assembleAndroidTest\')' +
|
|
283
|
-
'\nFor further assistance, visit the
|
|
283
|
+
'\nFor further assistance, visit the project setup guide (select the Android tabs): https://wix.github.io/Detox/docs/introduction/project-setup',
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
286
|
return testApkPath;
|
package/src/ipc/IPCClient.js
CHANGED
|
@@ -60,8 +60,8 @@ class IPCClient {
|
|
|
60
60
|
this._sessionState.patch(sessionState);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
async allocateDevice() {
|
|
64
|
-
const { deviceCookie, error } = deserializeObjectWithError(await this._emit('allocateDevice', {}));
|
|
63
|
+
async allocateDevice(deviceConfig) {
|
|
64
|
+
const { deviceCookie, error } = deserializeObjectWithError(await this._emit('allocateDevice', { deviceConfig }));
|
|
65
65
|
if (error) {
|
|
66
66
|
throw error;
|
|
67
67
|
}
|
package/src/ipc/IPCServer.js
CHANGED
|
@@ -9,7 +9,7 @@ class IPCServer {
|
|
|
9
9
|
* @param {import('./SessionState')} options.sessionState
|
|
10
10
|
* @param {Detox.Logger} options.logger
|
|
11
11
|
* @param {object} options.callbacks
|
|
12
|
-
* @param {() => Promise<any>} options.callbacks.onAllocateDevice
|
|
12
|
+
* @param {(deviceConfig: DetoxInternals.RuntimeConfig['device']) => Promise<any>} options.callbacks.onAllocateDevice
|
|
13
13
|
* @param {(cookie: any) => Promise<void>} options.callbacks.onDeallocateDevice
|
|
14
14
|
*/
|
|
15
15
|
constructor({ sessionState, logger, callbacks }) {
|
|
@@ -104,11 +104,11 @@ class IPCServer {
|
|
|
104
104
|
this._ipc.server.broadcast('sessionStateUpdate', newState);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
async onAllocateDevice(
|
|
107
|
+
async onAllocateDevice({ deviceConfig }, socket) {
|
|
108
108
|
let deviceCookie;
|
|
109
109
|
|
|
110
110
|
try {
|
|
111
|
-
deviceCookie = await this._callbacks.onAllocateDevice();
|
|
111
|
+
deviceCookie = await this._callbacks.onAllocateDevice(deviceConfig);
|
|
112
112
|
this._ipc.server.emit(socket, 'allocateDeviceDone', { deviceCookie });
|
|
113
113
|
} catch (error) {
|
|
114
114
|
this._ipc.server.emit(socket, 'allocateDeviceDone', serializeObjectWithError({ error }));
|
|
@@ -152,10 +152,10 @@ class DetoxContext {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
/** @abstract */
|
|
155
|
-
async [symbols.allocateDevice]() {}
|
|
155
|
+
async [symbols.allocateDevice](_deviceConfig) {}
|
|
156
156
|
|
|
157
157
|
/** @abstract */
|
|
158
|
-
async [symbols.deallocateDevice]() {}
|
|
158
|
+
async [symbols.deallocateDevice](_deviceCookie) {}
|
|
159
159
|
|
|
160
160
|
async [symbols.uninstallWorker]() {
|
|
161
161
|
try {
|
|
@@ -23,7 +23,9 @@ const _emergencyTeardown = Symbol('emergencyTeardown');
|
|
|
23
23
|
const _lifecycleLogger = Symbol('lifecycleLogger');
|
|
24
24
|
const _sessionFile = Symbol('sessionFile');
|
|
25
25
|
const _logFinalError = Symbol('logFinalError');
|
|
26
|
-
const
|
|
26
|
+
const _cookieAllocators = Symbol('cookieAllocators');
|
|
27
|
+
const _deviceAllocators = Symbol('deviceAllocators');
|
|
28
|
+
const _createDeviceAllocator = Symbol('createDeviceAllocator');
|
|
27
29
|
//#endregion
|
|
28
30
|
|
|
29
31
|
class DetoxPrimaryContext extends DetoxContext {
|
|
@@ -32,7 +34,8 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
|
32
34
|
|
|
33
35
|
this[_dirty] = false;
|
|
34
36
|
this[_wss] = null;
|
|
35
|
-
this[
|
|
37
|
+
this[_cookieAllocators] = {};
|
|
38
|
+
this[_deviceAllocators] = {};
|
|
36
39
|
|
|
37
40
|
/** Path to file where the initial session object is serialized */
|
|
38
41
|
this[_sessionFile] = '';
|
|
@@ -85,7 +88,6 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
|
85
88
|
const detoxConfig = await this[symbols.resolveConfig](opts);
|
|
86
89
|
|
|
87
90
|
const {
|
|
88
|
-
device: deviceConfig,
|
|
89
91
|
logger: loggerConfig,
|
|
90
92
|
session: sessionConfig
|
|
91
93
|
} = detoxConfig;
|
|
@@ -109,16 +111,6 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
|
109
111
|
|
|
110
112
|
await this[_ipcServer].init();
|
|
111
113
|
|
|
112
|
-
const environmentFactory = require('../environmentFactory');
|
|
113
|
-
|
|
114
|
-
const { deviceAllocatorFactory } = environmentFactory.createFactories(deviceConfig);
|
|
115
|
-
this[_deviceAllocator] = deviceAllocatorFactory.createDeviceAllocator({
|
|
116
|
-
detoxConfig,
|
|
117
|
-
detoxSession: this[$sessionState],
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
await this[_deviceAllocator].init();
|
|
121
|
-
|
|
122
114
|
// TODO: Detox-server creation ought to be delegated to a generator/factory.
|
|
123
115
|
const DetoxServer = require('../server/DetoxServer');
|
|
124
116
|
if (sessionConfig.autoStart) {
|
|
@@ -162,17 +154,20 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
|
162
154
|
}
|
|
163
155
|
|
|
164
156
|
/** @override */
|
|
165
|
-
async [symbols.allocateDevice]() {
|
|
166
|
-
const
|
|
167
|
-
const deviceCookie = await
|
|
157
|
+
async [symbols.allocateDevice](deviceConfig) {
|
|
158
|
+
const deviceAllocator = await this[_createDeviceAllocator](deviceConfig);
|
|
159
|
+
const deviceCookie = await deviceAllocator.allocate(deviceConfig);
|
|
160
|
+
this[_cookieAllocators][deviceCookie.id] = deviceAllocator;
|
|
168
161
|
|
|
169
162
|
try {
|
|
170
|
-
return await
|
|
163
|
+
return await deviceAllocator.postAllocate(deviceCookie);
|
|
171
164
|
} catch (e) {
|
|
172
165
|
try {
|
|
173
|
-
await
|
|
166
|
+
await deviceAllocator.free(deviceCookie, { shutdown: true });
|
|
174
167
|
} catch (e2) {
|
|
175
|
-
this[symbols.logger].error({ cat: 'device', err: e2 }, `Failed to free ${deviceCookie.name || deviceCookie.id} after a failed allocation`);
|
|
168
|
+
this[symbols.logger].error({ cat: 'device', err: e2 }, `Failed to free ${deviceCookie.name || deviceCookie.id} after a failed allocation attempt`);
|
|
169
|
+
} finally {
|
|
170
|
+
delete this[_cookieAllocators][deviceCookie.id];
|
|
176
171
|
}
|
|
177
172
|
|
|
178
173
|
throw e;
|
|
@@ -181,7 +176,17 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
|
181
176
|
|
|
182
177
|
/** @override */
|
|
183
178
|
async [symbols.deallocateDevice](cookie) {
|
|
184
|
-
|
|
179
|
+
const deviceAllocator = this[_cookieAllocators][cookie.id];
|
|
180
|
+
if (!deviceAllocator) {
|
|
181
|
+
throw new DetoxRuntimeError({
|
|
182
|
+
message: `Cannot deallocate device ${cookie.id} because it was not allocated by this context.`,
|
|
183
|
+
hint: `See the actually known allocated devices below:`,
|
|
184
|
+
debugInfo: Object.keys(this[_cookieAllocators]).map(id => `- ${id}`).join('\n'),
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
await deviceAllocator.free(cookie);
|
|
189
|
+
delete this[_cookieAllocators][cookie.id];
|
|
185
190
|
}
|
|
186
191
|
|
|
187
192
|
/** @override */
|
|
@@ -191,11 +196,18 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
|
191
196
|
await this[symbols.uninstallWorker]();
|
|
192
197
|
}
|
|
193
198
|
} finally {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
this[
|
|
199
|
+
for (const key of Object.keys(this[_deviceAllocators])) {
|
|
200
|
+
const deviceAllocator = this[_deviceAllocators][key];
|
|
201
|
+
delete this[_deviceAllocators][key];
|
|
202
|
+
try {
|
|
203
|
+
await deviceAllocator.cleanup();
|
|
204
|
+
} catch (err) {
|
|
205
|
+
this[symbols.logger].error({ cat: 'device', err }, `Failed to cleanup the device allocation driver for ${key}`);
|
|
206
|
+
}
|
|
197
207
|
}
|
|
198
208
|
|
|
209
|
+
this[_cookieAllocators] = {};
|
|
210
|
+
|
|
199
211
|
if (this[_wss]) {
|
|
200
212
|
await this[_wss].close();
|
|
201
213
|
this[_wss] = null;
|
|
@@ -227,11 +239,18 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
|
227
239
|
return;
|
|
228
240
|
}
|
|
229
241
|
|
|
230
|
-
|
|
231
|
-
this[
|
|
232
|
-
this[
|
|
242
|
+
for (const key of Object.keys(this[_deviceAllocators])) {
|
|
243
|
+
const deviceAllocator = this[_deviceAllocators][key];
|
|
244
|
+
delete this[_deviceAllocators][key];
|
|
245
|
+
try {
|
|
246
|
+
deviceAllocator.emergencyCleanup();
|
|
247
|
+
} catch (err) {
|
|
248
|
+
this[symbols.logger].error({ cat: 'device', err }, `Failed to clean up the device allocation driver for ${key} in emergency mode`);
|
|
249
|
+
}
|
|
233
250
|
}
|
|
234
251
|
|
|
252
|
+
this[_cookieAllocators] = {};
|
|
253
|
+
|
|
235
254
|
if (this[_wss]) {
|
|
236
255
|
this[_wss].close();
|
|
237
256
|
}
|
|
@@ -253,6 +272,35 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
|
253
272
|
}
|
|
254
273
|
};
|
|
255
274
|
|
|
275
|
+
/** @param {Detox.DetoxDeviceConfig} deviceConfig */
|
|
276
|
+
[_createDeviceAllocator] = async (deviceConfig) => {
|
|
277
|
+
const deviceType = deviceConfig.type;
|
|
278
|
+
if (!this[_deviceAllocators][deviceType]) {
|
|
279
|
+
const environmentFactory = require('../environmentFactory');
|
|
280
|
+
const { deviceAllocatorFactory } = environmentFactory.createFactories(deviceConfig);
|
|
281
|
+
const { detoxConfig } = this[$sessionState];
|
|
282
|
+
const deviceAllocator = deviceAllocatorFactory.createDeviceAllocator({
|
|
283
|
+
detoxConfig,
|
|
284
|
+
detoxSession: this[$sessionState],
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
try {
|
|
288
|
+
await deviceAllocator.init();
|
|
289
|
+
this[_deviceAllocators][deviceType] = deviceAllocator;
|
|
290
|
+
} catch (e) {
|
|
291
|
+
try {
|
|
292
|
+
await deviceAllocator.cleanup();
|
|
293
|
+
} catch (e2) {
|
|
294
|
+
this[symbols.logger].error({ cat: 'device', err: e2 }, `Failed to cleanup the device allocation driver for ${deviceType} after a failed initialization`);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
throw e;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return this[_deviceAllocators][deviceType];
|
|
302
|
+
};
|
|
303
|
+
|
|
256
304
|
[_logFinalError] = (err) => {
|
|
257
305
|
this[_lifecycleLogger].error(err, 'Encountered an error while merging the process logs:');
|
|
258
306
|
};
|
|
@@ -63,9 +63,9 @@ class DetoxSecondaryContext extends DetoxContext {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/** @override */
|
|
66
|
-
async [symbols.allocateDevice]() {
|
|
66
|
+
async [symbols.allocateDevice](deviceConfig) {
|
|
67
67
|
if (this[_ipcClient]) {
|
|
68
|
-
const deviceCookie = await this[_ipcClient].allocateDevice();
|
|
68
|
+
const deviceCookie = await this[_ipcClient].allocateDevice(deviceConfig);
|
|
69
69
|
return deviceCookie;
|
|
70
70
|
} else {
|
|
71
71
|
throw new DetoxInternalError('Detected an attempt to allocate a device using a non-initialized context.');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
e3fe08115a10d60faff7d0666d8424a8
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
758df184cbf0014569937f79a9159e2830f48235
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2790a45d2999e0dea3089ba464bca9d27745774574e55f3e352f0662ce1abd89
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2006fa8aca6a34168de9122808517afd219d0d70521a781c113d7192d1793b3b976ae9c982ab3f3210b5aa13be2e28c302ff68d037399549325b58e035108abd
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f57b338070b87d202a36f02d1884880e
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a09c7a7f11f8d6afafe3352d7bf8cbb9e038f35e
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a3cf6c53fa57c88e34d5cf819fe5e3a55375c841efc4452c642b4ebf876d160d
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
e9d0fadd3cce27cf46744537dff210cb32fac9d34296b8ee6669ac3642db10af33ed196f70ad251afeb268acf785690d76252e539b6c5253a2a271908a3770c1
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
30f7fec25a048bfadec9f0d4fb71c170
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
91ad6502b9702459aa188f9f05851f5ea9e4fba3
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
78c456b4f28e5810ea54fdf3674ad4c5782d7fdc620d6c7704dd26922368cfa4
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
4ed59a1fe2c6b181c0530db3290cac1cd963e4760e702d7788d9dfd80561e9286bb36d3d77f591f7bcddff922109f184fab585ead9d1b0c46bf2305fefdb2308
|
/package/Detox-android/com/wix/detox/{20.14.4/detox-20.14.4.aar → 20.14.6/detox-20.14.6.aar}
RENAMED
|
File without changes
|
/package/Detox-android/com/wix/detox/{20.14.4/detox-20.14.4.aar.md5 → 20.14.6/detox-20.14.6.aar.md5}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|