@appium/base-driver 9.11.5 → 9.12.1
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/build/lib/express/server.d.ts +6 -0
- package/build/lib/express/server.d.ts.map +1 -1
- package/build/lib/express/server.js +12 -6
- package/build/lib/express/server.js.map +1 -1
- package/build/lib/index.d.ts +1 -1
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +4 -1
- package/build/lib/index.js.map +1 -1
- package/lib/express/server.js +14 -8
- package/lib/index.js +2 -0
- package/package.json +8 -8
|
@@ -37,6 +37,12 @@ export type ConfigureHttpOpts = {
|
|
|
37
37
|
* - Keep-alive timeout in milliseconds
|
|
38
38
|
*/
|
|
39
39
|
keepAliveTimeout: number;
|
|
40
|
+
/**
|
|
41
|
+
* - For how long the server should delay its
|
|
42
|
+
* shutdown before force-closing all open connections to it. Providing zero will force-close
|
|
43
|
+
* the server without waiting for any connections.
|
|
44
|
+
*/
|
|
45
|
+
gracefulShutdownTimeout: number;
|
|
40
46
|
};
|
|
41
47
|
/**
|
|
42
48
|
* Options for {@linkcode server}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../lib/express/server.js"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../lib/express/server.js"],"names":[],"mappings":";;;;;;;gBAoTc,OAAO,MAAM,EAAE,MAAM;;;;UACrB,MAAM;;;;sBACN,MAAM;;;;;;2BAKP,OAAO,eAAe,EAAE,YAAY;wBAIpC,OAAO,eAAe,EAAE,SAAS,CAAC,OAAO,eAAe,EAAE,cAAc,CAAC;;;;;;;;gBAMxE,OAAO,MAAM,EAAE,MAAM;;;;YACrB,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI;;;;sBACrB,MAAM;;;;;;6BACN,MAAM;;;;;;8BAQN,wBAAwB;UACxB,MAAM;;;;;;;;;;;;6CAaT,OAAO,SAAS,EAAE,OAAO,sDAEvB,IAAI;;;;;;;;;;;;SAaH,OAAO,SAAS,EAAE,OAAO;eACzB,wBAAwB;;;;;;AArStC;;;;GAIG;AACH,6BAHW,UAAU,GACR,OAAO,CAAC,YAAY,CAAC,CAwDjC;AAED;;;GAGG;AACH,6GAFW,mBAAmB,QAiD7B;AA+FD;;;;GAIG;AACH,4CAHW,MAAM,GACJ,MAAM,CAkBlB"}
|
|
@@ -23,7 +23,6 @@ const bluebird_1 = __importDefault(require("bluebird"));
|
|
|
23
23
|
const constants_1 = require("../constants");
|
|
24
24
|
const support_1 = require("@appium/support");
|
|
25
25
|
const KEEP_ALIVE_TIMEOUT_MS = 10 * 60 * 1000; // 10 minutes
|
|
26
|
-
const SERVER_CLOSE_TIMEOUT_MS = 5000;
|
|
27
26
|
/**
|
|
28
27
|
*
|
|
29
28
|
* @param {import('express').Express} app
|
|
@@ -63,7 +62,7 @@ async function createServer(app, cliArgs) {
|
|
|
63
62
|
* @returns {Promise<AppiumServer>}
|
|
64
63
|
*/
|
|
65
64
|
async function server(opts) {
|
|
66
|
-
const { routeConfiguringFunction, port, hostname, cliArgs = {}, allowCors = true, basePath = constants_1.DEFAULT_BASE_PATH, extraMethodMap = {}, serverUpdaters = [], keepAliveTimeout = KEEP_ALIVE_TIMEOUT_MS, } = opts;
|
|
65
|
+
const { routeConfiguringFunction, port, hostname, cliArgs = /** @type {import('@appium/types').ServerArgs} */ ({}), allowCors = true, basePath = constants_1.DEFAULT_BASE_PATH, extraMethodMap = {}, serverUpdaters = [], keepAliveTimeout = KEEP_ALIVE_TIMEOUT_MS, } = opts;
|
|
67
66
|
const app = (0, express_1.default)();
|
|
68
67
|
const httpServer = await createServer(app, cliArgs);
|
|
69
68
|
return await new bluebird_1.default(async (resolve, reject) => {
|
|
@@ -77,6 +76,7 @@ async function server(opts) {
|
|
|
77
76
|
httpServer,
|
|
78
77
|
reject,
|
|
79
78
|
keepAliveTimeout,
|
|
79
|
+
gracefulShutdownTimeout: cliArgs.shutdownTimeout,
|
|
80
80
|
});
|
|
81
81
|
configureServer({
|
|
82
82
|
app,
|
|
@@ -146,7 +146,7 @@ function configureServer({ app, addRoutes, allowCors = true, basePath = constant
|
|
|
146
146
|
* @param {ConfigureHttpOpts} opts
|
|
147
147
|
* @returns {AppiumServer}
|
|
148
148
|
*/
|
|
149
|
-
function configureHttp({ httpServer, reject, keepAliveTimeout }) {
|
|
149
|
+
function configureHttp({ httpServer, reject, keepAliveTimeout, gracefulShutdownTimeout }) {
|
|
150
150
|
/**
|
|
151
151
|
* @type {AppiumServer}
|
|
152
152
|
*/
|
|
@@ -167,10 +167,13 @@ function configureHttp({ httpServer, reject, keepAliveTimeout }) {
|
|
|
167
167
|
logger_1.default.info('Closing Appium HTTP server');
|
|
168
168
|
const timer = new support_1.timing.Timer().start();
|
|
169
169
|
const onTimeout = setTimeout(() => {
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
if (gracefulShutdownTimeout > 0) {
|
|
171
|
+
logger_1.default.info(`Not all active connections have been closed within ${gracefulShutdownTimeout}ms. ` +
|
|
172
|
+
`This timeout might be customized by the --shutdown-timeout command line ` +
|
|
173
|
+
`argument. Closing the server anyway.`);
|
|
174
|
+
}
|
|
172
175
|
process.exit(process.exitCode ?? 0);
|
|
173
|
-
},
|
|
176
|
+
}, gracefulShutdownTimeout);
|
|
174
177
|
httpServer.once('close', () => {
|
|
175
178
|
logger_1.default.info(`Appium HTTP server has been succesfully closed after ` +
|
|
176
179
|
`${timer.getDuration().asMilliSeconds.toFixed(0)}ms`);
|
|
@@ -253,6 +256,9 @@ function normalizeBasePath(basePath) {
|
|
|
253
256
|
* @property {import('http').Server} httpServer - HTTP server instance
|
|
254
257
|
* @property {(error?: any) => void} reject - Rejection function from `Promise` constructor
|
|
255
258
|
* @property {number} keepAliveTimeout - Keep-alive timeout in milliseconds
|
|
259
|
+
* @property {number} gracefulShutdownTimeout - For how long the server should delay its
|
|
260
|
+
* shutdown before force-closing all open connections to it. Providing zero will force-close
|
|
261
|
+
* the server without waiting for any connections.
|
|
256
262
|
*/
|
|
257
263
|
/**
|
|
258
264
|
* Options for {@linkcode server}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../lib/express/server.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../lib/express/server.js"],"names":[],"mappings":";;;;;AA+SQ,wBAAM;AAAE,0CAAe;AAAE,8CAAiB;AA/SlD,oDAAuB;AACvB,gDAAwB;AACxB,sDAA8B;AAC9B,gDAAwB;AACxB,kEAAoC;AACpC,8DAAqC;AACrC,sEAA6C;AAC7C,sDAA2B;AAC3B,uDAAqE;AACrE,6CAUsB;AACtB,qCAAiG;AACjG,mCAAmD;AACnD,2CAKqB;AACrB,wDAAyB;AACzB,4CAA+C;AAC/C,6CAA2C;AAE3C,MAAM,qBAAqB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAE3D;;;;;GAKG;AACH,KAAK,UAAU,YAAY,CAAE,GAAG,EAAE,OAAO;IACvC,MAAM,EAAC,kBAAkB,EAAE,UAAU,EAAC,GAAG,OAAO,IAAI,EAAE,CAAC;IACvD,IAAI,CAAC,kBAAkB,IAAI,CAAC,UAAU,EAAE,CAAC;QACvC,OAAO,cAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,CAAC,kBAAkB,IAAI,CAAC,UAAU,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;IACvF,CAAC;IAED,MAAM,OAAO,GAAG,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,gBAAC,CAAC,GAAG,CAClB,MAAM,kBAAC,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAE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;AAEH;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;;;;;;;;;GASG"}
|
package/build/lib/index.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ export default BaseDriver;
|
|
|
5
5
|
export * from "./protocol";
|
|
6
6
|
export { errorFromMJSONWPStatusCode as errorFromCode } from "./protocol";
|
|
7
7
|
export { STATIC_DIR } from "./express/static";
|
|
8
|
-
export { JWProxy } from "./jsonwp-proxy/proxy";
|
|
9
8
|
export { DEFAULT_WS_PATHNAME_PREFIX } from "./express/websocket";
|
|
10
9
|
export type ServerOpts = import("./express/server").ServerOpts;
|
|
11
10
|
import { BaseDriver } from './basedriver/driver';
|
|
12
11
|
export { MAX_LOG_BODY_LENGTH, DEFAULT_BASE_PATH, PROTOCOLS, W3C_ELEMENT_KEY } from "./constants";
|
|
13
12
|
export { server, normalizeBasePath } from "./express/server";
|
|
13
|
+
export { JWProxy, JWProxy as WebDriverProxy } from "./jsonwp-proxy/proxy";
|
|
14
14
|
export { getSummaryByCode, codes as statusCodes } from "./jsonwp-status/status";
|
|
15
15
|
export { PREFIXED_APPIUM_OPTS_CAP, STANDARD_CAPS, processCapabilities, isStandardCap, validateCaps, promoteAppiumOptions, promoteAppiumOptionsForObject } from "./basedriver/capabilities";
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/build/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.js"],"names":[],"mappings":";;;;;;;;yBAmDa,OAAO,kBAAkB,EAAE,UAAU;2BAvCzB,qBAAqB"}
|
package/build/lib/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.DEFAULT_WS_PATHNAME_PREFIX = exports.promoteAppiumOptionsForObject = exports.promoteAppiumOptions = exports.validateCaps = exports.isStandardCap = exports.processCapabilities = exports.STANDARD_CAPS = exports.PREFIXED_APPIUM_OPTS_CAP = exports.statusCodes = exports.getSummaryByCode = exports.JWProxy = exports.normalizeBasePath = exports.server = exports.STATIC_DIR = exports.errorFromCode = exports.W3C_ELEMENT_KEY = exports.PROTOCOLS = exports.DEFAULT_BASE_PATH = exports.MAX_LOG_BODY_LENGTH = exports.BaseDriver = exports.DeviceSettings = exports.DriverCore = void 0;
|
|
20
|
+
exports.DEFAULT_WS_PATHNAME_PREFIX = exports.promoteAppiumOptionsForObject = exports.promoteAppiumOptions = exports.validateCaps = exports.isStandardCap = exports.processCapabilities = exports.STANDARD_CAPS = exports.PREFIXED_APPIUM_OPTS_CAP = exports.statusCodes = exports.getSummaryByCode = exports.WebDriverProxy = exports.JWProxy = exports.normalizeBasePath = exports.server = exports.STATIC_DIR = exports.errorFromCode = exports.W3C_ELEMENT_KEY = exports.PROTOCOLS = exports.DEFAULT_BASE_PATH = exports.MAX_LOG_BODY_LENGTH = exports.BaseDriver = exports.DeviceSettings = exports.DriverCore = void 0;
|
|
21
21
|
const bluebird_1 = __importDefault(require("bluebird"));
|
|
22
22
|
try {
|
|
23
23
|
bluebird_1.default.config({
|
|
@@ -52,8 +52,11 @@ var server_1 = require("./express/server");
|
|
|
52
52
|
Object.defineProperty(exports, "server", { enumerable: true, get: function () { return server_1.server; } });
|
|
53
53
|
Object.defineProperty(exports, "normalizeBasePath", { enumerable: true, get: function () { return server_1.normalizeBasePath; } });
|
|
54
54
|
// jsonwp-proxy exports
|
|
55
|
+
/** @deprecated The JWProxy export is deprecated. Please use WebDriverProxy instead */
|
|
55
56
|
var proxy_1 = require("./jsonwp-proxy/proxy");
|
|
56
57
|
Object.defineProperty(exports, "JWProxy", { enumerable: true, get: function () { return proxy_1.JWProxy; } });
|
|
58
|
+
var proxy_2 = require("./jsonwp-proxy/proxy");
|
|
59
|
+
Object.defineProperty(exports, "WebDriverProxy", { enumerable: true, get: function () { return proxy_2.JWProxy; } });
|
|
57
60
|
// jsonwp-status exports
|
|
58
61
|
var status_1 = require("./jsonwp-status/status");
|
|
59
62
|
Object.defineProperty(exports, "getSummaryByCode", { enumerable: true, get: function () { return status_1.getSummaryByCode; } });
|
package/build/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,wDAAyB;AAEzB,IAAI,CAAC;IACH,kBAAC,CAAC,MAAM,CAAC;QACP,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;AACL,CAAC;AAAC,OAAO,GAAG,EAAE,CAAC;IACb,0FAA0F;IAC1F,8EAA8E;AAChF,CAAC;AAED,qBAAqB;AACrB,gDAA+C;AAIvC,2FAJA,mBAAU,OAIA;AAHlB,0CAA6C;AAArC,kGAAA,UAAU,OAAA;AAClB,gEAA4D;AAApD,iHAAA,cAAc,OAAA;AAGtB,kBAAe,mBAAU,CAAC;AAC1B,yCAA+F;AAAvF,gHAAA,mBAAmB,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AAAE,sGAAA,SAAS,OAAA;AAAE,4GAAA,eAAe,OAAA;AAE1E,kBAAkB;AAClB,6CAA2B;AAC3B,uCAAuE;AAA/D,yGAAA,0BAA0B,OAAiB;AAEnD,kBAAkB;AAClB,2CAA4C;AAApC,oGAAA,UAAU,OAAA;AAClB,2CAA2D;AAAnD,gGAAA,MAAM,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAEjC,uBAAuB;AACvB,8CAA6C;AAArC,gGAAA,OAAO,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,wDAAyB;AAEzB,IA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from '@appium/support';
|
|
32
32
|
|
|
33
33
|
const KEEP_ALIVE_TIMEOUT_MS = 10 * 60 * 1000; // 10 minutes
|
|
34
|
-
const SERVER_CLOSE_TIMEOUT_MS = 5000;
|
|
35
34
|
|
|
36
35
|
/**
|
|
37
36
|
*
|
|
@@ -82,7 +81,7 @@ async function server(opts) {
|
|
|
82
81
|
routeConfiguringFunction,
|
|
83
82
|
port,
|
|
84
83
|
hostname,
|
|
85
|
-
cliArgs = {},
|
|
84
|
+
cliArgs = /** @type {import('@appium/types').ServerArgs} */ ({}),
|
|
86
85
|
allowCors = true,
|
|
87
86
|
basePath = DEFAULT_BASE_PATH,
|
|
88
87
|
extraMethodMap = {},
|
|
@@ -104,6 +103,7 @@ async function server(opts) {
|
|
|
104
103
|
httpServer,
|
|
105
104
|
reject,
|
|
106
105
|
keepAliveTimeout,
|
|
106
|
+
gracefulShutdownTimeout: cliArgs.shutdownTimeout,
|
|
107
107
|
});
|
|
108
108
|
configureServer({
|
|
109
109
|
app,
|
|
@@ -191,7 +191,7 @@ function configureServer({
|
|
|
191
191
|
* @param {ConfigureHttpOpts} opts
|
|
192
192
|
* @returns {AppiumServer}
|
|
193
193
|
*/
|
|
194
|
-
function configureHttp({httpServer, reject, keepAliveTimeout}) {
|
|
194
|
+
function configureHttp({httpServer, reject, keepAliveTimeout, gracefulShutdownTimeout}) {
|
|
195
195
|
/**
|
|
196
196
|
* @type {AppiumServer}
|
|
197
197
|
*/
|
|
@@ -214,12 +214,15 @@ function configureHttp({httpServer, reject, keepAliveTimeout}) {
|
|
|
214
214
|
log.info('Closing Appium HTTP server');
|
|
215
215
|
const timer = new timing.Timer().start();
|
|
216
216
|
const onTimeout = setTimeout(() => {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
217
|
+
if (gracefulShutdownTimeout > 0) {
|
|
218
|
+
log.info(
|
|
219
|
+
`Not all active connections have been closed within ${gracefulShutdownTimeout}ms. ` +
|
|
220
|
+
`This timeout might be customized by the --shutdown-timeout command line ` +
|
|
221
|
+
`argument. Closing the server anyway.`
|
|
222
|
+
);
|
|
223
|
+
}
|
|
221
224
|
process.exit(process.exitCode ?? 0);
|
|
222
|
-
},
|
|
225
|
+
}, gracefulShutdownTimeout);
|
|
223
226
|
httpServer.once('close', () => {
|
|
224
227
|
log.info(
|
|
225
228
|
`Appium HTTP server has been succesfully closed after ` +
|
|
@@ -323,6 +326,9 @@ export {server, configureServer, normalizeBasePath};
|
|
|
323
326
|
* @property {import('http').Server} httpServer - HTTP server instance
|
|
324
327
|
* @property {(error?: any) => void} reject - Rejection function from `Promise` constructor
|
|
325
328
|
* @property {number} keepAliveTimeout - Keep-alive timeout in milliseconds
|
|
329
|
+
* @property {number} gracefulShutdownTimeout - For how long the server should delay its
|
|
330
|
+
* shutdown before force-closing all open connections to it. Providing zero will force-close
|
|
331
|
+
* the server without waiting for any connections.
|
|
326
332
|
*/
|
|
327
333
|
|
|
328
334
|
/**
|
package/lib/index.js
CHANGED
|
@@ -27,7 +27,9 @@ export {STATIC_DIR} from './express/static';
|
|
|
27
27
|
export {server, normalizeBasePath} from './express/server';
|
|
28
28
|
|
|
29
29
|
// jsonwp-proxy exports
|
|
30
|
+
/** @deprecated The JWProxy export is deprecated. Please use WebDriverProxy instead */
|
|
30
31
|
export {JWProxy} from './jsonwp-proxy/proxy';
|
|
32
|
+
export {JWProxy as WebDriverProxy} from './jsonwp-proxy/proxy';
|
|
31
33
|
|
|
32
34
|
// jsonwp-status exports
|
|
33
35
|
export {getSummaryByCode, codes as statusCodes} from './jsonwp-status/status';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/base-driver",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.12.1",
|
|
4
4
|
"description": "Base driver class for Appium drivers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"test:types": "tsd"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@appium/support": "^5.1.
|
|
48
|
-
"@appium/types": "^0.
|
|
47
|
+
"@appium/support": "^5.1.6",
|
|
48
|
+
"@appium/types": "^0.22.0",
|
|
49
49
|
"@colors/colors": "1.6.0",
|
|
50
50
|
"@types/async-lock": "1.4.2",
|
|
51
51
|
"@types/bluebird": "3.5.42",
|
|
52
|
-
"@types/express": "
|
|
53
|
-
"@types/lodash": "4.17.
|
|
52
|
+
"@types/express": "5.0.0",
|
|
53
|
+
"@types/lodash": "4.17.12",
|
|
54
54
|
"@types/method-override": "0.0.35",
|
|
55
55
|
"@types/serve-favicon": "2.5.7",
|
|
56
56
|
"async-lock": "1.4.1",
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
"axios": "1.7.7",
|
|
59
59
|
"bluebird": "3.7.2",
|
|
60
60
|
"body-parser": "1.20.3",
|
|
61
|
-
"express": "4.21.
|
|
61
|
+
"express": "4.21.1",
|
|
62
62
|
"http-status-codes": "2.3.0",
|
|
63
63
|
"lodash": "4.17.21",
|
|
64
64
|
"lru-cache": "10.4.3",
|
|
65
65
|
"method-override": "3.0.0",
|
|
66
66
|
"morgan": "1.10.0",
|
|
67
|
-
"path-to-regexp": "8.
|
|
67
|
+
"path-to-regexp": "8.2.0",
|
|
68
68
|
"serve-favicon": "2.5.0",
|
|
69
69
|
"source-map-support": "0.5.21",
|
|
70
70
|
"type-fest": "4.26.1",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "b0095bfd47d7d90ba4e933a727fa6e024f3fe844",
|
|
84
84
|
"tsd": {
|
|
85
85
|
"directory": "test/types"
|
|
86
86
|
}
|