appium-webdriveragent 15.1.6 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/WebDriverAgentLib/Info.plist +2 -2
- package/build/lib/check-dependencies.d.ts +1 -1
- package/build/lib/check-dependencies.d.ts.map +1 -1
- package/build/lib/check-dependencies.js +12 -18
- package/build/lib/check-dependencies.js.map +1 -1
- package/build/lib/constants.js +13 -19
- package/build/lib/constants.js.map +1 -1
- package/build/lib/index.d.ts +6 -6
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +6 -32
- package/build/lib/index.js.map +1 -1
- package/build/lib/logger.js +2 -5
- package/build/lib/logger.js.map +1 -1
- package/build/lib/no-session-proxy.js +2 -6
- package/build/lib/no-session-proxy.js.map +1 -1
- package/build/lib/types.js +1 -2
- package/build/lib/utils/index.d.ts +6 -6
- package/build/lib/utils/index.d.ts.map +1 -1
- package/build/lib/utils/index.js +8 -22
- package/build/lib/utils/index.js.map +1 -1
- package/build/lib/utils/module.d.ts.map +1 -1
- package/build/lib/utils/module.js +9 -20
- package/build/lib/utils/module.js.map +1 -1
- package/build/lib/utils/platform.js +3 -6
- package/build/lib/utils/platform.js.map +1 -1
- package/build/lib/utils/processes.js +16 -21
- package/build/lib/utils/processes.js.map +1 -1
- package/build/lib/utils/security.js +7 -10
- package/build/lib/utils/security.js.map +1 -1
- package/build/lib/utils/xctestrun.d.ts +1 -1
- package/build/lib/utils/xctestrun.d.ts.map +1 -1
- package/build/lib/utils/xctestrun.js +24 -33
- package/build/lib/utils/xctestrun.js.map +1 -1
- package/build/lib/wda-strategies.d.ts +3 -3
- package/build/lib/wda-strategies.d.ts.map +1 -1
- package/build/lib/wda-strategies.js +14 -22
- package/build/lib/wda-strategies.js.map +1 -1
- package/build/lib/webdriveragent.d.ts +3 -8
- package/build/lib/webdriveragent.d.ts.map +1 -1
- package/build/lib/webdriveragent.js +44 -61
- package/build/lib/webdriveragent.js.map +1 -1
- package/build/lib/xcodebuild.d.ts +2 -2
- package/build/lib/xcodebuild.d.ts.map +1 -1
- package/build/lib/xcodebuild.js +26 -33
- package/build/lib/xcodebuild.js.map +1 -1
- package/lib/check-dependencies.ts +3 -3
- package/lib/index.ts +6 -6
- package/lib/utils/index.ts +7 -7
- package/lib/utils/module.ts +4 -7
- package/lib/utils/platform.ts +1 -1
- package/lib/utils/processes.ts +1 -1
- package/lib/utils/security.ts +1 -1
- package/lib/utils/xctestrun.ts +3 -3
- package/lib/wda-strategies.ts +4 -4
- package/lib/webdriveragent.ts +7 -18
- package/lib/xcodebuild.ts +10 -5
- package/package.json +12 -3
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
exports.setXctestrunFile = setXctestrunFile;
|
|
7
|
-
exports.getAdditionalRunContent = getAdditionalRunContent;
|
|
8
|
-
exports.getXctestrunFilePath = getXctestrunFilePath;
|
|
9
|
-
exports.getXctestrunFileName = getXctestrunFileName;
|
|
10
|
-
const support_1 = require("@appium/support");
|
|
11
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
-
const node_os_1 = require("node:os");
|
|
13
|
-
const logger_1 = require("../logger");
|
|
14
|
-
const platform_1 = require("./platform");
|
|
1
|
+
import { fs, plist, util } from '@appium/support';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { arch } from 'node:os';
|
|
4
|
+
import { log } from '../logger.js';
|
|
5
|
+
import { isTvOS } from './platform.js';
|
|
15
6
|
/**
|
|
16
7
|
* Creates xctestrun file per device & platform version.
|
|
17
8
|
* We expect to have WebDriverAgentRunner_iphoneos${sdkVersion|platformVersion}-arm64.xctestrun for real device
|
|
@@ -26,13 +17,13 @@ const platform_1 = require("./platform");
|
|
|
26
17
|
* or WebDriverAgentRunner_iphonesimulator${sdkVersion|platformVersion}-x86_64.xctestrun for simulator is not found @bootstrapPath,
|
|
27
18
|
* then it will throw a file not found exception
|
|
28
19
|
*/
|
|
29
|
-
async function setXctestrunFile(args) {
|
|
20
|
+
export async function setXctestrunFile(args) {
|
|
30
21
|
const { deviceInfo, sdkVersion, bootstrapPath, wdaRemotePort, wdaBindingIP, maxHttpRequestBodySize, } = args;
|
|
31
22
|
const xctestrunFilePath = await getXctestrunFilePath(deviceInfo, sdkVersion, bootstrapPath);
|
|
32
|
-
const xctestRunContent = await
|
|
23
|
+
const xctestRunContent = await plist.parsePlistFile(xctestrunFilePath);
|
|
33
24
|
const updateWDAPort = getAdditionalRunContent(deviceInfo.platformName, wdaRemotePort, wdaBindingIP, maxHttpRequestBodySize);
|
|
34
25
|
const newXctestRunContent = mergeObjects(xctestRunContent, updateWDAPort);
|
|
35
|
-
await
|
|
26
|
+
await plist.updatePlistFile(xctestrunFilePath, newXctestRunContent, true);
|
|
36
27
|
return xctestrunFilePath;
|
|
37
28
|
}
|
|
38
29
|
/**
|
|
@@ -43,8 +34,8 @@ async function setXctestrunFile(args) {
|
|
|
43
34
|
* @param maxHttpRequestBodySize - The maximum HTTP request body size in bytes.
|
|
44
35
|
* @return returns a runner object which has USE_PORT and optionally USE_IP
|
|
45
36
|
*/
|
|
46
|
-
function getAdditionalRunContent(platformName, wdaRemotePort, wdaBindingIP, maxHttpRequestBodySize) {
|
|
47
|
-
const runner = `WebDriverAgentRunner${
|
|
37
|
+
export function getAdditionalRunContent(platformName, wdaRemotePort, wdaBindingIP, maxHttpRequestBodySize) {
|
|
38
|
+
const runner = `WebDriverAgentRunner${isTvOS(platformName) ? '_tvOS' : ''}`;
|
|
48
39
|
return {
|
|
49
40
|
[runner]: {
|
|
50
41
|
EnvironmentVariables: {
|
|
@@ -64,34 +55,34 @@ function getAdditionalRunContent(platformName, wdaRemotePort, wdaBindingIP, maxH
|
|
|
64
55
|
* @param sdkVersion - The Xcode SDK version of OS.
|
|
65
56
|
* @param bootstrapPath - The folder path containing xctestrun file.
|
|
66
57
|
*/
|
|
67
|
-
async function getXctestrunFilePath(deviceInfo, sdkVersion, bootstrapPath) {
|
|
58
|
+
export async function getXctestrunFilePath(deviceInfo, sdkVersion, bootstrapPath) {
|
|
68
59
|
// First try the SDK path, for Xcode 10 (at least)
|
|
69
60
|
const sdkBased = [
|
|
70
|
-
|
|
61
|
+
path.resolve(bootstrapPath, `${deviceInfo.udid}_${sdkVersion}.xctestrun`),
|
|
71
62
|
sdkVersion,
|
|
72
63
|
];
|
|
73
64
|
// Next try Platform path, for earlier Xcode versions
|
|
74
65
|
const platformBased = [
|
|
75
|
-
|
|
66
|
+
path.resolve(bootstrapPath, `${deviceInfo.udid}_${deviceInfo.platformVersion}.xctestrun`),
|
|
76
67
|
deviceInfo.platformVersion,
|
|
77
68
|
];
|
|
78
69
|
for (const [filePath, version] of [sdkBased, platformBased]) {
|
|
79
|
-
if (await
|
|
80
|
-
|
|
70
|
+
if (await fs.exists(filePath)) {
|
|
71
|
+
log.info(`Using '${filePath}' as xctestrun file`);
|
|
81
72
|
return filePath;
|
|
82
73
|
}
|
|
83
|
-
const originalXctestrunFile =
|
|
84
|
-
if (await
|
|
74
|
+
const originalXctestrunFile = path.resolve(bootstrapPath, getXctestrunFileName(deviceInfo, version));
|
|
75
|
+
if (await fs.exists(originalXctestrunFile)) {
|
|
85
76
|
// If this is first time run for given device, then first generate xctestrun file for device.
|
|
86
77
|
// We need to have a xctestrun file **per device** because we cannot have same wda port for all devices.
|
|
87
|
-
await
|
|
88
|
-
|
|
78
|
+
await fs.copyFile(originalXctestrunFile, filePath);
|
|
79
|
+
log.info(`Using '${filePath}' as xctestrun file copied by '${originalXctestrunFile}'`);
|
|
89
80
|
return filePath;
|
|
90
81
|
}
|
|
91
82
|
}
|
|
92
83
|
throw new Error(`If you are using 'useXctestrunFile' capability then you ` +
|
|
93
84
|
`need to have a xctestrun file (expected: ` +
|
|
94
|
-
`'${
|
|
85
|
+
`'${path.resolve(bootstrapPath, getXctestrunFileName(deviceInfo, sdkVersion))}')`);
|
|
95
86
|
}
|
|
96
87
|
/**
|
|
97
88
|
* Return the name of xctestrun file
|
|
@@ -99,17 +90,17 @@ async function getXctestrunFilePath(deviceInfo, sdkVersion, bootstrapPath) {
|
|
|
99
90
|
* @param version - The Xcode SDK version of OS.
|
|
100
91
|
* @return returns xctestrunFilePath for given device
|
|
101
92
|
*/
|
|
102
|
-
function getXctestrunFileName(deviceInfo, version) {
|
|
93
|
+
export function getXctestrunFileName(deviceInfo, version) {
|
|
103
94
|
const archSuffix = deviceInfo.isRealDevice
|
|
104
95
|
? `os${version}-arm64`
|
|
105
|
-
: `simulator${version}-${
|
|
106
|
-
return `WebDriverAgentRunner_${
|
|
96
|
+
: `simulator${version}-${arch() === 'arm64' ? 'arm64' : 'x86_64'}`;
|
|
97
|
+
return `WebDriverAgentRunner_${isTvOS(deviceInfo.platformName) ? 'tvOS_appletv' : 'iphone'}${archSuffix}.xctestrun`;
|
|
107
98
|
}
|
|
108
99
|
function mergeObjects(target, source) {
|
|
109
100
|
const output = { ...target };
|
|
110
101
|
for (const [key, sourceValue] of Object.entries(source)) {
|
|
111
102
|
const targetValue = output[key];
|
|
112
|
-
if (
|
|
103
|
+
if (util.isPlainObject(targetValue) && util.isPlainObject(sourceValue)) {
|
|
113
104
|
output[key] = mergeObjects(targetValue, sourceValue);
|
|
114
105
|
continue;
|
|
115
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xctestrun.js","sourceRoot":"","sources":["../../../lib/utils/xctestrun.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xctestrun.js","sourceRoot":"","sources":["../../../lib/utils/xctestrun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,GAAG,EAAC,MAAM,cAAc,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,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,oBAAoB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,IAAI,CACpF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAsB,EAAE,OAAe;IAC1E,MAAM,UAAU,GAAG,UAAU,CAAC,YAAY;QACxC,CAAC,CAAC,KAAK,OAAO,QAAQ;QACtB,CAAC,CAAC,YAAY,OAAO,IAAI,IAAI,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IACrE,OAAO,wBAAwB,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,GAAG,UAAU,YAAY,CAAC;AACtH,CAAC;AAED,SAAS,YAAY,CACnB,MAAS,EACT,MAAS;IAET,MAAM,MAAM,GAAwB,EAAC,GAAG,MAAM,EAAC,CAAC;IAChD,KAAK,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACxD,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;YACvE,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YACrD,SAAS;QACX,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;IAC5B,CAAC;IACD,OAAO,MAAe,CAAC;AACzB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AppiumLogger, StringRecord } from '@appium/types';
|
|
2
|
-
import type { NoSessionProxy } from './no-session-proxy';
|
|
3
|
-
import type { XcodeBuild } from './xcodebuild';
|
|
4
|
-
import type { AppleDevice, RealDevicePreinstalledHostOps, RealDeviceXcodebuildHostOps, SimulatorHostOps, WdaHostOps, WdaStartupStrategyName } from './types';
|
|
2
|
+
import type { NoSessionProxy } from './no-session-proxy.js';
|
|
3
|
+
import type { XcodeBuild } from './xcodebuild.js';
|
|
4
|
+
import type { AppleDevice, RealDevicePreinstalledHostOps, RealDeviceXcodebuildHostOps, SimulatorHostOps, WdaHostOps, WdaStartupStrategyName } from './types.js';
|
|
5
5
|
export interface WdaStartupStrategy {
|
|
6
6
|
readonly name: WdaStartupStrategyName;
|
|
7
7
|
launch(sessionId: string): Promise<StringRecord | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wda-strategies.d.ts","sourceRoot":"","sources":["../../lib/wda-strategies.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAE9D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"wda-strategies.d.ts","sourceRoot":"","sources":["../../lib/wda-strategies.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAE9D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EACV,WAAW,EACX,6BAA6B,EAC7B,2BAA2B,EAC3B,gBAAgB,EAChB,UAAU,EAEV,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAMpB,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IACtC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IACxD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,MAAM,WAA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SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC5D,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,UAAU,IAAI,UAAU,CAAC;IACzB,cAAc,IAAI,cAAc,CAAC;IACjC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CACpC;AAsED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,GAAG,sBAAsB,CAWzB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,yBAAyB,GAAG,kBAAkB,CAkB3F;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,QAAQ,CAAC,UAAU,CAAC,CAM9D;AAED;;GAEG;AACH,wBAAgB,gCAAgC,IAAI,gBAAgB,CAYnE;AAED;;GAEG;AACH,wBAAgB,0CAA0C,IAAI,6BAA6B,CAS1F;AAED;;GAEG;AACH,wBAAgB,wCAAwC,IAAI,2BAA2B,CAkBtF"}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.createWdaStartupStrategy = createWdaStartupStrategy;
|
|
5
|
-
exports.createDefaultWdaHostOps = createDefaultWdaHostOps;
|
|
6
|
-
exports.createDefaultSimulatorWdaHostOps = createDefaultSimulatorWdaHostOps;
|
|
7
|
-
exports.createDefaultRealDevicePreinstalledHostOps = createDefaultRealDevicePreinstalledHostOps;
|
|
8
|
-
exports.createDefaultRealDeviceXcodebuildHostOps = createDefaultRealDeviceXcodebuildHostOps;
|
|
9
|
-
const teen_process_1 = require("teen_process");
|
|
10
|
-
const support_1 = require("@appium/support");
|
|
11
|
-
const utils_1 = require("./utils");
|
|
1
|
+
import { exec } from 'teen_process';
|
|
2
|
+
import { fs } from '@appium/support';
|
|
3
|
+
import { getPIDsListeningOnPort, resetTestProcesses } from './utils/index.js';
|
|
12
4
|
const WDA_AGENT_PORT = 8100;
|
|
13
5
|
const HOST_OPS_REQUIRED_MESSAGE = 'Host operations must be provided to launch or terminate preinstalled WebDriverAgent';
|
|
14
6
|
class ExistingWdaUrlStrategy {
|
|
@@ -76,7 +68,7 @@ class RealDevicePreinstalledStrategy {
|
|
|
76
68
|
/**
|
|
77
69
|
* Selects the WDA startup strategy for the provided launch arguments.
|
|
78
70
|
*/
|
|
79
|
-
function selectWdaStartupStrategyName(args) {
|
|
71
|
+
export function selectWdaStartupStrategyName(args) {
|
|
80
72
|
if (args.webDriverAgentUrl) {
|
|
81
73
|
return 'existing-url';
|
|
82
74
|
}
|
|
@@ -91,7 +83,7 @@ function selectWdaStartupStrategyName(args) {
|
|
|
91
83
|
/**
|
|
92
84
|
* Creates a WDA startup strategy for the current facade state.
|
|
93
85
|
*/
|
|
94
|
-
function createWdaStartupStrategy(ctx) {
|
|
86
|
+
export function createWdaStartupStrategy(ctx) {
|
|
95
87
|
const startupStrategy = selectWdaStartupStrategyName({
|
|
96
88
|
realDevice: ctx.isRealDevice,
|
|
97
89
|
webDriverAgentUrl: ctx.webDriverAgentUrl,
|
|
@@ -113,7 +105,7 @@ function createWdaStartupStrategy(ctx) {
|
|
|
113
105
|
/**
|
|
114
106
|
* Creates default host operations for flows the package can own directly.
|
|
115
107
|
*/
|
|
116
|
-
function createDefaultWdaHostOps() {
|
|
108
|
+
export function createDefaultWdaHostOps() {
|
|
117
109
|
return {
|
|
118
110
|
simulator: createDefaultSimulatorWdaHostOps(),
|
|
119
111
|
realDevicePreinstalled: createDefaultRealDevicePreinstalledHostOps(),
|
|
@@ -123,7 +115,7 @@ function createDefaultWdaHostOps() {
|
|
|
123
115
|
/**
|
|
124
116
|
* Creates default simulator host operations.
|
|
125
117
|
*/
|
|
126
|
-
function createDefaultSimulatorWdaHostOps() {
|
|
118
|
+
export function createDefaultSimulatorWdaHostOps() {
|
|
127
119
|
return {
|
|
128
120
|
async launchPreinstalled() {
|
|
129
121
|
throw new Error(HOST_OPS_REQUIRED_MESSAGE);
|
|
@@ -132,14 +124,14 @@ function createDefaultSimulatorWdaHostOps() {
|
|
|
132
124
|
throw new Error(HOST_OPS_REQUIRED_MESSAGE);
|
|
133
125
|
},
|
|
134
126
|
async resetTestProcesses({ udid, isSimulator }) {
|
|
135
|
-
await
|
|
127
|
+
await resetTestProcesses(udid, isSimulator);
|
|
136
128
|
},
|
|
137
129
|
};
|
|
138
130
|
}
|
|
139
131
|
/**
|
|
140
132
|
* Creates default real-device preinstalled host operations.
|
|
141
133
|
*/
|
|
142
|
-
function createDefaultRealDevicePreinstalledHostOps() {
|
|
134
|
+
export function createDefaultRealDevicePreinstalledHostOps() {
|
|
143
135
|
return {
|
|
144
136
|
async launchPreinstalled() {
|
|
145
137
|
throw new Error(HOST_OPS_REQUIRED_MESSAGE);
|
|
@@ -152,16 +144,16 @@ function createDefaultRealDevicePreinstalledHostOps() {
|
|
|
152
144
|
/**
|
|
153
145
|
* Creates default real-device xcodebuild host operations.
|
|
154
146
|
*/
|
|
155
|
-
function createDefaultRealDeviceXcodebuildHostOps() {
|
|
147
|
+
export function createDefaultRealDeviceXcodebuildHostOps() {
|
|
156
148
|
return {
|
|
157
149
|
async resetTestProcesses({ udid, isSimulator }) {
|
|
158
|
-
await
|
|
150
|
+
await resetTestProcesses(udid, isSimulator);
|
|
159
151
|
},
|
|
160
152
|
async cleanupObsoleteProcesses({ udid, port, commandLineIncludes }) {
|
|
161
|
-
const obsoletePids = await
|
|
153
|
+
const obsoletePids = await getPIDsListeningOnPort(port, (cmdLine) => cmdLine.includes(commandLineIncludes) &&
|
|
162
154
|
!cmdLine.toLowerCase().includes(udid.toLowerCase()));
|
|
163
155
|
if (obsoletePids.length > 0) {
|
|
164
|
-
await
|
|
156
|
+
await exec('kill', obsoletePids);
|
|
165
157
|
}
|
|
166
158
|
},
|
|
167
159
|
};
|
|
@@ -169,7 +161,7 @@ function createDefaultRealDeviceXcodebuildHostOps() {
|
|
|
169
161
|
async function launchWithXcodebuild(ctx, sessionId) {
|
|
170
162
|
ctx.log.info('Launching WebDriverAgent on the device');
|
|
171
163
|
ctx.setupProxies(sessionId);
|
|
172
|
-
if (!ctx.useXctestrunFile && !(await
|
|
164
|
+
if (!ctx.useXctestrunFile && !(await fs.exists(ctx.agentPath))) {
|
|
173
165
|
throw new Error(`Trying to use WebDriverAgent project at '${ctx.agentPath}' but the ` + 'file does not exist');
|
|
174
166
|
}
|
|
175
167
|
if (ctx.useXctestrunFile || ctx.usePrebuiltWDA) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wda-strategies.js","sourceRoot":"","sources":["../../lib/wda-strategies.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wda-strategies.js","sourceRoot":"","sources":["../../lib/wda-strategies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAC,EAAE,EAAC,MAAM,iBAAiB,CAAC;AAEnC,OAAO,EAAC,sBAAsB,EAAE,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAa5E,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,MAAM,yBAAyB,GAC7B,qFAAqF,CAAC;AAwCxF,MAAM,sBAAsB;IAGG;IAFpB,IAAI,GAAG,cAAuB,CAAC;IAExC,YAA6B,GAA8B;QAA9B,QAAG,GAAH,GAAG,CAA2B;IAAG,CAAC;IAE/D,KAAK,CAAC,MAAM,CAAC,SAAiB;QAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,qCAAqC,IAAI,CAAC,GAAG,CAAC,iBAAiB,GAAG,CAAC,CAAC;QACtF,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,iBAA2B,CAAC,CAAC;QACtD,IA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ACpE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { JWProxy } from '@appium/base-driver';
|
|
2
2
|
import type { AppiumLogger, StringRecord } from '@appium/types';
|
|
3
|
-
import { NoSessionProxy } from './no-session-proxy';
|
|
4
|
-
import { XcodeBuild } from './xcodebuild';
|
|
5
|
-
import type { WebDriverAgentArgs, AppleDevice, XcodeBuildSettings, RetrieveBuildSettingsOptions } from './types';
|
|
3
|
+
import { NoSessionProxy } from './no-session-proxy.js';
|
|
4
|
+
import { XcodeBuild } from './xcodebuild.js';
|
|
5
|
+
import type { WebDriverAgentArgs, AppleDevice, XcodeBuildSettings, RetrieveBuildSettingsOptions } from './types.js';
|
|
6
6
|
export declare class WebDriverAgent {
|
|
7
7
|
bootstrapPath: string;
|
|
8
8
|
agentPath: string;
|
|
@@ -137,11 +137,6 @@ export declare class WebDriverAgent {
|
|
|
137
137
|
* @returns Build settings, or `undefined` if xcodebuild is skipped or settings cannot be determined
|
|
138
138
|
*/
|
|
139
139
|
retrieveBuildSettings(options?: RetrieveBuildSettingsOptions): Promise<XcodeBuildSettings | undefined>;
|
|
140
|
-
/**
|
|
141
|
-
* @deprecated Use {@link retrieveBuildSettings} instead. Will be removed in a future release.
|
|
142
|
-
* @returns The derived data path, or `undefined` if xcodebuild is skipped
|
|
143
|
-
*/
|
|
144
|
-
retrieveDerivedDataPath(): Promise<string | undefined>;
|
|
145
140
|
/**
|
|
146
141
|
* Reuse running WDA if it has the same bundle id with updatedWDABundleId.
|
|
147
142
|
* Or reuse it if it has the default id without updatedWDABundleId.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webdriveragent.d.ts","sourceRoot":"","sources":["../../lib/webdriveragent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,eAAe,CA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AAI,OAAO,CAAC,IAAI,CAAC;IAY/C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAO7D;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IAOvC;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB3B;;;;OAIG;IACG,qBAAqB,CACzB,OAAO,CAAC,EAAE,4BAA4B,GACrC,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAO1C;;;;;OAKG;IACG,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAyDjD,OAAO,CAAC,qBAAqB;IAoD7B,OAAO,CAAC,YAAY;IAsBpB,OAAO,CAAC,KAAK;IAYb,OAAO,CAAC,WAAW;IAWnB;;;;;;;;;;;;;;;;;;;;OAoBG;YACW,SAAS;YAoDT,sBAAsB;CAkErC"}
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const utils_1 = require("./utils");
|
|
14
|
-
const xcodebuild_1 = require("./xcodebuild");
|
|
15
|
-
const async_lock_1 = __importDefault(require("async-lock"));
|
|
16
|
-
const constants_1 = require("./constants");
|
|
17
|
-
const strongbox_1 = require("@appium/strongbox");
|
|
18
|
-
const wda_strategies_1 = require("./wda-strategies");
|
|
1
|
+
import { waitForCondition } from 'asyncbox';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { JWProxy } from '@appium/base-driver';
|
|
4
|
+
import { fs, util } from '@appium/support';
|
|
5
|
+
import { log as defaultLogger } from './logger.js';
|
|
6
|
+
import { NoSessionProxy } from './no-session-proxy.js';
|
|
7
|
+
import { BOOTSTRAP_PATH, getWDAUpgradeTimestamp } from './utils/index.js';
|
|
8
|
+
import { XcodeBuild } from './xcodebuild.js';
|
|
9
|
+
import AsyncLock from 'async-lock';
|
|
10
|
+
import { WDA_RUNNER_BUNDLE_ID, WDA_BASE_URL, WDA_UPGRADE_TIMESTAMP_PATH, DEFAULT_TEST_BUNDLE_SUFFIX, } from './constants.js';
|
|
11
|
+
import { strongbox } from '@appium/strongbox';
|
|
12
|
+
import { createDefaultWdaHostOps, createWdaStartupStrategy, } from './wda-strategies.js';
|
|
19
13
|
const WDA_LAUNCH_TIMEOUT = 60 * 1000;
|
|
20
14
|
const WDA_AGENT_PORT = 8100;
|
|
21
|
-
const SHARED_RESOURCES_GUARD = new
|
|
15
|
+
const SHARED_RESOURCES_GUARD = new AsyncLock();
|
|
22
16
|
const RECENT_MODULE_VERSION_ITEM_NAME = 'recentWdaModuleVersion';
|
|
23
17
|
const URL_PROTOCOL_SEPARATOR = '://';
|
|
24
|
-
class WebDriverAgent {
|
|
18
|
+
export class WebDriverAgent {
|
|
25
19
|
bootstrapPath;
|
|
26
20
|
agentPath;
|
|
27
21
|
args;
|
|
@@ -62,7 +56,7 @@ class WebDriverAgent {
|
|
|
62
56
|
*/
|
|
63
57
|
constructor(args, log = null) {
|
|
64
58
|
this.args = { ...args };
|
|
65
|
-
this.log = log ??
|
|
59
|
+
this.log = log ?? defaultLogger;
|
|
66
60
|
this.device = args.device;
|
|
67
61
|
this.platformVersion = args.platformVersion;
|
|
68
62
|
this.platformName = args.platformName;
|
|
@@ -73,7 +67,7 @@ class WebDriverAgent {
|
|
|
73
67
|
this.wdaLocalPort = args.wdaLocalPort;
|
|
74
68
|
this.wdaRemotePort =
|
|
75
69
|
((this.isRealDevice ? args.wdaRemotePort : null) ?? args.wdaLocalPort) || WDA_AGENT_PORT;
|
|
76
|
-
this.wdaBaseUrl = args.wdaBaseUrl ||
|
|
70
|
+
this.wdaBaseUrl = args.wdaBaseUrl || WDA_BASE_URL;
|
|
77
71
|
this.wdaBindingIP = args.wdaBindingIP;
|
|
78
72
|
this.prebuildWDA = args.prebuildWDA;
|
|
79
73
|
// this.args.webDriverAgentUrl guiarantees the capabilities acually
|
|
@@ -89,8 +83,8 @@ class WebDriverAgent {
|
|
|
89
83
|
this.updatedWDABundleId = args.updatedWDABundleId;
|
|
90
84
|
this.wdaLaunchTimeout = args.wdaLaunchTimeout || WDA_LAUNCH_TIMEOUT;
|
|
91
85
|
this.usePreinstalledWDA = args.usePreinstalledWDA;
|
|
92
|
-
this.updatedWDABundleIdSuffix = args.updatedWDABundleIdSuffix ??
|
|
93
|
-
const defaultHostOps =
|
|
86
|
+
this.updatedWDABundleIdSuffix = args.updatedWDABundleIdSuffix ?? DEFAULT_TEST_BUNDLE_SUFFIX;
|
|
87
|
+
const defaultHostOps = createDefaultWdaHostOps();
|
|
94
88
|
this.hostOps = {
|
|
95
89
|
simulator: {
|
|
96
90
|
...defaultHostOps.simulator,
|
|
@@ -107,7 +101,7 @@ class WebDriverAgent {
|
|
|
107
101
|
};
|
|
108
102
|
this._xcodebuild = this.canSkipXcodebuild
|
|
109
103
|
? null
|
|
110
|
-
: new
|
|
104
|
+
: new XcodeBuild(this.device, {
|
|
111
105
|
platformVersion: this.platformVersion,
|
|
112
106
|
platformName: this.platformName,
|
|
113
107
|
iosSdkVersion: this.iosSdkVersion,
|
|
@@ -164,7 +158,7 @@ class WebDriverAgent {
|
|
|
164
158
|
* @returns Bundle ID for Xctest.
|
|
165
159
|
*/
|
|
166
160
|
get bundleIdForXctest() {
|
|
167
|
-
return `${this.updatedWDABundleId ? this.updatedWDABundleId :
|
|
161
|
+
return `${this.updatedWDABundleId ? this.updatedWDABundleId : WDA_RUNNER_BUNDLE_ID}${this.updatedWDABundleIdSuffix}`;
|
|
168
162
|
}
|
|
169
163
|
/**
|
|
170
164
|
* Gets the base path for the WebDriverAgent URL.
|
|
@@ -189,7 +183,7 @@ class WebDriverAgent {
|
|
|
189
183
|
}
|
|
190
184
|
else {
|
|
191
185
|
const port = this.wdaLocalPort || WDA_AGENT_PORT;
|
|
192
|
-
const parsedBaseUrl = this.toUrl(this.wdaBaseUrl ||
|
|
186
|
+
const parsedBaseUrl = this.toUrl(this.wdaBaseUrl || WDA_BASE_URL);
|
|
193
187
|
this._url = new URL(`${parsedBaseUrl.protocol}//${this.wdaBindingIP || parsedBaseUrl.hostname}:${port}`);
|
|
194
188
|
}
|
|
195
189
|
}
|
|
@@ -268,7 +262,7 @@ class WebDriverAgent {
|
|
|
268
262
|
* @returns `true` if source is fresh (all required files exist), `false` otherwise
|
|
269
263
|
*/
|
|
270
264
|
async isSourceFresh() {
|
|
271
|
-
const existsPromises = ['Resources',
|
|
265
|
+
const existsPromises = ['Resources', path.join('Resources', 'WebDriverAgent.bundle')].map((subPath) => fs.exists(path.resolve(this.bootstrapPath, subPath)));
|
|
272
266
|
return (await Promise.all(existsPromises)).every((v) => v === true);
|
|
273
267
|
}
|
|
274
268
|
/**
|
|
@@ -299,16 +293,6 @@ class WebDriverAgent {
|
|
|
299
293
|
}
|
|
300
294
|
return await this.xcodebuild.retrieveBuildSettings(options);
|
|
301
295
|
}
|
|
302
|
-
/**
|
|
303
|
-
* @deprecated Use {@link retrieveBuildSettings} instead. Will be removed in a future release.
|
|
304
|
-
* @returns The derived data path, or `undefined` if xcodebuild is skipped
|
|
305
|
-
*/
|
|
306
|
-
async retrieveDerivedDataPath() {
|
|
307
|
-
if (this.canSkipXcodebuild) {
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
return await this.xcodebuild.retrieveDerivedDataPath();
|
|
311
|
-
}
|
|
312
296
|
/**
|
|
313
297
|
* Reuse running WDA if it has the same bundle id with updatedWDABundleId.
|
|
314
298
|
* Or reuse it if it has the default id without updatedWDABundleId.
|
|
@@ -323,20 +307,20 @@ class WebDriverAgent {
|
|
|
323
307
|
}
|
|
324
308
|
const { productBundleIdentifier, upgradedAt } = status.build;
|
|
325
309
|
// for real device
|
|
326
|
-
if (
|
|
327
|
-
|
|
310
|
+
if (util.hasValue(productBundleIdentifier) &&
|
|
311
|
+
util.hasValue(this.updatedWDABundleId) &&
|
|
328
312
|
this.updatedWDABundleId !== productBundleIdentifier) {
|
|
329
313
|
this.log.info(`Will not reuse running WDA since it has different bundle id. The actual value is '${productBundleIdentifier}'.`);
|
|
330
314
|
return undefined;
|
|
331
315
|
}
|
|
332
316
|
// for simulator
|
|
333
|
-
if (
|
|
334
|
-
!
|
|
335
|
-
|
|
336
|
-
this.log.info(`Will not reuse running WDA since its bundle id is not equal to the default value ${
|
|
317
|
+
if (util.hasValue(productBundleIdentifier) &&
|
|
318
|
+
!util.hasValue(this.updatedWDABundleId) &&
|
|
319
|
+
WDA_RUNNER_BUNDLE_ID !== productBundleIdentifier) {
|
|
320
|
+
this.log.info(`Will not reuse running WDA since its bundle id is not equal to the default value ${WDA_RUNNER_BUNDLE_ID}`);
|
|
337
321
|
return undefined;
|
|
338
322
|
}
|
|
339
|
-
const actualUpgradeTimestamp = await
|
|
323
|
+
const actualUpgradeTimestamp = await getWDAUpgradeTimestamp();
|
|
340
324
|
this.log.debug(`Upgrade timestamp of the currently bundled WDA: ${actualUpgradeTimestamp}`);
|
|
341
325
|
this.log.debug(`Upgrade timestamp of the WDA on the device: ${upgradedAt}`);
|
|
342
326
|
if (actualUpgradeTimestamp &&
|
|
@@ -347,7 +331,7 @@ class WebDriverAgent {
|
|
|
347
331
|
return undefined;
|
|
348
332
|
}
|
|
349
333
|
const cachedUrl = this.url.href;
|
|
350
|
-
const message =
|
|
334
|
+
const message = util.hasValue(productBundleIdentifier)
|
|
351
335
|
? `Will reuse previously cached WDA instance at '${cachedUrl}' with '${productBundleIdentifier}'`
|
|
352
336
|
: `Will reuse previously cached WDA instance at '${cachedUrl}'`;
|
|
353
337
|
this.log.info(`${message}. Set the wdaLocalPort capability to a value different from ${this.url.port} if this is an undesired behavior.`);
|
|
@@ -386,7 +370,7 @@ class WebDriverAgent {
|
|
|
386
370
|
setupProxies: (sessionId) => this.setupProxies(sessionId),
|
|
387
371
|
getStatus: async (timeoutMs) => await this.getStatus(timeoutMs),
|
|
388
372
|
cleanupProjectIfFresh: async () => {
|
|
389
|
-
const synchronizationKey =
|
|
373
|
+
const synchronizationKey = path.normalize(this.bootstrapPath);
|
|
390
374
|
await SHARED_RESOURCES_GUARD.acquire(synchronizationKey, async () => await this._cleanupProjectIfFresh());
|
|
391
375
|
},
|
|
392
376
|
xcodebuild: () => this.xcodebuild,
|
|
@@ -400,7 +384,7 @@ class WebDriverAgent {
|
|
|
400
384
|
this.started = started;
|
|
401
385
|
},
|
|
402
386
|
};
|
|
403
|
-
return
|
|
387
|
+
return createWdaStartupStrategy(context);
|
|
404
388
|
}
|
|
405
389
|
setupProxies(sessionId) {
|
|
406
390
|
const proxyOpts = {
|
|
@@ -416,10 +400,10 @@ class WebDriverAgent {
|
|
|
416
400
|
if (this.args.reqBasePath) {
|
|
417
401
|
proxyOpts.reqBasePath = this.args.reqBasePath;
|
|
418
402
|
}
|
|
419
|
-
this.jwproxy = new
|
|
403
|
+
this.jwproxy = new JWProxy(proxyOpts);
|
|
420
404
|
this.jwproxy.sessionId = sessionId;
|
|
421
405
|
this.proxyReqRes = this.jwproxy.proxyReqRes.bind(this.jwproxy);
|
|
422
|
-
this.noSessionProxy = new
|
|
406
|
+
this.noSessionProxy = new NoSessionProxy(proxyOpts);
|
|
423
407
|
}
|
|
424
408
|
toUrl(value) {
|
|
425
409
|
// Treat values without `://` as host/path inputs and normalize to http.
|
|
@@ -436,10 +420,10 @@ class WebDriverAgent {
|
|
|
436
420
|
setWDAPaths(bootstrapPath, agentPath) {
|
|
437
421
|
// allow the user to specify a place for WDA. This is undocumented and
|
|
438
422
|
// only here for the purposes of testing development of WDA
|
|
439
|
-
this.bootstrapPath = bootstrapPath ||
|
|
423
|
+
this.bootstrapPath = bootstrapPath || BOOTSTRAP_PATH;
|
|
440
424
|
this.log.info(`Using WDA path: '${this.bootstrapPath}'`);
|
|
441
425
|
// for backward compatibility we need to be able to specify agentPath too
|
|
442
|
-
this.agentPath = agentPath ||
|
|
426
|
+
this.agentPath = agentPath || path.resolve(this.bootstrapPath, 'WebDriverAgent.xcodeproj');
|
|
443
427
|
this.log.info(`Using WDA agent: '${this.agentPath}'`);
|
|
444
428
|
}
|
|
445
429
|
/**
|
|
@@ -464,7 +448,7 @@ class WebDriverAgent {
|
|
|
464
448
|
* @param timeoutMs If zero or negative, returns immediately. Otherwise, waits up to timeoutMs.
|
|
465
449
|
*/
|
|
466
450
|
async getStatus(timeoutMs = 0) {
|
|
467
|
-
const noSessionProxy = new
|
|
451
|
+
const noSessionProxy = new NoSessionProxy({
|
|
468
452
|
scheme: this.url.protocol ? this.url.protocol.replace(':', '') : 'http',
|
|
469
453
|
server: this.url.hostname ?? undefined,
|
|
470
454
|
port: parseInt(this.url.port ?? '', 10) || undefined,
|
|
@@ -485,7 +469,7 @@ class WebDriverAgent {
|
|
|
485
469
|
let lastError = null;
|
|
486
470
|
let status = null;
|
|
487
471
|
try {
|
|
488
|
-
await
|
|
472
|
+
await waitForCondition(async () => {
|
|
489
473
|
try {
|
|
490
474
|
status = await sendGetStatus();
|
|
491
475
|
return true;
|
|
@@ -510,12 +494,12 @@ class WebDriverAgent {
|
|
|
510
494
|
if (this.canSkipXcodebuild) {
|
|
511
495
|
return;
|
|
512
496
|
}
|
|
513
|
-
const packageInfo = JSON.parse(await
|
|
514
|
-
const box =
|
|
497
|
+
const packageInfo = JSON.parse(await fs.readFile(path.join(BOOTSTRAP_PATH, 'package.json'), 'utf8'));
|
|
498
|
+
const box = strongbox(packageInfo.name);
|
|
515
499
|
let boxItem = box.getItem(RECENT_MODULE_VERSION_ITEM_NAME);
|
|
516
500
|
if (!boxItem) {
|
|
517
|
-
const timestampPath =
|
|
518
|
-
if (await
|
|
501
|
+
const timestampPath = path.resolve(process.env.HOME ?? '', WDA_UPGRADE_TIMESTAMP_PATH);
|
|
502
|
+
if (await fs.exists(timestampPath)) {
|
|
519
503
|
// TODO: It is probably a bit ugly to hardcode the recent version string,
|
|
520
504
|
// TODO: hovewer it should do the job as a temporary transition trick
|
|
521
505
|
// TODO: to switch from a hardcoded file path to the strongbox usage.
|
|
@@ -540,7 +524,7 @@ class WebDriverAgent {
|
|
|
540
524
|
}
|
|
541
525
|
let recentModuleVersion = await boxItem.read();
|
|
542
526
|
try {
|
|
543
|
-
recentModuleVersion =
|
|
527
|
+
recentModuleVersion = util.coerceVersion(recentModuleVersion, true);
|
|
544
528
|
}
|
|
545
529
|
catch (e) {
|
|
546
530
|
this.log.warn(`The persisted module version string has been damaged: ${e.message}`);
|
|
@@ -548,7 +532,7 @@ class WebDriverAgent {
|
|
|
548
532
|
await boxItem.write(packageInfo.version);
|
|
549
533
|
return;
|
|
550
534
|
}
|
|
551
|
-
if (
|
|
535
|
+
if (util.compareVersions(recentModuleVersion, '>=', packageInfo.version)) {
|
|
552
536
|
this.log.info(`WebDriverAgent does not need a cleanup. The project sources are up to date ` +
|
|
553
537
|
`(${recentModuleVersion} >= ${packageInfo.version})`);
|
|
554
538
|
return;
|
|
@@ -564,5 +548,4 @@ class WebDriverAgent {
|
|
|
564
548
|
}
|
|
565
549
|
}
|
|
566
550
|
}
|
|
567
|
-
exports.WebDriverAgent = WebDriverAgent;
|
|
568
551
|
//# sourceMappingURL=webdriveragent.js.map
|