@wdio/appium-service 7.20.7 → 7.20.8-alpha.219
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/index.d.ts +3 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -25
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +23 -24
- package/build/types.js +1 -2
- package/build/utils.d.ts +1 -1
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +10 -17
- package/package.json +11 -9
package/build/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import AppiumLauncher from './launcher';
|
|
1
|
+
import AppiumLauncher from './launcher.js';
|
|
2
2
|
export default class AppiumService {
|
|
3
3
|
}
|
|
4
4
|
export declare const launcher: typeof AppiumLauncher;
|
|
5
|
-
export * from './types';
|
|
6
|
-
import { AppiumServiceConfig } from './types';
|
|
5
|
+
export * from './types.js';
|
|
6
|
+
import type { AppiumServiceConfig } from './types';
|
|
7
7
|
declare global {
|
|
8
8
|
namespace WebdriverIO {
|
|
9
9
|
interface ServiceOption extends AppiumServiceConfig {
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,eAAe,CAAA;AAE1C,MAAM,CAAC,OAAO,OAAO,aAAa;CAAG;AACrC,eAAO,MAAM,QAAQ,uBAAiB,CAAA;AAEtC,cAAc,YAAY,CAAA;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,WAAW,CAAC;QAClB,UAAU,aAAc,SAAQ,mBAAmB;SAAG;KACzD;CACJ"}
|
package/build/index.js
CHANGED
|
@@ -1,27 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* istanbul ignore file */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.launcher = void 0;
|
|
22
|
-
const launcher_1 = __importDefault(require("./launcher"));
|
|
23
|
-
class AppiumService {
|
|
2
|
+
import AppiumLauncher from './launcher.js';
|
|
3
|
+
export default class AppiumService {
|
|
24
4
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
__exportStar(require("./types"), exports);
|
|
5
|
+
export const launcher = AppiumLauncher;
|
|
6
|
+
export * from './types.js';
|
package/build/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAGlE,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAmBzE,MAAM,CAAC,OAAO,OAAO,cAAe,YAAW,QAAQ,CAAC,eAAe;IAQ/D,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,OAAO,CAAC;IATpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAe;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuB;IAC7C,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,QAAQ,CAAC,CAA+C;gBAGpD,QAAQ,EAAE,mBAAmB,EAC7B,aAAa,EAAE,YAAY,CAAC,kBAAkB,EAC9C,OAAO,CAAC,gCAAoB;IAUxC,OAAO,CAAC,WAAW;IAqBnB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IA6BlB,SAAS;IAkBf,UAAU;IAOV,OAAO,CAAC,YAAY;IA2BpB,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,MAAM,CAAC,iBAAiB;CAanC"}
|
package/build/launcher.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const fs_extra_1 = require("fs-extra");
|
|
9
|
-
const util_1 = require("util");
|
|
10
|
-
const config_1 = require("@wdio/config");
|
|
11
|
-
const utils_1 = require("./utils");
|
|
12
|
-
const log = (0, logger_1.default)('@wdio/appium-service');
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import logger from '@wdio/logger';
|
|
5
|
+
import { isCloudCapability } from '@wdio/config';
|
|
6
|
+
import { getFilePath, formatCliArgs } from './utils.js';
|
|
7
|
+
const log = logger('@wdio/appium-service');
|
|
13
8
|
const DEFAULT_LOG_FILENAME = 'wdio-appium.log';
|
|
14
9
|
const DEFAULT_CONNECTION = {
|
|
15
10
|
protocol: 'http',
|
|
@@ -17,9 +12,14 @@ const DEFAULT_CONNECTION = {
|
|
|
17
12
|
port: 4723,
|
|
18
13
|
path: '/'
|
|
19
14
|
};
|
|
20
|
-
|
|
15
|
+
const require = createRequire(import.meta.url);
|
|
16
|
+
/**
|
|
17
|
+
* 'fs-extra' has no support for ESM
|
|
18
|
+
* https://github.com/jprichardson/node-fs-extra/issues/746
|
|
19
|
+
*/
|
|
20
|
+
const { createWriteStream, ensureFileSync } = require('fs-extra');
|
|
21
|
+
export default class AppiumLauncher {
|
|
21
22
|
constructor(_options, _capabilities, _config) {
|
|
22
|
-
var _a;
|
|
23
23
|
this._options = _options;
|
|
24
24
|
this._capabilities = _capabilities;
|
|
25
25
|
this._config = _config;
|
|
@@ -28,7 +28,7 @@ class AppiumLauncher {
|
|
|
28
28
|
basePath: DEFAULT_CONNECTION.path,
|
|
29
29
|
...(this._options.args || {})
|
|
30
30
|
};
|
|
31
|
-
this._logPath = _options.logPath ||
|
|
31
|
+
this._logPath = _options.logPath || this._config?.outputDir;
|
|
32
32
|
this._command = this._getCommand(_options.command);
|
|
33
33
|
}
|
|
34
34
|
_getCommand(command) {
|
|
@@ -61,22 +61,22 @@ class AppiumLauncher {
|
|
|
61
61
|
for (const [, capability] of Object.entries(this._capabilities)) {
|
|
62
62
|
const cap = capability.capabilities || capability;
|
|
63
63
|
const c = cap.alwaysMatch || cap;
|
|
64
|
-
!
|
|
64
|
+
!isCloudCapability(c) && Object.assign(capability, DEFAULT_CONNECTION, 'port' in this._args ? { port: this._args.port } : {}, { path: this._args.basePath }, { ...capability });
|
|
65
65
|
}
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
this._capabilities.forEach((cap) => !
|
|
68
|
+
this._capabilities.forEach((cap) => !isCloudCapability(cap.alwaysMatch || cap) && Object.assign(cap, DEFAULT_CONNECTION, 'port' in this._args ? { port: this._args.port } : {}, { path: this._args.basePath }, { ...cap }));
|
|
69
69
|
}
|
|
70
70
|
async onPrepare() {
|
|
71
71
|
/**
|
|
72
72
|
* Append remaining arguments
|
|
73
73
|
*/
|
|
74
|
-
this._appiumCliArgs.push(...
|
|
74
|
+
this._appiumCliArgs.push(...formatCliArgs(this._args));
|
|
75
75
|
this._setCapabilities();
|
|
76
76
|
/**
|
|
77
77
|
* start Appium
|
|
78
78
|
*/
|
|
79
|
-
this._process = await
|
|
79
|
+
this._process = await promisify(this._startAppium)(this._command, this._appiumCliArgs);
|
|
80
80
|
if (this._logPath) {
|
|
81
81
|
this._redirectLogStream(this._logPath);
|
|
82
82
|
}
|
|
@@ -89,7 +89,7 @@ class AppiumLauncher {
|
|
|
89
89
|
}
|
|
90
90
|
_startAppium(command, args, callback) {
|
|
91
91
|
log.debug(`Will spawn Appium process: ${command} ${args.join(' ')}`);
|
|
92
|
-
let process =
|
|
92
|
+
let process = spawn(command, args, { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
93
93
|
let error;
|
|
94
94
|
process.stdout.on('data', (data) => {
|
|
95
95
|
if (data.includes('Appium REST http interface listener started')) {
|
|
@@ -114,11 +114,11 @@ class AppiumLauncher {
|
|
|
114
114
|
if (!this._process) {
|
|
115
115
|
throw Error('No Appium process to redirect log stream');
|
|
116
116
|
}
|
|
117
|
-
const logFile =
|
|
117
|
+
const logFile = getFilePath(logPath, DEFAULT_LOG_FILENAME);
|
|
118
118
|
// ensure file & directory exists
|
|
119
|
-
|
|
119
|
+
ensureFileSync(logFile);
|
|
120
120
|
log.debug(`Appium logs written to: ${logFile}`);
|
|
121
|
-
const logStream =
|
|
121
|
+
const logStream = createWriteStream(logFile, { flags: 'w' });
|
|
122
122
|
this._process.stdout.pipe(logStream);
|
|
123
123
|
this._process.stderr.pipe(logStream);
|
|
124
124
|
}
|
|
@@ -135,4 +135,3 @@ class AppiumLauncher {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
exports.default = AppiumLauncher;
|
package/build/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/build/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArgValue, KeyValueArgs } from './types';
|
|
1
|
+
import type { ArgValue, KeyValueArgs } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Resolves the given path into a absolute path and appends the default filename as fallback when the provided path is a directory.
|
|
4
4
|
* @param {String} filePath relative file or directory path
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAIrD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAU9E;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,CAoBvE;AAED,wBAAgB,sBAAsB,CAAE,KAAK,EAAE,QAAQ,UAItD;AAED,wBAAgB,SAAS,IAAI,OAAO,CAEnC"}
|
package/build/utils.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.isWindows = exports.sanitizeCliOptionValue = exports.formatCliArgs = exports.getFilePath = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const param_case_1 = require("param-case");
|
|
1
|
+
import { basename, join, resolve } from 'node:path';
|
|
2
|
+
import { paramCase } from 'param-case';
|
|
6
3
|
const FILE_EXTENSION_REGEX = /\.[0-9a-z]+$/i;
|
|
7
4
|
/**
|
|
8
5
|
* Resolves the given path into a absolute path and appends the default filename as fallback when the provided path is a directory.
|
|
@@ -10,17 +7,16 @@ const FILE_EXTENSION_REGEX = /\.[0-9a-z]+$/i;
|
|
|
10
7
|
* @param {String} defaultFilename default file name when filePath is a directory
|
|
11
8
|
* @return {String} absolute file path
|
|
12
9
|
*/
|
|
13
|
-
function getFilePath(filePath, defaultFilename) {
|
|
14
|
-
let absolutePath =
|
|
10
|
+
export function getFilePath(filePath, defaultFilename) {
|
|
11
|
+
let absolutePath = resolve(filePath);
|
|
15
12
|
// test if we already have a file (e.g. selenium.txt, .log, log.txt, etc.)
|
|
16
13
|
// NOTE: path.extname doesn't work to detect a file, cause dotfiles are reported by node to have no extension
|
|
17
|
-
if (!FILE_EXTENSION_REGEX.test(
|
|
18
|
-
absolutePath =
|
|
14
|
+
if (!FILE_EXTENSION_REGEX.test(basename(absolutePath))) {
|
|
15
|
+
absolutePath = join(absolutePath, defaultFilename);
|
|
19
16
|
}
|
|
20
17
|
return absolutePath;
|
|
21
18
|
}
|
|
22
|
-
|
|
23
|
-
function formatCliArgs(args) {
|
|
19
|
+
export function formatCliArgs(args) {
|
|
24
20
|
if (Array.isArray(args)) {
|
|
25
21
|
return args.map(arg => sanitizeCliOptionValue(arg));
|
|
26
22
|
}
|
|
@@ -31,7 +27,7 @@ function formatCliArgs(args) {
|
|
|
31
27
|
if ((typeof value === 'boolean' && !value) || value === null) {
|
|
32
28
|
continue;
|
|
33
29
|
}
|
|
34
|
-
cliArgs.push(`--${
|
|
30
|
+
cliArgs.push(`--${paramCase(key)}`);
|
|
35
31
|
// Only non-boolean and non-null values are added as option values
|
|
36
32
|
if (typeof value !== 'boolean') {
|
|
37
33
|
cliArgs.push(sanitizeCliOptionValue(value));
|
|
@@ -39,14 +35,11 @@ function formatCliArgs(args) {
|
|
|
39
35
|
}
|
|
40
36
|
return cliArgs;
|
|
41
37
|
}
|
|
42
|
-
|
|
43
|
-
function sanitizeCliOptionValue(value) {
|
|
38
|
+
export function sanitizeCliOptionValue(value) {
|
|
44
39
|
const valueString = String(value);
|
|
45
40
|
// Encapsulate the value string in single quotes if it contains a white space
|
|
46
41
|
return /\s/.test(valueString) ? `'${valueString}'` : valueString;
|
|
47
42
|
}
|
|
48
|
-
|
|
49
|
-
function isWindows() {
|
|
43
|
+
export function isWindows() {
|
|
50
44
|
return process.platform === 'win32';
|
|
51
45
|
}
|
|
52
|
-
exports.isWindows = isWindows;
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/appium-service",
|
|
3
|
-
"version": "7.20.
|
|
3
|
+
"version": "7.20.8-alpha.219+4aab2cef1",
|
|
4
4
|
"description": "A WebdriverIO service to start & stop Appium Server",
|
|
5
5
|
"author": "Morten Bjerg Gregersen <morten@mogee.dk>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-appium-service",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"main": "./build/index",
|
|
9
8
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
9
|
+
"node": "^16.13 || >=18"
|
|
11
10
|
},
|
|
12
11
|
"repository": {
|
|
13
12
|
"type": "git",
|
|
@@ -25,20 +24,23 @@
|
|
|
25
24
|
"bugs": {
|
|
26
25
|
"url": "https://github.com/webdriverio/webdriverio/issues"
|
|
27
26
|
},
|
|
27
|
+
"type": "module",
|
|
28
|
+
"exports": "./build/index.js",
|
|
29
|
+
"types": "./build/index.d.ts",
|
|
30
|
+
"typeScriptVersion": "3.8.3",
|
|
28
31
|
"dependencies": {
|
|
29
|
-
"@types/fs-extra": "^9.0.
|
|
32
|
+
"@types/fs-extra": "^9.0.13",
|
|
30
33
|
"@wdio/config": "7.20.7",
|
|
31
34
|
"@wdio/logger": "7.19.0",
|
|
32
35
|
"@wdio/types": "7.20.7",
|
|
33
|
-
"fs-extra": "^10.
|
|
34
|
-
"param-case": "^3.0.
|
|
36
|
+
"fs-extra": "^10.1.0",
|
|
37
|
+
"param-case": "^3.0.4"
|
|
35
38
|
},
|
|
36
39
|
"peerDependencies": {
|
|
37
|
-
"@wdio/cli": "
|
|
40
|
+
"@wdio/cli": "next"
|
|
38
41
|
},
|
|
39
42
|
"publishConfig": {
|
|
40
43
|
"access": "public"
|
|
41
44
|
},
|
|
42
|
-
"
|
|
43
|
-
"gitHead": "21b8b61453f4749d87eca3e4d7d6e5e2cb60f043"
|
|
45
|
+
"gitHead": "4aab2cef1b8b195ac8cc611f28b1fd54e4ba3443"
|
|
44
46
|
}
|