appium-xcuitest-driver 4.32.3 → 4.32.5
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 +14 -0
- package/build/lib/css-converter.d.ts +0 -75
- package/build/lib/css-converter.d.ts.map +1 -1
- package/build/lib/css-converter.js +81 -106
- package/build/lib/css-converter.js.map +1 -1
- package/lib/css-converter.js +83 -112
- package/npm-shrinkwrap.json +162 -56
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [4.32.5](https://github.com/appium/appium-xcuitest-driver/compare/v4.32.4...v4.32.5) (2023-06-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update dependency semver to v7.5.2 ([d6c236d](https://github.com/appium/appium-xcuitest-driver/commit/d6c236da158dc6fe50a20e812917cc4dc132447b))
|
|
7
|
+
|
|
8
|
+
## [4.32.4](https://github.com/appium/appium-xcuitest-driver/compare/v4.32.3...v4.32.4) (2023-06-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency css-selector-parser to v2 ([#1759](https://github.com/appium/appium-xcuitest-driver/issues/1759)) ([0426349](https://github.com/appium/appium-xcuitest-driver/commit/0426349da313127111c19d4de44151ab45ecb64f))
|
|
14
|
+
|
|
1
15
|
## [4.32.3](https://github.com/appium/appium-xcuitest-driver/compare/v4.32.2...v4.32.3) (2023-06-16)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,79 +1,4 @@
|
|
|
1
1
|
export default CssConverter;
|
|
2
|
-
export type CssNameValueObject = {
|
|
3
|
-
/**
|
|
4
|
-
* The name of the CSS object
|
|
5
|
-
*/
|
|
6
|
-
name?: string | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* The value of the CSS object
|
|
9
|
-
*/
|
|
10
|
-
value?: string | undefined;
|
|
11
|
-
};
|
|
12
|
-
export type CssAttr = {
|
|
13
|
-
name?: string | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* Type of attribute (must be string or empty)
|
|
16
|
-
*/
|
|
17
|
-
valueType?: string | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* Value of the attribute
|
|
20
|
-
*/
|
|
21
|
-
value?: string | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* The operator between value and value type (=, *=, , ^=, $=)
|
|
24
|
-
*/
|
|
25
|
-
operator?: string | undefined;
|
|
26
|
-
};
|
|
27
|
-
export type CssPseudo = {
|
|
28
|
-
/**
|
|
29
|
-
* The type of CSS pseudo selector (https://www.npmjs.com/package/css-selector-parser for reference)
|
|
30
|
-
*/
|
|
31
|
-
valueType?: string | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* The name of the pseudo selector
|
|
34
|
-
*/
|
|
35
|
-
name?: string | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* The value of the pseudo selector
|
|
38
|
-
*/
|
|
39
|
-
value?: string | undefined;
|
|
40
|
-
};
|
|
41
|
-
export type CssRule = {
|
|
42
|
-
/**
|
|
43
|
-
* The nesting operator (aka: combinator https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors)
|
|
44
|
-
*/
|
|
45
|
-
nestingOperator?: string | undefined;
|
|
46
|
-
/**
|
|
47
|
-
* The tag name (aka: type selector https://developer.mozilla.org/en-US/docs/Web/CSS/Type_selectors)
|
|
48
|
-
*/
|
|
49
|
-
tagName?: string | undefined;
|
|
50
|
-
/**
|
|
51
|
-
* An array of CSS class names
|
|
52
|
-
*/
|
|
53
|
-
classNames?: string[] | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* An array of CSS attributes
|
|
56
|
-
*/
|
|
57
|
-
attrs?: CssAttr[] | undefined;
|
|
58
|
-
/**
|
|
59
|
-
* An array of CSS pseudos
|
|
60
|
-
*/
|
|
61
|
-
pseudos?: CssPseudo[] | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* CSS identifier
|
|
64
|
-
*/
|
|
65
|
-
id?: string | undefined;
|
|
66
|
-
/**
|
|
67
|
-
* A descendant of this CSS rule
|
|
68
|
-
*/
|
|
69
|
-
rule?: CssRule | undefined;
|
|
70
|
-
};
|
|
71
|
-
export type CssObject = {
|
|
72
|
-
/**
|
|
73
|
-
* Type of CSS object. 'rule', 'ruleset' or 'selectors'
|
|
74
|
-
*/
|
|
75
|
-
type?: string | undefined;
|
|
76
|
-
};
|
|
77
2
|
declare namespace CssConverter {
|
|
78
3
|
/**
|
|
79
4
|
* Convert a CSS selector to a iOS Class Chain selector
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-converter.d.ts","sourceRoot":"","sources":["../../lib/css-converter.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"css-converter.d.ts","sourceRoot":"","sources":["../../lib/css-converter.js"],"names":[],"mappings":";;IAoQA;;;;OAIG;IACH,8DAcC"}
|
|
@@ -6,12 +6,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const css_selector_parser_1 = require("css-selector-parser");
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const driver_1 = require("appium/driver");
|
|
9
|
+
const logger_js_1 = __importDefault(require("./logger.js"));
|
|
9
10
|
const CssConverter = {};
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const parseCssSelector = (0, css_selector_parser_1.createParser)({
|
|
12
|
+
syntax: {
|
|
13
|
+
pseudoClasses: {
|
|
14
|
+
unknown: 'accept',
|
|
15
|
+
definitions: {
|
|
16
|
+
Selector: ['has'],
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
combinators: ['>', '+', '~'],
|
|
20
|
+
attributes: {
|
|
21
|
+
operators: ['^=', '$=', '*=', '~=', '=']
|
|
22
|
+
},
|
|
23
|
+
ids: true,
|
|
24
|
+
classNames: true,
|
|
25
|
+
tag: {
|
|
26
|
+
wildcard: true
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
substitutes: true
|
|
30
|
+
});
|
|
15
31
|
const BOOLEAN_ATTRS = [
|
|
16
32
|
'visible', 'accessible', 'accessibility-container', 'enabled',
|
|
17
33
|
];
|
|
@@ -36,7 +52,7 @@ const ATTRIBUTE_ALIASES = [
|
|
|
36
52
|
/**
|
|
37
53
|
* Convert hyphen separated word to camel case
|
|
38
54
|
*
|
|
39
|
-
* @param {string} str
|
|
55
|
+
* @param {string?} str
|
|
40
56
|
* @returns {string} The hyphen separated word translated to camel case
|
|
41
57
|
*/
|
|
42
58
|
function toCamelCase(str) {
|
|
@@ -47,19 +63,16 @@ function toCamelCase(str) {
|
|
|
47
63
|
const out = tokens.join('');
|
|
48
64
|
return out.charAt(0).toLowerCase() + out.slice(1);
|
|
49
65
|
}
|
|
50
|
-
/**
|
|
51
|
-
* @typedef {Object} CssNameValueObject
|
|
52
|
-
* @property {string} [name] The name of the CSS object
|
|
53
|
-
* @property {string} [value] The value of the CSS object
|
|
54
|
-
*/
|
|
55
66
|
/**
|
|
56
67
|
* Get the boolean from a CSS object. If empty, return true. If not true/false/empty, throw exception
|
|
57
68
|
*
|
|
58
|
-
* @param {
|
|
69
|
+
* @param {import('css-selector-parser').AstAttribute|import('css-selector-parser').AstPseudoClass} cssAttr
|
|
59
70
|
* @returns {string} Either 'true' or 'false'. If value is empty, return 'true'
|
|
60
71
|
*/
|
|
61
|
-
function requireBoolean(
|
|
62
|
-
|
|
72
|
+
function requireBoolean(cssAttr) {
|
|
73
|
+
// @ts-ignore We only support strings
|
|
74
|
+
const attrValue = cssAttr.value?.value;
|
|
75
|
+
const val = lodash_1.default.toLower(attrValue) || 'true'; // an omitted boolean attribute means 'true' (e.g.: input[checked] means checked is true)
|
|
63
76
|
switch (val) {
|
|
64
77
|
case '0':
|
|
65
78
|
case 'false':
|
|
@@ -68,7 +81,7 @@ function requireBoolean(css) {
|
|
|
68
81
|
case 'true':
|
|
69
82
|
return '1';
|
|
70
83
|
default:
|
|
71
|
-
throw new TypeError(`'${
|
|
84
|
+
throw new TypeError(`'${cssAttr.name}' must be true/1 or false/0 or empty. Found '${attrValue}'`);
|
|
72
85
|
}
|
|
73
86
|
}
|
|
74
87
|
/**
|
|
@@ -77,43 +90,38 @@ function requireBoolean(css) {
|
|
|
77
90
|
* Converts to lowercase and if an attribute name is an alias for something else, return
|
|
78
91
|
* what it is an alias for
|
|
79
92
|
*
|
|
80
|
-
* @param {
|
|
93
|
+
* @param {import('css-selector-parser').AstAttribute|import('css-selector-parser').AstPseudoClass} cssEntity
|
|
81
94
|
* @returns {string} The canonical attribute name
|
|
82
95
|
*/
|
|
83
|
-
function
|
|
84
|
-
const
|
|
96
|
+
function requireEntityName(cssEntity) {
|
|
97
|
+
const entityName = cssEntity.name.toLowerCase();
|
|
85
98
|
// Check if it's supported and if it is, return it
|
|
86
|
-
if (ALL_ATTRS.includes(
|
|
87
|
-
return
|
|
99
|
+
if (ALL_ATTRS.includes(entityName)) {
|
|
100
|
+
return entityName.toLowerCase();
|
|
88
101
|
}
|
|
89
102
|
// If attrName is an alias for something else, return that
|
|
90
103
|
for (const [officialAttr, aliasAttrs] of ATTRIBUTE_ALIASES) {
|
|
91
|
-
if (aliasAttrs.includes(
|
|
104
|
+
if (aliasAttrs.includes(entityName)) {
|
|
92
105
|
return officialAttr;
|
|
93
106
|
}
|
|
94
107
|
}
|
|
95
|
-
throw new Error(`'${
|
|
96
|
-
`Supported attributes are '${ALL_ATTRS.join(', ')}'`);
|
|
108
|
+
throw new Error(`'${entityName}' is not a valid attribute. ` +
|
|
109
|
+
`Supported attributes are: '${ALL_ATTRS.join(', ')}'`);
|
|
97
110
|
}
|
|
98
|
-
/**
|
|
99
|
-
* @typedef {Object} CssAttr
|
|
100
|
-
* @property {string} [name]
|
|
101
|
-
* @property {string} [valueType] Type of attribute (must be string or empty)
|
|
102
|
-
* @property {string} [value] Value of the attribute
|
|
103
|
-
* @property {string} [operator] The operator between value and value type (=, *=, , ^=, $=)
|
|
104
|
-
*/
|
|
105
111
|
/**
|
|
106
112
|
* Convert a CSS attribute into a UiSelector method call
|
|
107
113
|
*
|
|
108
|
-
* @param {
|
|
114
|
+
* @param {import('css-selector-parser').AstAttribute} cssAttr CSS attribute object
|
|
109
115
|
* @returns {string|{index: string|undefined}} CSS attribute parsed as UiSelector
|
|
110
116
|
*/
|
|
111
117
|
function parseAttr(cssAttr) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
// @ts-ignore We only care for strings
|
|
119
|
+
const attrValue = cssAttr.value?.value;
|
|
120
|
+
if (!lodash_1.default.isString(attrValue) && !lodash_1.default.isEmpty(attrValue)) {
|
|
121
|
+
throw new TypeError(`'${cssAttr.name}=${attrValue}' is an invalid attribute. ` +
|
|
122
|
+
`Only 'string' and empty attribute types are supported. Found '${attrValue}'`);
|
|
115
123
|
}
|
|
116
|
-
const attrName = toCamelCase(
|
|
124
|
+
const attrName = toCamelCase(requireEntityName(cssAttr));
|
|
117
125
|
// Validate that it's a supported attribute
|
|
118
126
|
if (!STR_ATTRS.includes(attrName) && !BOOLEAN_ATTRS.includes(attrName)) {
|
|
119
127
|
throw new Error(`'${attrName}' is not supported. Supported attributes are ` +
|
|
@@ -121,12 +129,12 @@ function parseAttr(cssAttr) {
|
|
|
121
129
|
}
|
|
122
130
|
// Parse index if it's an index attribute
|
|
123
131
|
if (attrName === 'index') {
|
|
124
|
-
return { index:
|
|
132
|
+
return { index: attrValue };
|
|
125
133
|
}
|
|
126
134
|
if (BOOLEAN_ATTRS.includes(attrName)) {
|
|
127
135
|
return `${attrName} == ${requireBoolean(cssAttr)}`;
|
|
128
136
|
}
|
|
129
|
-
let value =
|
|
137
|
+
let value = attrValue || '';
|
|
130
138
|
if (value === '') {
|
|
131
139
|
return `[${attrName} LIKE ${value}]`;
|
|
132
140
|
}
|
|
@@ -147,49 +155,34 @@ function parseAttr(cssAttr) {
|
|
|
147
155
|
` '=', '*=', '^=', '$=' and '~=' are supported.`);
|
|
148
156
|
}
|
|
149
157
|
}
|
|
150
|
-
/**
|
|
151
|
-
* @typedef {Object} CssPseudo
|
|
152
|
-
* @property {string} [valueType] The type of CSS pseudo selector (https://www.npmjs.com/package/css-selector-parser for reference)
|
|
153
|
-
* @property {string} [name] The name of the pseudo selector
|
|
154
|
-
* @property {string} [value] The value of the pseudo selector
|
|
155
|
-
*/
|
|
156
158
|
/**
|
|
157
159
|
* Convert a CSS pseudo class to a UiSelector
|
|
158
160
|
*
|
|
159
|
-
* @param {
|
|
161
|
+
* @param {import('css-selector-parser').AstPseudoClass} cssPseudo
|
|
160
162
|
* @returns {string|{index: string|undefined}|undefined} Pseudo selector parsed as UiSelector
|
|
161
163
|
*/
|
|
162
164
|
function parsePseudo(cssPseudo) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
// @ts-ignore We only care for strings
|
|
166
|
+
const argValue = cssPseudo.argument?.value;
|
|
167
|
+
if (!lodash_1.default.isString(argValue) && !lodash_1.default.isEmpty(argValue)) {
|
|
168
|
+
throw new TypeError(`'${cssPseudo.name}=${argValue}'. ` +
|
|
169
|
+
`Unsupported css pseudo class value: '${argValue}'. Only 'string' type or empty is supported.`);
|
|
166
170
|
}
|
|
167
|
-
const pseudoName =
|
|
171
|
+
const pseudoName = requireEntityName(cssPseudo);
|
|
168
172
|
if (BOOLEAN_ATTRS.includes(pseudoName)) {
|
|
169
173
|
return `${toCamelCase(pseudoName)} == ${requireBoolean(cssPseudo)}`;
|
|
170
174
|
}
|
|
171
175
|
if (pseudoName === 'index') {
|
|
172
|
-
return { index:
|
|
176
|
+
return { index: argValue };
|
|
173
177
|
}
|
|
174
178
|
}
|
|
175
|
-
/**
|
|
176
|
-
* @typedef {Object} CssRule
|
|
177
|
-
* @property {string} [nestingOperator] The nesting operator (aka: combinator https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors)
|
|
178
|
-
* @property {string} [tagName] The tag name (aka: type selector https://developer.mozilla.org/en-US/docs/Web/CSS/Type_selectors)
|
|
179
|
-
* @property {string[]} [classNames] An array of CSS class names
|
|
180
|
-
* @property {CssAttr[]} [attrs] An array of CSS attributes
|
|
181
|
-
* @property {CssPseudo[]} [pseudos] An array of CSS pseudos
|
|
182
|
-
* @property {string} [id] CSS identifier
|
|
183
|
-
* @property {CssRule} [rule] A descendant of this CSS rule
|
|
184
|
-
*/
|
|
185
179
|
/**
|
|
186
180
|
* Convert a CSS rule to a UiSelector
|
|
187
|
-
* @param {
|
|
181
|
+
* @param {import('css-selector-parser').AstRule} cssRule CSS rule definition
|
|
188
182
|
*/
|
|
189
183
|
function parseCssRule(cssRule) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
throw new Error(`'${nestingOperator}' is not a supported combinator. ` +
|
|
184
|
+
if (cssRule.combinator && ![' ', '>'].includes(cssRule.combinator)) {
|
|
185
|
+
throw new Error(`'${cssRule.combinator}' is not a supported combinator. ` +
|
|
193
186
|
`Only child combinator (>) and descendant combinator are supported.`);
|
|
194
187
|
}
|
|
195
188
|
let iosClassChainSelector = '';
|
|
@@ -198,67 +191,47 @@ function parseCssRule(cssRule) {
|
|
|
198
191
|
is not a valid ios class. Must be a single string (e.g.: XCUIElementTypeWindow) without
|
|
199
192
|
dots separating them`);
|
|
200
193
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
194
|
+
// @ts-ignore name presense
|
|
195
|
+
let tagName = cssRule.tag?.name ?? '';
|
|
196
|
+
if (tagName && tagName !== '*' && !lodash_1.default.startsWith(lodash_1.default.toLower(tagName), 'xcuielementtype')) {
|
|
197
|
+
const capitalizedTagName = tagName.charAt(0).toUpperCase() + tagName.slice(1);
|
|
198
|
+
tagName = `XCUIElementType${capitalizedTagName}`;
|
|
204
199
|
}
|
|
205
|
-
iosClassChainSelector += (
|
|
206
|
-
|
|
207
|
-
if (cssRule.
|
|
208
|
-
attrs.push(`name == "${cssRule.
|
|
200
|
+
iosClassChainSelector += (tagName || '*');
|
|
201
|
+
const attrs = [];
|
|
202
|
+
if (cssRule.ids && !lodash_1.default.isEmpty(cssRule.ids)) {
|
|
203
|
+
attrs.push(`name == "${cssRule.ids[0]}"`);
|
|
209
204
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
attrs.push(parseAttr(attr));
|
|
213
|
-
}
|
|
205
|
+
for (const attr of cssRule.attributes ?? []) {
|
|
206
|
+
attrs.push(parseAttr(attr));
|
|
214
207
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
attrs.push(parsePseudo(pseudo));
|
|
218
|
-
}
|
|
208
|
+
for (const pseudo of cssRule.pseudoClasses ?? []) {
|
|
209
|
+
attrs.push(parsePseudo(pseudo));
|
|
219
210
|
}
|
|
220
211
|
const nonIndexAttrs = attrs.filter((attr) => lodash_1.default.isString(attr));
|
|
221
|
-
if (nonIndexAttrs
|
|
212
|
+
if (!lodash_1.default.isEmpty(nonIndexAttrs)) {
|
|
222
213
|
iosClassChainSelector += `[\`${nonIndexAttrs.join(' AND ')}\`]`;
|
|
223
214
|
}
|
|
224
215
|
const indexAttr = attrs.find((attr) => lodash_1.default.isObject(attr) && attr.index);
|
|
225
216
|
if (indexAttr) {
|
|
226
217
|
iosClassChainSelector += `[${ /** @type { {index: string} } */(indexAttr).index}]`;
|
|
227
218
|
}
|
|
228
|
-
if (cssRule.
|
|
229
|
-
iosClassChainSelector += `/${parseCssRule(cssRule.
|
|
230
|
-
}
|
|
231
|
-
if (cssRule.nestingOperator === '>') {
|
|
232
|
-
return iosClassChainSelector;
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
return `**/` + iosClassChainSelector;
|
|
219
|
+
if (cssRule.nestedRule) {
|
|
220
|
+
iosClassChainSelector += `/${parseCssRule(cssRule.nestedRule)}`;
|
|
236
221
|
}
|
|
222
|
+
return cssRule.combinator === '>' ? iosClassChainSelector : `**/${iosClassChainSelector}`;
|
|
237
223
|
}
|
|
238
|
-
/**
|
|
239
|
-
* @typedef {Object} CssObject
|
|
240
|
-
* @property {string} [type] Type of CSS object. 'rule', 'ruleset' or 'selectors'
|
|
241
|
-
*/
|
|
242
224
|
/**
|
|
243
225
|
* Convert CSS object to iOS Class Chain selector
|
|
244
|
-
*
|
|
226
|
+
*
|
|
227
|
+
* @param {import('css-selector-parser').AstSelector} css CSS object
|
|
245
228
|
* @returns {string} The CSS object parsed as a UiSelector
|
|
246
229
|
*/
|
|
247
230
|
function parseCssObject(css) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
// @ts-expect-error this is extremely broken
|
|
251
|
-
return parseCssRule(css);
|
|
252
|
-
case 'ruleSet':
|
|
253
|
-
// @ts-expect-error this is extremely broken
|
|
254
|
-
return parseCssObject(css.rule);
|
|
255
|
-
case 'selectors':
|
|
256
|
-
// @ts-expect-error this is extremely broken
|
|
257
|
-
return css.selectors.map((selector) => parseCssObject(selector)).join('; ');
|
|
258
|
-
default:
|
|
259
|
-
// This is never reachable, but if it ever is do this.
|
|
260
|
-
throw new Error(`iOS Class Chain does not support '${css.type}' css. Only supports 'rule', 'ruleSet', 'selectors'`);
|
|
231
|
+
if (!lodash_1.default.isEmpty(css.rules)) {
|
|
232
|
+
return parseCssRule(css.rules[0]);
|
|
261
233
|
}
|
|
234
|
+
throw new Error('No rules could be parsed out of the current selector');
|
|
262
235
|
}
|
|
263
236
|
/**
|
|
264
237
|
* Convert a CSS selector to a iOS Class Chain selector
|
|
@@ -268,15 +241,17 @@ function parseCssObject(css) {
|
|
|
268
241
|
CssConverter.toIosClassChainSelector = function toIosClassChainSelector(cssSelector) {
|
|
269
242
|
let cssObj;
|
|
270
243
|
try {
|
|
271
|
-
cssObj =
|
|
244
|
+
cssObj = parseCssSelector(cssSelector);
|
|
272
245
|
}
|
|
273
246
|
catch (e) {
|
|
247
|
+
logger_js_1.default.debug(e.stack);
|
|
274
248
|
throw new driver_1.errors.InvalidSelectorError(`Invalid CSS selector '${cssSelector}'. Reason: '${e.message}'`);
|
|
275
249
|
}
|
|
276
250
|
try {
|
|
277
251
|
return parseCssObject(cssObj);
|
|
278
252
|
}
|
|
279
253
|
catch (e) {
|
|
254
|
+
logger_js_1.default.debug(e.stack);
|
|
280
255
|
throw new driver_1.errors.InvalidSelectorError(`Unsupported CSS selector '${cssSelector}'. Reason: '${e.message}'`);
|
|
281
256
|
}
|
|
282
257
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-converter.js","sourceRoot":"","sources":["../../lib/css-converter.js"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"css-converter.js","sourceRoot":"","sources":["../../lib/css-converter.js"],"names":[],"mappings":";;;;;AAAA,6DAAmD;AACnD,oDAAuB;AACvB,0CAAuC;AACvC,4DAA8B;AAE9B,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,MAAM,gBAAgB,GAAG,IAAA,kCAAY,EAAC;IACpC,MAAM,EAAE;QACN,aAAa,EAAE;YACb,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE;gBACX,QAAQ,EAAE,CAAC,KAAK,CAAC;aAClB;SACF;QACD,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;QAC5B,UAAU,EAAE;YACV,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC;SACzC;QACD,GAAG,EAAE,IAAI;QACT,UAAU,EAAE,IAAI;QAChB,GAAG,EAAE;YACH,QAAQ,EAAE,IAAI;SACf;KACF;IACD,WAAW,EAAE,IAAI;CAClB,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG;IACpB,SAAS,EAAE,YAAY,EAAE,yBAAyB,EAAE,SAAS;CAC9D,CAAC;AAEF,MAAM,aAAa,GAAG;IACpB,OAAO;CACR,CAAC;AAEF,MAAM,SAAS,GAAG;IAChB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CACjC,CAAC;A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C,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;KACjE;IAED,OAAO,OAAO,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,MAAM,qBAAqB,EAAE,CAAC;AAC5F,CAAC;AAED;;;;;GAKG;AACH,SAAS,cAAc,CAAE,GAAG;IAC1B,IAAI,CAAC,gBAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QACzB,OAAO,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;KACnC;IAED,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;AAC1E,CAAC;AAED;;;;GAIG;AACH,YAAY,CAAC,uBAAuB,GAAG,SAAS,uBAAuB,CAAE,WAAW;IAClF,IAAI,MAAM,CAAC;IACX,IAAI;QACF,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;KACxC;IAAC,OAAO,CAAC,EAAE;QACV,mBAAG,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,yBAAyB,WAAW,eAAe,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC;KACxG;IACD,IAAI;QACF,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;KAC/B;IAAC,OAAO,CAAC,EAAE;QACV,mBAAG,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,6BAA6B,WAAW,eAAe,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC;KAC5G;AACH,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
|
package/lib/css-converter.js
CHANGED
|
@@ -1,14 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createParser } from 'css-selector-parser';
|
|
2
2
|
import _ from 'lodash';
|
|
3
3
|
import { errors } from 'appium/driver';
|
|
4
|
+
import log from './logger.js';
|
|
4
5
|
|
|
5
6
|
const CssConverter = {};
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const parseCssSelector = createParser({
|
|
9
|
+
syntax: {
|
|
10
|
+
pseudoClasses: {
|
|
11
|
+
unknown: 'accept',
|
|
12
|
+
definitions: {
|
|
13
|
+
Selector: ['has'],
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
combinators: ['>', '+', '~'],
|
|
17
|
+
attributes: {
|
|
18
|
+
operators: ['^=', '$=', '*=', '~=', '=']
|
|
19
|
+
},
|
|
20
|
+
ids: true,
|
|
21
|
+
classNames: true,
|
|
22
|
+
tag: {
|
|
23
|
+
wildcard: true
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
substitutes: true
|
|
27
|
+
});
|
|
12
28
|
|
|
13
29
|
const BOOLEAN_ATTRS = [
|
|
14
30
|
'visible', 'accessible', 'accessibility-container', 'enabled',
|
|
@@ -39,7 +55,7 @@ const ATTRIBUTE_ALIASES = [
|
|
|
39
55
|
/**
|
|
40
56
|
* Convert hyphen separated word to camel case
|
|
41
57
|
*
|
|
42
|
-
* @param {string} str
|
|
58
|
+
* @param {string?} str
|
|
43
59
|
* @returns {string} The hyphen separated word translated to camel case
|
|
44
60
|
*/
|
|
45
61
|
function toCamelCase (str) {
|
|
@@ -51,20 +67,16 @@ function toCamelCase (str) {
|
|
|
51
67
|
return out.charAt(0).toLowerCase() + out.slice(1);
|
|
52
68
|
}
|
|
53
69
|
|
|
54
|
-
/**
|
|
55
|
-
* @typedef {Object} CssNameValueObject
|
|
56
|
-
* @property {string} [name] The name of the CSS object
|
|
57
|
-
* @property {string} [value] The value of the CSS object
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
70
|
/**
|
|
61
71
|
* Get the boolean from a CSS object. If empty, return true. If not true/false/empty, throw exception
|
|
62
72
|
*
|
|
63
|
-
* @param {
|
|
73
|
+
* @param {import('css-selector-parser').AstAttribute|import('css-selector-parser').AstPseudoClass} cssAttr
|
|
64
74
|
* @returns {string} Either 'true' or 'false'. If value is empty, return 'true'
|
|
65
75
|
*/
|
|
66
|
-
function requireBoolean (
|
|
67
|
-
|
|
76
|
+
function requireBoolean (cssAttr) {
|
|
77
|
+
// @ts-ignore We only support strings
|
|
78
|
+
const attrValue = cssAttr.value?.value;
|
|
79
|
+
const val = _.toLower(attrValue) || 'true'; // an omitted boolean attribute means 'true' (e.g.: input[checked] means checked is true)
|
|
68
80
|
switch (val) {
|
|
69
81
|
case '0':
|
|
70
82
|
case 'false':
|
|
@@ -73,7 +85,7 @@ function requireBoolean (css) {
|
|
|
73
85
|
case 'true':
|
|
74
86
|
return '1';
|
|
75
87
|
default:
|
|
76
|
-
throw new TypeError(`'${
|
|
88
|
+
throw new TypeError(`'${cssAttr.name}' must be true/1 or false/0 or empty. Found '${attrValue}'`);
|
|
77
89
|
}
|
|
78
90
|
}
|
|
79
91
|
|
|
@@ -83,47 +95,41 @@ function requireBoolean (css) {
|
|
|
83
95
|
* Converts to lowercase and if an attribute name is an alias for something else, return
|
|
84
96
|
* what it is an alias for
|
|
85
97
|
*
|
|
86
|
-
* @param {
|
|
98
|
+
* @param {import('css-selector-parser').AstAttribute|import('css-selector-parser').AstPseudoClass} cssEntity
|
|
87
99
|
* @returns {string} The canonical attribute name
|
|
88
100
|
*/
|
|
89
|
-
function
|
|
90
|
-
const
|
|
101
|
+
function requireEntityName (cssEntity) {
|
|
102
|
+
const entityName = cssEntity.name.toLowerCase();
|
|
91
103
|
|
|
92
104
|
// Check if it's supported and if it is, return it
|
|
93
|
-
if (ALL_ATTRS.includes(
|
|
94
|
-
return
|
|
105
|
+
if (ALL_ATTRS.includes(entityName)) {
|
|
106
|
+
return entityName.toLowerCase();
|
|
95
107
|
}
|
|
96
108
|
|
|
97
109
|
// If attrName is an alias for something else, return that
|
|
98
110
|
for (const [officialAttr, aliasAttrs] of ATTRIBUTE_ALIASES) {
|
|
99
|
-
if (aliasAttrs.includes(
|
|
111
|
+
if (aliasAttrs.includes(entityName)) {
|
|
100
112
|
return officialAttr;
|
|
101
113
|
}
|
|
102
114
|
}
|
|
103
|
-
throw new Error(`'${
|
|
104
|
-
`Supported attributes are '${ALL_ATTRS.join(', ')}'`);
|
|
115
|
+
throw new Error(`'${entityName}' is not a valid attribute. ` +
|
|
116
|
+
`Supported attributes are: '${ALL_ATTRS.join(', ')}'`);
|
|
105
117
|
}
|
|
106
118
|
|
|
107
|
-
/**
|
|
108
|
-
* @typedef {Object} CssAttr
|
|
109
|
-
* @property {string} [name]
|
|
110
|
-
* @property {string} [valueType] Type of attribute (must be string or empty)
|
|
111
|
-
* @property {string} [value] Value of the attribute
|
|
112
|
-
* @property {string} [operator] The operator between value and value type (=, *=, , ^=, $=)
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
119
|
/**
|
|
116
120
|
* Convert a CSS attribute into a UiSelector method call
|
|
117
121
|
*
|
|
118
|
-
* @param {
|
|
122
|
+
* @param {import('css-selector-parser').AstAttribute} cssAttr CSS attribute object
|
|
119
123
|
* @returns {string|{index: string|undefined}} CSS attribute parsed as UiSelector
|
|
120
124
|
*/
|
|
121
125
|
function parseAttr (cssAttr) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
// @ts-ignore We only care for strings
|
|
127
|
+
const attrValue = cssAttr.value?.value;
|
|
128
|
+
if (!_.isString(attrValue) && !_.isEmpty(attrValue)) {
|
|
129
|
+
throw new TypeError(`'${cssAttr.name}=${attrValue}' is an invalid attribute. ` +
|
|
130
|
+
`Only 'string' and empty attribute types are supported. Found '${attrValue}'`);
|
|
125
131
|
}
|
|
126
|
-
const attrName = toCamelCase(
|
|
132
|
+
const attrName = toCamelCase(requireEntityName(cssAttr));
|
|
127
133
|
|
|
128
134
|
// Validate that it's a supported attribute
|
|
129
135
|
if (!STR_ATTRS.includes(attrName) && !BOOLEAN_ATTRS.includes(attrName)) {
|
|
@@ -133,13 +139,13 @@ function parseAttr (cssAttr) {
|
|
|
133
139
|
|
|
134
140
|
// Parse index if it's an index attribute
|
|
135
141
|
if (attrName === 'index') {
|
|
136
|
-
return {index:
|
|
142
|
+
return {index: attrValue};
|
|
137
143
|
}
|
|
138
144
|
if (BOOLEAN_ATTRS.includes(attrName)) {
|
|
139
145
|
return `${attrName} == ${requireBoolean(cssAttr)}`;
|
|
140
146
|
}
|
|
141
147
|
|
|
142
|
-
let value =
|
|
148
|
+
let value = attrValue || '';
|
|
143
149
|
if (value === '') {
|
|
144
150
|
return `[${attrName} LIKE ${value}]`;
|
|
145
151
|
}
|
|
@@ -162,55 +168,38 @@ function parseAttr (cssAttr) {
|
|
|
162
168
|
}
|
|
163
169
|
}
|
|
164
170
|
|
|
165
|
-
/**
|
|
166
|
-
* @typedef {Object} CssPseudo
|
|
167
|
-
* @property {string} [valueType] The type of CSS pseudo selector (https://www.npmjs.com/package/css-selector-parser for reference)
|
|
168
|
-
* @property {string} [name] The name of the pseudo selector
|
|
169
|
-
* @property {string} [value] The value of the pseudo selector
|
|
170
|
-
*/
|
|
171
|
-
|
|
172
171
|
/**
|
|
173
172
|
* Convert a CSS pseudo class to a UiSelector
|
|
174
173
|
*
|
|
175
|
-
* @param {
|
|
174
|
+
* @param {import('css-selector-parser').AstPseudoClass} cssPseudo
|
|
176
175
|
* @returns {string|{index: string|undefined}|undefined} Pseudo selector parsed as UiSelector
|
|
177
176
|
*/
|
|
178
177
|
function parsePseudo (cssPseudo) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
// @ts-ignore We only care for strings
|
|
179
|
+
const argValue = cssPseudo.argument?.value;
|
|
180
|
+
if (!_.isString(argValue) && !_.isEmpty(argValue)) {
|
|
181
|
+
throw new TypeError(`'${cssPseudo.name}=${argValue}'. ` +
|
|
182
|
+
`Unsupported css pseudo class value: '${argValue}'. Only 'string' type or empty is supported.`);
|
|
182
183
|
}
|
|
183
184
|
|
|
184
|
-
const pseudoName =
|
|
185
|
+
const pseudoName = requireEntityName(cssPseudo);
|
|
185
186
|
|
|
186
187
|
if (BOOLEAN_ATTRS.includes(pseudoName)) {
|
|
187
188
|
return `${toCamelCase(pseudoName)} == ${requireBoolean(cssPseudo)}`;
|
|
188
189
|
}
|
|
189
190
|
|
|
190
191
|
if (pseudoName === 'index') {
|
|
191
|
-
return {index:
|
|
192
|
+
return {index: argValue};
|
|
192
193
|
}
|
|
193
194
|
}
|
|
194
195
|
|
|
195
|
-
/**
|
|
196
|
-
* @typedef {Object} CssRule
|
|
197
|
-
* @property {string} [nestingOperator] The nesting operator (aka: combinator https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors)
|
|
198
|
-
* @property {string} [tagName] The tag name (aka: type selector https://developer.mozilla.org/en-US/docs/Web/CSS/Type_selectors)
|
|
199
|
-
* @property {string[]} [classNames] An array of CSS class names
|
|
200
|
-
* @property {CssAttr[]} [attrs] An array of CSS attributes
|
|
201
|
-
* @property {CssPseudo[]} [pseudos] An array of CSS pseudos
|
|
202
|
-
* @property {string} [id] CSS identifier
|
|
203
|
-
* @property {CssRule} [rule] A descendant of this CSS rule
|
|
204
|
-
*/
|
|
205
|
-
|
|
206
196
|
/**
|
|
207
197
|
* Convert a CSS rule to a UiSelector
|
|
208
|
-
* @param {
|
|
198
|
+
* @param {import('css-selector-parser').AstRule} cssRule CSS rule definition
|
|
209
199
|
*/
|
|
210
200
|
function parseCssRule (cssRule) {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
throw new Error(`'${nestingOperator}' is not a supported combinator. ` +
|
|
201
|
+
if (cssRule.combinator && ![' ', '>'].includes(cssRule.combinator)) {
|
|
202
|
+
throw new Error(`'${cssRule.combinator}' is not a supported combinator. ` +
|
|
214
203
|
`Only child combinator (>) and descendant combinator are supported.`);
|
|
215
204
|
}
|
|
216
205
|
|
|
@@ -220,28 +209,26 @@ function parseCssRule (cssRule) {
|
|
|
220
209
|
is not a valid ios class. Must be a single string (e.g.: XCUIElementTypeWindow) without
|
|
221
210
|
dots separating them`);
|
|
222
211
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
212
|
+
// @ts-ignore name presense
|
|
213
|
+
let tagName = cssRule.tag?.name ?? '';
|
|
214
|
+
if (tagName && tagName !== '*' && !_.startsWith(_.toLower(tagName), 'xcuielementtype')) {
|
|
215
|
+
const capitalizedTagName = tagName.charAt(0).toUpperCase() + tagName.slice(1);
|
|
216
|
+
tagName = `XCUIElementType${capitalizedTagName}`;
|
|
226
217
|
}
|
|
227
|
-
iosClassChainSelector += (
|
|
218
|
+
iosClassChainSelector += (tagName || '*');
|
|
228
219
|
|
|
229
|
-
|
|
230
|
-
if (cssRule.
|
|
231
|
-
attrs.push(`name == "${cssRule.
|
|
220
|
+
const attrs = [];
|
|
221
|
+
if (cssRule.ids && !_.isEmpty(cssRule.ids)) {
|
|
222
|
+
attrs.push(`name == "${cssRule.ids[0]}"`);
|
|
232
223
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
attrs.push(parseAttr(attr));
|
|
236
|
-
}
|
|
224
|
+
for (const attr of cssRule.attributes ?? []) {
|
|
225
|
+
attrs.push(parseAttr(attr));
|
|
237
226
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
attrs.push(parsePseudo(pseudo));
|
|
241
|
-
}
|
|
227
|
+
for (const pseudo of cssRule.pseudoClasses ?? []) {
|
|
228
|
+
attrs.push(parsePseudo(pseudo));
|
|
242
229
|
}
|
|
243
230
|
const nonIndexAttrs = attrs.filter((attr) => _.isString(attr));
|
|
244
|
-
if (nonIndexAttrs
|
|
231
|
+
if (!_.isEmpty(nonIndexAttrs)) {
|
|
245
232
|
iosClassChainSelector += `[\`${nonIndexAttrs.join(' AND ')}\`]`;
|
|
246
233
|
}
|
|
247
234
|
|
|
@@ -250,43 +237,25 @@ function parseCssRule (cssRule) {
|
|
|
250
237
|
iosClassChainSelector += `[${/** @type { {index: string} } */(indexAttr).index}]`;
|
|
251
238
|
}
|
|
252
239
|
|
|
253
|
-
if (cssRule.
|
|
254
|
-
iosClassChainSelector += `/${parseCssRule(cssRule.
|
|
240
|
+
if (cssRule.nestedRule) {
|
|
241
|
+
iosClassChainSelector += `/${parseCssRule(cssRule.nestedRule)}`;
|
|
255
242
|
}
|
|
256
243
|
|
|
257
|
-
|
|
258
|
-
return iosClassChainSelector;
|
|
259
|
-
} else {
|
|
260
|
-
return `**/` + iosClassChainSelector;
|
|
261
|
-
}
|
|
244
|
+
return cssRule.combinator === '>' ? iosClassChainSelector : `**/${iosClassChainSelector}`;
|
|
262
245
|
}
|
|
263
246
|
|
|
264
|
-
/**
|
|
265
|
-
* @typedef {Object} CssObject
|
|
266
|
-
* @property {string} [type] Type of CSS object. 'rule', 'ruleset' or 'selectors'
|
|
267
|
-
*/
|
|
268
|
-
|
|
269
247
|
/**
|
|
270
248
|
* Convert CSS object to iOS Class Chain selector
|
|
271
|
-
*
|
|
249
|
+
*
|
|
250
|
+
* @param {import('css-selector-parser').AstSelector} css CSS object
|
|
272
251
|
* @returns {string} The CSS object parsed as a UiSelector
|
|
273
252
|
*/
|
|
274
253
|
function parseCssObject (css) {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
// @ts-expect-error this is extremely broken
|
|
278
|
-
return parseCssRule(css);
|
|
279
|
-
case 'ruleSet':
|
|
280
|
-
// @ts-expect-error this is extremely broken
|
|
281
|
-
return parseCssObject(css.rule);
|
|
282
|
-
case 'selectors':
|
|
283
|
-
// @ts-expect-error this is extremely broken
|
|
284
|
-
return css.selectors.map((selector) => parseCssObject(selector)).join('; ');
|
|
285
|
-
|
|
286
|
-
default:
|
|
287
|
-
// This is never reachable, but if it ever is do this.
|
|
288
|
-
throw new Error(`iOS Class Chain does not support '${css.type}' css. Only supports 'rule', 'ruleSet', 'selectors'`);
|
|
254
|
+
if (!_.isEmpty(css.rules)) {
|
|
255
|
+
return parseCssRule(css.rules[0]);
|
|
289
256
|
}
|
|
257
|
+
|
|
258
|
+
throw new Error('No rules could be parsed out of the current selector');
|
|
290
259
|
}
|
|
291
260
|
|
|
292
261
|
/**
|
|
@@ -297,13 +266,15 @@ function parseCssObject (css) {
|
|
|
297
266
|
CssConverter.toIosClassChainSelector = function toIosClassChainSelector (cssSelector) {
|
|
298
267
|
let cssObj;
|
|
299
268
|
try {
|
|
300
|
-
cssObj =
|
|
269
|
+
cssObj = parseCssSelector(cssSelector);
|
|
301
270
|
} catch (e) {
|
|
271
|
+
log.debug(e.stack);
|
|
302
272
|
throw new errors.InvalidSelectorError(`Invalid CSS selector '${cssSelector}'. Reason: '${e.message}'`);
|
|
303
273
|
}
|
|
304
274
|
try {
|
|
305
275
|
return parseCssObject(cssObj);
|
|
306
276
|
} catch (e) {
|
|
277
|
+
log.debug(e.stack);
|
|
307
278
|
throw new errors.InvalidSelectorError(`Unsupported CSS selector '${cssSelector}'. Reason: '${e.message}'`);
|
|
308
279
|
}
|
|
309
280
|
};
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-xcuitest-driver",
|
|
3
|
-
"version": "4.32.
|
|
3
|
+
"version": "4.32.5",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "appium-xcuitest-driver",
|
|
9
|
-
"version": "4.32.
|
|
9
|
+
"version": "4.32.5",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xmldom/xmldom": "0.8.8",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"async-lock": "1.4.0",
|
|
20
20
|
"asyncbox": "2.9.4",
|
|
21
21
|
"bluebird": "3.7.2",
|
|
22
|
-
"css-selector-parser": "
|
|
22
|
+
"css-selector-parser": "2.2.3",
|
|
23
23
|
"fancy-log": "2.0.0",
|
|
24
24
|
"js2xmlparser2": "0.2.0",
|
|
25
25
|
"lodash": "4.17.21",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"moment-timezone": "0.5.43",
|
|
29
29
|
"node-simctl": "7.1.16",
|
|
30
30
|
"portscanner": "2.2.0",
|
|
31
|
-
"semver": "7.5.
|
|
31
|
+
"semver": "7.5.2",
|
|
32
32
|
"source-map-support": "0.5.21",
|
|
33
33
|
"teen_process": "2.0.4",
|
|
34
34
|
"ws": "8.13.0"
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"@types/chai-as-promised": "7.1.5",
|
|
50
50
|
"@types/lodash": "4.14.195",
|
|
51
51
|
"@types/mocha": "10.0.1",
|
|
52
|
-
"@types/node": "18.16.
|
|
52
|
+
"@types/node": "18.16.18",
|
|
53
53
|
"@types/portscanner": "2.1.1",
|
|
54
54
|
"@types/sinon": "10.0.15",
|
|
55
55
|
"@types/sinon-chai": "3.2.9",
|
|
56
56
|
"@types/teen_process": "2.0.0",
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "5.59.
|
|
58
|
-
"@typescript-eslint/parser": "5.59.
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "5.59.11",
|
|
58
|
+
"@typescript-eslint/parser": "5.59.11",
|
|
59
59
|
"appium": "2.0.0-rc.2",
|
|
60
60
|
"axios": "1.4.0",
|
|
61
61
|
"chai": "4.3.7",
|
|
@@ -213,6 +213,33 @@
|
|
|
213
213
|
"node": ">=6.9.0"
|
|
214
214
|
}
|
|
215
215
|
},
|
|
216
|
+
"node_modules/@appium/docutils/node_modules/lru-cache": {
|
|
217
|
+
"version": "6.0.0",
|
|
218
|
+
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
|
219
|
+
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
|
220
|
+
"dev": true,
|
|
221
|
+
"dependencies": {
|
|
222
|
+
"yallist": "^4.0.0"
|
|
223
|
+
},
|
|
224
|
+
"engines": {
|
|
225
|
+
"node": ">=10"
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
"node_modules/@appium/docutils/node_modules/semver": {
|
|
229
|
+
"version": "7.5.1",
|
|
230
|
+
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz",
|
|
231
|
+
"integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==",
|
|
232
|
+
"dev": true,
|
|
233
|
+
"dependencies": {
|
|
234
|
+
"lru-cache": "^6.0.0"
|
|
235
|
+
},
|
|
236
|
+
"bin": {
|
|
237
|
+
"semver": "bin/semver.js"
|
|
238
|
+
},
|
|
239
|
+
"engines": {
|
|
240
|
+
"node": ">=10"
|
|
241
|
+
}
|
|
242
|
+
},
|
|
216
243
|
"node_modules/@appium/docutils/node_modules/shell-quote": {
|
|
217
244
|
"version": "1.7.3",
|
|
218
245
|
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz",
|
|
@@ -252,6 +279,12 @@
|
|
|
252
279
|
"node": ">= 8"
|
|
253
280
|
}
|
|
254
281
|
},
|
|
282
|
+
"node_modules/@appium/docutils/node_modules/yallist": {
|
|
283
|
+
"version": "4.0.0",
|
|
284
|
+
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
|
285
|
+
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
|
286
|
+
"dev": true
|
|
287
|
+
},
|
|
255
288
|
"node_modules/@appium/eslint-config-appium": {
|
|
256
289
|
"version": "8.0.3",
|
|
257
290
|
"resolved": "https://registry.npmjs.org/@appium/eslint-config-appium/-/eslint-config-appium-8.0.3.tgz",
|
|
@@ -422,6 +455,17 @@
|
|
|
422
455
|
"url": "https://github.com/sponsors/isaacs"
|
|
423
456
|
}
|
|
424
457
|
},
|
|
458
|
+
"node_modules/@appium/support/node_modules/lru-cache": {
|
|
459
|
+
"version": "6.0.0",
|
|
460
|
+
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
|
461
|
+
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
|
462
|
+
"dependencies": {
|
|
463
|
+
"yallist": "^4.0.0"
|
|
464
|
+
},
|
|
465
|
+
"engines": {
|
|
466
|
+
"node": ">=10"
|
|
467
|
+
}
|
|
468
|
+
},
|
|
425
469
|
"node_modules/@appium/support/node_modules/minimatch": {
|
|
426
470
|
"version": "5.1.6",
|
|
427
471
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
|
|
@@ -433,6 +477,20 @@
|
|
|
433
477
|
"node": ">=10"
|
|
434
478
|
}
|
|
435
479
|
},
|
|
480
|
+
"node_modules/@appium/support/node_modules/semver": {
|
|
481
|
+
"version": "7.5.1",
|
|
482
|
+
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz",
|
|
483
|
+
"integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==",
|
|
484
|
+
"dependencies": {
|
|
485
|
+
"lru-cache": "^6.0.0"
|
|
486
|
+
},
|
|
487
|
+
"bin": {
|
|
488
|
+
"semver": "bin/semver.js"
|
|
489
|
+
},
|
|
490
|
+
"engines": {
|
|
491
|
+
"node": ">=10"
|
|
492
|
+
}
|
|
493
|
+
},
|
|
436
494
|
"node_modules/@appium/support/node_modules/teen_process": {
|
|
437
495
|
"version": "2.0.2",
|
|
438
496
|
"resolved": "https://registry.npmjs.org/teen_process/-/teen_process-2.0.2.tgz",
|
|
@@ -469,6 +527,11 @@
|
|
|
469
527
|
"node": ">= 8"
|
|
470
528
|
}
|
|
471
529
|
},
|
|
530
|
+
"node_modules/@appium/support/node_modules/yallist": {
|
|
531
|
+
"version": "4.0.0",
|
|
532
|
+
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
|
533
|
+
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
|
534
|
+
},
|
|
472
535
|
"node_modules/@appium/test-support": {
|
|
473
536
|
"version": "3.0.17",
|
|
474
537
|
"resolved": "https://registry.npmjs.org/@appium/test-support/-/test-support-3.0.17.tgz",
|
|
@@ -2530,9 +2593,9 @@
|
|
|
2530
2593
|
}
|
|
2531
2594
|
},
|
|
2532
2595
|
"node_modules/@types/node": {
|
|
2533
|
-
"version": "18.16.
|
|
2534
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.
|
|
2535
|
-
"integrity": "sha512
|
|
2596
|
+
"version": "18.16.18",
|
|
2597
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.18.tgz",
|
|
2598
|
+
"integrity": "sha512-/aNaQZD0+iSBAGnvvN2Cx92HqE5sZCPZtx2TsK+4nvV23fFe09jVDvpArXr2j9DnYlzuU9WuoykDDc6wqvpNcw=="
|
|
2536
2599
|
},
|
|
2537
2600
|
"node_modules/@types/normalize-package-data": {
|
|
2538
2601
|
"version": "2.4.1",
|
|
@@ -2688,15 +2751,15 @@
|
|
|
2688
2751
|
}
|
|
2689
2752
|
},
|
|
2690
2753
|
"node_modules/@typescript-eslint/eslint-plugin": {
|
|
2691
|
-
"version": "5.59.
|
|
2692
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.
|
|
2693
|
-
"integrity": "sha512-
|
|
2754
|
+
"version": "5.59.11",
|
|
2755
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.11.tgz",
|
|
2756
|
+
"integrity": "sha512-XxuOfTkCUiOSyBWIvHlUraLw/JT/6Io1365RO6ZuI88STKMavJZPNMU0lFcUTeQXEhHiv64CbxYxBNoDVSmghg==",
|
|
2694
2757
|
"dev": true,
|
|
2695
2758
|
"dependencies": {
|
|
2696
2759
|
"@eslint-community/regexpp": "^4.4.0",
|
|
2697
|
-
"@typescript-eslint/scope-manager": "5.59.
|
|
2698
|
-
"@typescript-eslint/type-utils": "5.59.
|
|
2699
|
-
"@typescript-eslint/utils": "5.59.
|
|
2760
|
+
"@typescript-eslint/scope-manager": "5.59.11",
|
|
2761
|
+
"@typescript-eslint/type-utils": "5.59.11",
|
|
2762
|
+
"@typescript-eslint/utils": "5.59.11",
|
|
2700
2763
|
"debug": "^4.3.4",
|
|
2701
2764
|
"grapheme-splitter": "^1.0.4",
|
|
2702
2765
|
"ignore": "^5.2.0",
|
|
@@ -2722,14 +2785,14 @@
|
|
|
2722
2785
|
}
|
|
2723
2786
|
},
|
|
2724
2787
|
"node_modules/@typescript-eslint/parser": {
|
|
2725
|
-
"version": "5.59.
|
|
2726
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.
|
|
2727
|
-
"integrity": "sha512-
|
|
2788
|
+
"version": "5.59.11",
|
|
2789
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.11.tgz",
|
|
2790
|
+
"integrity": "sha512-s9ZF3M+Nym6CAZEkJJeO2TFHHDsKAM3ecNkLuH4i4s8/RCPnF5JRip2GyviYkeEAcwGMJxkqG9h2dAsnA1nZpA==",
|
|
2728
2791
|
"dev": true,
|
|
2729
2792
|
"dependencies": {
|
|
2730
|
-
"@typescript-eslint/scope-manager": "5.59.
|
|
2731
|
-
"@typescript-eslint/types": "5.59.
|
|
2732
|
-
"@typescript-eslint/typescript-estree": "5.59.
|
|
2793
|
+
"@typescript-eslint/scope-manager": "5.59.11",
|
|
2794
|
+
"@typescript-eslint/types": "5.59.11",
|
|
2795
|
+
"@typescript-eslint/typescript-estree": "5.59.11",
|
|
2733
2796
|
"debug": "^4.3.4"
|
|
2734
2797
|
},
|
|
2735
2798
|
"engines": {
|
|
@@ -2749,13 +2812,13 @@
|
|
|
2749
2812
|
}
|
|
2750
2813
|
},
|
|
2751
2814
|
"node_modules/@typescript-eslint/scope-manager": {
|
|
2752
|
-
"version": "5.59.
|
|
2753
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.
|
|
2754
|
-
"integrity": "sha512-
|
|
2815
|
+
"version": "5.59.11",
|
|
2816
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.11.tgz",
|
|
2817
|
+
"integrity": "sha512-dHFOsxoLFtrIcSj5h0QoBT/89hxQONwmn3FOQ0GOQcLOOXm+MIrS8zEAhs4tWl5MraxCY3ZJpaXQQdFMc2Tu+Q==",
|
|
2755
2818
|
"dev": true,
|
|
2756
2819
|
"dependencies": {
|
|
2757
|
-
"@typescript-eslint/types": "5.59.
|
|
2758
|
-
"@typescript-eslint/visitor-keys": "5.59.
|
|
2820
|
+
"@typescript-eslint/types": "5.59.11",
|
|
2821
|
+
"@typescript-eslint/visitor-keys": "5.59.11"
|
|
2759
2822
|
},
|
|
2760
2823
|
"engines": {
|
|
2761
2824
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
|
@@ -2766,13 +2829,13 @@
|
|
|
2766
2829
|
}
|
|
2767
2830
|
},
|
|
2768
2831
|
"node_modules/@typescript-eslint/type-utils": {
|
|
2769
|
-
"version": "5.59.
|
|
2770
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.
|
|
2771
|
-
"integrity": "sha512-
|
|
2832
|
+
"version": "5.59.11",
|
|
2833
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.11.tgz",
|
|
2834
|
+
"integrity": "sha512-LZqVY8hMiVRF2a7/swmkStMYSoXMFlzL6sXV6U/2gL5cwnLWQgLEG8tjWPpaE4rMIdZ6VKWwcffPlo1jPfk43g==",
|
|
2772
2835
|
"dev": true,
|
|
2773
2836
|
"dependencies": {
|
|
2774
|
-
"@typescript-eslint/typescript-estree": "5.59.
|
|
2775
|
-
"@typescript-eslint/utils": "5.59.
|
|
2837
|
+
"@typescript-eslint/typescript-estree": "5.59.11",
|
|
2838
|
+
"@typescript-eslint/utils": "5.59.11",
|
|
2776
2839
|
"debug": "^4.3.4",
|
|
2777
2840
|
"tsutils": "^3.21.0"
|
|
2778
2841
|
},
|
|
@@ -2793,9 +2856,9 @@
|
|
|
2793
2856
|
}
|
|
2794
2857
|
},
|
|
2795
2858
|
"node_modules/@typescript-eslint/types": {
|
|
2796
|
-
"version": "5.59.
|
|
2797
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.
|
|
2798
|
-
"integrity": "sha512-
|
|
2859
|
+
"version": "5.59.11",
|
|
2860
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.11.tgz",
|
|
2861
|
+
"integrity": "sha512-epoN6R6tkvBYSc+cllrz+c2sOFWkbisJZWkOE+y3xHtvYaOE6Wk6B8e114McRJwFRjGvYdJwLXQH5c9osME/AA==",
|
|
2799
2862
|
"dev": true,
|
|
2800
2863
|
"engines": {
|
|
2801
2864
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
|
@@ -2806,13 +2869,13 @@
|
|
|
2806
2869
|
}
|
|
2807
2870
|
},
|
|
2808
2871
|
"node_modules/@typescript-eslint/typescript-estree": {
|
|
2809
|
-
"version": "5.59.
|
|
2810
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.
|
|
2811
|
-
"integrity": "sha512-
|
|
2872
|
+
"version": "5.59.11",
|
|
2873
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.11.tgz",
|
|
2874
|
+
"integrity": "sha512-YupOpot5hJO0maupJXixi6l5ETdrITxeo5eBOeuV7RSKgYdU3G5cxO49/9WRnJq9EMrB7AuTSLH/bqOsXi7wPA==",
|
|
2812
2875
|
"dev": true,
|
|
2813
2876
|
"dependencies": {
|
|
2814
|
-
"@typescript-eslint/types": "5.59.
|
|
2815
|
-
"@typescript-eslint/visitor-keys": "5.59.
|
|
2877
|
+
"@typescript-eslint/types": "5.59.11",
|
|
2878
|
+
"@typescript-eslint/visitor-keys": "5.59.11",
|
|
2816
2879
|
"debug": "^4.3.4",
|
|
2817
2880
|
"globby": "^11.1.0",
|
|
2818
2881
|
"is-glob": "^4.0.3",
|
|
@@ -2833,17 +2896,17 @@
|
|
|
2833
2896
|
}
|
|
2834
2897
|
},
|
|
2835
2898
|
"node_modules/@typescript-eslint/utils": {
|
|
2836
|
-
"version": "5.59.
|
|
2837
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.
|
|
2838
|
-
"integrity": "sha512-
|
|
2899
|
+
"version": "5.59.11",
|
|
2900
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.11.tgz",
|
|
2901
|
+
"integrity": "sha512-didu2rHSOMUdJThLk4aZ1Or8IcO3HzCw/ZvEjTTIfjIrcdd5cvSIwwDy2AOlE7htSNp7QIZ10fLMyRCveesMLg==",
|
|
2839
2902
|
"dev": true,
|
|
2840
2903
|
"dependencies": {
|
|
2841
2904
|
"@eslint-community/eslint-utils": "^4.2.0",
|
|
2842
2905
|
"@types/json-schema": "^7.0.9",
|
|
2843
2906
|
"@types/semver": "^7.3.12",
|
|
2844
|
-
"@typescript-eslint/scope-manager": "5.59.
|
|
2845
|
-
"@typescript-eslint/types": "5.59.
|
|
2846
|
-
"@typescript-eslint/typescript-estree": "5.59.
|
|
2907
|
+
"@typescript-eslint/scope-manager": "5.59.11",
|
|
2908
|
+
"@typescript-eslint/types": "5.59.11",
|
|
2909
|
+
"@typescript-eslint/typescript-estree": "5.59.11",
|
|
2847
2910
|
"eslint-scope": "^5.1.1",
|
|
2848
2911
|
"semver": "^7.3.7"
|
|
2849
2912
|
},
|
|
@@ -2859,12 +2922,12 @@
|
|
|
2859
2922
|
}
|
|
2860
2923
|
},
|
|
2861
2924
|
"node_modules/@typescript-eslint/visitor-keys": {
|
|
2862
|
-
"version": "5.59.
|
|
2863
|
-
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.
|
|
2864
|
-
"integrity": "sha512-
|
|
2925
|
+
"version": "5.59.11",
|
|
2926
|
+
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.11.tgz",
|
|
2927
|
+
"integrity": "sha512-KGYniTGG3AMTuKF9QBD7EIrvufkB6O6uX3knP73xbKLMpH+QRPcgnCxjWXSHjMRuOxFLovljqQgQpR0c7GvjoA==",
|
|
2865
2928
|
"dev": true,
|
|
2866
2929
|
"dependencies": {
|
|
2867
|
-
"@typescript-eslint/types": "5.59.
|
|
2930
|
+
"@typescript-eslint/types": "5.59.11",
|
|
2868
2931
|
"eslint-visitor-keys": "^3.3.0"
|
|
2869
2932
|
},
|
|
2870
2933
|
"engines": {
|
|
@@ -3703,6 +3766,18 @@
|
|
|
3703
3766
|
"url": "https://github.com/sponsors/isaacs"
|
|
3704
3767
|
}
|
|
3705
3768
|
},
|
|
3769
|
+
"node_modules/appium/node_modules/lru-cache": {
|
|
3770
|
+
"version": "6.0.0",
|
|
3771
|
+
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
|
3772
|
+
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
|
3773
|
+
"dev": true,
|
|
3774
|
+
"dependencies": {
|
|
3775
|
+
"yallist": "^4.0.0"
|
|
3776
|
+
},
|
|
3777
|
+
"engines": {
|
|
3778
|
+
"node": ">=10"
|
|
3779
|
+
}
|
|
3780
|
+
},
|
|
3706
3781
|
"node_modules/appium/node_modules/minimatch": {
|
|
3707
3782
|
"version": "5.1.6",
|
|
3708
3783
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
|
|
@@ -3715,6 +3790,21 @@
|
|
|
3715
3790
|
"node": ">=10"
|
|
3716
3791
|
}
|
|
3717
3792
|
},
|
|
3793
|
+
"node_modules/appium/node_modules/semver": {
|
|
3794
|
+
"version": "7.5.1",
|
|
3795
|
+
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz",
|
|
3796
|
+
"integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==",
|
|
3797
|
+
"dev": true,
|
|
3798
|
+
"dependencies": {
|
|
3799
|
+
"lru-cache": "^6.0.0"
|
|
3800
|
+
},
|
|
3801
|
+
"bin": {
|
|
3802
|
+
"semver": "bin/semver.js"
|
|
3803
|
+
},
|
|
3804
|
+
"engines": {
|
|
3805
|
+
"node": ">=10"
|
|
3806
|
+
}
|
|
3807
|
+
},
|
|
3718
3808
|
"node_modules/appium/node_modules/shell-quote": {
|
|
3719
3809
|
"version": "1.7.3",
|
|
3720
3810
|
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz",
|
|
@@ -3754,6 +3844,12 @@
|
|
|
3754
3844
|
"node": ">= 8"
|
|
3755
3845
|
}
|
|
3756
3846
|
},
|
|
3847
|
+
"node_modules/appium/node_modules/yallist": {
|
|
3848
|
+
"version": "4.0.0",
|
|
3849
|
+
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
|
3850
|
+
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
|
3851
|
+
"dev": true
|
|
3852
|
+
},
|
|
3757
3853
|
"node_modules/aproba": {
|
|
3758
3854
|
"version": "2.0.0",
|
|
3759
3855
|
"resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz",
|
|
@@ -5244,9 +5340,19 @@
|
|
|
5244
5340
|
}
|
|
5245
5341
|
},
|
|
5246
5342
|
"node_modules/css-selector-parser": {
|
|
5247
|
-
"version": "
|
|
5248
|
-
"resolved": "https://registry.npmjs.org/css-selector-parser/-/css-selector-parser-
|
|
5249
|
-
"integrity": "sha512-
|
|
5343
|
+
"version": "2.2.3",
|
|
5344
|
+
"resolved": "https://registry.npmjs.org/css-selector-parser/-/css-selector-parser-2.2.3.tgz",
|
|
5345
|
+
"integrity": "sha512-m5+MAFyt1pdzS754fwxCdya7E+fouV5oXLCG1KkMtR+5JDBEegM7ilSUNtnOTrVA46pVEEgC9+YO/VEOVFRYIw==",
|
|
5346
|
+
"funding": [
|
|
5347
|
+
{
|
|
5348
|
+
"type": "github",
|
|
5349
|
+
"url": "https://github.com/sponsors/mdevils"
|
|
5350
|
+
},
|
|
5351
|
+
{
|
|
5352
|
+
"type": "patreon",
|
|
5353
|
+
"url": "https://patreon.com/mdevils"
|
|
5354
|
+
}
|
|
5355
|
+
]
|
|
5250
5356
|
},
|
|
5251
5357
|
"node_modules/css-shorthand-properties": {
|
|
5252
5358
|
"version": "1.1.1",
|
|
@@ -15521,9 +15627,9 @@
|
|
|
15521
15627
|
}
|
|
15522
15628
|
},
|
|
15523
15629
|
"node_modules/semver": {
|
|
15524
|
-
"version": "7.5.
|
|
15525
|
-
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.
|
|
15526
|
-
"integrity": "sha512-
|
|
15630
|
+
"version": "7.5.2",
|
|
15631
|
+
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz",
|
|
15632
|
+
"integrity": "sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==",
|
|
15527
15633
|
"dependencies": {
|
|
15528
15634
|
"lru-cache": "^6.0.0"
|
|
15529
15635
|
},
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"xcuitest",
|
|
9
9
|
"xctest"
|
|
10
10
|
],
|
|
11
|
-
"version": "4.32.
|
|
11
|
+
"version": "4.32.5",
|
|
12
12
|
"author": "Appium Contributors",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"repository": {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"async-lock": "1.4.0",
|
|
79
79
|
"asyncbox": "2.9.4",
|
|
80
80
|
"bluebird": "3.7.2",
|
|
81
|
-
"css-selector-parser": "
|
|
81
|
+
"css-selector-parser": "2.2.3",
|
|
82
82
|
"fancy-log": "2.0.0",
|
|
83
83
|
"js2xmlparser2": "0.2.0",
|
|
84
84
|
"lodash": "4.17.21",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"moment-timezone": "0.5.43",
|
|
88
88
|
"node-simctl": "7.1.16",
|
|
89
89
|
"portscanner": "2.2.0",
|
|
90
|
-
"semver": "7.5.
|
|
90
|
+
"semver": "7.5.2",
|
|
91
91
|
"source-map-support": "0.5.21",
|
|
92
92
|
"teen_process": "2.0.4",
|
|
93
93
|
"ws": "8.13.0"
|
|
@@ -146,13 +146,13 @@
|
|
|
146
146
|
"@types/chai-as-promised": "7.1.5",
|
|
147
147
|
"@types/lodash": "4.14.195",
|
|
148
148
|
"@types/mocha": "10.0.1",
|
|
149
|
-
"@types/node": "18.16.
|
|
149
|
+
"@types/node": "18.16.18",
|
|
150
150
|
"@types/portscanner": "2.1.1",
|
|
151
151
|
"@types/sinon": "10.0.15",
|
|
152
152
|
"@types/sinon-chai": "3.2.9",
|
|
153
153
|
"@types/teen_process": "2.0.0",
|
|
154
|
-
"@typescript-eslint/eslint-plugin": "5.59.
|
|
155
|
-
"@typescript-eslint/parser": "5.59.
|
|
154
|
+
"@typescript-eslint/eslint-plugin": "5.59.11",
|
|
155
|
+
"@typescript-eslint/parser": "5.59.11",
|
|
156
156
|
"appium": "2.0.0-rc.2",
|
|
157
157
|
"axios": "1.4.0",
|
|
158
158
|
"chai": "4.3.7",
|