detox 20.12.0-smoke.0 → 20.12.0
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/detox-20.12.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0-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/detox-20.12.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0.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/detox-20.12.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.12.0/detox-20.12.0.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 +4 -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 +1 -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
@@ -1,186 +0,0 @@
|
|
1
|
-
const ExclusiveLockfile = require('../../utils/ExclusiveLockfile');
|
2
|
-
const PIDService = require('../../utils/PIDService');
|
3
|
-
const { getDeviceRegistryPath } = require('../../utils/environment');
|
4
|
-
const safeAsync = require('../../utils/safeAsync');
|
5
|
-
|
6
|
-
const DeviceList = require('./DeviceList');
|
7
|
-
|
8
|
-
const readOptions = {
|
9
|
-
encoding: 'utf8',
|
10
|
-
};
|
11
|
-
|
12
|
-
class DeviceRegistry {
|
13
|
-
constructor({
|
14
|
-
lockfilePath = getDeviceRegistryPath(),
|
15
|
-
sessionId = '',
|
16
|
-
pidService = new PIDService(),
|
17
|
-
} = {}) {
|
18
|
-
/***
|
19
|
-
* @private
|
20
|
-
* @type {string}
|
21
|
-
*/
|
22
|
-
this._lockfilePath = lockfilePath;
|
23
|
-
/***
|
24
|
-
* @private
|
25
|
-
* @type {string}
|
26
|
-
*/
|
27
|
-
this._sessionId = sessionId;
|
28
|
-
/***
|
29
|
-
* @private
|
30
|
-
*/
|
31
|
-
this._pidService = pidService;
|
32
|
-
/***
|
33
|
-
* @protected
|
34
|
-
* @type {ExclusiveLockfile}
|
35
|
-
*/
|
36
|
-
this._lockfile = new ExclusiveLockfile(this._lockfilePath, {
|
37
|
-
getInitialState: this._getInitialLockFileState.bind(this),
|
38
|
-
readOptions,
|
39
|
-
});
|
40
|
-
}
|
41
|
-
|
42
|
-
get lockFilePath() {
|
43
|
-
return this._lockfilePath;
|
44
|
-
}
|
45
|
-
|
46
|
-
/**
|
47
|
-
* Safety method to ensure that there are no remains of previously crashed Detox sessions.
|
48
|
-
*/
|
49
|
-
async reset() {
|
50
|
-
await this._lockfile.exclusively(() => {
|
51
|
-
const empty = this._getInitialLockFileState();
|
52
|
-
this._lockfile.write(empty);
|
53
|
-
});
|
54
|
-
}
|
55
|
-
|
56
|
-
/***
|
57
|
-
* @param {string|Function} getDeviceId
|
58
|
-
* @returns {Promise<string>}
|
59
|
-
*/
|
60
|
-
async registerDevice(getDeviceId) {
|
61
|
-
return this._lockfile.exclusively(async () => {
|
62
|
-
const deviceId = await safeAsync(getDeviceId);
|
63
|
-
if (deviceId) {
|
64
|
-
this._upsertDevice(deviceId, {
|
65
|
-
busy: true,
|
66
|
-
sessionId: this._sessionId,
|
67
|
-
pid: this._pidService.getPid(),
|
68
|
-
});
|
69
|
-
}
|
70
|
-
return deviceId;
|
71
|
-
});
|
72
|
-
}
|
73
|
-
|
74
|
-
/***
|
75
|
-
* @param {string|Function} getDeviceId
|
76
|
-
* @returns {Promise<string>}
|
77
|
-
*/
|
78
|
-
async releaseDevice(getDeviceId) {
|
79
|
-
return this._lockfile.exclusively(async () => {
|
80
|
-
const deviceId = await safeAsync(getDeviceId);
|
81
|
-
if (deviceId) {
|
82
|
-
this._upsertDevice(deviceId, {
|
83
|
-
busy: false,
|
84
|
-
sessionId: this._sessionId,
|
85
|
-
pid: this._pidService.getPid(),
|
86
|
-
});
|
87
|
-
}
|
88
|
-
return deviceId;
|
89
|
-
});
|
90
|
-
}
|
91
|
-
|
92
|
-
/***
|
93
|
-
* @param {string|Function} getDeviceId
|
94
|
-
* @returns {Promise<void>}
|
95
|
-
*/
|
96
|
-
async unregisterDevice(getDeviceId) {
|
97
|
-
await this._lockfile.exclusively(async () => {
|
98
|
-
const deviceId = await safeAsync(getDeviceId);
|
99
|
-
if (deviceId) {
|
100
|
-
this._deleteDevice(deviceId);
|
101
|
-
}
|
102
|
-
});
|
103
|
-
}
|
104
|
-
|
105
|
-
async unregisterSessionDevices() {
|
106
|
-
await this._lockfile.exclusively(async () => {
|
107
|
-
const allDevices = this._getRegisteredDevices();
|
108
|
-
const sessionDevices = allDevices.filter(device => device.sessionId === this._sessionId);
|
109
|
-
for (const id of sessionDevices.getIds()) {
|
110
|
-
allDevices.delete(id);
|
111
|
-
}
|
112
|
-
this._lockfile.write([...allDevices]);
|
113
|
-
});
|
114
|
-
}
|
115
|
-
|
116
|
-
async unregisterZombieDevices() {
|
117
|
-
await this._lockfile.exclusively(async () => {
|
118
|
-
const allDevices = this._getRegisteredDevices();
|
119
|
-
const zombieDevices = allDevices.filter(device => {
|
120
|
-
return device.sessionId !== this._sessionId && !this._pidService.isAlive(device.pid);
|
121
|
-
});
|
122
|
-
|
123
|
-
for (const id of zombieDevices.getIds()) {
|
124
|
-
allDevices.delete(id);
|
125
|
-
}
|
126
|
-
this._lockfile.write([...allDevices]);
|
127
|
-
});
|
128
|
-
}
|
129
|
-
|
130
|
-
async readSessionDevices() {
|
131
|
-
let devices;
|
132
|
-
await this._lockfile.exclusively(() => {
|
133
|
-
devices = this._getSessionDevicesSync();
|
134
|
-
});
|
135
|
-
return devices;
|
136
|
-
}
|
137
|
-
|
138
|
-
getTakenDevicesSync() {
|
139
|
-
const allDevices = this._getRegisteredDevices();
|
140
|
-
const busyDevices = allDevices.filter(device => device.busy);
|
141
|
-
const externalDevices = allDevices.filter(device => device.sessionId !== this._sessionId);
|
142
|
-
return busyDevices.concat(externalDevices);
|
143
|
-
}
|
144
|
-
|
145
|
-
/***
|
146
|
-
* @private
|
147
|
-
*/
|
148
|
-
_getInitialLockFileState() {
|
149
|
-
return [];
|
150
|
-
}
|
151
|
-
|
152
|
-
/**
|
153
|
-
* @private
|
154
|
-
*/
|
155
|
-
_upsertDevice(deviceId, data) {
|
156
|
-
const devices = this._getRegisteredDevices();
|
157
|
-
devices.add(deviceId, data);
|
158
|
-
this._lockfile.write([...devices]);
|
159
|
-
}
|
160
|
-
|
161
|
-
/**
|
162
|
-
* @private
|
163
|
-
*/
|
164
|
-
_deleteDevice(deviceId) {
|
165
|
-
const devices = this._getRegisteredDevices();
|
166
|
-
devices.delete(deviceId);
|
167
|
-
this._lockfile.write([...devices]);
|
168
|
-
}
|
169
|
-
|
170
|
-
/***
|
171
|
-
* @private
|
172
|
-
* @returns {DeviceList}
|
173
|
-
*/
|
174
|
-
_getRegisteredDevices() {
|
175
|
-
const devices = this._lockfile.read();
|
176
|
-
return new DeviceList(devices);
|
177
|
-
}
|
178
|
-
|
179
|
-
_getSessionDevicesSync() {
|
180
|
-
const devices = this._getRegisteredDevices();
|
181
|
-
const sessionDevices = devices.filter(device => device.sessionId === this._sessionId);
|
182
|
-
return sessionDevices;
|
183
|
-
}
|
184
|
-
}
|
185
|
-
|
186
|
-
module.exports = DeviceRegistry;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
class FreePortFinder {
|
2
|
-
constructor({ min = 10000, max = 20000 } = {}) {
|
3
|
-
this._min = min;
|
4
|
-
this._max = max;
|
5
|
-
}
|
6
|
-
|
7
|
-
async findFreePort() {
|
8
|
-
const min = this._min;
|
9
|
-
const max = this._max;
|
10
|
-
let port = Math.random() * (max - min) + min;
|
11
|
-
port = port & 0xFFFFFFFE; // Should always be even
|
12
|
-
return port;
|
13
|
-
}
|
14
|
-
}
|
15
|
-
|
16
|
-
module.exports = FreePortFinder;
|
@@ -1,93 +0,0 @@
|
|
1
|
-
const { DetoxInternalError } = require('../../../../../errors');
|
2
|
-
|
3
|
-
class GenyRegistry {
|
4
|
-
constructor() {
|
5
|
-
/** @type {Map<string, import('./services/dto/GenyRecipe')>} */
|
6
|
-
this._recipes = new Map();
|
7
|
-
/** @type {Map<string, import('./services/dto/GenyInstance')>} */
|
8
|
-
this._freeInstances = new Map();
|
9
|
-
/** @type {Map<string, import('./services/dto/GenyInstance')>} */
|
10
|
-
this._busyInstances = new Map();
|
11
|
-
/** @type {Set<string>} */
|
12
|
-
this._newInstances = new Set();
|
13
|
-
}
|
14
|
-
|
15
|
-
getInstances() {
|
16
|
-
return [...this._freeInstances.values(), ...this._busyInstances.values()];
|
17
|
-
}
|
18
|
-
|
19
|
-
/**
|
20
|
-
* @param {import('./services/dto/GenyInstance')} instance
|
21
|
-
* @param {import('./services/dto/GenyRecipe')} recipe
|
22
|
-
*/
|
23
|
-
addInstance(instance, recipe) {
|
24
|
-
this._recipes.set(instance.uuid, recipe);
|
25
|
-
this._busyInstances.set(instance.uuid, instance);
|
26
|
-
this._newInstances.add(instance.uuid);
|
27
|
-
}
|
28
|
-
|
29
|
-
/** @param {import('./services/dto/GenyInstance')} instance */
|
30
|
-
pollNewInstance(instance) {
|
31
|
-
const result = this._newInstances.has(instance.uuid);
|
32
|
-
this._newInstances.delete(instance.uuid);
|
33
|
-
return result;
|
34
|
-
}
|
35
|
-
|
36
|
-
/** @param {import('./services/dto/GenyInstance')} instance */
|
37
|
-
updateInstance(instance) {
|
38
|
-
if (this._freeInstances.has(instance.uuid)) {
|
39
|
-
this._freeInstances.set(instance.uuid, instance);
|
40
|
-
}
|
41
|
-
|
42
|
-
if (this._busyInstances.has(instance.uuid)) {
|
43
|
-
this._busyInstances.set(instance.uuid, instance);
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
/** @param {import('./services/dto/GenyInstance')} instance */
|
48
|
-
removeInstance(instance) {
|
49
|
-
this._freeInstances.delete(instance.uuid);
|
50
|
-
this._busyInstances.delete(instance.uuid);
|
51
|
-
this._newInstances.delete(instance.uuid);
|
52
|
-
this._recipes.delete(instance.uuid);
|
53
|
-
}
|
54
|
-
|
55
|
-
/** @param {import('./services/dto/GenyInstance')} instance */
|
56
|
-
markAsBusy({ uuid }) {
|
57
|
-
if (this._busyInstances.has(uuid)) {
|
58
|
-
return;
|
59
|
-
}
|
60
|
-
|
61
|
-
const instance = this._freeInstances.get(uuid);
|
62
|
-
if (!instance) {
|
63
|
-
throw new DetoxInternalError(`Cannot mark an unknown instance ${uuid} as busy`);
|
64
|
-
}
|
65
|
-
|
66
|
-
this._busyInstances.set(uuid, instance);
|
67
|
-
this._freeInstances.delete(uuid);
|
68
|
-
return instance;
|
69
|
-
}
|
70
|
-
|
71
|
-
/** @param {import('./services/dto/GenyInstance')} instance */
|
72
|
-
markAsFree({ uuid }) {
|
73
|
-
const instance = this._busyInstances.get(uuid);
|
74
|
-
if (!instance) {
|
75
|
-
throw new DetoxInternalError(`Cannot mark an unknown instance ${uuid} as free`);
|
76
|
-
}
|
77
|
-
|
78
|
-
this._busyInstances.delete(uuid);
|
79
|
-
this._freeInstances.set(uuid, instance);
|
80
|
-
return instance;
|
81
|
-
}
|
82
|
-
|
83
|
-
findFreeInstance(recipe) {
|
84
|
-
for (const instance of this._freeInstances.values()) {
|
85
|
-
const aRecipe = this._recipes.get(instance.uuid);
|
86
|
-
if (recipe.uuid === aRecipe.uuid) {
|
87
|
-
return this.markAsBusy(instance);
|
88
|
-
}
|
89
|
-
}
|
90
|
-
}
|
91
|
-
}
|
92
|
-
|
93
|
-
module.exports = GenyRegistry;
|
package/src/devices/allocation/drivers/android/genycloud/services/GenyInstanceLifecycleService.js
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
const Instance = require('./dto/GenyInstance');
|
2
|
-
|
3
|
-
class GenyInstanceLifecycleService {
|
4
|
-
constructor(genyCloudExec) {
|
5
|
-
this._genyCloudExec = genyCloudExec;
|
6
|
-
}
|
7
|
-
|
8
|
-
async createInstance(recipeUUID, instanceName) {
|
9
|
-
const result = await this._genyCloudExec.startInstance(recipeUUID, instanceName);
|
10
|
-
return new Instance(result.instance);
|
11
|
-
}
|
12
|
-
|
13
|
-
async adbConnectInstance(instanceUUID) {
|
14
|
-
const result = (await this._genyCloudExec.adbConnect(instanceUUID));
|
15
|
-
return new Instance(result.instance);
|
16
|
-
}
|
17
|
-
|
18
|
-
async deleteInstance(instanceUUID) {
|
19
|
-
const result = await this._genyCloudExec.stopInstance(instanceUUID);
|
20
|
-
return new Instance(result.instance);
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
module.exports = GenyInstanceLifecycleService;
|
@@ -1,24 +0,0 @@
|
|
1
|
-
class SimulatorQuery {
|
2
|
-
/** @param {Partial<Detox.IosSimulatorQuery>} query */
|
3
|
-
constructor({ id, name, os, type }) {
|
4
|
-
if (id != null) this.byId = id;
|
5
|
-
if (name != null) this.byName = name;
|
6
|
-
if (os != null) this.byOS = os;
|
7
|
-
if (type != null) this.byType = type;
|
8
|
-
}
|
9
|
-
|
10
|
-
getDeviceComment() {
|
11
|
-
return this.byId || [this.byName, this.byType, this.byOS].filter(Boolean).join(', ');
|
12
|
-
}
|
13
|
-
|
14
|
-
toString() {
|
15
|
-
return [
|
16
|
-
this.byId && `by UDID = ${JSON.stringify(this.byId)}`,
|
17
|
-
this.byName && `by name = ${JSON.stringify(this.byName)}`,
|
18
|
-
this.byType && `by type = ${JSON.stringify(this.byType)}`,
|
19
|
-
this.byOS && `by OS = ${JSON.stringify(this.byOS)}`,
|
20
|
-
].filter(Boolean).join(' and ');
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
module.exports = SimulatorQuery;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
class GenycloudServiceLocator {
|
2
|
-
constructor() {
|
3
|
-
this._exec = null;
|
4
|
-
}
|
5
|
-
|
6
|
-
// Note: important to keep lazy because of implicit validations that are sensitive (inside environment, in particular).
|
7
|
-
get exec() {
|
8
|
-
if (!this._exec) {
|
9
|
-
const Exec = require('../../allocation/drivers/android/genycloud/exec/GenyCloudExec');
|
10
|
-
const environment = require('../../../utils/environment');
|
11
|
-
this._exec = new Exec(environment.getGmsaasPath());
|
12
|
-
}
|
13
|
-
return this._exec;
|
14
|
-
}
|
15
|
-
}
|
16
|
-
|
17
|
-
module.exports = new GenycloudServiceLocator();
|
@@ -1,23 +0,0 @@
|
|
1
|
-
const AndroidDevicePathBuilder = require('../../../artifacts/utils/AndroidDevicePathBuilder');
|
2
|
-
const AAPT = require('../../common/drivers/android/exec/AAPT');
|
3
|
-
const ADB = require('../../common/drivers/android/exec/ADB');
|
4
|
-
const ApkValidator = require('../../common/drivers/android/tools/ApkValidator');
|
5
|
-
const { TempFileTransfer } = require('../../common/drivers/android/tools/TempFileTransfer');
|
6
|
-
|
7
|
-
const AndroidServiceLocator = {
|
8
|
-
get emulator() {
|
9
|
-
return require('./emulatorServiceLocator');
|
10
|
-
},
|
11
|
-
|
12
|
-
get genycloud() {
|
13
|
-
return require('./genycloudServiceLocator');
|
14
|
-
},
|
15
|
-
};
|
16
|
-
|
17
|
-
AndroidServiceLocator.adb = new ADB();
|
18
|
-
AndroidServiceLocator.aapt = new AAPT();
|
19
|
-
AndroidServiceLocator.apkValidator = new ApkValidator(AndroidServiceLocator.aapt);
|
20
|
-
AndroidServiceLocator.fileTransfer = new TempFileTransfer(AndroidServiceLocator.adb);
|
21
|
-
AndroidServiceLocator.devicePathBuilder = new AndroidDevicePathBuilder();
|
22
|
-
|
23
|
-
module.exports = AndroidServiceLocator;
|
package/src/utils/PIDService.js
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
const { pid } = require('process');
|
2
|
-
|
3
|
-
class PIDService {
|
4
|
-
getPid() {
|
5
|
-
return pid;
|
6
|
-
}
|
7
|
-
|
8
|
-
/**
|
9
|
-
* Checks if the other process id is running in the current operating system
|
10
|
-
* @param {number} otherPID
|
11
|
-
* @returns {boolean}
|
12
|
-
*/
|
13
|
-
isAlive(otherPID) {
|
14
|
-
try {
|
15
|
-
process.kill(otherPID, 0);
|
16
|
-
return true;
|
17
|
-
} catch (ex) {
|
18
|
-
if (ex.code === 'ESRCH') {
|
19
|
-
return false;
|
20
|
-
}
|
21
|
-
throw ex;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
}
|
26
|
-
|
27
|
-
module.exports = PIDService;
|
File without changes
|
/package/src/devices/{allocation → common}/drivers/android/genycloud/services/GenyAuthService.js
RENAMED
File without changes
|
/package/src/devices/{allocation → common}/drivers/android/genycloud/services/dto/GenyRecipe.js
RENAMED
File without changes
|
File without changes
|