detox 20.12.0-smoke.0 → 20.12.0-smoke.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.0-smoke.1/detox-20.12.0-smoke.1-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.1-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.1-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.1-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.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.0-smoke.1/detox-20.12.0-smoke.1-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.1-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.1-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.1-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.1-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.1.aar +0 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.1.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.1.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.1.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.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.0-smoke.1/detox-20.12.0-smoke.1.pom} +1 -1
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.1.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.1.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.1.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.12.0-smoke.1/detox-20.12.0-smoke.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/package.json +2 -2
- package/runners/jest/testEnvironment/index.js +1 -0
- package/src/DetoxWorker.js +0 -2
- 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/configuration/composeLoggerConfig.js +1 -0
- package/src/devices/allocation/DeviceAllocator.js +24 -13
- package/src/devices/allocation/DeviceRegistry.js +3 -0
- package/src/devices/allocation/drivers/AllocationDriverBase.d.ts +15 -0
- package/src/devices/allocation/drivers/android/attached/AttachedAndroidAllocDriver.js +16 -12
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +39 -62
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +0 -3
- package/src/devices/allocation/drivers/android/genycloud/GenyAllocDriver.js +28 -16
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceLauncher.js +3 -5
- package/src/devices/allocation/drivers/android/genycloud/GenyRegistry.js +54 -26
- package/src/devices/allocation/drivers/ios/SimulatorAllocDriver.js +26 -13
- package/src/devices/common/drivers/DeviceCookie.d.ts +12 -0
- package/src/devices/common/drivers/android/cookies.d.ts +11 -0
- package/src/devices/common/drivers/ios/cookies.d.ts +9 -0
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +3 -1
- package/src/devices/cookies/index.js +0 -6
- package/src/devices/runtime/drivers/android/genycloud/GenyCloudDriver.js +7 -6
- package/src/devices/runtime/factories/android.js +2 -10
- package/src/devices/validation/EnvironmentValidatorBase.js +1 -0
- package/src/ipc/IPCServer.js +3 -1
- package/src/logger/DetoxLogger.js +2 -2
- package/src/realms/DetoxPrimaryContext.js +1 -1
- package/src/utils/errorUtils.js +1 -1
- package/tsconfig.json +5 -3
- 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/drivers/AllocationDriverBase.js +0 -36
- package/src/devices/cookies/AndroidDeviceCookie.js +0 -17
- package/src/devices/cookies/AndroidEmulatorCookie.js +0 -6
- package/src/devices/cookies/AttachedAndroidDeviceCookie.js +0 -12
- package/src/devices/cookies/DeviceCookie.js +0 -4
- package/src/devices/cookies/GenycloudEmulatorCookie.js +0 -18
- package/src/devices/cookies/IosCookie.js +0 -6
- package/src/devices/cookies/IosSimulatorCookie.js +0 -14
@@ -1,8 +1,6 @@
|
|
1
1
|
// @ts-nocheck
|
2
2
|
const { DetoxRuntimeError } = require('../../../../../errors');
|
3
|
-
const log = require('../../../../../utils/logger').child({ cat: 'device' });
|
4
3
|
const retry = require('../../../../../utils/retry');
|
5
|
-
const traceMethods = require('../../../../../utils/traceMethods');
|
6
4
|
const { LaunchCommand } = require('../../../../common/drivers/android/emulator/exec/EmulatorExec');
|
7
5
|
|
8
6
|
const { launchEmulatorProcess } = require('./launchEmulatorProcess');
|
@@ -13,7 +11,6 @@ class EmulatorLauncher {
|
|
13
11
|
constructor({ adb, emulatorExec }) {
|
14
12
|
this._adb = adb;
|
15
13
|
this._emulatorExec = emulatorExec;
|
16
|
-
traceMethods(log, this, ['awaitEmulatorBoot']);
|
17
14
|
}
|
18
15
|
|
19
16
|
/**
|
@@ -1,8 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* @typedef {import('../../AllocationDriverBase').AllocationDriverBase} AllocationDriverBase
|
3
|
+
* @typedef {import('../../../../common/drivers/android/cookies').GenycloudEmulatorCookie} GenycloudEmulatorCookie
|
4
|
+
*/
|
5
|
+
|
1
6
|
const { DetoxRuntimeError } = require('../../../../../errors');
|
2
7
|
const Timer = require('../../../../../utils/Timer');
|
3
8
|
const log = require('../../../../../utils/logger').child({ cat: 'device' });
|
4
|
-
const GenycloudEmulatorCookie = require('../../../../cookies/GenycloudEmulatorCookie');
|
5
|
-
const AllocationDriverBase = require('../../AllocationDriverBase');
|
6
9
|
|
7
10
|
const GenyRegistry = require('./GenyRegistry');
|
8
11
|
|
@@ -10,7 +13,10 @@ const events = {
|
|
10
13
|
GENYCLOUD_TEARDOWN: { event: 'GENYCLOUD_TEARDOWN' },
|
11
14
|
};
|
12
15
|
|
13
|
-
|
16
|
+
/**
|
17
|
+
* @implements {AllocationDriverBase}
|
18
|
+
*/
|
19
|
+
class GenyAllocDriver {
|
14
20
|
/**
|
15
21
|
* @param {object} options
|
16
22
|
* @param {import('../../../../common/drivers/android/exec/ADB')} options.adb
|
@@ -26,8 +32,6 @@ class GenyAllocDriver extends AllocationDriverBase {
|
|
26
32
|
instanceLauncher,
|
27
33
|
recipeQuerying,
|
28
34
|
}) {
|
29
|
-
super();
|
30
|
-
|
31
35
|
this._adb = adb;
|
32
36
|
this._detoxSessionId = detoxSession.id;
|
33
37
|
this._genyRegistry = genyRegistry;
|
@@ -53,7 +57,12 @@ class GenyAllocDriver extends AllocationDriverBase {
|
|
53
57
|
this._genyRegistry.addInstance(instance, recipe);
|
54
58
|
}
|
55
59
|
|
56
|
-
return
|
60
|
+
return {
|
61
|
+
id: instance.uuid,
|
62
|
+
adbName: instance.adbName,
|
63
|
+
name: instance.name,
|
64
|
+
instance,
|
65
|
+
};
|
57
66
|
}
|
58
67
|
|
59
68
|
/**
|
@@ -63,7 +72,7 @@ class GenyAllocDriver extends AllocationDriverBase {
|
|
63
72
|
const instance = await this._instanceLauncher.connect(cookie.instance);
|
64
73
|
this._genyRegistry.updateInstance(instance);
|
65
74
|
|
66
|
-
if (this._genyRegistry.pollNewInstance(instance)) {
|
75
|
+
if (this._genyRegistry.pollNewInstance(instance.uuid)) {
|
67
76
|
const { adbName } = instance;
|
68
77
|
|
69
78
|
await Timer.run(20000, 'waiting for device to respond', async () => {
|
@@ -73,20 +82,24 @@ class GenyAllocDriver extends AllocationDriverBase {
|
|
73
82
|
});
|
74
83
|
}
|
75
84
|
|
76
|
-
return
|
85
|
+
return {
|
86
|
+
...cookie,
|
87
|
+
adbName: instance.adbName,
|
88
|
+
};
|
77
89
|
}
|
78
90
|
|
79
91
|
/**
|
80
|
-
* @param cookie {GenycloudEmulatorCookie}
|
92
|
+
* @param cookie {Omit<GenycloudEmulatorCookie, 'instance'>}
|
81
93
|
* @param options {Partial<import('../../AllocationDriverBase').DeallocOptions>}
|
82
94
|
* @return {Promise<void>}
|
83
95
|
*/
|
84
96
|
async free(cookie, options = {}) {
|
97
|
+
// Known issue: cookie won't have a proper 'instance' field due to (de)serialization
|
85
98
|
if (options.shutdown) {
|
86
|
-
this._genyRegistry.removeInstance(cookie.
|
87
|
-
await this._instanceLauncher.shutdown(cookie.
|
99
|
+
this._genyRegistry.removeInstance(cookie.id);
|
100
|
+
await this._instanceLauncher.shutdown(cookie.id);
|
88
101
|
} else {
|
89
|
-
this._genyRegistry.markAsFree(cookie.
|
102
|
+
this._genyRegistry.markAsFree(cookie.id);
|
90
103
|
}
|
91
104
|
}
|
92
105
|
|
@@ -94,10 +107,10 @@ class GenyAllocDriver extends AllocationDriverBase {
|
|
94
107
|
log.info(events.GENYCLOUD_TEARDOWN, 'Initiating Genymotion SaaS instances teardown...');
|
95
108
|
|
96
109
|
const killPromises = this._genyRegistry.getInstances().map((instance) => {
|
97
|
-
this._genyRegistry.markAsBusy(instance);
|
98
|
-
const onSuccess = () => this._genyRegistry.removeInstance(instance);
|
110
|
+
this._genyRegistry.markAsBusy(instance.uuid);
|
111
|
+
const onSuccess = () => this._genyRegistry.removeInstance(instance.uuid);
|
99
112
|
const onError = (error) => ({ ...instance, error });
|
100
|
-
return this._instanceLauncher.shutdown(instance).then(onSuccess, onError);
|
113
|
+
return this._instanceLauncher.shutdown(instance.uuid).then(onSuccess, onError);
|
101
114
|
});
|
102
115
|
|
103
116
|
const deletionLeaks = (await Promise.all(killPromises)).filter(Boolean);
|
@@ -137,5 +150,4 @@ class GenyAllocDriver extends AllocationDriverBase {
|
|
137
150
|
}
|
138
151
|
}
|
139
152
|
|
140
|
-
|
141
153
|
module.exports = GenyAllocDriver;
|
@@ -40,12 +40,10 @@ class GenyInstanceLauncher {
|
|
40
40
|
}
|
41
41
|
|
42
42
|
/**
|
43
|
-
* @param {
|
43
|
+
* @param {string} instanceId
|
44
44
|
*/
|
45
|
-
async shutdown(
|
46
|
-
|
47
|
-
|
48
|
-
await this._instanceLifecycleService.deleteInstance(uuid);
|
45
|
+
async shutdown(instanceId) {
|
46
|
+
await this._instanceLifecycleService.deleteInstance(instanceId);
|
49
47
|
}
|
50
48
|
|
51
49
|
async _waitForInstanceBoot(instance) {
|
@@ -12,8 +12,14 @@ class GenyRegistry {
|
|
12
12
|
this._newInstances = new Set();
|
13
13
|
}
|
14
14
|
|
15
|
+
/**
|
16
|
+
* @returns {import('./services/dto/GenyInstance')[]}
|
17
|
+
*/
|
15
18
|
getInstances() {
|
16
|
-
return [
|
19
|
+
return [
|
20
|
+
...this._freeInstances.values(),
|
21
|
+
...this._busyInstances.values(),
|
22
|
+
];
|
17
23
|
}
|
18
24
|
|
19
25
|
/**
|
@@ -26,65 +32,87 @@ class GenyRegistry {
|
|
26
32
|
this._newInstances.add(instance.uuid);
|
27
33
|
}
|
28
34
|
|
29
|
-
/**
|
30
|
-
|
31
|
-
|
32
|
-
|
35
|
+
/**
|
36
|
+
* @param {string} instanceId
|
37
|
+
* @returns {boolean}
|
38
|
+
*/
|
39
|
+
pollNewInstance(instanceId) {
|
40
|
+
const result = this._newInstances.has(instanceId);
|
41
|
+
this._newInstances.delete(instanceId);
|
33
42
|
return result;
|
34
43
|
}
|
35
44
|
|
36
45
|
/** @param {import('./services/dto/GenyInstance')} instance */
|
37
46
|
updateInstance(instance) {
|
47
|
+
let found = false;
|
48
|
+
|
38
49
|
if (this._freeInstances.has(instance.uuid)) {
|
39
50
|
this._freeInstances.set(instance.uuid, instance);
|
51
|
+
found = true;
|
40
52
|
}
|
41
53
|
|
42
54
|
if (this._busyInstances.has(instance.uuid)) {
|
43
55
|
this._busyInstances.set(instance.uuid, instance);
|
56
|
+
found = true;
|
57
|
+
}
|
58
|
+
|
59
|
+
if (!found) {
|
60
|
+
throw new DetoxInternalError(`Cannot update an unknown instance ${instance.uuid}`);
|
44
61
|
}
|
45
62
|
}
|
46
63
|
|
47
|
-
/** @param {
|
48
|
-
removeInstance(
|
49
|
-
this._freeInstances.delete(
|
50
|
-
this._busyInstances.delete(
|
51
|
-
this._newInstances.delete(
|
52
|
-
this._recipes.delete(
|
64
|
+
/** @param {string} instanceId */
|
65
|
+
removeInstance(instanceId) {
|
66
|
+
this._freeInstances.delete(instanceId);
|
67
|
+
this._busyInstances.delete(instanceId);
|
68
|
+
this._newInstances.delete(instanceId);
|
69
|
+
this._recipes.delete(instanceId);
|
53
70
|
}
|
54
71
|
|
55
|
-
/**
|
56
|
-
|
57
|
-
|
58
|
-
|
72
|
+
/**
|
73
|
+
* @param {string} instanceId
|
74
|
+
* @returns {import('./services/dto/GenyInstance')}
|
75
|
+
*/
|
76
|
+
markAsBusy(instanceId) {
|
77
|
+
if (this._busyInstances.has(instanceId)) {
|
78
|
+
return this._busyInstances.get(instanceId);
|
59
79
|
}
|
60
80
|
|
61
|
-
const instance = this._freeInstances.get(
|
81
|
+
const instance = this._freeInstances.get(instanceId);
|
62
82
|
if (!instance) {
|
63
|
-
throw new DetoxInternalError(`Cannot mark an unknown instance ${
|
83
|
+
throw new DetoxInternalError(`Cannot mark an unknown instance ${instanceId} as busy`);
|
64
84
|
}
|
65
85
|
|
66
|
-
this._busyInstances.set(
|
67
|
-
this._freeInstances.delete(
|
86
|
+
this._busyInstances.set(instanceId, instance);
|
87
|
+
this._freeInstances.delete(instanceId);
|
68
88
|
return instance;
|
69
89
|
}
|
70
90
|
|
71
|
-
/**
|
72
|
-
|
73
|
-
|
91
|
+
/**
|
92
|
+
* @param {string} instanceId
|
93
|
+
* @returns {import('./services/dto/GenyInstance')}
|
94
|
+
*/
|
95
|
+
markAsFree(instanceId) {
|
96
|
+
if (this._freeInstances.has(instanceId)) {
|
97
|
+
return this._freeInstances.get(instanceId);
|
98
|
+
}
|
99
|
+
|
100
|
+
const instance = this._busyInstances.get(instanceId);
|
74
101
|
if (!instance) {
|
75
|
-
throw new DetoxInternalError(`Cannot mark an unknown instance ${
|
102
|
+
throw new DetoxInternalError(`Cannot mark an unknown instance ${instanceId} as free`);
|
76
103
|
}
|
77
104
|
|
78
|
-
this._busyInstances.delete(
|
79
|
-
this._freeInstances.set(
|
105
|
+
this._busyInstances.delete(instanceId);
|
106
|
+
this._freeInstances.set(instanceId, instance);
|
80
107
|
return instance;
|
81
108
|
}
|
82
109
|
|
110
|
+
/** @returns {import('./services/dto/GenyInstance') | undefined} */
|
83
111
|
findFreeInstance(recipe) {
|
84
112
|
for (const instance of this._freeInstances.values()) {
|
85
113
|
const aRecipe = this._recipes.get(instance.uuid);
|
86
114
|
if (recipe.uuid === aRecipe.uuid) {
|
87
|
-
return this.markAsBusy(instance);
|
115
|
+
return this.markAsBusy(instance.uuid);
|
88
116
|
}
|
89
117
|
}
|
90
118
|
}
|
@@ -1,23 +1,28 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
* @typedef {import('../AllocationDriverBase').AllocationDriverBase} AllocationDriverBase
|
3
|
+
* @typedef {import('../AllocationDriverBase').DeallocOptions} DeallocOptions
|
4
|
+
* @typedef {import('../../../common/drivers/ios/cookies').IosSimulatorCookie} IosSimulatorCookie
|
5
|
+
*/
|
6
|
+
|
2
7
|
const _ = require('lodash');
|
3
8
|
|
4
|
-
const DetoxRuntimeError = require('../../../../errors
|
9
|
+
const { DetoxRuntimeError } = require('../../../../errors');
|
5
10
|
const log = require('../../../../utils/logger').child({ cat: 'device,device-allocation' });
|
6
|
-
const IosSimulatorCookie = require('../../../cookies/IosSimulatorCookie');
|
7
|
-
const AllocationDriverBase = require('../AllocationDriverBase');
|
8
11
|
|
9
12
|
const SimulatorQuery = require('./SimulatorQuery');
|
10
13
|
|
11
|
-
|
14
|
+
/**
|
15
|
+
* @implements {AllocationDriverBase}
|
16
|
+
*/
|
17
|
+
class SimulatorAllocDriver {
|
12
18
|
/**
|
13
|
-
* @param
|
14
|
-
* @param
|
15
|
-
* @param
|
16
|
-
* @param
|
17
|
-
* @param
|
19
|
+
* @param {object} options
|
20
|
+
* @param {import('../../DeviceRegistry')} options.deviceRegistry
|
21
|
+
* @param {DetoxInternals.RuntimeConfig} options.detoxConfig
|
22
|
+
* @param {import('../../../common/drivers/ios/tools/AppleSimUtils')} options.applesimutils
|
23
|
+
* @param {import('./SimulatorLauncher')} options.simulatorLauncher
|
18
24
|
*/
|
19
25
|
constructor({ detoxConfig, deviceRegistry, applesimutils, simulatorLauncher }) {
|
20
|
-
super();
|
21
26
|
this._deviceRegistry = deviceRegistry;
|
22
27
|
this._applesimutils = applesimutils;
|
23
28
|
this._simulatorLauncher = simulatorLauncher;
|
@@ -46,17 +51,25 @@ class SimulatorAllocDriver extends AllocationDriverBase {
|
|
46
51
|
}
|
47
52
|
|
48
53
|
this._launchInfo[udid] = { deviceConfig };
|
49
|
-
return
|
54
|
+
return { id: udid, udid };
|
50
55
|
}
|
51
56
|
|
52
57
|
/**
|
53
58
|
* @param {IosSimulatorCookie} deviceCookie
|
54
|
-
* @returns {Promise<
|
59
|
+
* @returns {Promise<IosSimulatorCookie>}
|
55
60
|
*/
|
56
61
|
async postAllocate(deviceCookie) {
|
57
62
|
const { udid } = deviceCookie;
|
58
63
|
const { deviceConfig } = this._launchInfo[udid];
|
59
64
|
await this._simulatorLauncher.launch(udid, deviceConfig.type, deviceConfig.bootArgs, deviceConfig.headless);
|
65
|
+
|
66
|
+
return {
|
67
|
+
id: udid,
|
68
|
+
udid,
|
69
|
+
type: deviceConfig.type,
|
70
|
+
bootArgs: deviceConfig.bootArgs,
|
71
|
+
headless: deviceConfig.headless,
|
72
|
+
};
|
60
73
|
}
|
61
74
|
|
62
75
|
/**
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/* eslint-disable import/no-unresolved,node/no-missing-import,node/no-unsupported-features/es-syntax */
|
2
|
+
|
3
|
+
/**
|
4
|
+
* A serializable object that represents a device.
|
5
|
+
*/
|
6
|
+
export interface DeviceCookie {
|
7
|
+
/** The device's unique identifier. */
|
8
|
+
id: string;
|
9
|
+
/** The display name of the device. */
|
10
|
+
name?: string;
|
11
|
+
}
|
12
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/* eslint-disable import/no-unresolved,node/no-missing-import,node/no-unsupported-features/es-syntax */
|
2
|
+
import GenyInstance from '../../../allocation/drivers/android/genycloud/services/dto/GenyInstance';
|
3
|
+
import { DeviceCookie } from '../DeviceCookie';
|
4
|
+
|
5
|
+
interface AndroidDeviceCookie extends DeviceCookie {
|
6
|
+
adbName: string;
|
7
|
+
}
|
8
|
+
|
9
|
+
interface GenycloudEmulatorCookie extends AndroidDeviceCookie {
|
10
|
+
instance: GenyInstance;
|
11
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/* eslint-disable import/no-unresolved,node/no-missing-import,node/no-unsupported-features/es-syntax */
|
2
|
+
import { DeviceCookie } from '../DeviceCookie';
|
3
|
+
|
4
|
+
interface IosSimulatorCookie extends DeviceCookie {
|
5
|
+
udid: string;
|
6
|
+
type?: string;
|
7
|
+
bootArgs?: string;
|
8
|
+
headless?: boolean;
|
9
|
+
}
|
@@ -297,7 +297,7 @@ class AppleSimUtils {
|
|
297
297
|
// want to make sure it isn't now.
|
298
298
|
if (err.code === 3 &&
|
299
299
|
(err.stderr.includes(`the app is not currently running`) ||
|
300
|
-
err.stderr.includes(`
|
300
|
+
err.stderr.includes(`found nothing to terminate`))) {
|
301
301
|
return;
|
302
302
|
}
|
303
303
|
|
@@ -455,6 +455,8 @@ class AppleSimUtils {
|
|
455
455
|
overrides.push(`--cellularMode "${flags.cellularMode}"`);
|
456
456
|
if (flags.cellularBars)
|
457
457
|
overrides.push(`--cellularBars "${flags.cellularBars}"`);
|
458
|
+
if (flags.operatorName)
|
459
|
+
overrides.push(`--operatorName "${flags.operatorName}"`);
|
458
460
|
if (flags.batteryState)
|
459
461
|
overrides.push(`--batteryState "${flags.batteryState}"`);
|
460
462
|
if (flags.batteryLevel)
|
@@ -1,6 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
IosSimulatorCookie: require('./IosSimulatorCookie'),
|
3
|
-
AttachedAndroidDeviceCookie: require('./AttachedAndroidDeviceCookie'),
|
4
|
-
AndroidEmulatorCookie: require('./AndroidEmulatorCookie'),
|
5
|
-
GenycloudEmulatorCookie: require('./GenycloudEmulatorCookie'),
|
6
|
-
};
|
@@ -8,21 +8,22 @@ const AndroidDriver = require('../AndroidDriver');
|
|
8
8
|
|
9
9
|
/**
|
10
10
|
* @typedef GenycloudDriverProps
|
11
|
-
* @property
|
11
|
+
* @property adbName { GenyInstance } The DTO associated with the cloud instance
|
12
12
|
*/
|
13
13
|
|
14
14
|
class GenyCloudDriver extends AndroidDriver {
|
15
15
|
/**
|
16
16
|
* @param deps { GenycloudDriverDeps }
|
17
|
-
* @param props {
|
17
|
+
* @param props { GenycloudEmulatorCookie }
|
18
18
|
*/
|
19
|
-
constructor(deps, {
|
20
|
-
super(deps, { adbName
|
21
|
-
|
19
|
+
constructor(deps, { adbName, name }) {
|
20
|
+
super(deps, { adbName });
|
21
|
+
|
22
|
+
this._instanceName = name;
|
22
23
|
}
|
23
24
|
|
24
25
|
getDeviceName() {
|
25
|
-
return this.
|
26
|
+
return this._instanceName;
|
26
27
|
}
|
27
28
|
|
28
29
|
async setLocation(lat, lon) {
|
@@ -43,23 +43,15 @@ class AndroidEmulator extends RuntimeDriverFactoryAndroid {
|
|
43
43
|
|
44
44
|
class AndroidAttached extends RuntimeDriverFactoryAndroid {
|
45
45
|
_createDriver(deviceCookie, deps, configs) {
|
46
|
-
const props = {
|
47
|
-
adbName: deviceCookie.adbName,
|
48
|
-
};
|
49
|
-
|
50
46
|
const { AttachedAndroidRuntimeDriver } = require('../drivers');
|
51
|
-
return new AttachedAndroidRuntimeDriver(deps,
|
47
|
+
return new AttachedAndroidRuntimeDriver(deps, deviceCookie);
|
52
48
|
}
|
53
49
|
}
|
54
50
|
|
55
51
|
class Genycloud extends RuntimeDriverFactoryAndroid {
|
56
52
|
_createDriver(deviceCookie, deps, configs) {
|
57
|
-
const props = {
|
58
|
-
instance: deviceCookie.instance,
|
59
|
-
};
|
60
|
-
|
61
53
|
const { GenycloudRuntimeDriver } = require('../drivers');
|
62
|
-
return new GenycloudRuntimeDriver(deps,
|
54
|
+
return new GenycloudRuntimeDriver(deps, deviceCookie);
|
63
55
|
}
|
64
56
|
}
|
65
57
|
|
package/src/ipc/IPCServer.js
CHANGED
@@ -90,8 +90,10 @@ class IPCServer {
|
|
90
90
|
}
|
91
91
|
|
92
92
|
async onAllocateDevice(_payload, socket) {
|
93
|
+
let deviceCookie;
|
94
|
+
|
93
95
|
try {
|
94
|
-
|
96
|
+
deviceCookie = await this._callbacks.onAllocateDevice();
|
95
97
|
this._ipc.server.emit(socket, 'allocateDeviceDone', { deviceCookie });
|
96
98
|
} catch (error) {
|
97
99
|
this._ipc.server.emit(socket, 'allocateDeviceDone', serializeObjectWithError({ error }));
|
@@ -249,7 +249,7 @@ class DetoxLogger {
|
|
249
249
|
_complete(level, maybeContext, maybeMessage, maybeAction) {
|
250
250
|
const action = typeof maybeContext !== 'string' ? maybeAction : maybeMessage;
|
251
251
|
const args = maybeAction === action ? [maybeContext, maybeMessage] : [maybeContext];
|
252
|
-
const { context, msg } = this._parseArgs(
|
252
|
+
const { context, msg } = this._parseArgs({ ph: 'B' }, args);
|
253
253
|
const end = (ctx) => this[level].end({
|
254
254
|
id: context.id,
|
255
255
|
cat: context.cat,
|
@@ -257,7 +257,7 @@ class DetoxLogger {
|
|
257
257
|
});
|
258
258
|
|
259
259
|
let result;
|
260
|
-
this._beginInternal(level,
|
260
|
+
this._beginInternal(level, context, msg);
|
261
261
|
try {
|
262
262
|
result = typeof action === 'function'
|
263
263
|
? action()
|
@@ -166,7 +166,7 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
166
166
|
try {
|
167
167
|
await this[_deviceAllocator].free(deviceCookie, { shutdown: true });
|
168
168
|
} catch (e2) {
|
169
|
-
this[symbols.logger].error({ cat: 'device', err: e2 }, `Failed to free ${deviceCookie} after a failed allocation`);
|
169
|
+
this[symbols.logger].error({ cat: 'device', err: e2 }, `Failed to free ${deviceCookie.name || deviceCookie.id} after a failed allocation`);
|
170
170
|
}
|
171
171
|
|
172
172
|
throw e;
|
package/src/utils/errorUtils.js
CHANGED
package/tsconfig.json
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"compilerOptions": {
|
3
3
|
"module": "commonjs",
|
4
|
-
"lib": ["
|
5
|
-
"target": "
|
4
|
+
"lib": ["es2022"],
|
5
|
+
"target": "ES2022",
|
6
6
|
"allowJs": true,
|
7
7
|
"checkJs": true,
|
8
|
-
"moduleResolution": "
|
8
|
+
"moduleResolution": "node16",
|
9
9
|
"resolveJsonModule": true,
|
10
10
|
"esModuleInterop": true,
|
11
11
|
"noEmit": true,
|
@@ -20,6 +20,8 @@
|
|
20
20
|
],
|
21
21
|
"exclude": [
|
22
22
|
"android",
|
23
|
+
"allure-report",
|
24
|
+
"allure-results",
|
23
25
|
"coverage",
|
24
26
|
"ios",
|
25
27
|
"test"
|
@@ -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,36 +0,0 @@
|
|
1
|
-
/* eslint @typescript-eslint/no-unused-vars: ["error", { "args": "none" }] */
|
2
|
-
// @ts-nocheck
|
3
|
-
|
4
|
-
/**
|
5
|
-
* @typedef DeallocOptions
|
6
|
-
* @property shutdown { Boolean }
|
7
|
-
*/
|
8
|
-
|
9
|
-
class AllocationDriverBase {
|
10
|
-
async init() {}
|
11
|
-
|
12
|
-
/**
|
13
|
-
* @param deviceConfig { Object }
|
14
|
-
* @return {Promise<import('../../cookies/DeviceCookie')>}
|
15
|
-
*/
|
16
|
-
async allocate(deviceConfig) {}
|
17
|
-
|
18
|
-
/**
|
19
|
-
* @param {import('../../cookies/DeviceCookie')} deviceCookie
|
20
|
-
* @return {Promise<import('../../cookies/DeviceCookie') | void>}
|
21
|
-
*/
|
22
|
-
async postAllocate(deviceCookie) {}
|
23
|
-
|
24
|
-
/**
|
25
|
-
* @param cookie { import('../../cookies/DeviceCookie') }
|
26
|
-
* @param options { DeallocOptions }
|
27
|
-
* @return {Promise<void>}
|
28
|
-
*/
|
29
|
-
async free(cookie, options) {}
|
30
|
-
|
31
|
-
async cleanup() {}
|
32
|
-
|
33
|
-
emergencyCleanup() {}
|
34
|
-
}
|
35
|
-
|
36
|
-
module.exports = AllocationDriverBase;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
const DeviceCookie = require('./DeviceCookie');
|
2
|
-
|
3
|
-
class AndroidDeviceCookie extends DeviceCookie {
|
4
|
-
/**
|
5
|
-
* @param adbName { String }
|
6
|
-
*/
|
7
|
-
constructor(adbName) {
|
8
|
-
super();
|
9
|
-
this.adbName = adbName;
|
10
|
-
}
|
11
|
-
|
12
|
-
toString() {
|
13
|
-
return this.adbName;
|
14
|
-
}
|
15
|
-
}
|
16
|
-
|
17
|
-
module.exports = AndroidDeviceCookie;
|