appium-espresso-driver 8.4.1 → 8.5.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 +6 -0
- package/build/lib/commands/app-install.d.ts +21 -0
- package/build/lib/commands/app-install.d.ts.map +1 -0
- package/build/lib/commands/app-install.js +157 -0
- package/build/lib/commands/app-install.js.map +1 -0
- package/build/lib/commands/app.d.ts +8 -0
- package/build/lib/commands/app.d.ts.map +1 -0
- package/build/lib/commands/app.js +11 -0
- package/build/lib/commands/app.js.map +1 -0
- package/build/lib/{server-builder.d.ts → commands/server/builder.d.ts} +10 -1
- package/build/lib/commands/server/builder.d.ts.map +1 -0
- package/build/lib/{server-builder.js → commands/server/builder.js} +24 -3
- package/build/lib/commands/server/builder.js.map +1 -0
- package/build/lib/commands/server/constants.d.ts +8 -0
- package/build/lib/commands/server/constants.d.ts.map +1 -0
- package/build/lib/commands/server/constants.js +11 -0
- package/build/lib/commands/server/constants.js.map +1 -0
- package/build/lib/commands/server/index.d.ts +5 -0
- package/build/lib/commands/server/index.d.ts.map +1 -0
- package/build/lib/commands/server/index.js +17 -0
- package/build/lib/commands/server/index.js.map +1 -0
- package/build/lib/{espresso-runner.d.ts → commands/server/runner.d.ts} +8 -3
- package/build/lib/commands/server/runner.d.ts.map +1 -0
- package/build/lib/{espresso-runner.js → commands/server/runner.js} +61 -27
- package/build/lib/commands/server/runner.js.map +1 -0
- package/build/lib/commands/server/startup.d.ts +18 -0
- package/build/lib/commands/server/startup.d.ts.map +1 -0
- package/build/lib/commands/server/startup.js +179 -0
- package/build/lib/commands/server/startup.js.map +1 -0
- package/build/lib/driver.d.ts +10 -16
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +51 -319
- package/build/lib/driver.js.map +1 -1
- package/build/lib/utils/app.d.ts +0 -7
- package/build/lib/utils/app.d.ts.map +1 -1
- package/build/lib/utils/app.js +0 -8
- package/build/lib/utils/app.js.map +1 -1
- package/build/lib/utils/index.d.ts +0 -1
- package/build/lib/utils/index.d.ts.map +1 -1
- package/build/lib/utils/index.js +0 -1
- package/build/lib/utils/index.js.map +1 -1
- package/espresso-server/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk +0 -0
- package/espresso-server/buildSrc/.gradle/9.5.1/executionHistory/executionHistory.bin +0 -0
- package/espresso-server/buildSrc/.gradle/9.5.1/executionHistory/executionHistory.lock +0 -0
- package/espresso-server/buildSrc/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/espresso-server/buildSrc/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/espresso-server/buildSrc/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/espresso-server/buildSrc/.gradle/file-system.probe +0 -0
- package/espresso-server/buildSrc/build/kotlin/compileKotlin/cacheable/last-build.bin +0 -0
- package/espresso-server/library/src/main/java/io/appium/espressoserver/lib/helpers/Version.kt +1 -1
- package/lib/commands/app-install.ts +177 -0
- package/lib/commands/app.ts +14 -0
- package/lib/{server-builder.ts → commands/server/builder.ts} +31 -1
- package/lib/commands/server/constants.ts +11 -0
- package/lib/commands/server/index.ts +11 -0
- package/lib/{espresso-runner.ts → commands/server/runner.ts} +56 -20
- package/lib/commands/server/startup.ts +193 -0
- package/lib/driver.ts +78 -392
- package/lib/utils/app.ts +0 -15
- package/lib/utils/index.ts +0 -1
- package/npm-shrinkwrap.json +89 -25
- package/package.json +1 -1
- package/scripts/build-espresso.mjs +1 -1
- package/build/lib/espresso-runner.d.ts.map +0 -1
- package/build/lib/espresso-runner.js.map +0 -1
- package/build/lib/server-builder.d.ts.map +0 -1
- package/build/lib/server-builder.js.map +0 -1
- package/build/lib/utils/gradle.d.ts +0 -17
- package/build/lib/utils/gradle.d.ts.map +0 -1
- package/build/lib/utils/gradle.js +0 -55
- package/build/lib/utils/gradle.js.map +0 -1
- package/lib/utils/gradle.ts +0 -62
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [8.5.0](https://github.com/appium/appium-espresso-driver/compare/v8.4.1...v8.5.0) (2026-05-20)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* Refactor driver methods into focused domain modules ([#1162](https://github.com/appium/appium-espresso-driver/issues/1162)) ([aa74a0d](https://github.com/appium/appium-espresso-driver/commit/aa74a0d06b181472387bfd42c3a32f23b5f68988))
|
|
6
|
+
|
|
1
7
|
## [8.4.1](https://github.com/appium/appium-espresso-driver/compare/v8.4.0...v8.4.1) (2026-05-12)
|
|
2
8
|
|
|
3
9
|
### Miscellaneous Chores
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PostProcessOptions, PostProcessResult } from '@appium/types';
|
|
2
|
+
import type { EspressoDriver } from '../driver';
|
|
3
|
+
export declare const APK_EXT = ".apk";
|
|
4
|
+
export declare const AAB_EXT = ".aab";
|
|
5
|
+
export declare const SUPPORTED_EXTENSIONS: string[];
|
|
6
|
+
/** Whether the session targets an app already installed on the device (no app path). */
|
|
7
|
+
export declare function isAppOnDevice(driver: EspressoDriver): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Unzip the given app path and return the first package that has SUPPORTED_EXTENSIONS
|
|
10
|
+
* in the archived file.
|
|
11
|
+
*
|
|
12
|
+
* @param appPath The path to app file.
|
|
13
|
+
* @returns The path to an unzipped app file path.
|
|
14
|
+
* @throws If the zip did not have any SUPPORTED_EXTENSIONS packages.
|
|
15
|
+
*/
|
|
16
|
+
export declare function unzipApp(this: EspressoDriver, appPath: string): Promise<string>;
|
|
17
|
+
/** Post-processes configured apps and reuses a valid cache entry when possible. */
|
|
18
|
+
export declare function onPostConfigureApp(this: EspressoDriver, opts: PostProcessOptions): Promise<PostProcessResult | undefined>;
|
|
19
|
+
/** Prepare the application under test on the device. */
|
|
20
|
+
export declare function initAUT(this: EspressoDriver): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=app-install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-install.d.ts","sourceRoot":"","sources":["../../../lib/commands/app-install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKzE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAI9C,eAAO,MAAM,OAAO,SAAS,CAAC;AAC9B,eAAO,MAAM,OAAO,SAAS,CAAC;AAC9B,eAAO,MAAM,oBAAoB,UAAqB,CAAC;AAEvD,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAG7D;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBrF;AAED,mFAAmF;AACnF,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAiExC;AAED,wDAAwD;AACxD,wBAAsB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAoDjE"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SUPPORTED_EXTENSIONS = exports.AAB_EXT = exports.APK_EXT = void 0;
|
|
7
|
+
exports.isAppOnDevice = isAppOnDevice;
|
|
8
|
+
exports.unzipApp = unzipApp;
|
|
9
|
+
exports.onPostConfigureApp = onPostConfigureApp;
|
|
10
|
+
exports.initAUT = initAUT;
|
|
11
|
+
const appium_android_driver_1 = require("appium-android-driver");
|
|
12
|
+
const support_1 = require("appium/support");
|
|
13
|
+
const io_appium_settings_1 = require("io.appium.settings");
|
|
14
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
15
|
+
const app_1 = require("./app");
|
|
16
|
+
const server_1 = require("./server");
|
|
17
|
+
exports.APK_EXT = '.apk';
|
|
18
|
+
exports.AAB_EXT = '.aab';
|
|
19
|
+
exports.SUPPORTED_EXTENSIONS = [exports.APK_EXT, exports.AAB_EXT];
|
|
20
|
+
/** Whether the session targets an app already installed on the device (no app path). */
|
|
21
|
+
function isAppOnDevice(driver) {
|
|
22
|
+
const appPackage = driver.opts.appPackage;
|
|
23
|
+
return !driver.opts.app && !!appPackage && driver.helpers.isPackageOrBundle(appPackage);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Unzip the given app path and return the first package that has SUPPORTED_EXTENSIONS
|
|
27
|
+
* in the archived file.
|
|
28
|
+
*
|
|
29
|
+
* @param appPath The path to app file.
|
|
30
|
+
* @returns The path to an unzipped app file path.
|
|
31
|
+
* @throws If the zip did not have any SUPPORTED_EXTENSIONS packages.
|
|
32
|
+
*/
|
|
33
|
+
async function unzipApp(appPath) {
|
|
34
|
+
const useSystemUnzipEnv = process.env.APPIUM_PREFER_SYSTEM_UNZIP;
|
|
35
|
+
const useSystemUnzip = !useSystemUnzipEnv || !['0', 'false'].includes(useSystemUnzipEnv.toLowerCase());
|
|
36
|
+
const tmpRoot = await support_1.tempDir.openDir();
|
|
37
|
+
await support_1.zip.extractAllTo(appPath, tmpRoot, { useSystemUnzip });
|
|
38
|
+
const globPattern = `**/*.+(${exports.SUPPORTED_EXTENSIONS.map((ext) => ext.replace(/^\./, '')).join('|')})`;
|
|
39
|
+
const sortedBundleItems = (await support_1.fs.glob(globPattern, {
|
|
40
|
+
cwd: tmpRoot,
|
|
41
|
+
})).sort((a, b) => a.split(node_path_1.default.sep).length - b.split(node_path_1.default.sep).length);
|
|
42
|
+
if (sortedBundleItems.length === 0) {
|
|
43
|
+
throw this.log.errorWithException(`${this.opts.app} did not have any of '${exports.SUPPORTED_EXTENSIONS.join(', ')}' ` +
|
|
44
|
+
`extension packages. Please make sure the provided .zip archive contains at ` +
|
|
45
|
+
`least one valid application package.`);
|
|
46
|
+
}
|
|
47
|
+
const unzippedAppPath = node_path_1.default.join(tmpRoot, sortedBundleItems[0]);
|
|
48
|
+
this.log.debug(`'${unzippedAppPath}' is the unzipped file from '${appPath}'`);
|
|
49
|
+
return unzippedAppPath;
|
|
50
|
+
}
|
|
51
|
+
/** Post-processes configured apps and reuses a valid cache entry when possible. */
|
|
52
|
+
async function onPostConfigureApp(opts) {
|
|
53
|
+
const { cachedAppInfo, isUrl, appPath } = opts;
|
|
54
|
+
if (!appPath) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
const presignApp = async (appLocation) => {
|
|
58
|
+
if (this.opts.noSign) {
|
|
59
|
+
this.log.info('Skipping application signing because noSign capability is set to true. ' +
|
|
60
|
+
'Having the application under test with improper signature/non-signed will cause ' +
|
|
61
|
+
'Espresso automation startup failure.');
|
|
62
|
+
}
|
|
63
|
+
else if (!(await this.adb.checkApkCert(appLocation, ''))) {
|
|
64
|
+
await this.adb.sign(appLocation);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const hasApkExt = (p) => p.toLowerCase().endsWith(exports.APK_EXT);
|
|
68
|
+
const hasAabExt = (p) => p.toLowerCase().endsWith(exports.AAB_EXT);
|
|
69
|
+
const extractUniversalApk = async (shouldExtract, p) => shouldExtract ? p : await this.adb.extractUniversalApk(p);
|
|
70
|
+
let pathInCache = null;
|
|
71
|
+
let isResultAppPathAlreadyCached = false;
|
|
72
|
+
if ((0, app_1.isCachedAppInfo)(cachedAppInfo)) {
|
|
73
|
+
const packageHash = await support_1.fs.hash(appPath);
|
|
74
|
+
if (packageHash === cachedAppInfo.packageHash && (await support_1.fs.exists(cachedAppInfo.fullPath))) {
|
|
75
|
+
this.log.info(`Using '${cachedAppInfo.fullPath}' which is cached from '${appPath}'`);
|
|
76
|
+
isResultAppPathAlreadyCached = true;
|
|
77
|
+
pathInCache = cachedAppInfo.fullPath;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const isApk = hasApkExt(appPath);
|
|
81
|
+
const shouldResultAppPathBeCached = !isApk || (isApk && isUrl);
|
|
82
|
+
if (!isResultAppPathAlreadyCached) {
|
|
83
|
+
if (shouldResultAppPathBeCached) {
|
|
84
|
+
let unzippedAppPath;
|
|
85
|
+
let isUnzippedApk = false;
|
|
86
|
+
if (!(hasApkExt(appPath) || hasAabExt(appPath))) {
|
|
87
|
+
unzippedAppPath = await this.unzipApp(appPath);
|
|
88
|
+
isUnzippedApk = hasApkExt(unzippedAppPath);
|
|
89
|
+
}
|
|
90
|
+
pathInCache = unzippedAppPath
|
|
91
|
+
? await extractUniversalApk(isUnzippedApk, unzippedAppPath)
|
|
92
|
+
: await extractUniversalApk(isApk, appPath);
|
|
93
|
+
if (!isApk && isUrl) {
|
|
94
|
+
await support_1.fs.rimraf(appPath);
|
|
95
|
+
}
|
|
96
|
+
if (unzippedAppPath !== undefined && hasAabExt(unzippedAppPath)) {
|
|
97
|
+
await support_1.fs.rimraf(unzippedAppPath);
|
|
98
|
+
}
|
|
99
|
+
if (pathInCache == null) {
|
|
100
|
+
throw this.log.errorWithException('Expected a cached app path after post-processing');
|
|
101
|
+
}
|
|
102
|
+
await presignApp(pathInCache);
|
|
103
|
+
}
|
|
104
|
+
else if (isApk) {
|
|
105
|
+
await presignApp(appPath);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return shouldResultAppPathBeCached && pathInCache != null ? { appPath: pathInCache } : undefined;
|
|
109
|
+
}
|
|
110
|
+
/** Prepare the application under test on the device. */
|
|
111
|
+
async function initAUT() {
|
|
112
|
+
if (this.opts.uninstallOtherPackages) {
|
|
113
|
+
await this.uninstallOtherPackages(appium_android_driver_1.utils.parseArray(this.opts.uninstallOtherPackages), [
|
|
114
|
+
io_appium_settings_1.SETTINGS_HELPER_ID,
|
|
115
|
+
server_1.TEST_APK_PKG,
|
|
116
|
+
]);
|
|
117
|
+
}
|
|
118
|
+
if (!this.opts.app) {
|
|
119
|
+
if (this.opts.fullReset) {
|
|
120
|
+
throw this.log.errorWithException('Full reset requires an app capability, use fastReset if app is not provided');
|
|
121
|
+
}
|
|
122
|
+
this.log.debug('No app capability. Assuming it is already on the device');
|
|
123
|
+
if (this.opts.fastReset) {
|
|
124
|
+
await this.resetAUT();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const appPackage = this.opts.appPackage;
|
|
128
|
+
if (!appPackage) {
|
|
129
|
+
throw this.log.errorWithException('appPackage is required');
|
|
130
|
+
}
|
|
131
|
+
if (!this.opts.skipUninstall) {
|
|
132
|
+
await this.adb.uninstallApk(appPackage);
|
|
133
|
+
}
|
|
134
|
+
if (this.opts.app) {
|
|
135
|
+
await this.installAUT();
|
|
136
|
+
}
|
|
137
|
+
if (this.opts.skipServerInstallation) {
|
|
138
|
+
this.log.debug('skipServerInstallation capability is set. Not installig espresso-server');
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
await this.espresso.installTestApk();
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
await this.adb.addToDeviceIdleWhitelist(io_appium_settings_1.SETTINGS_HELPER_ID, server_1.TEST_APK_PKG);
|
|
145
|
+
}
|
|
146
|
+
catch (e) {
|
|
147
|
+
const stderr = typeof e === 'object' &&
|
|
148
|
+
e !== null &&
|
|
149
|
+
'stderr' in e &&
|
|
150
|
+
typeof e.stderr === 'string'
|
|
151
|
+
? e.stderr
|
|
152
|
+
: undefined;
|
|
153
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
154
|
+
this.log.warn(`Cannot add server packages to the Doze whitelist. Original error: ` + (stderr || message));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=app-install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-install.js","sourceRoot":"","sources":["../../../lib/commands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GAAG,CAAC,wBAAwB,CAAC,uCAAkB,EAAE,qBAAY,CAAC,CAAC;IAC5E,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QACpB,MAAM,MAAM,GACV,OAAO,CAAC,KAAK,QAAQ;YACrB,CAAC,KAAK,IAAI;YACV,QAAQ,IAAI,CAAC;YACb,OAAQ,CAAuB,CAAC,MAAM,KAAK,QAAQ;YACjD,CAAC,CAAE,CAAsB,CAAC,MAAM;YAChC,CAAC,CAAC,SAAS,CAAC;QAChB,MAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAI,CAAC,GAAG,CAAC,IAAI,CACX,oEAAoE,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,CAC3F,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CachedAppInfo } from '@appium/types';
|
|
2
|
+
/** Cached app entry with integrity path (narrower than {@link CachedAppInfo}). */
|
|
3
|
+
export type StrictCachedAppInfo = CachedAppInfo & {
|
|
4
|
+
fullPath: string;
|
|
5
|
+
};
|
|
6
|
+
/** Type guard for cached app metadata shape. */
|
|
7
|
+
export declare function isCachedAppInfo(value: unknown): value is StrictCachedAppInfo;
|
|
8
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../lib/commands/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAGjD,kFAAkF;AAClF,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAAC;AAErE,gDAAgD;AAChD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAM5E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isCachedAppInfo = isCachedAppInfo;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
/** Type guard for cached app metadata shape. */
|
|
6
|
+
function isCachedAppInfo(value) {
|
|
7
|
+
return ((0, utils_1.isPlainObject)(value) &&
|
|
8
|
+
typeof value.packageHash === 'string' &&
|
|
9
|
+
typeof value.fullPath === 'string');
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../lib/commands/app.ts"],"names":[],"mappings":";;AAOA,0CAMC;AAZD,oCAAuC;AAKvC,gDAAgD;AAChD,SAAgB,eAAe,CAAC,KAAc;IAC5C,OAAO,CACL,IAAA,qBAAa,EAAC,KAAK,CAAC;QACpB,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ;QACrC,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CACnC,CAAC;AACJ,CAAC"}
|
|
@@ -56,4 +56,13 @@ export declare class ServerBuilder {
|
|
|
56
56
|
* @returns Configuration consumed by the Gradle signing step.
|
|
57
57
|
*/
|
|
58
58
|
export declare function buildServerSigningConfig(args: BuildServerSigningConfigArgs): ServerSigningConfig;
|
|
59
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Insert Gradle dependency lines after a `// placeholder` marker in a Gradle file.
|
|
61
|
+
*
|
|
62
|
+
* @param originalContent - Full text of the Gradle configuration file.
|
|
63
|
+
* @param dependencyPlaceholder - Placeholder comment label to find (e.g. from build.gradle).
|
|
64
|
+
* @param dependencyLines - Dependency lines to insert (e.g. `implementation "..."`).
|
|
65
|
+
* @returns Updated file content, or the original string if the placeholder is missing.
|
|
66
|
+
*/
|
|
67
|
+
export declare function updateDependencyLines(originalContent: string, dependencyPlaceholder: string, dependencyLines: string[]): string;
|
|
68
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../../lib/commands/server/builder.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAIhD,eAAO,MAAM,mBAAmB,uEACsC,CAAC;AAMvE,eAAO,MAAM,YAAY,8NAcf,CAAC;AAEX,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,4BAA4B;IAC3C,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,0BAA0B;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAC;IACrC,iCAAiC,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9C;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,0BAA0B,CAAC;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC5C;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAU;IACzC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAyD;IACxF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAA6B;IAC5D,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAgB;IAC1D,OAAO,CAAC,QAAQ,CAAC,iCAAiC,CAAgB;IAClE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;gBAE7B,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,oBAAoB;IA0BnD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAW5B,OAAO,CAAC,UAAU;YA4CJ,uBAAuB;IAYrC,OAAO,CAAC,mBAAmB;YAOb,4BAA4B;YA0C5B,eAAe;CAmC9B;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,4BAA4B,GAAG,mBAAmB,CAQhG;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,MAAM,EACvB,qBAAqB,EAAE,MAAM,EAC7B,eAAe,EAAE,MAAM,EAAE,GACxB,MAAM,CAgBR"}
|
|
@@ -5,11 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ServerBuilder = exports.VERSION_KEYS = exports.GRADLE_URL_TEMPLATE = void 0;
|
|
7
7
|
exports.buildServerSigningConfig = buildServerSigningConfig;
|
|
8
|
+
exports.updateDependencyLines = updateDependencyLines;
|
|
8
9
|
const teen_process_1 = require("teen_process");
|
|
9
10
|
const support_1 = require("appium/support");
|
|
10
11
|
const node_path_1 = __importDefault(require("node:path"));
|
|
11
12
|
const node_os_1 = require("node:os");
|
|
12
|
-
const utils_1 = require("
|
|
13
|
+
const utils_1 = require("../../utils");
|
|
13
14
|
const GRADLE_VERSION_KEY = 'gradle';
|
|
14
15
|
const GRADLE_URL_PREFIX = 'distributionUrl=';
|
|
15
16
|
exports.GRADLE_URL_TEMPLATE = 'https\\://services.gradle.org/distributions/gradle-VERSION-all.zip';
|
|
@@ -150,7 +151,7 @@ class ServerBuilder {
|
|
|
150
151
|
continue;
|
|
151
152
|
}
|
|
152
153
|
this.log.info(`Adding the following ${propName} to build.gradle.kts: ${deps}`);
|
|
153
|
-
configuration =
|
|
154
|
+
configuration = updateDependencyLines(configuration, propName, deps);
|
|
154
155
|
}
|
|
155
156
|
await support_1.fs.writeFile(buildPath, configuration, 'utf8');
|
|
156
157
|
}
|
|
@@ -203,4 +204,24 @@ function buildServerSigningConfig(args) {
|
|
|
203
204
|
keyPassword: args.keyPassword,
|
|
204
205
|
};
|
|
205
206
|
}
|
|
206
|
-
|
|
207
|
+
/**
|
|
208
|
+
* Insert Gradle dependency lines after a `// placeholder` marker in a Gradle file.
|
|
209
|
+
*
|
|
210
|
+
* @param originalContent - Full text of the Gradle configuration file.
|
|
211
|
+
* @param dependencyPlaceholder - Placeholder comment label to find (e.g. from build.gradle).
|
|
212
|
+
* @param dependencyLines - Dependency lines to insert (e.g. `implementation "..."`).
|
|
213
|
+
* @returns Updated file content, or the original string if the placeholder is missing.
|
|
214
|
+
*/
|
|
215
|
+
function updateDependencyLines(originalContent, dependencyPlaceholder, dependencyLines) {
|
|
216
|
+
const configurationLines = originalContent.split('\n');
|
|
217
|
+
const searchRe = new RegExp(`^\\s*//\\s*\\b${(0, utils_1.escapeRegExp)(dependencyPlaceholder)}\\b`, 'm');
|
|
218
|
+
const placeholderIndex = configurationLines.findIndex((line) => searchRe.test(line));
|
|
219
|
+
if (placeholderIndex < 0) {
|
|
220
|
+
return originalContent;
|
|
221
|
+
}
|
|
222
|
+
const placeholderLine = configurationLines[placeholderIndex];
|
|
223
|
+
const indentLen = placeholderLine.length - placeholderLine.trimStart().length;
|
|
224
|
+
configurationLines.splice(placeholderIndex + 1, 0, ...dependencyLines.map((line) => `${' '.repeat(indentLen)}${line}`));
|
|
225
|
+
return configurationLines.join('\n');
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../../../lib/commands/server/builder.ts"],"names":[],"mappings":";;;;;;AAsQA,4DAQC;AAUD,sDAoBC;AA5SD,+CAAwC;AACxC,4CAA0C;AAC1C,0DAA6B;AAC7B,qCAA4B;AAC5B,uCAAyC;AAGzC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AACpC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAChC,QAAA,mBAAmB,GAC9B,oEAAoE,CAAC;AACvE,MAAM,qBAAqB,GAAG;IAC5B,2BAA2B;IAC3B,mCAAmC;CAC3B,CAAC;AAEE,QAAA,YAAY,GAAG;IAC1B,kBAAkB;IAClB,qBAAqB;IACrB,YAAY;IACZ,YAAY;IACZ,QAAQ;IACR,WAAW;IACX,QAAQ;IACR,qBAAqB;IACrB,qBAAqB;IACrB,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,mBAAmB;CACX,CAAC;AAoCX,MAAa,aAAa;IACP,GAAG,CAAe;IAClB,UAAU,CAAS;IACnB,aAAa,CAAW;IACxB,cAAc,CAAyD;IACvE,cAAc,CAAU;IACxB,aAAa,CAA8B;IAC3C,yBAAyB,GAAa,EAAE,CAAC;IACzC,iCAAiC,GAAa,EAAE,CAAC;IACjD,cAAc,CAAU;IAEzC,YAAY,GAAiB,EAAE,IAA0B;QACvD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QAExC,MAAM,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,IAAI,EAAE,CAAC;QACzD,IAAI,CAAC,cAAc,GAAG,kBAAkB,CAAC,cAAc,KAAK,KAAK,CAAC;QAElE,MA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CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,eAAuB,EACvB,qBAA6B,EAC7B,eAAyB;IAEzB,MAAM,kBAAkB,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,iBAAiB,IAAA,oBAAY,EAAC,qBAAqB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC5F,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACrF,IAAI,gBAAgB,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,MAAM,eAAe,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IAC7D,MAAM,SAAS,GAAG,eAAe,CAAC,MAAM,GAAG,eAAe,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC;IAC9E,kBAAkB,CAAC,MAAM,CACvB,gBAAgB,GAAG,CAAC,EACpB,CAAC,EACD,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,CAAC,CACpE,CAAC;IACF,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const TEST_APK_PKG = "io.appium.espressoserver.test";
|
|
2
|
+
export declare const ESPRESSO_SERVER_LAUNCH_TIMEOUT_MS = 45000;
|
|
3
|
+
export declare const TARGET_PACKAGE_CONTAINER = "/data/local/tmp/espresso.apppackage";
|
|
4
|
+
/** System port range used to communicate with the Espresso HTTP server on the device. */
|
|
5
|
+
export declare const SYSTEM_PORT_RANGE: number[];
|
|
6
|
+
/** Port the Espresso server listens on on the device (forwarded from {@link SYSTEM_PORT_RANGE}). */
|
|
7
|
+
export declare const DEVICE_PORT = 6791;
|
|
8
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../lib/commands/server/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,kCAAkC,CAAC;AAE5D,eAAO,MAAM,iCAAiC,QAAQ,CAAC;AAEvD,eAAO,MAAM,wBAAwB,wCAAwC,CAAC;AAE9E,yFAAyF;AACzF,eAAO,MAAM,iBAAiB,UAAe,CAAC;AAE9C,oGAAoG;AACpG,eAAO,MAAM,WAAW,OAAO,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEVICE_PORT = exports.SYSTEM_PORT_RANGE = exports.TARGET_PACKAGE_CONTAINER = exports.ESPRESSO_SERVER_LAUNCH_TIMEOUT_MS = exports.TEST_APK_PKG = void 0;
|
|
4
|
+
exports.TEST_APK_PKG = 'io.appium.espressoserver.test';
|
|
5
|
+
exports.ESPRESSO_SERVER_LAUNCH_TIMEOUT_MS = 45000;
|
|
6
|
+
exports.TARGET_PACKAGE_CONTAINER = '/data/local/tmp/espresso.apppackage';
|
|
7
|
+
/** System port range used to communicate with the Espresso HTTP server on the device. */
|
|
8
|
+
exports.SYSTEM_PORT_RANGE = [8300, 8399];
|
|
9
|
+
/** Port the Espresso server listens on on the device (forwarded from {@link SYSTEM_PORT_RANGE}). */
|
|
10
|
+
exports.DEVICE_PORT = 6791;
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../lib/commands/server/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG,+BAA+B,CAAC;AAE/C,QAAA,iCAAiC,GAAG,KAAK,CAAC;AAE1C,QAAA,wBAAwB,GAAG,qCAAqC,CAAC;AAE9E,yFAAyF;AAC5E,QAAA,iBAAiB,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAE9C,oGAAoG;AACvF,QAAA,WAAW,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { SYSTEM_PORT_RANGE, TEST_APK_PKG } from './constants';
|
|
2
|
+
export { ServerBuilder, buildServerSigningConfig, type BuildServerSigningConfigArgs, type EspressoBuildConfiguration, type ServerBuilderOptions, type ServerSigningConfig, } from './builder';
|
|
3
|
+
export { EspressoRunner, type EspressoRunnerOptions } from './runner';
|
|
4
|
+
export { initServer, removePortForward, startSession, teardown } from './startup';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/commands/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAC5D,OAAO,EACL,aAAa,EACb,wBAAwB,EACxB,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAC,cAAc,EAAE,KAAK,qBAAqB,EAAC,MAAM,UAAU,CAAC;AACpE,OAAO,EAAC,UAAU,EAAE,iBAAiB,EAAE,YAAY,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.teardown = exports.startSession = exports.removePortForward = exports.initServer = exports.EspressoRunner = exports.buildServerSigningConfig = exports.ServerBuilder = exports.TEST_APK_PKG = exports.SYSTEM_PORT_RANGE = void 0;
|
|
4
|
+
var constants_1 = require("./constants");
|
|
5
|
+
Object.defineProperty(exports, "SYSTEM_PORT_RANGE", { enumerable: true, get: function () { return constants_1.SYSTEM_PORT_RANGE; } });
|
|
6
|
+
Object.defineProperty(exports, "TEST_APK_PKG", { enumerable: true, get: function () { return constants_1.TEST_APK_PKG; } });
|
|
7
|
+
var builder_1 = require("./builder");
|
|
8
|
+
Object.defineProperty(exports, "ServerBuilder", { enumerable: true, get: function () { return builder_1.ServerBuilder; } });
|
|
9
|
+
Object.defineProperty(exports, "buildServerSigningConfig", { enumerable: true, get: function () { return builder_1.buildServerSigningConfig; } });
|
|
10
|
+
var runner_1 = require("./runner");
|
|
11
|
+
Object.defineProperty(exports, "EspressoRunner", { enumerable: true, get: function () { return runner_1.EspressoRunner; } });
|
|
12
|
+
var startup_1 = require("./startup");
|
|
13
|
+
Object.defineProperty(exports, "initServer", { enumerable: true, get: function () { return startup_1.initServer; } });
|
|
14
|
+
Object.defineProperty(exports, "removePortForward", { enumerable: true, get: function () { return startup_1.removePortForward; } });
|
|
15
|
+
Object.defineProperty(exports, "startSession", { enumerable: true, get: function () { return startup_1.startSession; } });
|
|
16
|
+
Object.defineProperty(exports, "teardown", { enumerable: true, get: function () { return startup_1.teardown; } });
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/commands/server/index.ts"],"names":[],"mappings":";;;AAAA,yCAA4D;AAApD,8GAAA,iBAAiB,OAAA;AAAE,yGAAA,YAAY,OAAA;AACvC,qCAOmB;AANjB,wGAAA,aAAa,OAAA;AACb,mHAAA,wBAAwB,OAAA;AAM1B,mCAAoE;AAA5D,wGAAA,cAAc,OAAA;AACtB,qCAAgF;AAAxE,qGAAA,UAAU,OAAA;AAAE,4GAAA,iBAAiB,OAAA;AAAE,uGAAA,YAAY,OAAA;AAAE,mGAAA,QAAQ,OAAA"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { JWProxy } from 'appium/driver';
|
|
2
|
-
import { type ServerSigningConfig } from './
|
|
2
|
+
import { type ServerSigningConfig } from './builder';
|
|
3
3
|
import type { AppiumLogger, StringRecord, HTTPMethod, HTTPBody, ProxyResponse } from '@appium/types';
|
|
4
4
|
import type { ADB } from 'appium-adb';
|
|
5
5
|
import type { SubProcess } from 'teen_process';
|
|
6
|
-
export declare const TEST_APK_PKG = "io.appium.espressoserver.test";
|
|
7
6
|
export interface EspressoRunnerOptions {
|
|
8
7
|
adb: ADB;
|
|
9
8
|
tmpDir: string;
|
|
@@ -67,5 +66,11 @@ export declare class EspressoRunner {
|
|
|
67
66
|
private recordTargetAppPackage;
|
|
68
67
|
private _verifyServerStatus;
|
|
69
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Recursively copy all files except build directories contents
|
|
71
|
+
* @param sourceBaseDir directory to copy files from
|
|
72
|
+
* @param targetBaseDir directory to copy files to
|
|
73
|
+
*/
|
|
74
|
+
export declare function copyGradleProjectRecursively(sourceBaseDir: string, targetBaseDir: string): Promise<void>;
|
|
70
75
|
export {};
|
|
71
|
-
//# sourceMappingURL=
|
|
76
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../../lib/commands/server/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAS,MAAM,eAAe,CAAC;AAK9C,OAAO,EAA0C,KAAK,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAQ5F,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,aAAa,EAEd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAE7C,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE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AE,OAAO,aAAa,CAAC,SAAS,CAAC,WAAW,CAAC;IACxE,SAAgB,YAAY,EAAE,OAAO,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC;IACrE,SAAgB,aAAa,EAAE,MAAM,CAAC;IACtC,SAAgB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxC,SAAgB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7C,SAAgB,mBAAmB,EAAE,MAAM,CAAC;IAC5C,SAAgB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/C,SAAgB,mCAAmC,CAAC,EAAE,OAAO,CAAC;IAC9D,SAAgB,aAAa,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnD,WAAW,EAAE,UAAU,GAAG,IAAI,CAAQ;IAC7C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;gBAEvB,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,qBAAqB;IA2DpD,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC;IAa7C;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAyC9B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IA2B/B,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAoDlC,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAmH/C,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;YAiBtB,uBAAuB;YAkCvB,sBAAsB;YAOtB,mBAAmB;CAgDlC;AAgBD;;;;GAIG;AACH,wBAAsB,4BAA4B,CAChD,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CAkBf"}
|
|
@@ -36,19 +36,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.EspressoRunner =
|
|
39
|
+
exports.EspressoRunner = void 0;
|
|
40
|
+
exports.copyGradleProjectRecursively = copyGradleProjectRecursively;
|
|
40
41
|
const driver_1 = require("appium/driver");
|
|
41
42
|
const asyncbox_1 = require("asyncbox");
|
|
42
|
-
const server_builder_1 = require("./server-builder");
|
|
43
43
|
const node_path_1 = __importDefault(require("node:path"));
|
|
44
44
|
const support_1 = require("appium/support");
|
|
45
|
-
const utils_1 = require("
|
|
45
|
+
const utils_1 = require("../../utils");
|
|
46
|
+
const builder_1 = require("./builder");
|
|
47
|
+
const constants_1 = require("./constants");
|
|
46
48
|
const axios_1 = __importDefault(require("axios"));
|
|
47
49
|
const semver = __importStar(require("semver"));
|
|
48
|
-
const TEST_SERVER_ROOT = node_path_1.default.resolve(__dirname, '..', '..', 'espresso-server');
|
|
49
|
-
exports.TEST_APK_PKG = 'io.appium.espressoserver.test';
|
|
50
|
-
const ESPRESSO_SERVER_LAUNCH_TIMEOUT_MS = 45000;
|
|
51
|
-
const TARGET_PACKAGE_CONTAINER = '/data/local/tmp/espresso.apppackage';
|
|
52
50
|
class EspressoProxy extends driver_1.JWProxy {
|
|
53
51
|
instrumentationState;
|
|
54
52
|
async proxyCommand(url, method, body = null) {
|
|
@@ -107,11 +105,11 @@ class EspressoRunner {
|
|
|
107
105
|
crashed: false,
|
|
108
106
|
};
|
|
109
107
|
const { manifestPayload } = (0, utils_1.getPackageInfoSync)();
|
|
110
|
-
const modServerName = support_1.fs.sanitizeName(`${
|
|
108
|
+
const modServerName = support_1.fs.sanitizeName(`${constants_1.TEST_APK_PKG}_${manifestPayload.version}_${this.appPackage}_${this.adb.curDeviceId}.apk`, { replacement: '-' });
|
|
111
109
|
this.modServerPath = node_path_1.default.resolve(this.tmpDir, modServerName);
|
|
112
110
|
this.showGradleLog = opts.showGradleLog;
|
|
113
111
|
this.espressoBuildConfig = opts.espressoBuildConfig;
|
|
114
|
-
this.serverLaunchTimeout = opts.serverLaunchTimeout || ESPRESSO_SERVER_LAUNCH_TIMEOUT_MS;
|
|
112
|
+
this.serverLaunchTimeout = opts.serverLaunchTimeout || constants_1.ESPRESSO_SERVER_LAUNCH_TIMEOUT_MS;
|
|
115
113
|
this.androidInstallTimeout = opts.androidInstallTimeout;
|
|
116
114
|
this.disableSuppressAccessibilityService = opts.disableSuppressAccessibilityService;
|
|
117
115
|
// Espresso Server app needs to be signed with same keyStore as appPackage
|
|
@@ -120,7 +118,7 @@ class EspressoRunner {
|
|
|
120
118
|
opts.keystorePassword &&
|
|
121
119
|
opts.keyAlias &&
|
|
122
120
|
opts.keyPassword) {
|
|
123
|
-
this.signingConfig = (0,
|
|
121
|
+
this.signingConfig = (0, builder_1.buildServerSigningConfig)({
|
|
124
122
|
keystoreFile: opts.keystorePath,
|
|
125
123
|
keystorePassword: opts.keystorePassword,
|
|
126
124
|
keyAlias: opts.keyAlias,
|
|
@@ -132,11 +130,11 @@ class EspressoRunner {
|
|
|
132
130
|
}
|
|
133
131
|
}
|
|
134
132
|
async isAppPackageChanged() {
|
|
135
|
-
if (!(await this.adb.fileExists(TARGET_PACKAGE_CONTAINER))) {
|
|
133
|
+
if (!(await this.adb.fileExists(constants_1.TARGET_PACKAGE_CONTAINER))) {
|
|
136
134
|
this.log.debug('The previous target application package is unknown');
|
|
137
135
|
return true;
|
|
138
136
|
}
|
|
139
|
-
const previousAppPackage = (await this.adb.shell(['cat', TARGET_PACKAGE_CONTAINER])).trim();
|
|
137
|
+
const previousAppPackage = (await this.adb.shell(['cat', constants_1.TARGET_PACKAGE_CONTAINER])).trim();
|
|
140
138
|
this.log.debug(`The previous target application package was '${previousAppPackage}'. ` +
|
|
141
139
|
`The current package is '${this.appPackage}'`);
|
|
142
140
|
return previousAppPackage !== this.appPackage;
|
|
@@ -146,19 +144,19 @@ class EspressoRunner {
|
|
|
146
144
|
* Each adb command uses default timeout by them.
|
|
147
145
|
*/
|
|
148
146
|
async installServer() {
|
|
149
|
-
const appState = await this.adb.getApplicationInstallState(this.modServerPath,
|
|
147
|
+
const appState = await this.adb.getApplicationInstallState(this.modServerPath, constants_1.TEST_APK_PKG);
|
|
150
148
|
const shouldUninstallApp = [
|
|
151
149
|
this.adb.APP_INSTALL_STATE.OLDER_VERSION_INSTALLED,
|
|
152
150
|
this.adb.APP_INSTALL_STATE.NEWER_VERSION_INSTALLED,
|
|
153
151
|
].includes(appState);
|
|
154
152
|
const shouldInstallApp = shouldUninstallApp || [this.adb.APP_INSTALL_STATE.NOT_INSTALLED].includes(appState);
|
|
155
153
|
if (shouldUninstallApp) {
|
|
156
|
-
this.log.info(`Uninstalling Espresso Test Server apk from the target device (pkg: '${
|
|
154
|
+
this.log.info(`Uninstalling Espresso Test Server apk from the target device (pkg: '${constants_1.TEST_APK_PKG}')`);
|
|
157
155
|
try {
|
|
158
|
-
await this.adb.uninstallApk(
|
|
156
|
+
await this.adb.uninstallApk(constants_1.TEST_APK_PKG);
|
|
159
157
|
}
|
|
160
158
|
catch (err) {
|
|
161
|
-
this.log.warn(`Error uninstalling '${
|
|
159
|
+
this.log.warn(`Error uninstalling '${constants_1.TEST_APK_PKG}': ${err.message}`);
|
|
162
160
|
}
|
|
163
161
|
}
|
|
164
162
|
if (shouldInstallApp) {
|
|
@@ -168,7 +166,7 @@ class EspressoRunner {
|
|
|
168
166
|
replace: false,
|
|
169
167
|
timeout: this.androidInstallTimeout,
|
|
170
168
|
});
|
|
171
|
-
this.log.info(`Installed Espresso Test Server apk '${this.modServerPath}' (pkg: '${
|
|
169
|
+
this.log.info(`Installed Espresso Test Server apk '${this.modServerPath}' (pkg: '${constants_1.TEST_APK_PKG}')`);
|
|
172
170
|
}
|
|
173
171
|
catch (err) {
|
|
174
172
|
throw this.log.errorWithException(`Cannot install '${this.modServerPath}' because of '${err.message}'`);
|
|
@@ -191,11 +189,11 @@ class EspressoRunner {
|
|
|
191
189
|
if (!(await support_1.fs.exists(this.modServerPath))) {
|
|
192
190
|
await this.buildNewModServer();
|
|
193
191
|
}
|
|
194
|
-
const
|
|
195
|
-
if (!
|
|
192
|
+
const wasSigned = await this.adb.checkApkCert(this.modServerPath, '');
|
|
193
|
+
if (!wasSigned) {
|
|
196
194
|
await this.adb.sign(this.modServerPath);
|
|
197
195
|
}
|
|
198
|
-
if ((rebuild || !
|
|
196
|
+
if ((rebuild || !wasSigned) && (await this.adb.uninstallApk(constants_1.TEST_APK_PKG))) {
|
|
199
197
|
this.log.info('Uninstalled the obsolete Espresso server package from the device under test');
|
|
200
198
|
}
|
|
201
199
|
await this.installServer();
|
|
@@ -228,10 +226,10 @@ class EspressoRunner {
|
|
|
228
226
|
this.log.debug(`The build folder root could be customized by changing the 'tmpDir' capability`);
|
|
229
227
|
await support_1.fs.rimraf(serverPath);
|
|
230
228
|
await support_1.fs.mkdirp(serverPath);
|
|
231
|
-
this.log.debug(`Copying espresso server template from ('${
|
|
232
|
-
await (
|
|
229
|
+
this.log.debug(`Copying espresso server template from ('${getTestServerRoot()}' to '${serverPath}')`);
|
|
230
|
+
await copyGradleProjectRecursively(getTestServerRoot(), serverPath);
|
|
233
231
|
this.log.debug('Bulding espresso server');
|
|
234
|
-
await new
|
|
232
|
+
await new builder_1.ServerBuilder(this.log, {
|
|
235
233
|
serverPath,
|
|
236
234
|
buildConfiguration,
|
|
237
235
|
showGradleLog: this.showGradleLog,
|
|
@@ -259,7 +257,7 @@ class EspressoRunner {
|
|
|
259
257
|
if (typeof this.disableSuppressAccessibilityService === 'boolean') {
|
|
260
258
|
cmd.push('-e', 'DISABLE_SUPPRESS_ACCESSIBILITY_SERVICES', String(this.disableSuppressAccessibilityService));
|
|
261
259
|
}
|
|
262
|
-
cmd.push(`${
|
|
260
|
+
cmd.push(`${constants_1.TEST_APK_PKG}/androidx.test.runner.AndroidJUnitRunner`);
|
|
263
261
|
const { manifestPayload } = await (0, utils_1.getPackageInfo)();
|
|
264
262
|
this.log.info(`Starting Espresso Server v${manifestPayload.version} with cmd: adb ${cmd.join(' ')}`);
|
|
265
263
|
let hasSocketError = false;
|
|
@@ -376,8 +374,8 @@ class EspressoRunner {
|
|
|
376
374
|
}
|
|
377
375
|
}
|
|
378
376
|
async recordTargetAppPackage() {
|
|
379
|
-
await this.adb.shell([`echo "${this.appPackage}" > "${TARGET_PACKAGE_CONTAINER}"`]);
|
|
380
|
-
this.log.info(`Recorded the target application package '${this.appPackage}' to ${TARGET_PACKAGE_CONTAINER}`);
|
|
377
|
+
await this.adb.shell([`echo "${this.appPackage}" > "${constants_1.TARGET_PACKAGE_CONTAINER}"`]);
|
|
378
|
+
this.log.info(`Recorded the target application package '${this.appPackage}' to ${constants_1.TARGET_PACKAGE_CONTAINER}`);
|
|
381
379
|
}
|
|
382
380
|
async _verifyServerStatus(driverVersion, serverStatus) {
|
|
383
381
|
if (!(0, utils_1.isPlainObject)(serverStatus) || !(0, utils_1.isPlainObject)(serverStatus.build)) {
|
|
@@ -424,4 +422,40 @@ function requireOption(opts, key) {
|
|
|
424
422
|
}
|
|
425
423
|
return opts[key];
|
|
426
424
|
}
|
|
427
|
-
|
|
425
|
+
const MODULE_NAME = 'appium-espresso-driver';
|
|
426
|
+
let testServerRoot;
|
|
427
|
+
/**
|
|
428
|
+
* Recursively copy all files except build directories contents
|
|
429
|
+
* @param sourceBaseDir directory to copy files from
|
|
430
|
+
* @param targetBaseDir directory to copy files to
|
|
431
|
+
*/
|
|
432
|
+
async function copyGradleProjectRecursively(sourceBaseDir, targetBaseDir) {
|
|
433
|
+
// @ts-ignore it is ok to have the async callback
|
|
434
|
+
await support_1.fs.walkDir(sourceBaseDir, true, async (itemPath, isDirectory) => {
|
|
435
|
+
const relativePath = node_path_1.default.relative(sourceBaseDir, itemPath);
|
|
436
|
+
const targetPath = node_path_1.default.resolve(targetBaseDir, relativePath);
|
|
437
|
+
const isInGradleBuildDir = `${node_path_1.default.sep}${itemPath}`.includes(`${node_path_1.default.sep}build${node_path_1.default.sep}`);
|
|
438
|
+
if (isInGradleBuildDir) {
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
if (isDirectory) {
|
|
442
|
+
await support_1.fs.mkdirp(targetPath);
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
await support_1.fs.copyFile(itemPath, targetPath);
|
|
446
|
+
}
|
|
447
|
+
return false;
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
/** Root path of the bundled Espresso server Gradle project. */
|
|
451
|
+
function getTestServerRoot() {
|
|
452
|
+
if (testServerRoot === undefined) {
|
|
453
|
+
const moduleRoot = support_1.node.getModuleRootSync(MODULE_NAME, __filename);
|
|
454
|
+
if (!moduleRoot) {
|
|
455
|
+
throw new Error(`Cannot find the root folder of the ${MODULE_NAME} Node.js module`);
|
|
456
|
+
}
|
|
457
|
+
testServerRoot = node_path_1.default.join(moduleRoot, 'espresso-server');
|
|
458
|
+
}
|
|
459
|
+
return testServerRoot;
|
|
460
|
+
}
|
|
461
|
+
//# sourceMappingURL=runner.js.map
|