@wdio/appium-service 9.23.3 → 9.25.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.
Files changed (75) hide show
  1. package/README.md +639 -0
  2. package/build/index.d.ts +2 -1
  3. package/build/index.d.ts.map +1 -1
  4. package/build/index.js +2507 -52
  5. package/build/launcher.d.ts +1 -1
  6. package/build/launcher.d.ts.map +1 -1
  7. package/build/mobileSelectorPerformanceOptimizer/aggregator.d.ts +16 -0
  8. package/build/mobileSelectorPerformanceOptimizer/aggregator.d.ts.map +1 -0
  9. package/build/mobileSelectorPerformanceOptimizer/markdown-formatter.d.ts +11 -0
  10. package/build/mobileSelectorPerformanceOptimizer/markdown-formatter.d.ts.map +1 -0
  11. package/build/mobileSelectorPerformanceOptimizer/mspo-reporter.d.ts +45 -0
  12. package/build/mobileSelectorPerformanceOptimizer/mspo-reporter.d.ts.map +1 -0
  13. package/build/mobileSelectorPerformanceOptimizer/mspo-service.d.ts +27 -0
  14. package/build/mobileSelectorPerformanceOptimizer/mspo-service.d.ts.map +1 -0
  15. package/build/mobileSelectorPerformanceOptimizer/mspo-store.d.ts +50 -0
  16. package/build/mobileSelectorPerformanceOptimizer/mspo-store.d.ts.map +1 -0
  17. package/build/mobileSelectorPerformanceOptimizer/optimizer.d.ts +10 -0
  18. package/build/mobileSelectorPerformanceOptimizer/optimizer.d.ts.map +1 -0
  19. package/build/mobileSelectorPerformanceOptimizer/overwrite.d.ts +6 -0
  20. package/build/mobileSelectorPerformanceOptimizer/overwrite.d.ts.map +1 -0
  21. package/build/mobileSelectorPerformanceOptimizer/reporting-types.d.ts +48 -0
  22. package/build/mobileSelectorPerformanceOptimizer/reporting-types.d.ts.map +1 -0
  23. package/build/mobileSelectorPerformanceOptimizer/types.d.ts +53 -0
  24. package/build/mobileSelectorPerformanceOptimizer/types.d.ts.map +1 -0
  25. package/build/mobileSelectorPerformanceOptimizer/utils/browser-utils.d.ts +6 -0
  26. package/build/mobileSelectorPerformanceOptimizer/utils/browser-utils.d.ts.map +1 -0
  27. package/build/mobileSelectorPerformanceOptimizer/utils/command-timing.d.ts +10 -0
  28. package/build/mobileSelectorPerformanceOptimizer/utils/command-timing.d.ts.map +1 -0
  29. package/build/mobileSelectorPerformanceOptimizer/utils/constants.d.ts +14 -0
  30. package/build/mobileSelectorPerformanceOptimizer/utils/constants.d.ts.map +1 -0
  31. package/build/mobileSelectorPerformanceOptimizer/utils/formatting.d.ts +15 -0
  32. package/build/mobileSelectorPerformanceOptimizer/utils/formatting.d.ts.map +1 -0
  33. package/build/mobileSelectorPerformanceOptimizer/utils/index.d.ts +22 -0
  34. package/build/mobileSelectorPerformanceOptimizer/utils/index.d.ts.map +1 -0
  35. package/build/mobileSelectorPerformanceOptimizer/utils/optimization.d.ts +8 -0
  36. package/build/mobileSelectorPerformanceOptimizer/utils/optimization.d.ts.map +1 -0
  37. package/build/mobileSelectorPerformanceOptimizer/utils/performance-data.d.ts +10 -0
  38. package/build/mobileSelectorPerformanceOptimizer/utils/performance-data.d.ts.map +1 -0
  39. package/build/mobileSelectorPerformanceOptimizer/utils/reporter.d.ts +16 -0
  40. package/build/mobileSelectorPerformanceOptimizer/utils/reporter.d.ts.map +1 -0
  41. package/build/mobileSelectorPerformanceOptimizer/utils/selector-location.d.ts +20 -0
  42. package/build/mobileSelectorPerformanceOptimizer/utils/selector-location.d.ts.map +1 -0
  43. package/build/mobileSelectorPerformanceOptimizer/utils/selector-testing.d.ts +10 -0
  44. package/build/mobileSelectorPerformanceOptimizer/utils/selector-testing.d.ts.map +1 -0
  45. package/build/mobileSelectorPerformanceOptimizer/utils/selector-utils.d.ts +37 -0
  46. package/build/mobileSelectorPerformanceOptimizer/utils/selector-utils.d.ts.map +1 -0
  47. package/build/mobileSelectorPerformanceOptimizer/utils/test-context.d.ts +24 -0
  48. package/build/mobileSelectorPerformanceOptimizer/utils/test-context.d.ts.map +1 -0
  49. package/build/mobileSelectorPerformanceOptimizer/utils/timing.d.ts +7 -0
  50. package/build/mobileSelectorPerformanceOptimizer/utils/timing.d.ts.map +1 -0
  51. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-class-chain.d.ts +10 -0
  52. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-class-chain.d.ts.map +1 -0
  53. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-conditions.d.ts +26 -0
  54. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-conditions.d.ts.map +1 -0
  55. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-constants.d.ts +64 -0
  56. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-constants.d.ts.map +1 -0
  57. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-converter.d.ts +14 -0
  58. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-converter.d.ts.map +1 -0
  59. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-detection.d.ts +30 -0
  60. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-detection.d.ts.map +1 -0
  61. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-page-source-executor.d.ts +30 -0
  62. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-page-source-executor.d.ts.map +1 -0
  63. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-page-source.d.ts +20 -0
  64. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-page-source.d.ts.map +1 -0
  65. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-parser.d.ts +9 -0
  66. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-parser.d.ts.map +1 -0
  67. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-predicate.d.ts +18 -0
  68. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-predicate.d.ts.map +1 -0
  69. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-selector-builder.d.ts +11 -0
  70. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-selector-builder.d.ts.map +1 -0
  71. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-types.d.ts +68 -0
  72. package/build/mobileSelectorPerformanceOptimizer/utils/xpath-types.d.ts.map +1 -0
  73. package/build/types.d.ts +46 -0
  74. package/build/types.d.ts.map +1 -1
  75. package/package.json +9 -6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xpath-class-chain.d.ts","sourceRoot":"","sources":["../../../src/mobileSelectorPerformanceOptimizer/utils/xpath-class-chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAgC,MAAM,kBAAkB,CAAA;AA0E3F;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CAuCpF"}
@@ -0,0 +1,26 @@
1
+ import type { XPathCondition } from './xpath-types.js';
2
+ /**
3
+ * Extracts all conditions from an XPath expression.
4
+ * Handles OR conditions, contains, starts-with, ends-with, text(), and substring().
5
+ *
6
+ * @param xpath - The XPath selector to extract conditions from
7
+ * @returns Array of extracted conditions
8
+ */
9
+ export declare function extractXPathConditions(xpath: string): XPathCondition[];
10
+ /**
11
+ * Converts a single XPath condition to predicate syntax (NSPredicate or Class Chain).
12
+ *
13
+ * @param condition - The condition to convert
14
+ * @param quoteStyle - Quote style to use: 'single' for predicate strings, 'double' for class chain
15
+ * @returns Predicate string representation
16
+ */
17
+ export declare function convertConditionToPredicate(condition: XPathCondition, quoteStyle?: 'single' | 'double'): string;
18
+ /**
19
+ * Groups OR conditions together and converts them to predicate syntax.
20
+ *
21
+ * @param conditions - Array of conditions to group
22
+ * @param quoteStyle - Quote style to use: 'single' for predicate strings, 'double' for class chain
23
+ * @returns Array of grouped condition strings
24
+ */
25
+ export declare function groupOrConditions(conditions: XPathCondition[], quoteStyle?: 'single' | 'double'): string[];
26
+ //# sourceMappingURL=xpath-conditions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xpath-conditions.d.ts","sourceRoot":"","sources":["../../../src/mobileSelectorPerformanceOptimizer/utils/xpath-conditions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,CA4BtE;AAyLD;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACvC,SAAS,EAAE,cAAc,EACzB,UAAU,GAAE,QAAQ,GAAG,QAAmB,GAC3C,MAAM,CA4BR;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC7B,UAAU,EAAE,cAAc,EAAE,EAC5B,UAAU,GAAE,QAAQ,GAAG,QAAmB,GAC3C,MAAM,EAAE,CA2BV"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * XPath axes that cannot be mapped to predicate strings or class chains.
3
+ *
4
+ * These axes require traversing UP the tree (parent/ancestor),
5
+ * SIDEWAYS (siblings), or by document order - none of which are
6
+ * supported by predicate strings or class chains.
7
+ */
8
+ export declare const UNMAPPABLE_XPATH_AXES: readonly [{
9
+ readonly pattern: RegExp;
10
+ readonly name: "ancestor axis";
11
+ }, {
12
+ readonly pattern: RegExp;
13
+ readonly name: "ancestor-or-self axis";
14
+ }, {
15
+ readonly pattern: RegExp;
16
+ readonly name: "following-sibling axis";
17
+ }, {
18
+ readonly pattern: RegExp;
19
+ readonly name: "preceding-sibling axis";
20
+ }, {
21
+ readonly pattern: RegExp;
22
+ readonly name: "following axis";
23
+ }, {
24
+ readonly pattern: RegExp;
25
+ readonly name: "preceding axis";
26
+ }, {
27
+ readonly pattern: RegExp;
28
+ readonly name: "parent axis";
29
+ }, {
30
+ readonly pattern: RegExp;
31
+ readonly name: "parent axis";
32
+ }];
33
+ /**
34
+ * XPath functions that cannot be mapped to predicate strings or class chains.
35
+ */
36
+ export declare const UNMAPPABLE_XPATH_FUNCTIONS: readonly [{
37
+ readonly pattern: RegExp;
38
+ readonly name: "normalize-space() function";
39
+ }, {
40
+ readonly pattern: RegExp;
41
+ readonly name: "position() function";
42
+ }, {
43
+ readonly pattern: RegExp;
44
+ readonly name: "count() function";
45
+ }];
46
+ /**
47
+ * Patterns that indicate a complex XPath requiring predicate/class chain conversion
48
+ * (not suitable for simple accessibility ID conversion).
49
+ */
50
+ export declare const COMPLEX_XPATH_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
51
+ /**
52
+ * Priority order of attributes for building unique selectors.
53
+ * Meaningful attributes first, then boolean attributes.
54
+ */
55
+ export declare const ATTRIBUTE_PRIORITY: readonly ["name", "label", "value", "enabled", "visible", "accessible", "hittable"];
56
+ /**
57
+ * Attributes that contain meaningful identifying information.
58
+ */
59
+ export declare const MEANINGFUL_ATTRIBUTES: readonly ["name", "label", "value"];
60
+ /**
61
+ * Boolean attributes that may help with uniqueness but are less reliable.
62
+ */
63
+ export declare const BOOLEAN_ATTRIBUTES: readonly ["enabled", "visible", "accessible", "hittable"];
64
+ //# sourceMappingURL=xpath-constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xpath-constants.d.ts","sourceRoot":"","sources":["../../../src/mobileSelectorPerformanceOptimizer/utils/xpath-constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;EASxB,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;EAI7B,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,sBAAsB,2FAWzB,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,kBAAkB,qFAAsF,CAAA;AAErH;;GAEG;AACH,eAAO,MAAM,qBAAqB,qCAAsC,CAAA;AAExE;;GAEG;AACH,eAAO,MAAM,kBAAkB,2DAA4D,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { XPathConversionResult, XPathConversionOptions } from './xpath-types.js';
2
+ /**
3
+ * Converts an XPath selector to an optimized alternative selector.
4
+ * Priority: Accessibility ID > Predicate String > Class Chain
5
+ *
6
+ * Uses page source analysis to find the exact element and build an optimized
7
+ * selector with uniqueness validation.
8
+ *
9
+ * @param xpath - The XPath selector to convert
10
+ * @param options - Conversion options including browser instance for page source analysis
11
+ * @returns Conversion result with selector and optional warning, or null if conversion isn't possible.
12
+ */
13
+ export declare function convertXPathToOptimizedSelector(xpath: string, options: XPathConversionOptions): Promise<XPathConversionResult | null>;
14
+ //# sourceMappingURL=xpath-converter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xpath-converter.d.ts","sourceRoot":"","sources":["../../../src/mobileSelectorPerformanceOptimizer/utils/xpath-converter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAOrF;;;;;;;;;;GAUG;AACH,wBAAsB,+BAA+B,CACjD,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,sBAAsB,GAChC,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAmEvC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Detects XPath features that cannot be mapped to predicate strings or class chains.
3
+ *
4
+ * @param xpath - The XPath selector to analyze
5
+ * @returns Array of unmappable feature names
6
+ */
7
+ export declare function detectUnmappableXPathFeatures(xpath: string): string[];
8
+ /**
9
+ * Checks if an XPath is complex (contains OR, AND, contains, etc.).
10
+ * Used to determine if we should skip accessibility ID conversion.
11
+ *
12
+ * @param xpath - The XPath selector to check
13
+ * @returns True if XPath contains complex patterns
14
+ */
15
+ export declare function isComplexXPath(xpath: string): boolean;
16
+ /**
17
+ * Extracts the element type from an XPath selector.
18
+ *
19
+ * @param xpath - The XPath selector
20
+ * @returns The element type (e.g., 'XCUIElementTypeButton') or null
21
+ */
22
+ export declare function extractElementTypeFromXPath(xpath: string): string | null;
23
+ /**
24
+ * Checks if an XPath uses a wildcard selector.
25
+ *
26
+ * @param xpath - The XPath selector
27
+ * @returns True if the XPath starts with //*
28
+ */
29
+ export declare function isWildcardXPath(xpath: string): boolean;
30
+ //# sourceMappingURL=xpath-detection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xpath-detection.d.ts","sourceRoot":"","sources":["../../../src/mobileSelectorPerformanceOptimizer/utils/xpath-detection.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAkCrE;AA+BD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGxE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Functions for executing XPath expressions against page source XML.
3
+ * Used as a fallback for unmappable XPath features (sibling axes, parent traversal, etc.)
4
+ */
5
+ import type { ElementData } from './xpath-types.js';
6
+ /**
7
+ * Result of finding an element by XPath with match count for uniqueness validation
8
+ */
9
+ export interface XPathExecutionResult {
10
+ element: ElementData;
11
+ matchCount: number;
12
+ }
13
+ /**
14
+ * Executes an XPath expression against page source XML and returns matching elements.
15
+ *
16
+ * @param xpathExpr - The XPath expression to execute
17
+ * @param pageSource - The page source XML
18
+ * @returns Array of ElementData for matching elements, or null if execution failed
19
+ */
20
+ export declare function executeXPathOnPageSource(xpathExpr: string, pageSource: string): ElementData[] | null;
21
+ /**
22
+ * Finds an element by executing XPath against page source and returns element data with match count.
23
+ * Used for unmappable XPath fallback with uniqueness validation.
24
+ *
25
+ * @param xpathExpr - The XPath expression to execute
26
+ * @param pageSource - The page source XML
27
+ * @returns XPathExecutionResult with first matching element and total match count, or null if not found
28
+ */
29
+ export declare function findElementByXPathWithFallback(xpathExpr: string, pageSource: string): XPathExecutionResult | null;
30
+ //# sourceMappingURL=xpath-page-source-executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xpath-page-source-executor.d.ts","sourceRoot":"","sources":["../../../src/mobileSelectorPerformanceOptimizer/utils/xpath-page-source-executor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAInD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,WAAW,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,EAAE,GAAG,IAAI,CAgDpG;AAED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAWjH"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Functions for validating selector uniqueness in page source XML.
3
+ */
4
+ /**
5
+ * Tests if a selector matches exactly one element by parsing the page source XML.
6
+ *
7
+ * @param selector - The selector to test
8
+ * @param pageSource - The page source XML to search in
9
+ * @returns True if exactly one element matches the selector
10
+ */
11
+ export declare function isSelectorUniqueInPageSource(selector: string, pageSource: string): boolean;
12
+ /**
13
+ * Counts elements matching a predicate string by parsing page source XML.
14
+ */
15
+ export declare function countMatchingElementsByPredicate(predicateString: string, pageSource: string): number;
16
+ /**
17
+ * Counts elements matching a class chain by parsing page source XML.
18
+ */
19
+ export declare function countMatchingElementsByClassChain(chainString: string, pageSource: string): number;
20
+ //# sourceMappingURL=xpath-page-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xpath-page-source.d.ts","sourceRoot":"","sources":["../../../src/mobileSelectorPerformanceOptimizer/utils/xpath-page-source.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAgB1F;AAeD;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAyBpG;AA+BD;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CA4CjG"}
@@ -0,0 +1,9 @@
1
+ import type { XPathSegment } from './xpath-types.js';
2
+ /**
3
+ * Parses an XPath expression into structured segments.
4
+ *
5
+ * @param xpath - The XPath expression to parse
6
+ * @returns Array of XPathSegment objects, or null if the XPath cannot be parsed
7
+ */
8
+ export declare function parseXPathToSegments(xpath: string): XPathSegment[] | null;
9
+ //# sourceMappingURL=xpath-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xpath-parser.d.ts","sourceRoot":"","sources":["../../../src/mobileSelectorPerformanceOptimizer/utils/xpath-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAqVpE;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,IAAI,CAiCzE"}
@@ -0,0 +1,18 @@
1
+ import type { XPathConversionResult } from './xpath-types.js';
2
+ /**
3
+ * Attempts to convert XPath to iOS Predicate String.
4
+ * Handles common XPath patterns and converts them to NSPredicate syntax.
5
+ *
6
+ * @param xpath - The XPath selector to convert
7
+ * @returns Conversion result with predicate string selector, or null if not applicable
8
+ */
9
+ export declare function convertXPathToPredicateString(xpath: string): XPathConversionResult | null;
10
+ /**
11
+ * Attempts to convert XPath to Accessibility ID selector.
12
+ * Only works for simple cases with single @name or @label attribute.
13
+ *
14
+ * @param xpath - The XPath selector to convert
15
+ * @returns The accessibility ID value, or null if not applicable
16
+ */
17
+ export declare function convertXPathToAccessibilityId(xpath: string): string | null;
18
+ //# sourceMappingURL=xpath-predicate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xpath-predicate.d.ts","sourceRoot":"","sources":["../../../src/mobileSelectorPerformanceOptimizer/utils/xpath-predicate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAI7D;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CAyBzF;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAY1E"}
@@ -0,0 +1,11 @@
1
+ import type { ElementData, XPathConversionResult } from './xpath-types.js';
2
+ /**
3
+ * Builds optimal selector from element data, ensuring uniqueness.
4
+ * Priority: Accessibility ID > Predicate String > Class Chain
5
+ *
6
+ * @param elementData - Element data extracted from page source
7
+ * @param pageSource - The page source XML to test selector uniqueness against
8
+ * @returns Conversion result with unique selector, or warning if not unique
9
+ */
10
+ export declare function buildSelectorFromElementData(elementData: ElementData, pageSource: string): XPathConversionResult | null;
11
+ //# sourceMappingURL=xpath-selector-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xpath-selector-builder.d.ts","sourceRoot":"","sources":["../../../src/mobileSelectorPerformanceOptimizer/utils/xpath-selector-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAI1E;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CACxC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,MAAM,GACnB,qBAAqB,GAAG,IAAI,CAgC9B"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Result of XPath conversion attempt
3
+ */
4
+ export interface XPathConversionResult {
5
+ selector: string | null;
6
+ warning?: string;
7
+ /**
8
+ * When an XPath cannot be converted but we found a potential selector via page source analysis,
9
+ * this field contains that selector as a suggestion (even if it's not unique).
10
+ */
11
+ suggestion?: string;
12
+ }
13
+ /**
14
+ * Condition extracted from XPath expression
15
+ */
16
+ export interface XPathCondition {
17
+ attribute: string;
18
+ operator: string;
19
+ value: string;
20
+ logicalOp?: string;
21
+ }
22
+ /**
23
+ * Options for XPath conversion
24
+ */
25
+ export interface XPathConversionOptions {
26
+ /**
27
+ * Browser instance for page source analysis.
28
+ * Used to execute XPath and build optimized selectors with uniqueness validation.
29
+ */
30
+ browser: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser;
31
+ }
32
+ /**
33
+ * Element data extracted from page source
34
+ */
35
+ export interface ElementData {
36
+ type: string;
37
+ attributes: Record<string, string>;
38
+ }
39
+ /**
40
+ * Predicate condition for matching elements
41
+ */
42
+ export interface PredicateCondition {
43
+ attr: string;
44
+ op: string;
45
+ value: string;
46
+ }
47
+ /**
48
+ * Represents a single segment of a parsed XPath expression
49
+ */
50
+ export interface XPathSegment {
51
+ /**
52
+ * The axis used: '//' for descendant, '/' for child
53
+ **/
54
+ axis: '//' | '/';
55
+ /**
56
+ * The element type or '*' for wildcard
57
+ **/
58
+ element: string;
59
+ /**
60
+ * Conditions/predicates for this segment
61
+ **/
62
+ conditions: XPathCondition[];
63
+ /**
64
+ * Positional index if specified (e.g., [1])
65
+ **/
66
+ index?: number;
67
+ }
68
+ //# sourceMappingURL=xpath-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xpath-types.d.ts","sourceRoot":"","sources":["../../../src/mobileSelectorPerformanceOptimizer/utils/xpath-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC;;;OAGG;IACH,OAAO,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB,CAAA;CAChE;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;QAEI;IACJ,IAAI,EAAE,IAAI,GAAG,GAAG,CAAA;IAChB;;QAEI;IACJ,OAAO,EAAE,MAAM,CAAA;IACf;;QAEI;IACJ,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B;;QAEI;IACJ,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB"}
package/build/types.d.ts CHANGED
@@ -142,6 +142,52 @@ export interface AppiumServiceConfig {
142
142
  * @default 30000
143
143
  */
144
144
  appiumStartTimeout?: number;
145
+ /**
146
+ * Enable selector performance tracking to measure element finding times.
147
+ * When enabled, tracks all element-finding commands and stores timing data in JSON format.
148
+ */
149
+ trackSelectorPerformance?: {
150
+ /**
151
+ * Enable the CLI report output to the terminal.
152
+ * When enabled, a formatted performance report is printed to the terminal after test execution.
153
+ * @default false
154
+ */
155
+ enableCliReport?: boolean;
156
+ /**
157
+ * Enable markdown report generation.
158
+ * When enabled, a markdown file with the same content as the CLI report is written to the logs folder.
159
+ * @default false
160
+ */
161
+ enableMarkdownReport?: boolean;
162
+ /**
163
+ * Path where the JSON report file should be saved.
164
+ * If not provided, falls back to config.outputDir, then appium service logPath.
165
+ * If none are set, an error will be thrown.
166
+ */
167
+ reportPath?: string;
168
+ /**
169
+ * Maximum line length for terminal report output.
170
+ * Lines longer than this will be wrapped at word boundaries.
171
+ * @default 100
172
+ */
173
+ maxLineLength?: number;
174
+ /**
175
+ * Paths to directories containing page objects or helper files where selectors may be defined.
176
+ * The service will search these directories to find selector locations and show file paths
177
+ * in the report (e.g., "Found at: TabBar.ts:3").
178
+ *
179
+ * This option is required when `trackSelectorPerformance` is configured.
180
+ *
181
+ * @example
182
+ * // Single directory
183
+ * pageObjectPaths: ['./tests/pageobjects']
184
+ *
185
+ * @example
186
+ * // Multiple directories
187
+ * pageObjectPaths: ['./tests/pageobjects', './tests/pages', './tests/helpers']
188
+ */
189
+ pageObjectPaths: string[];
190
+ };
145
191
  }
146
192
  export type ArgValue = string | number | boolean | null | object;
147
193
  export type KeyValueArgs = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC9B;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAClC;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,GAAG,CAAC,EAAE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AED,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,CAAA;AAChE,MAAM,MAAM,YAAY,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/appium-service",
3
- "version": "9.23.3",
3
+ "version": "9.25.0",
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",
@@ -43,18 +43,21 @@
43
43
  },
44
44
  "typeScriptVersion": "3.8.3",
45
45
  "dependencies": {
46
- "@wdio/config": "9.23.3",
46
+ "@wdio/config": "9.25.0",
47
47
  "@wdio/logger": "9.18.0",
48
- "@wdio/types": "9.23.3",
49
- "@wdio/utils": "9.23.3",
48
+ "@wdio/reporter": "9.25.0",
49
+ "@wdio/types": "9.25.0",
50
+ "@wdio/utils": "9.25.0",
51
+ "@xmldom/xmldom": "^0.9.5",
50
52
  "change-case": "^5.4.3",
51
53
  "get-port": "^7.0.0",
52
54
  "import-meta-resolve": "^4.0.0",
53
55
  "tree-kill": "^1.2.2",
54
- "webdriverio": "9.23.3"
56
+ "webdriverio": "9.25.0",
57
+ "xpath": "^0.0.34"
55
58
  },
56
59
  "publishConfig": {
57
60
  "access": "public"
58
61
  },
59
- "gitHead": "ae97a13a6f03d0d6c988beb56ec822473fa61c62"
62
+ "gitHead": "1352571ae8709a895c223973f1840f38d8530f4a"
60
63
  }