appium-espresso-driver 7.1.2 → 7.2.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/espresso-server/library/src/main/java/io/appium/espressoserver/lib/helpers/Version.kt +1 -1
- package/npm-shrinkwrap.json +12 -2
- package/package.json +5 -4
- package/scripts/build-espresso.mjs +109 -0
- package/scripts/print-espresso-path.mjs +25 -0
- package/scripts/sync-version.mjs +65 -0
- package/scripts/build-espresso.js +0 -56
- package/scripts/print-espresso-path.js +0 -8
- package/scripts/sync-version.js +0 -47
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [7.2.0](https://github.com/appium/appium-espresso-driver/compare/v7.1.2...v7.2.0) (2026-04-08)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* Migrate scripts to mjs/ESM format ([#1149](https://github.com/appium/appium-espresso-driver/issues/1149)) ([cffd424](https://github.com/appium/appium-espresso-driver/commit/cffd424917938f83beaea2752ccd9fd73ab67d3f))
|
|
6
|
+
|
|
1
7
|
## [7.1.2](https://github.com/appium/appium-espresso-driver/compare/v7.1.1...v7.1.2) (2026-04-08)
|
|
2
8
|
|
|
3
9
|
### Miscellaneous Chores
|
package/espresso-server/library/src/main/java/io/appium/espressoserver/lib/helpers/Version.kt
CHANGED
|
@@ -2,6 +2,6 @@ package io.appium.espressoserver.lib.helpers
|
|
|
2
2
|
|
|
3
3
|
// This value is updated automatically by the NPM versioning script
|
|
4
4
|
// It should be in sync with the NPM module version from package.json
|
|
5
|
-
private const val VERSION = "7.
|
|
5
|
+
private const val VERSION = "7.2.0"
|
|
6
6
|
|
|
7
7
|
fun getEspressoServerVersion() = VERSION
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-espresso-driver",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "appium-espresso-driver",
|
|
9
|
-
"version": "7.
|
|
9
|
+
"version": "7.2.0",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"appium-adb": "^14.0.0",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"asyncbox": "^6.1.0",
|
|
15
15
|
"axios": "^1.12.2",
|
|
16
16
|
"bluebird": "^3.5.0",
|
|
17
|
+
"commander": "^14.0.1",
|
|
17
18
|
"io.appium.settings": "^7.0.1",
|
|
18
19
|
"lodash": "^4.17.11",
|
|
19
20
|
"portscanner": "^2.2.0",
|
|
@@ -1132,6 +1133,15 @@
|
|
|
1132
1133
|
"node": ">= 0.8"
|
|
1133
1134
|
}
|
|
1134
1135
|
},
|
|
1136
|
+
"node_modules/commander": {
|
|
1137
|
+
"version": "14.0.3",
|
|
1138
|
+
"resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz",
|
|
1139
|
+
"integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==",
|
|
1140
|
+
"license": "MIT",
|
|
1141
|
+
"engines": {
|
|
1142
|
+
"node": ">=20"
|
|
1143
|
+
}
|
|
1144
|
+
},
|
|
1135
1145
|
"node_modules/compare-versions": {
|
|
1136
1146
|
"version": "6.1.1",
|
|
1137
1147
|
"resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.1.tgz",
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"automated testing",
|
|
8
8
|
"android"
|
|
9
9
|
],
|
|
10
|
-
"version": "7.
|
|
10
|
+
"version": "7.2.0",
|
|
11
11
|
"author": "Appium Contributors",
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
13
|
"repository": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
],
|
|
35
35
|
"mainClass": "EspressoDriver",
|
|
36
36
|
"scripts": {
|
|
37
|
-
"print-espresso-path": "./scripts/print-espresso-path.
|
|
38
|
-
"build-espresso": "./scripts/build-espresso.
|
|
37
|
+
"print-espresso-path": "./scripts/print-espresso-path.mjs",
|
|
38
|
+
"build-espresso": "./scripts/build-espresso.mjs"
|
|
39
39
|
},
|
|
40
40
|
"doctor": {
|
|
41
41
|
"checks": [
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"asyncbox": "^6.1.0",
|
|
79
79
|
"axios": "^1.12.2",
|
|
80
80
|
"bluebird": "^3.5.0",
|
|
81
|
+
"commander": "^14.0.1",
|
|
81
82
|
"io.appium.settings": "^7.0.1",
|
|
82
83
|
"lodash": "^4.17.11",
|
|
83
84
|
"portscanner": "^2.2.0",
|
|
@@ -100,7 +101,7 @@
|
|
|
100
101
|
"format": "prettier -w ./lib ./test",
|
|
101
102
|
"format:check": "prettier --check ./lib ./test",
|
|
102
103
|
"prepare": "npm run rebuild",
|
|
103
|
-
"sync-version": "node ./scripts/sync-version.
|
|
104
|
+
"sync-version": "node ./scripts/sync-version.mjs --package-version=${npm_package_version}",
|
|
104
105
|
"test": "npm run test:node",
|
|
105
106
|
"test:node": "mocha --exit --timeout 1m \"./test/unit/**/*-specs.ts\"",
|
|
106
107
|
"test:server": "cd espresso-server && ./gradlew test --stacktrace || cd ..",
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import {fileURLToPath} from 'node:url';
|
|
4
|
+
import {Command} from 'commander';
|
|
5
|
+
import {logger, fs} from 'appium/support.js';
|
|
6
|
+
import {ServerBuilder} from '../build/lib/server-builder.js';
|
|
7
|
+
|
|
8
|
+
const LOG = logger.getLogger('EspressoBuild');
|
|
9
|
+
|
|
10
|
+
const ROOT_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
11
|
+
const ESPRESSO_SERVER_ROOT = path.join(ROOT_DIR, 'espresso-server');
|
|
12
|
+
const ESPRESSO_SERVER_BUILD = path.join(ESPRESSO_SERVER_ROOT, 'app', 'build');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {BuildOptions} options
|
|
16
|
+
*/
|
|
17
|
+
async function buildEspressoServer(options) {
|
|
18
|
+
LOG.info(`Building espresso server in '${ESPRESSO_SERVER_BUILD}'`);
|
|
19
|
+
|
|
20
|
+
const opts = {
|
|
21
|
+
serverPath: ESPRESSO_SERVER_ROOT,
|
|
22
|
+
showGradleLog: options.showGradleLog,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
if (options.testAppPackage) {
|
|
26
|
+
opts.testAppPackage = options.testAppPackage;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (options.buildConfig) {
|
|
30
|
+
if (!(await fs.exists(options.buildConfig))) {
|
|
31
|
+
throw new Error(
|
|
32
|
+
`Cannot find build config at '${options.buildConfig}'. Please provide a valid absolute path to it.`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
const buildConfigurationStr = await fs.readFile(options.buildConfig, 'utf8');
|
|
37
|
+
opts.buildConfiguration = JSON.parse(buildConfigurationStr);
|
|
38
|
+
LOG.info(`The espresso build config is ${JSON.stringify(opts.buildConfiguration)}`);
|
|
39
|
+
} catch (e) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Failed to parse the build config at '${options.buildConfig}'. ` +
|
|
42
|
+
`Please make sure it is a valid JSON file.`, {cause: e}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const builder = new ServerBuilder(LOG, opts);
|
|
48
|
+
try {
|
|
49
|
+
await builder.build();
|
|
50
|
+
} catch (e) {
|
|
51
|
+
let errorMessage = `Failed to build the espresso server`;
|
|
52
|
+
if (!isGradleLogEnabled(options)) {
|
|
53
|
+
errorMessage += `. Set SHOW_GRADLE_LOG environment variable to true to check the gradle log.`;
|
|
54
|
+
}
|
|
55
|
+
throw new Error(errorMessage, {cause: e});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const dstPath = path.resolve(
|
|
59
|
+
ESPRESSO_SERVER_BUILD,
|
|
60
|
+
'outputs',
|
|
61
|
+
'apk',
|
|
62
|
+
'androidTest',
|
|
63
|
+
'debug',
|
|
64
|
+
'app-debug-androidTest.apk',
|
|
65
|
+
);
|
|
66
|
+
if (await fs.exists(dstPath)) {
|
|
67
|
+
LOG.info(`Full path to the server APK: ${dstPath}`);
|
|
68
|
+
} else {
|
|
69
|
+
LOG.info(`Full path to the server build folder: ${ESPRESSO_SERVER_BUILD}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @param {BuildOptions} options
|
|
75
|
+
* @returns {boolean}
|
|
76
|
+
*/
|
|
77
|
+
function isGradleLogEnabled(options) {
|
|
78
|
+
return Boolean(options.showGradleLog ||
|
|
79
|
+
!_.isEmpty(process.env.SHOW_GRADLE_LOG) && ['1', 'true'].includes(_.toLower(process.env.SHOW_GRADLE_LOG))
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function main() {
|
|
84
|
+
const program = new Command();
|
|
85
|
+
program
|
|
86
|
+
.name('appium driver run espresso build-espresso')
|
|
87
|
+
.description('Build the Espresso server APK')
|
|
88
|
+
.option('--show-gradle-log', 'Show Gradle logs during build')
|
|
89
|
+
.option('--test-app-package <package>', 'App package to target for test server build')
|
|
90
|
+
.option('--build-config <path>', 'Absolute path to a JSON build configuration file')
|
|
91
|
+
.action(async (options) => {
|
|
92
|
+
await buildEspressoServer({
|
|
93
|
+
showGradleLog: isGradleLogEnabled(options),
|
|
94
|
+
testAppPackage: options.testAppPackage ?? process.env.TEST_APP_PACKAGE,
|
|
95
|
+
buildConfig: options.buildConfig ?? process.env.ESPRESSO_BUILD_CONFIG,
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
await program.parseAsync(process.argv);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
await main();
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @typedef {Object} BuildOptions
|
|
106
|
+
* @property {boolean | undefined} showGradleLog
|
|
107
|
+
* @property {string | undefined} testAppPackage
|
|
108
|
+
* @property {string | undefined} buildConfig
|
|
109
|
+
*/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import {fileURLToPath} from 'node:url';
|
|
3
|
+
import {Command} from 'commander';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @returns {void}
|
|
7
|
+
*/
|
|
8
|
+
function printEspressoServerPath() {
|
|
9
|
+
const dstPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'espresso-server');
|
|
10
|
+
console.log(dstPath); // eslint-disable-line no-console
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async function main() {
|
|
14
|
+
const program = new Command();
|
|
15
|
+
program
|
|
16
|
+
.name('appium driver run espresso print-espresso-path')
|
|
17
|
+
.description('Print the Espresso server path')
|
|
18
|
+
.action(() => {
|
|
19
|
+
printEspressoServerPath();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
await program.parseAsync(process.argv);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
await main();
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import {fileURLToPath} from 'node:url';
|
|
3
|
+
import {Command} from 'commander';
|
|
4
|
+
import {logger, fs} from 'appium/support.js';
|
|
5
|
+
import semver from 'semver';
|
|
6
|
+
|
|
7
|
+
const LOG = logger.getLogger('VersionSync');
|
|
8
|
+
|
|
9
|
+
const ROOT_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
10
|
+
const ESPRESSO_SERVER_ROOT = path.join(ROOT_DIR, 'espresso-server');
|
|
11
|
+
const VERSION_FILE = path.join(
|
|
12
|
+
ESPRESSO_SERVER_ROOT,
|
|
13
|
+
'library',
|
|
14
|
+
'src',
|
|
15
|
+
'main',
|
|
16
|
+
'java',
|
|
17
|
+
'io',
|
|
18
|
+
'appium',
|
|
19
|
+
'espressoserver',
|
|
20
|
+
'lib',
|
|
21
|
+
'helpers',
|
|
22
|
+
'Version.kt'
|
|
23
|
+
);
|
|
24
|
+
const VERSION_PATTERN = /VERSION\s*=\s*"([0-9.]+)"/;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param {string} packageVersion
|
|
28
|
+
* @returns {Promise<void>}
|
|
29
|
+
*/
|
|
30
|
+
async function syncModuleVersion(packageVersion) {
|
|
31
|
+
const origContent = await fs.readFile(VERSION_FILE, 'utf8');
|
|
32
|
+
const espressoVersionMatch = VERSION_PATTERN.exec(origContent);
|
|
33
|
+
if (!espressoVersionMatch) {
|
|
34
|
+
throw new Error(`Could not parse Espresso module version from '${VERSION_FILE}'`);
|
|
35
|
+
}
|
|
36
|
+
const updatedContent = origContent.replace(espressoVersionMatch[1], packageVersion);
|
|
37
|
+
await fs.writeFile(VERSION_FILE, updatedContent, 'utf8');
|
|
38
|
+
LOG.info(`Synchronized module version '${packageVersion}' to '${VERSION_FILE}'`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function main() {
|
|
42
|
+
const program = new Command();
|
|
43
|
+
program
|
|
44
|
+
.name('node ./scripts/sync-version.mjs')
|
|
45
|
+
.description('Sync package version into Espresso server module source')
|
|
46
|
+
.requiredOption(
|
|
47
|
+
'--package-version <version>',
|
|
48
|
+
'Package version to synchronize',
|
|
49
|
+
(value) => {
|
|
50
|
+
if (!semver.valid(value)) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
`Invalid version specified '${value}'. The value must be a valid semver string like '1.2.3'`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
.action(async (options) => {
|
|
59
|
+
await syncModuleVersion(options.packageVersion);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
await program.parseAsync(process.argv);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
await main();
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const _ = require('lodash');
|
|
2
|
-
const path = require('node:path');
|
|
3
|
-
const { logger, fs } = require('appium/support');
|
|
4
|
-
const { ServerBuilder } = require('../build/lib/server-builder.js');
|
|
5
|
-
|
|
6
|
-
const LOG = new logger.getLogger('EspressoBuild');
|
|
7
|
-
|
|
8
|
-
const ROOT_DIR = path.resolve(__dirname, '..');
|
|
9
|
-
const ESPRESSO_SERVER_ROOT = path.join(ROOT_DIR, 'espresso-server');
|
|
10
|
-
|
|
11
|
-
const ESPRESSO_SERVER_BUILD = path.join(ESPRESSO_SERVER_ROOT, 'app', 'build');
|
|
12
|
-
|
|
13
|
-
async function buildEspressoServer () {
|
|
14
|
-
|
|
15
|
-
LOG.info(`Deleting the build directory ${ESPRESSO_SERVER_BUILD}`);
|
|
16
|
-
|
|
17
|
-
const opts = {
|
|
18
|
-
serverPath: ESPRESSO_SERVER_ROOT,
|
|
19
|
-
showGradleLog: !_.isEmpty(process.env.SHOW_GRADLE_LOG) && ['1', 'true'].includes(_.toLower(process.env.SHOW_GRADLE_LOG))
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
if (process.env.TEST_APP_PACKAGE) {
|
|
23
|
-
opts.testAppPackage = process.env.TEST_APP_PACKAGE;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (process.env.ESPRESSO_BUILD_CONFIG) {
|
|
27
|
-
if (!(await fs.exists(process.env.ESPRESSO_BUILD_CONFIG))) {
|
|
28
|
-
throw new Error(`'${process.env.ESPRESSO_BUILD_CONFIG}' did not exist. Please set the path as an absolute path.`);
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
const buildConfigurationStr = await fs.readFile(process.env.ESPRESSO_BUILD_CONFIG, 'utf8');
|
|
32
|
-
opts.buildConfiguration = JSON.parse(buildConfigurationStr);
|
|
33
|
-
LOG.info(`The espresso build config is ${JSON.stringify(opts.buildConfiguration)}`);
|
|
34
|
-
} catch (e) {
|
|
35
|
-
throw new Error(`Failed to parse the ${process.env.ESPRESSO_BUILD_CONFIG}. ` +
|
|
36
|
-
`Please make sure that the JSON is valid format. Error: ${e}`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const builder = new ServerBuilder(LOG, opts);
|
|
41
|
-
try {
|
|
42
|
-
await builder.build();
|
|
43
|
-
} catch (e) {
|
|
44
|
-
throw new Error(`Failed to build the espresso server. ` +
|
|
45
|
-
`SHOW_GRADLE_LOG=true environment variable helps to check the gradle log. Error: ${e}`);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const dstPath = path.resolve(ESPRESSO_SERVER_ROOT, 'app', 'build', 'outputs', 'apk', 'androidTest', 'debug', 'app-debug-androidTest.apk');
|
|
49
|
-
if (await fs.exists(dstPath)) {
|
|
50
|
-
LOG.info(`Full path to the server APK: ${dstPath}`);
|
|
51
|
-
} else {
|
|
52
|
-
LOG.info(`Full path to the server build folder: ${ESPRESSO_SERVER_BUILD}`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
(async () => await buildEspressoServer())();
|
package/scripts/sync-version.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const path = require('node:path');
|
|
2
|
-
const { logger, fs } = require('appium/support');
|
|
3
|
-
const semver = require('semver');
|
|
4
|
-
|
|
5
|
-
const LOG = logger.getLogger('VersionSync');
|
|
6
|
-
|
|
7
|
-
const ROOT_DIR = path.resolve(__dirname, '..');
|
|
8
|
-
const ESPRESSO_SERVER_ROOT = path.join(ROOT_DIR, 'espresso-server');
|
|
9
|
-
const VERSION_FILE = path.join(
|
|
10
|
-
ESPRESSO_SERVER_ROOT, 'library', 'src', 'main', 'java',
|
|
11
|
-
'io', 'appium', 'espressoserver',
|
|
12
|
-
'lib', 'helpers', 'Version.kt'
|
|
13
|
-
);
|
|
14
|
-
const VERSION_PATTERN = /VERSION\s*=\s*"([0-9.]+)"/;
|
|
15
|
-
|
|
16
|
-
function parseArgValue (argName) {
|
|
17
|
-
const argNamePattern = new RegExp(`^--${argName}\\b`);
|
|
18
|
-
for (let i = 1; i < process.argv.length; ++i) {
|
|
19
|
-
const arg = process.argv[i];
|
|
20
|
-
if (argNamePattern.test(arg)) {
|
|
21
|
-
return arg.includes('=') ? arg.split('=')[1] : process.argv[i + 1];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async function syncModuleVersion () {
|
|
28
|
-
const origContent = await fs.readFile(VERSION_FILE, 'utf8');
|
|
29
|
-
const espressoVersionMatch = VERSION_PATTERN.exec(origContent);
|
|
30
|
-
if (!espressoVersionMatch) {
|
|
31
|
-
throw new Error(`Could not parse Espresso module version from '${VERSION_FILE}'`);
|
|
32
|
-
}
|
|
33
|
-
const packageVersion = parseArgValue('package-version');
|
|
34
|
-
if (!packageVersion) {
|
|
35
|
-
throw new Error('No package version argument (use `--package-version=xxx`)');
|
|
36
|
-
}
|
|
37
|
-
if (!semver.valid(packageVersion)) {
|
|
38
|
-
throw new Error(
|
|
39
|
-
`Invalid version specified '${packageVersion}'. Version should be in the form '1.2.3'`
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
const updatedContent = origContent.replace(espressoVersionMatch[1], packageVersion);
|
|
43
|
-
await fs.writeFile(VERSION_FILE, updatedContent, 'utf8');
|
|
44
|
-
LOG.info(`Synchronized module version '${packageVersion}' to '${VERSION_FILE}'`);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
(async () => await syncModuleVersion())();
|