detox 20.12.0-smoke.0 → 20.12.1
Sign up to get free protection for your applications and to get access to all the features.
- package/Detox-android/com/wix/detox/{20.12.0-smoke.0/detox-20.12.0-smoke.0-javadoc.jar → 20.12.1/detox-20.12.1-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.12.0-smoke.0/detox-20.12.0-smoke.0-sources.jar → 20.12.1/detox-20.12.1-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.aar +0 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.12.0-smoke.0/detox-20.12.0-smoke.0.pom → 20.12.1/detox-20.12.1.pom} +1 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.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/build.gradle +1 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/DetoxAssertion.java +44 -25
- package/android/detox/src/full/java/com/wix/detox/espresso/EspressoDetox.java +6 -7
- package/android/detox/src/full/java/com/wix/detox/espresso/action/GetAttributesAction.kt +4 -4
- package/android/detox/src/full/java/com/wix/detox/espresso/performer/MultipleViewsActionPerformer.kt +43 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/performer/SingleViewActionPerformer.kt +19 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/performer/ViewActionPerformer.kt +24 -0
- package/android/detox/src/full/java/com/wix/invoke/types/Invocation.java +5 -4
- package/android/detox/src/main/java/com/wix/detox/espresso/MultipleViewsAction.kt +4 -0
- package/android/detox/src/main/java/com/wix/detox/espresso/UiControllerSpy.kt +0 -1
- package/android/detox/src/main/java/com/wix/detox/espresso/ViewActionWithResult.kt +2 -1
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/GetAttributesActionTest.kt +6 -5
- package/android/detox/src/testFull/java/com/wix/detox/espresso/performer/ViewActionPerformerSpec.kt +37 -0
- package/index.d.ts +47 -3
- package/local-cli/reset-lock-file.js +9 -5
- package/package.json +6 -6
- package/src/DetoxWorker.js +9 -5
- package/src/android/core/NativeElement.js +26 -29
- package/src/android/espressoapi/DetoxAssertion.js +16 -14
- package/src/android/espressoapi/EspressoDetox.js +9 -2
- package/src/android/interactions/native.js +2 -3
- package/src/artifacts/providers/index.js +3 -3
- package/src/artifacts/screenshot/SimulatorScreenshotPlugin.js +17 -0
- package/src/devices/DeviceRegistry.js +176 -0
- package/src/devices/allocation/DeviceAllocator.js +15 -50
- package/src/devices/allocation/drivers/AllocationDriverBase.js +4 -10
- package/src/devices/allocation/drivers/android/attached/AttachedAndroidAllocDriver.js +6 -7
- package/src/devices/allocation/drivers/android/attached/AttachedAndroidLauncher.js +13 -0
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +26 -108
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocationHelper.js +72 -0
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +43 -33
- package/src/devices/allocation/drivers/android/emulator/FreeEmulatorFinder.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +3 -3
- package/src/devices/allocation/drivers/android/genycloud/GenyAllocDriver.js +27 -87
- package/src/devices/allocation/drivers/android/genycloud/GenyDeviceRegistryFactory.js +16 -0
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceAllocationHelper.js +65 -0
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceLauncher.js +28 -39
- package/src/devices/allocation/drivers/ios/SimulatorAllocDriver.js +40 -70
- package/src/devices/allocation/drivers/ios/SimulatorLauncher.js +7 -11
- package/src/devices/allocation/factories/android.js +35 -29
- package/src/devices/allocation/factories/ios.js +5 -7
- package/src/devices/common/drivers/DeviceAllocationHelper.js +20 -0
- package/src/devices/common/drivers/DeviceLauncher.js +19 -0
- package/src/devices/common/drivers/android/emulator/exec/EmulatorExec.js +5 -17
- package/src/devices/common/drivers/android/exec/ADB.js +0 -1
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceLifecycleService.js +25 -0
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceLookupService.js +38 -0
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +14 -0
- package/src/devices/{allocation → common}/drivers/android/genycloud/services/GenyRecipesService.js +1 -1
- package/src/devices/{allocation → common}/drivers/android/genycloud/services/dto/GenyInstance.js +1 -6
- package/src/devices/{allocation/drivers/android → common/drivers/android/tools}/FreeDeviceFinder.js +10 -11
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +3 -1
- package/src/devices/cookies/AndroidDeviceCookie.js +0 -4
- package/src/devices/cookies/GenycloudEmulatorCookie.js +5 -3
- package/src/devices/cookies/IosSimulatorCookie.js +0 -4
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +71 -0
- package/src/devices/lifecycle/factories/GenyGlobalLifecycleHandlerFactory.js +18 -0
- package/src/devices/runtime/drivers/android/genycloud/GenyCloudDriver.js +2 -2
- package/src/devices/runtime/factories/android.js +1 -1
- package/src/devices/runtime/factories/ios.js +2 -3
- package/src/environmentFactory.js +11 -1
- package/src/ipc/IPCClient.js +1 -17
- package/src/ipc/IPCServer.js +1 -25
- package/src/realms/DetoxContext.js +0 -6
- package/src/realms/DetoxPrimaryContext.js +42 -42
- package/src/realms/DetoxSecondaryContext.js +0 -19
- package/src/realms/symbols.js +0 -4
- package/src/{devices/servicelocator → servicelocator}/android/emulatorServiceLocator.js +1 -1
- package/src/servicelocator/android/genycloudServiceLocator.js +21 -0
- package/src/servicelocator/android/index.js +25 -0
- package/src/servicelocator/ios.js +7 -0
- package/src/utils/environment.js +15 -8
- package/src/utils/errorUtils.js +2 -2
- package/src/{devices/validation → validation}/android/GenycloudEnvValidator.js +2 -2
- package/src/{devices/validation → validation}/factories/index.js +1 -1
- package/src/{devices/validation → validation}/ios/IosSimulatorEnvValidator.js +2 -2
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0.pom.sha512 +0 -1
- package/src/devices/allocation/DeviceList.js +0 -44
- package/src/devices/allocation/DeviceRegistry.js +0 -186
- package/src/devices/allocation/drivers/android/emulator/FreePortFinder.js +0 -16
- package/src/devices/allocation/drivers/android/genycloud/GenyRegistry.js +0 -93
- package/src/devices/allocation/drivers/android/genycloud/services/GenyInstanceLifecycleService.js +0 -24
- package/src/devices/allocation/drivers/ios/SimulatorQuery.js +0 -24
- package/src/devices/servicelocator/android/genycloudServiceLocator.js +0 -17
- package/src/devices/servicelocator/android/index.js +0 -23
- package/src/utils/PIDService.js +0 -27
- /package/src/devices/{allocation → common}/drivers/android/genycloud/exec/GenyCloudExec.js +0 -0
- /package/src/devices/{allocation → common}/drivers/android/genycloud/services/GenyAuthService.js +0 -0
- /package/src/devices/{allocation → common}/drivers/android/genycloud/services/dto/GenyRecipe.js +0 -0
- /package/src/{devices/validation → validation}/EnvironmentValidatorBase.js +0 -0
package/src/ipc/IPCServer.js
CHANGED
@@ -8,15 +8,11 @@ class IPCServer {
|
|
8
8
|
* @param {object} options
|
9
9
|
* @param {import('./SessionState')} options.sessionState
|
10
10
|
* @param {Detox.Logger} options.logger
|
11
|
-
* @param {object} options.callbacks
|
12
|
-
* @param {() => Promise<any>} options.callbacks.onAllocateDevice
|
13
|
-
* @param {(cookie: any) => Promise<void>} options.callbacks.onDeallocateDevice
|
14
11
|
*/
|
15
|
-
constructor({ sessionState, logger
|
12
|
+
constructor({ sessionState, logger }) {
|
16
13
|
this._sessionState = sessionState;
|
17
14
|
this._logger = logger.child({ cat: 'ipc,ipc-server' });
|
18
15
|
this._ipc = null;
|
19
|
-
this._callbacks = callbacks;
|
20
16
|
this._workers = new Set();
|
21
17
|
this._contexts = new Set();
|
22
18
|
}
|
@@ -45,8 +41,6 @@ class IPCServer {
|
|
45
41
|
this._ipc.server.on('registerContext', this.onRegisterContext.bind(this));
|
46
42
|
this._ipc.server.on('registerWorker', this.onRegisterWorker.bind(this));
|
47
43
|
this._ipc.server.on('reportTestResults', this.onReportTestResults.bind(this));
|
48
|
-
this._ipc.server.on('allocateDevice', this.onAllocateDevice.bind(this));
|
49
|
-
this._ipc.server.on('deallocateDevice', this.onDeallocateDevice.bind(this));
|
50
44
|
this._ipc.server.start();
|
51
45
|
});
|
52
46
|
}
|
@@ -89,24 +83,6 @@ class IPCServer {
|
|
89
83
|
}
|
90
84
|
}
|
91
85
|
|
92
|
-
async onAllocateDevice(_payload, socket) {
|
93
|
-
try {
|
94
|
-
const deviceCookie = await this._callbacks.onAllocateDevice();
|
95
|
-
this._ipc.server.emit(socket, 'allocateDeviceDone', { deviceCookie });
|
96
|
-
} catch (error) {
|
97
|
-
this._ipc.server.emit(socket, 'allocateDeviceDone', serializeObjectWithError({ error }));
|
98
|
-
}
|
99
|
-
}
|
100
|
-
|
101
|
-
async onDeallocateDevice({ deviceCookie }, socket) {
|
102
|
-
try {
|
103
|
-
await this._callbacks.onDeallocateDevice(deviceCookie);
|
104
|
-
this._ipc.server.emit(socket, 'deallocateDeviceDone', {});
|
105
|
-
} catch (error) {
|
106
|
-
this._ipc.server.emit(socket, 'deallocateDeviceDone', serializeObjectWithError({ error }));
|
107
|
-
}
|
108
|
-
}
|
109
|
-
|
110
86
|
onReportTestResults({ testResults }, socket = null) {
|
111
87
|
const merged = uniqBy([
|
112
88
|
...testResults.map(r => serializeObjectWithError(r, 'testExecError')),
|
@@ -149,12 +149,6 @@ class DetoxContext {
|
|
149
149
|
await this[$worker].init();
|
150
150
|
}
|
151
151
|
|
152
|
-
/** @abstract */
|
153
|
-
async [symbols.allocateDevice]() {}
|
154
|
-
|
155
|
-
/** @abstract */
|
156
|
-
async [symbols.deallocateDevice]() {}
|
157
|
-
|
158
152
|
async [symbols.uninstallWorker]() {
|
159
153
|
try {
|
160
154
|
if (this[$worker]) {
|
@@ -16,14 +16,15 @@ const symbols = require('./symbols');
|
|
16
16
|
const { $logFinalizer, $restoreSessionState, $sessionState, $worker } = DetoxContext.protected;
|
17
17
|
|
18
18
|
//#region Private symbols
|
19
|
+
const _globalLifecycleHandler = Symbol('globalLifecycleHandler');
|
19
20
|
const _ipcServer = Symbol('ipcServer');
|
21
|
+
const _resetLockFile = Symbol('resetLockFile');
|
20
22
|
const _wss = Symbol('wss');
|
21
23
|
const _dirty = Symbol('dirty');
|
22
24
|
const _emergencyTeardown = Symbol('emergencyTeardown');
|
23
25
|
const _lifecycleLogger = Symbol('lifecycleLogger');
|
24
26
|
const _sessionFile = Symbol('sessionFile');
|
25
27
|
const _logFinalError = Symbol('logFinalError');
|
26
|
-
const _deviceAllocator = Symbol('deviceAllocator');
|
27
28
|
//#endregion
|
28
29
|
|
29
30
|
class DetoxPrimaryContext extends DetoxContext {
|
@@ -32,8 +33,7 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
32
33
|
|
33
34
|
this[_dirty] = false;
|
34
35
|
this[_wss] = null;
|
35
|
-
this[
|
36
|
-
|
36
|
+
this[_globalLifecycleHandler] = null;
|
37
37
|
/** Path to file where the initial session object is serialized */
|
38
38
|
this[_sessionFile] = '';
|
39
39
|
/**
|
@@ -79,6 +79,7 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
79
79
|
const detoxConfig = await this[symbols.resolveConfig](opts);
|
80
80
|
|
81
81
|
const {
|
82
|
+
behavior: behaviorConfig,
|
82
83
|
device: deviceConfig,
|
83
84
|
logger: loggerConfig,
|
84
85
|
session: sessionConfig
|
@@ -95,23 +96,20 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
95
96
|
this[_ipcServer] = new IPCServer({
|
96
97
|
sessionState: this[$sessionState],
|
97
98
|
logger: this[symbols.logger],
|
98
|
-
callbacks: {
|
99
|
-
onAllocateDevice: this[symbols.allocateDevice].bind(this),
|
100
|
-
onDeallocateDevice: this[symbols.deallocateDevice].bind(this),
|
101
|
-
},
|
102
99
|
});
|
103
100
|
|
104
101
|
await this[_ipcServer].init();
|
105
102
|
|
106
103
|
const environmentFactory = require('../environmentFactory');
|
104
|
+
this[_globalLifecycleHandler] = await environmentFactory.createGlobalLifecycleHandler(deviceConfig);
|
107
105
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
detoxSession: this[$sessionState],
|
112
|
-
});
|
106
|
+
if (this[_globalLifecycleHandler]) {
|
107
|
+
await this[_globalLifecycleHandler].globalInit();
|
108
|
+
}
|
113
109
|
|
114
|
-
|
110
|
+
if (!behaviorConfig.init.keepLockFile) {
|
111
|
+
await this[_resetLockFile]();
|
112
|
+
}
|
115
113
|
|
116
114
|
// TODO: Detox-server creation ought to be delegated to a generator/factory.
|
117
115
|
const DetoxServer = require('../server/DetoxServer');
|
@@ -155,29 +153,6 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
155
153
|
await super[symbols.installWorker]({ ...opts, workerId });
|
156
154
|
}
|
157
155
|
|
158
|
-
/** @override */
|
159
|
-
async [symbols.allocateDevice]() {
|
160
|
-
const { device } = this[$sessionState].detoxConfig;
|
161
|
-
const deviceCookie = await this[_deviceAllocator].allocate(device);
|
162
|
-
|
163
|
-
try {
|
164
|
-
return await this[_deviceAllocator].postAllocate(deviceCookie);
|
165
|
-
} catch (e) {
|
166
|
-
try {
|
167
|
-
await this[_deviceAllocator].free(deviceCookie, { shutdown: true });
|
168
|
-
} catch (e2) {
|
169
|
-
this[symbols.logger].error({ cat: 'device', err: e2 }, `Failed to free ${deviceCookie} after a failed allocation`);
|
170
|
-
}
|
171
|
-
|
172
|
-
throw e;
|
173
|
-
}
|
174
|
-
}
|
175
|
-
|
176
|
-
/** @override */
|
177
|
-
async [symbols.deallocateDevice](cookie) {
|
178
|
-
await this[_deviceAllocator].free(cookie);
|
179
|
-
}
|
180
|
-
|
181
156
|
/** @override */
|
182
157
|
async [symbols.cleanup]() {
|
183
158
|
try {
|
@@ -185,9 +160,9 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
185
160
|
await this[symbols.uninstallWorker]();
|
186
161
|
}
|
187
162
|
} finally {
|
188
|
-
if (this[
|
189
|
-
await this[
|
190
|
-
this[
|
163
|
+
if (this[_globalLifecycleHandler]) {
|
164
|
+
await this[_globalLifecycleHandler].globalCleanup();
|
165
|
+
this[_globalLifecycleHandler] = null;
|
191
166
|
}
|
192
167
|
|
193
168
|
if (this[_wss]) {
|
@@ -221,9 +196,9 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
221
196
|
return;
|
222
197
|
}
|
223
198
|
|
224
|
-
if (this[
|
225
|
-
this[
|
226
|
-
this[
|
199
|
+
if (this[_globalLifecycleHandler]) {
|
200
|
+
this[_globalLifecycleHandler].emergencyCleanup();
|
201
|
+
this[_globalLifecycleHandler] = null;
|
227
202
|
}
|
228
203
|
|
229
204
|
if (this[_wss]) {
|
@@ -266,6 +241,31 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
266
241
|
});
|
267
242
|
}
|
268
243
|
//#endregion
|
244
|
+
|
245
|
+
//#region Private members
|
246
|
+
async[_resetLockFile]() {
|
247
|
+
const DeviceRegistry = require('../devices/DeviceRegistry');
|
248
|
+
|
249
|
+
const deviceType = this[symbols.config].device.type;
|
250
|
+
|
251
|
+
switch (deviceType) {
|
252
|
+
case 'ios.none':
|
253
|
+
case 'ios.simulator':
|
254
|
+
await DeviceRegistry.forIOS().reset();
|
255
|
+
break;
|
256
|
+
case 'android.attached':
|
257
|
+
case 'android.emulator':
|
258
|
+
case 'android.genycloud':
|
259
|
+
await DeviceRegistry.forAndroid().reset();
|
260
|
+
break;
|
261
|
+
}
|
262
|
+
|
263
|
+
if (deviceType === 'android.genycloud') {
|
264
|
+
const GenyDeviceRegistryFactory = require('../devices/allocation/drivers/android/genycloud/GenyDeviceRegistryFactory');
|
265
|
+
await GenyDeviceRegistryFactory.forGlobalShutdown().reset();
|
266
|
+
}
|
267
|
+
}
|
268
|
+
//#endregion
|
269
269
|
}
|
270
270
|
|
271
271
|
module.exports = DetoxPrimaryContext;
|
@@ -54,25 +54,6 @@ class DetoxSecondaryContext extends DetoxContext {
|
|
54
54
|
}
|
55
55
|
}
|
56
56
|
|
57
|
-
/** @override */
|
58
|
-
async [symbols.allocateDevice]() {
|
59
|
-
if (this[_ipcClient]) {
|
60
|
-
const deviceCookie = await this[_ipcClient].allocateDevice();
|
61
|
-
return deviceCookie;
|
62
|
-
} else {
|
63
|
-
throw new DetoxInternalError('Detected an attempt to allocate a device using a non-initialized context.');
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
/** @override */
|
68
|
-
async [symbols.deallocateDevice](deviceCookie) {
|
69
|
-
if (this[_ipcClient]) {
|
70
|
-
await this[_ipcClient].deallocateDevice(deviceCookie);
|
71
|
-
} else {
|
72
|
-
throw new DetoxInternalError('Detected an attempt to allocate a device using a non-initialized context.');
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
57
|
/** @override */
|
77
58
|
async [symbols.cleanup]() {
|
78
59
|
try {
|
package/src/realms/symbols.js
CHANGED
@@ -5,8 +5,6 @@
|
|
5
5
|
* readonly getStatus: unique symbol;
|
6
6
|
* readonly init: unique symbol;
|
7
7
|
* readonly installWorker: unique symbol;
|
8
|
-
* readonly allocateDevice: unique symbol;
|
9
|
-
* readonly deallocateDevice: unique symbol;
|
10
8
|
* readonly logger: unique symbol;
|
11
9
|
* readonly onHookFailure: unique symbol;
|
12
10
|
* readonly onRunDescribeFinish: unique symbol;
|
@@ -34,8 +32,6 @@ module.exports = {
|
|
34
32
|
|
35
33
|
//#region IPC
|
36
34
|
reportTestResults: Symbol('reportTestResults'),
|
37
|
-
allocateDevice: Symbol('allocateDevice'),
|
38
|
-
deallocateDevice: Symbol('deallocateDevice'),
|
39
35
|
//#endregion
|
40
36
|
|
41
37
|
//#region Main
|
@@ -0,0 +1,21 @@
|
|
1
|
+
const GenyDeviceRegistryFactory = require('../../devices/allocation/drivers/android/genycloud/GenyDeviceRegistryFactory');
|
2
|
+
|
3
|
+
class GenycloudServiceLocator {
|
4
|
+
constructor() {
|
5
|
+
this._exec = null;
|
6
|
+
this.runtimeDeviceRegistry = GenyDeviceRegistryFactory.forRuntime();
|
7
|
+
this.cleanupDeviceRegistry = GenyDeviceRegistryFactory.forGlobalShutdown();
|
8
|
+
}
|
9
|
+
|
10
|
+
// Note: important to keep lazy because of implicit validations that are sensitive (inside environment, in particular).
|
11
|
+
get exec() {
|
12
|
+
if (!this._exec) {
|
13
|
+
const Exec = require('../../devices/common/drivers/android/genycloud/exec/GenyCloudExec');
|
14
|
+
const environment = require('../../utils/environment');
|
15
|
+
this._exec = new Exec(environment.getGmsaasPath());
|
16
|
+
}
|
17
|
+
return this._exec;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
module.exports = new GenycloudServiceLocator();
|
@@ -0,0 +1,25 @@
|
|
1
|
+
const AndroidDevicePathBuilder = require('../../artifacts/utils/AndroidDevicePathBuilder');
|
2
|
+
const DeviceRegistry = require('../../devices/DeviceRegistry');
|
3
|
+
const AAPT = require('../../devices/common/drivers/android/exec/AAPT');
|
4
|
+
const ADB = require('../../devices/common/drivers/android/exec/ADB');
|
5
|
+
const ApkValidator = require('../../devices/common/drivers/android/tools/ApkValidator');
|
6
|
+
const { TempFileTransfer } = require('../../devices/common/drivers/android/tools/TempFileTransfer');
|
7
|
+
|
8
|
+
const AndroidServiceLocator = {
|
9
|
+
get emulator() {
|
10
|
+
return require('./emulatorServiceLocator');
|
11
|
+
},
|
12
|
+
|
13
|
+
get genycloud() {
|
14
|
+
return require('./genycloudServiceLocator');
|
15
|
+
},
|
16
|
+
};
|
17
|
+
|
18
|
+
AndroidServiceLocator.adb = new ADB();
|
19
|
+
AndroidServiceLocator.aapt = new AAPT();
|
20
|
+
AndroidServiceLocator.apkValidator = new ApkValidator(AndroidServiceLocator.aapt);
|
21
|
+
AndroidServiceLocator.fileTransfer = new TempFileTransfer(AndroidServiceLocator.adb);
|
22
|
+
AndroidServiceLocator.deviceRegistry = DeviceRegistry.forAndroid();
|
23
|
+
AndroidServiceLocator.devicePathBuilder = new AndroidDevicePathBuilder();
|
24
|
+
|
25
|
+
module.exports = AndroidServiceLocator;
|
package/src/utils/environment.js
CHANGED
@@ -19,8 +19,9 @@ function which(executable, path) {
|
|
19
19
|
const DETOX_LIBRARY_ROOT_PATH = path.join(appdatapath.appDataPath(), 'Detox');
|
20
20
|
const MISSING_SDK_ERROR = `$ANDROID_SDK_ROOT is not defined, set the path to the SDK installation directory into $ANDROID_SDK_ROOT,
|
21
21
|
Go to https://developer.android.com/studio/command-line/variables.html for more details`;
|
22
|
-
const
|
23
|
-
const
|
22
|
+
const DEVICE_LOCK_FILE_PATH_IOS = path.join(DETOX_LIBRARY_ROOT_PATH, 'device.registry.state.lock');
|
23
|
+
const DEVICE_LOCK_FILE_PATH_ANDROID = path.join(DETOX_LIBRARY_ROOT_PATH, 'android-device.registry.state.lock');
|
24
|
+
const GENYCLOUD_GLOBAL_CLEANUP_FILE_PATH = path.join(DETOX_LIBRARY_ROOT_PATH, 'genycloud-cleanup.lock');
|
24
25
|
const LAST_FAILED_TESTS_PATH = path.join(DETOX_LIBRARY_ROOT_PATH, 'last-failed.txt');
|
25
26
|
|
26
27
|
function getAndroidSDKPath() {
|
@@ -194,12 +195,17 @@ function getDetoxLibraryRootPath() {
|
|
194
195
|
return DETOX_LIBRARY_ROOT_PATH;
|
195
196
|
}
|
196
197
|
|
197
|
-
function
|
198
|
-
return
|
198
|
+
function getDeviceLockFilePathIOS() {
|
199
|
+
return DEVICE_LOCK_FILE_PATH_IOS;
|
199
200
|
}
|
200
201
|
|
201
|
-
|
202
|
-
|
202
|
+
// TODO This can probably be merged with IOS' by now
|
203
|
+
function getDeviceLockFilePathAndroid() {
|
204
|
+
return DEVICE_LOCK_FILE_PATH_ANDROID;
|
205
|
+
}
|
206
|
+
|
207
|
+
function getGenyCloudGlobalCleanupFilePath() {
|
208
|
+
return GENYCLOUD_GLOBAL_CLEANUP_FILE_PATH;
|
203
209
|
}
|
204
210
|
|
205
211
|
function getLastFailedTestsPath() {
|
@@ -223,8 +229,9 @@ module.exports = {
|
|
223
229
|
getAndroidSDKPath,
|
224
230
|
getAndroidEmulatorPath,
|
225
231
|
getDetoxLibraryRootPath,
|
226
|
-
|
227
|
-
|
232
|
+
getDeviceLockFilePathIOS,
|
233
|
+
getDeviceLockFilePathAndroid,
|
234
|
+
getGenyCloudGlobalCleanupFilePath,
|
228
235
|
getLastFailedTestsPath,
|
229
236
|
getHomeDir,
|
230
237
|
};
|
package/src/utils/errorUtils.js
CHANGED
@@ -40,7 +40,7 @@ function asError(error) {
|
|
40
40
|
return isError(error) ? error : new Error(error);
|
41
41
|
}
|
42
42
|
|
43
|
-
function serializeObjectWithError(obj, errorKey
|
43
|
+
function serializeObjectWithError(obj, errorKey) {
|
44
44
|
if (obj[errorKey]) {
|
45
45
|
return { ...obj, [errorKey]: serializeError(obj[errorKey]) };
|
46
46
|
}
|
@@ -48,7 +48,7 @@ function serializeObjectWithError(obj, errorKey = 'error') {
|
|
48
48
|
return obj;
|
49
49
|
}
|
50
50
|
|
51
|
-
function deserializeObjectWithError(obj, errorKey
|
51
|
+
function deserializeObjectWithError(obj, errorKey) {
|
52
52
|
if (typeof obj[errorKey] === 'object' && !(obj[errorKey] instanceof Error)) {
|
53
53
|
return { ...obj, [errorKey]: deserializeError(obj[errorKey]) };
|
54
54
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
// @ts-nocheck
|
2
2
|
const semver = require('semver');
|
3
3
|
|
4
|
-
const
|
5
|
-
const environment = require('
|
4
|
+
const DetoxRuntimeError = require('../../errors/DetoxRuntimeError');
|
5
|
+
const environment = require('../../utils/environment');
|
6
6
|
const EnvironmentValidatorBase = require('../EnvironmentValidatorBase');
|
7
7
|
|
8
8
|
const MIN_GMSAAS_VERSION = '1.6.0';
|
@@ -7,7 +7,7 @@ class Genycloud extends EnvValidatorFactory {
|
|
7
7
|
const serviceLocator = require('../../servicelocator/android');
|
8
8
|
const exec = serviceLocator.genycloud.exec;
|
9
9
|
|
10
|
-
const GenyAuthService = require('../../
|
10
|
+
const GenyAuthService = require('../../devices/common/drivers/android/genycloud/services/GenyAuthService');
|
11
11
|
const authService = new GenyAuthService(exec);
|
12
12
|
|
13
13
|
const GenycloudEnvValidator = require('../android/GenycloudEnvValidator');
|
@@ -1,7 +1,7 @@
|
|
1
1
|
const fs = require('fs');
|
2
2
|
|
3
|
-
const DetoxRuntimeError = require('
|
4
|
-
const environment = require('
|
3
|
+
const DetoxRuntimeError = require('../../errors/DetoxRuntimeError');
|
4
|
+
const environment = require('../../utils/environment');
|
5
5
|
const EnvironmentValidatorBase = require('../EnvironmentValidatorBase');
|
6
6
|
|
7
7
|
class IosSimulatorEnvValidator extends EnvironmentValidatorBase {
|
@@ -1 +0,0 @@
|
|
1
|
-
9e1ed6595db1eb79fd10b72e768b9561
|
@@ -1 +0,0 @@
|
|
1
|
-
d94beb57b34924c9ff07315304976d12682bcb64
|
package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0-javadoc.jar.sha256
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
282729592fa58c2559eaeae9eb7524552ef025e306c20b6619b2ab79e0187f08
|
package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0-javadoc.jar.sha512
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
bea0140ed5de7a5b9143c3cfbe6a65e5a11d5d7fa4699c0ed81f1d50a4978a72b3cd60a2908d88be78a908260bdb081258edcfd5ee34a5ec3a72a73d1fae7161
|
@@ -1 +0,0 @@
|
|
1
|
-
2cd5617bb26a597c18bd4a2fcc3e47a5
|
@@ -1 +0,0 @@
|
|
1
|
-
e3addaba91ad374e5e74a90b848ce1691e089f9c
|
package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0-sources.jar.sha256
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ea34470f9caff1392d20c486c997cbcee75f7aad8dfa4cf9268d6984ae620d3c
|
package/Detox-android/com/wix/detox/20.12.0-smoke.0/detox-20.12.0-smoke.0-sources.jar.sha512
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
f66e64dc2055ed7bb0ef4ce4434308e607f7f5cfa27bc5b447b94a355aacb731664e1ab8a86816dc64f5b8a949ab7bd76753413a84aa9ad610a11cc2d0c91534
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
e1d6c5353b93ff848864f887b4763050
|
@@ -1 +0,0 @@
|
|
1
|
-
809426e1ab6811b1e6a727fdcd22bbbf20f89b02
|
@@ -1 +0,0 @@
|
|
1
|
-
dadebda11f4a94f751e23277fadbbaef518955f72ba353a5ae5f52ef1ba9acde
|
@@ -1 +0,0 @@
|
|
1
|
-
ba77a84e27f54bc932e73fac36cf2aa3b2a45fc51975088af59632256b214365fb1decbb77c117e5889013b10e4dc110e074100ac439b201e58ffd7333aa370e
|
@@ -1 +0,0 @@
|
|
1
|
-
b657a85f93b0087e4bd3d2ef359cdcca
|
@@ -1 +0,0 @@
|
|
1
|
-
abbf983b4b77e1b748513273b9fb853feea6cfc9
|
@@ -1 +0,0 @@
|
|
1
|
-
8532ca9a4f54fcbdedcea406b715c7d7150d031e9478996ab505e453dca5d9bc
|
@@ -1 +0,0 @@
|
|
1
|
-
20dc62ea32120332c031cc66c5b90e9917c7bd5ebe0bfff2c30014a05b7e613572fdd6a45b08260fb3b5f8feafc916034c6015a8a3627e67db6205b57cd4697f
|
@@ -1,44 +0,0 @@
|
|
1
|
-
class DeviceListReadonly {
|
2
|
-
constructor(devices = []) {
|
3
|
-
this._devices = new Map(devices.map(device => [device.id, device]));
|
4
|
-
}
|
5
|
-
|
6
|
-
concat(other) {
|
7
|
-
return new DeviceListReadonly([...this, ...other]);
|
8
|
-
}
|
9
|
-
|
10
|
-
getIds() {
|
11
|
-
return [...this._devices.keys()];
|
12
|
-
}
|
13
|
-
|
14
|
-
[Symbol.iterator]() {
|
15
|
-
return this._devices.values();
|
16
|
-
}
|
17
|
-
|
18
|
-
/**
|
19
|
-
* @param {string} deviceId
|
20
|
-
* @returns {boolean}
|
21
|
-
*/
|
22
|
-
includes(deviceId) {
|
23
|
-
return this._devices.has(deviceId);
|
24
|
-
}
|
25
|
-
}
|
26
|
-
|
27
|
-
class DeviceList extends DeviceListReadonly {
|
28
|
-
filter(predicate) {
|
29
|
-
return new DeviceListReadonly([...this].filter(predicate));
|
30
|
-
}
|
31
|
-
|
32
|
-
add(deviceId, data) {
|
33
|
-
this._devices.set(deviceId, {
|
34
|
-
id: deviceId,
|
35
|
-
...data,
|
36
|
-
});
|
37
|
-
}
|
38
|
-
|
39
|
-
delete(deviceId) {
|
40
|
-
this._devices.delete(deviceId);
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
module.exports = DeviceList;
|