appium-xcuitest-driver 10.13.1 → 10.13.3

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 (49) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/lib/commands/app-management.d.ts +99 -76
  3. package/build/lib/commands/app-management.d.ts.map +1 -1
  4. package/build/lib/commands/app-management.js +83 -73
  5. package/build/lib/commands/app-management.js.map +1 -1
  6. package/build/lib/commands/certificate.d.ts +14 -19
  7. package/build/lib/commands/certificate.d.ts.map +1 -1
  8. package/build/lib/commands/certificate.js +24 -31
  9. package/build/lib/commands/certificate.js.map +1 -1
  10. package/build/lib/commands/element.d.ts +83 -67
  11. package/build/lib/commands/element.d.ts.map +1 -1
  12. package/build/lib/commands/element.js +111 -134
  13. package/build/lib/commands/element.js.map +1 -1
  14. package/build/lib/commands/file-movement.d.ts +31 -42
  15. package/build/lib/commands/file-movement.d.ts.map +1 -1
  16. package/build/lib/commands/file-movement.js +146 -205
  17. package/build/lib/commands/file-movement.js.map +1 -1
  18. package/build/lib/commands/find.d.ts +20 -12
  19. package/build/lib/commands/find.d.ts.map +1 -1
  20. package/build/lib/commands/find.js +27 -65
  21. package/build/lib/commands/find.js.map +1 -1
  22. package/build/lib/commands/navigation.d.ts.map +1 -1
  23. package/build/lib/commands/navigation.js +12 -14
  24. package/build/lib/commands/navigation.js.map +1 -1
  25. package/build/lib/commands/performance.d.ts +36 -55
  26. package/build/lib/commands/performance.d.ts.map +1 -1
  27. package/build/lib/commands/performance.js +93 -86
  28. package/build/lib/commands/performance.js.map +1 -1
  29. package/build/lib/commands/recordscreen.d.ts +31 -63
  30. package/build/lib/commands/recordscreen.d.ts.map +1 -1
  31. package/build/lib/commands/recordscreen.js +29 -28
  32. package/build/lib/commands/recordscreen.js.map +1 -1
  33. package/build/lib/execute-method-map.d.ts.map +1 -1
  34. package/build/lib/execute-method-map.js +0 -1
  35. package/build/lib/execute-method-map.js.map +1 -1
  36. package/lib/commands/app-management.ts +414 -0
  37. package/lib/commands/{certificate.js → certificate.ts} +55 -50
  38. package/lib/commands/element.ts +419 -0
  39. package/lib/commands/{file-movement.js → file-movement.ts} +212 -235
  40. package/lib/commands/find.ts +277 -0
  41. package/lib/commands/navigation.js +20 -14
  42. package/lib/commands/{performance.js → performance.ts} +133 -114
  43. package/lib/commands/{recordscreen.js → recordscreen.ts} +78 -50
  44. package/lib/execute-method-map.ts +0 -1
  45. package/npm-shrinkwrap.json +5 -5
  46. package/package.json +1 -1
  47. package/lib/commands/app-management.js +0 -346
  48. package/lib/commands/element.js +0 -423
  49. package/lib/commands/find.js +0 -205
@@ -11,31 +11,23 @@ const lodash_1 = __importDefault(require("lodash"));
11
11
  const css_converter_1 = require("../css-converter");
12
12
  const driver_1 = require("appium/driver");
13
13
  const support_1 = require("appium/support");
14
- /**
15
- * @this {XCUITestDriver}
16
- */
17
14
  async function findElOrEls(strategy, selector, mult, context) {
18
15
  if (this.isWebview()) {
19
- return await this.findWebElementOrElements(strategy, selector, mult, context);
20
- }
21
- else {
22
- return await this.findNativeElementOrElements(strategy, selector, mult, context);
16
+ return mult
17
+ ? await this.findWebElementOrElements(strategy, selector, true, context)
18
+ : await this.findWebElementOrElements(strategy, selector, false, context);
23
19
  }
20
+ return mult
21
+ ? await this.findNativeElementOrElements(strategy, selector, true, context)
22
+ : await this.findNativeElementOrElements(strategy, selector, false, context);
24
23
  }
25
- /**
26
- * @this {XCUITestDriver}
27
- * @privateRemarks I'm not sure what these objects are; they aren't `Element`.
28
- * @returns {Promise<any|any[]|undefined>}
29
- */
30
24
  async function findNativeElementOrElements(strategy, selector, mult, context) {
31
25
  const initSelector = selector;
32
26
  let rewroteSelector = false;
33
27
  if (strategy === '-ios predicate string') {
34
- // WebDriverAgent uses 'predicate string'
35
28
  strategy = 'predicate string';
36
29
  }
37
30
  else if (strategy === '-ios class chain') {
38
- // WebDriverAgent uses 'class chain'
39
31
  strategy = WDA_CLASS_CHAIN_STRATEGY;
40
32
  }
41
33
  else if (strategy === 'css selector') {
@@ -43,12 +35,9 @@ async function findNativeElementOrElements(strategy, selector, mult, context) {
43
35
  selector = css_converter_1.CssConverter.toIosClassChainSelector(selector);
44
36
  }
45
37
  if (strategy === 'class name') {
46
- // XCUITest classes have `XCUIElementType` prepended
47
- // first check if there is the old `UIA` prefix
48
38
  if (selector.startsWith('UIA')) {
49
39
  selector = selector.substring(3);
50
40
  }
51
- // now check if we need to add `XCUIElementType`
52
41
  if (!selector.startsWith('XCUIElementType')) {
53
42
  selector = stripViewFromSelector(`XCUIElementType${selector}`);
54
43
  rewroteSelector = true;
@@ -61,8 +50,7 @@ async function findNativeElementOrElements(strategy, selector, mult, context) {
61
50
  [strategy, selector] = rewriteMagicScrollable(mult, this.log);
62
51
  }
63
52
  else if (strategy === 'xpath') {
64
- // Replace UIA if it comes after a forward slash or is at the beginning of the string
65
- selector = selector.replace(/(^|\/)(UIA)([^[/]+)/g, (str, g1, g2, g3) => {
53
+ selector = selector.replace(/(^|\/)(UIA)([^[/]+)/g, (str, g1, _g2, g3) => {
66
54
  rewroteSelector = true;
67
55
  return g1 + stripViewFromSelector(`XCUIElementType${g3}`);
68
56
  });
@@ -72,39 +60,32 @@ async function findNativeElementOrElements(strategy, selector, mult, context) {
72
60
  `'${selector}' to match XCUI type. You should consider ` +
73
61
  `updating your tests to use the new selectors directly`);
74
62
  }
75
- return await this.doNativeFind(strategy, selector, mult, context);
63
+ return mult
64
+ ? await this.doNativeFind(strategy, selector, true, context)
65
+ : await this.doNativeFind(strategy, selector, false, context);
76
66
  }
77
- /**
78
- * @this {XCUITestDriver}
79
- */
80
67
  async function doNativeFind(strategy, selector, mult, context) {
81
- context = support_1.util.unwrapElement(context);
82
- let endpoint = `/element${context ? `/${context}/element` : ''}${mult ? 's' : ''}`;
83
- let body = {
68
+ const ctx = support_1.util.unwrapElement(context ?? null);
69
+ const endpoint = `/element${ctx ? `/${ctx}/element` : ''}${mult ? 's' : ''}`;
70
+ const body = {
84
71
  using: strategy,
85
72
  value: selector,
86
73
  };
87
- /** @type {import('./proxy-helper').AllowedHttpMethod} */
88
74
  const method = 'POST';
89
- // This is either an array is mult === true
90
- // or an object if mult === false
91
- /** @type {Element[]|undefined} */
92
- let els;
75
+ let els = [];
93
76
  try {
94
77
  await this.implicitWaitForCondition(async () => {
95
78
  try {
96
- els = /** @type {Element[]|undefined} */ (await this.proxyCommand(endpoint, method, body));
79
+ els = (await this.proxyCommand(endpoint, method, body));
97
80
  }
98
81
  catch {
99
82
  els = [];
100
83
  }
101
- // we succeed if we get some elements
102
84
  return !lodash_1.default.isEmpty(els);
103
85
  });
104
86
  }
105
87
  catch (err) {
106
88
  if (err.message?.match(/Condition unmet/)) {
107
- // condition was not met setting res to empty array
108
89
  els = [];
109
90
  }
110
91
  else {
@@ -112,15 +93,21 @@ async function doNativeFind(strategy, selector, mult, context) {
112
93
  }
113
94
  }
114
95
  if (mult) {
115
- return els;
96
+ return Array.isArray(els) ? els : [els];
116
97
  }
117
- if (lodash_1.default.isEmpty(els)) {
98
+ if (Array.isArray(els)) {
99
+ if (lodash_1.default.isEmpty(els)) {
100
+ throw new driver_1.errors.NoSuchElementError();
101
+ }
102
+ return els[0];
103
+ }
104
+ if (!els) {
118
105
  throw new driver_1.errors.NoSuchElementError();
119
106
  }
120
107
  return els;
121
108
  }
122
109
  /**
123
- * @this {XCUITestDriver}
110
+ * Finds the first visible child element inside a context.
124
111
  */
125
112
  async function getFirstVisibleChild(mult, context) {
126
113
  this.log.info(`Getting first visible child`);
@@ -131,16 +118,10 @@ async function getFirstVisibleChild(mult, context) {
131
118
  throw new Error('Cannot get first visible child without a context element');
132
119
  }
133
120
  let index = 1;
134
- // loop through children via class-chain finds, until we run out of children
135
- // or we find a visible one. This loop looks infinite but its not, because at
136
- // some point the call to doNativeFind will throw with an Element Not Found
137
- // error, when the index gets higher than the number of child elements. This
138
- // is what we want because that error will halt the loop and make it all the
139
- // way to the client.
140
121
  while (true) {
141
122
  const strategy = WDA_CLASS_CHAIN_STRATEGY;
142
123
  const selector = `*[${index}]`;
143
- const nthChild = await this.doNativeFind(strategy, selector, false, context);
124
+ const nthChild = (await this.doNativeFind(strategy, selector, false, context));
144
125
  const visible = await this.getAttribute('visible', nthChild);
145
126
  if (visible === 'true') {
146
127
  this.log.info(`Found first visible child at position ${index}`);
@@ -149,17 +130,10 @@ async function getFirstVisibleChild(mult, context) {
149
130
  index++;
150
131
  }
151
132
  }
152
- // we override the xpath search for this first-visible-child selector, which
153
- // looks like /*[@firstVisible="true"]
154
133
  const MAGIC_FIRST_VIS_CHILD_SEL = /\/\*\[@firstVisible\s*=\s*('|")true\1\]/;
155
- // we likewise override xpath search to provide a shortcut for finding all
156
- // scrollable elements
157
134
  const MAGIC_SCROLLABLE_SEL = /\/\/\*\[@scrollable\s*=\s*('|")true\1\]/;
158
135
  const WDA_CLASS_CHAIN_STRATEGY = 'class chain';
159
- // Check if the word 'View' is appended to selector and if it is, strip it out
160
136
  function stripViewFromSelector(selector) {
161
- // Don't strip it out if it's one of these 4 element types
162
- // (see https://github.com/facebook/WebDriverAgent/blob/master/WebDriverAgentLib/Utilities/FBElementTypeTransformer.m for reference)
163
137
  const keepView = [
164
138
  'XCUIElementTypeScrollView',
165
139
  'XCUIElementTypeCollectionView',
@@ -167,18 +141,10 @@ function stripViewFromSelector(selector) {
167
141
  'XCUIElementTypeWebView',
168
142
  ].includes(selector);
169
143
  if (!keepView && selector.indexOf('View') === selector.length - 4) {
170
- return selector.substr(0, selector.length - 4);
171
- }
172
- else {
173
- return selector;
144
+ return selector.substring(0, selector.length - 4);
174
145
  }
146
+ return selector;
175
147
  }
176
- /**
177
- *
178
- * @param {boolean} mult
179
- * @param {import('@appium/types').AppiumLogger|null} log
180
- * @returns {[string, string]}
181
- */
182
148
  function rewriteMagicScrollable(mult, log = null) {
183
149
  const pred = ['ScrollView', 'Table', 'CollectionView', 'WebView']
184
150
  .map((t) => `type == "XCUIElementType${t}"`)
@@ -192,8 +158,4 @@ function rewriteMagicScrollable(mult, log = null) {
192
158
  `format with selector '${selector}'`);
193
159
  return [strategy, selector];
194
160
  }
195
- /**
196
- * @typedef {import('../driver').XCUITestDriver} XCUITestDriver
197
- * @typedef {import('@appium/types').Element} Element
198
- */
199
161
  //# sourceMappingURL=find.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"find.js","sourceRoot":"","sources":["../../../lib/commands/find.js"],"names":[],"mappings":";;;;;AAQA,kCAMC;AAOD,kEAgDC;AAKD,oCA4CC;AAKD,oDA0BC;AArJD,oDAAuB;AACvB,oDAA8C;AAC9C,0CAAqC;AACrC,4CAAoC;AAEpC;;GAEG;AACI,KAAK,UAAU,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;IACjE,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;QACrB,OAAO,MAAM,IAAI,CAAC,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAChF,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,IAAI,CAAC,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACnF,CAAC;AACH,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;IACjF,MAAM,YAAY,GAAG,QAAQ,CAAC;IAC9B,IAAI,eAAe,GAAG,KAAK,CAAC;IAC5B,IAAI,QAAQ,KAAK,uBAAuB,EAAE,CAAC;QACzC,yCAAyC;QACzC,QAAQ,GAAG,kBAAkB,CAAC;IAChC,CAAC;SAAM,IAAI,QAAQ,KAAK,kBAAkB,EAAE,CAAC;QAC3C,oCAAoC;QACpC,QAAQ,GAAG,wBAAwB,CAAC;IACtC,CAAC;SAAM,IAAI,QAAQ,KAAK,cAAc,EAAE,CAAC;QACvC,QAAQ,GAAG,wBAAwB,CAAC;QACpC,Q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,GAAG,IAAI,CAAC;IACtC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,QAAQ,IAAI,KAAK,CAAC;IACpB,CAAC;IACD,GAAG,EAAE,IAAI,CACP,4DAA4D;QAC1D,yBAAyB,QAAQ,GAAG,CACvC,CAAC;IACF,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../lib/commands/navigation.js"],"names":[],"mappings":"AASA;;GAEG;AACH,8EAMC;AAED;;GAEG;AACH,iFAIC;AAED;;GAEG;AACH,oFAsBC;AAED;;;;;;;;;;;;GAYG;AACH,8EAPW,MAAM,aACN,MAAM,GAEJ,OAAO,CAAC,IAAI,CAAC,CASzB;AAED;;GAEG;AACH,uFAiCC;6BAGY,OAAO,WAAW,EAAE,cAAc;;;;;SAKjC,MAAM;;;;;;cACN,MAAM,OAAC"}
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../lib/commands/navigation.js"],"names":[],"mappings":"AAQA;;GAEG;AACH,8EAMC;AAED;;GAEG;AACH,iFAIC;AAED;;GAEG;AACH,oFAsBC;AAED;;;;;;;;;;;;GAYG;AACH,8EAPW,MAAM,aACN,MAAM,GAEJ,OAAO,CAAC,IAAI,CAAC,CASzB;AAED;;GAEG;AACH,uFAwCC;6BAGY,OAAO,WAAW,EAAE,cAAc;;;;;SAKjC,MAAM;;;;;;cACN,MAAM,OAAC"}
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.back = back;
7
4
  exports.forward = forward;
@@ -9,7 +6,6 @@ exports.closeWindow = closeWindow;
9
6
  exports.mobileDeepLink = mobileDeepLink;
10
7
  exports.nativeBack = nativeBack;
11
8
  const driver_1 = require("appium/driver");
12
- const lodash_1 = __importDefault(require("lodash"));
13
9
  const asyncbox_1 = require("asyncbox");
14
10
  const utils_1 = require("../utils");
15
11
  // these two constitute the wait after closing a window
@@ -89,20 +85,22 @@ async function nativeBack() {
89
85
  return await this.mobilePressButton('Menu');
90
86
  }
91
87
  try {
92
- let navBar = await this.findNativeElementOrElements('class name', 'XCUIElementTypeNavigationBar', false);
93
- let buttons = await this.findNativeElementOrElements('class name', 'XCUIElementTypeButton', true, navBar);
94
- if (buttons?.length === 0) {
95
- throw new Error('No buttons found in navigation bar');
96
- }
97
- let backButton = lodash_1.default.filter(buttons, (value) => value.label === 'Back')[0];
98
- if (backButton) {
88
+ const navBar = await this.findNativeElementOrElements('class name', 'XCUIElementTypeNavigationBar', false);
89
+ let dstButton;
90
+ const backButtons = await this.findNativeElementOrElements('-ios predicate string', 'type == "XCUIElementTypeButton" AND label == "Back"', true, navBar);
91
+ if (backButtons.length === 0) {
92
+ const buttons = await this.findNativeElementOrElements('-ios predicate string', 'type == "XCUIElementTypeButton"', true, navBar);
93
+ if (buttons.length === 0) {
94
+ throw new Error('No buttons found in navigation bar');
95
+ }
99
96
  this.log.debug(`Found navigation bar 'back' button. Clicking.`);
97
+ dstButton = buttons[0];
100
98
  }
101
99
  else {
102
- this.log.debug(`Unable to find 'Back' button. Trying first button in navigation bar`);
103
- backButton = buttons?.[0];
100
+ this.log.debug(`Did not find any navigation bar 'back' button. Clicking the first one.`);
101
+ dstButton = backButtons[0];
104
102
  }
105
- await this.nativeClick(/** @type {string} */ (backButton));
103
+ await this.nativeClick(dstButton);
106
104
  }
107
105
  catch (err) {
108
106
  this.log.error(`Unable to find navigation bar and back button: ${err.message}`);
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../lib/commands/navigation.js"],"names":[],"mappings":";;;;;AAYA,oBAMC;AAKD,0BAIC;AAKD,kCAsBC;AAeD,wCAKC;AAKD,gCAiCC;AAhHD,0CAAqC;AACrC,oDAAuB;AACvB,u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AAuB,EACvB,iCAAiC,EACjC,IAAI,EACJ,MAAM,CACP,CAAC;YACF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;YACxD,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;YAChE,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,wEAAwE,CAAC,CAAC;YACzF,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC;QAED,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,kDAAkD,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAClF,CAAC;AACH,CAAC;AAED;;GAEG;AAEH;;;;;;GAMG"}
@@ -1,3 +1,5 @@
1
+ import type { XCUITestDriver } from '../driver';
2
+ import type { Method } from 'axios';
1
3
  /**
2
4
  * Starts performance profiling for the device under test.
3
5
  *
@@ -11,34 +13,11 @@
11
13
  *
12
14
  * Read [Recording, Pausing, and Stopping Traces](https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Recording,Pausing,andStoppingTraces.html) for more details.
13
15
  *
14
- * @param {number} timeout - The maximum count of milliseconds to record the profiling information.
15
- * @param {string} profileName - The name of existing performance profile to apply. Can also contain the full path to the chosen template on the server file system. Note: not all profiles are supported on mobile devices.
16
- * @param {number|'current'} [pid] - The ID of the process to measure the performance for. Set it to `current` in order to measure the performance of the process, which belongs to the currently active application. All processes running on the device are measured if `pid` is unset (the default setting).
17
- * @this {XCUITestDriver}
16
+ * @param timeout - The maximum count of milliseconds to record the profiling information.
17
+ * @param profileName - The name of existing performance profile to apply. Can also contain the full path to the chosen template on the server file system. Note: not all profiles are supported on mobile devices.
18
+ * @param pid - The ID of the process to measure the performance for. Set it to `current` in order to measure the performance of the process, which belongs to the currently active application. All processes running on the device are measured if `pid` is unset (the default setting).
18
19
  */
19
- export function mobileStartPerfRecord(this: import("../driver").XCUITestDriver, timeout?: number, profileName?: string, pid?: number | "current"): Promise<void>;
20
- export class mobileStartPerfRecord {
21
- /**
22
- * Starts performance profiling for the device under test.
23
- *
24
- * Relaxing security is mandatory for simulators. It can always work for real devices.
25
- *
26
- * Since XCode 12 the method tries to use `xctrace` tool to record performance stats.
27
- *
28
- * The `instruments` developer utility is used as a fallback for this purpose if `xctrace` is not available.
29
- *
30
- * It is possible to record multiple profiles at the same time.
31
- *
32
- * Read [Recording, Pausing, and Stopping Traces](https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Recording,Pausing,andStoppingTraces.html) for more details.
33
- *
34
- * @param {number} timeout - The maximum count of milliseconds to record the profiling information.
35
- * @param {string} profileName - The name of existing performance profile to apply. Can also contain the full path to the chosen template on the server file system. Note: not all profiles are supported on mobile devices.
36
- * @param {number|'current'} [pid] - The ID of the process to measure the performance for. Set it to `current` in order to measure the performance of the process, which belongs to the currently active application. All processes running on the device are measured if `pid` is unset (the default setting).
37
- * @this {XCUITestDriver}
38
- */
39
- constructor(this: import("../driver").XCUITestDriver, timeout?: number, profileName?: string, pid?: number | "current");
40
- _perfRecorders: PerfRecorder[] | undefined;
41
- }
20
+ export declare function mobileStartPerfRecord(this: XCUITestDriver, timeout?: number, profileName?: string, pid?: number | 'current'): Promise<void>;
42
21
  /**
43
22
  * Stops performance recording operation previously started by {@linkcode XCUITestDriver.mobileStartPerfRecord mobile: startPerfRecord}.
44
23
  *
@@ -46,40 +25,42 @@ export class mobileStartPerfRecord {
46
25
  *
47
26
  * The resulting file in `.trace` format can be either returned directly as base64-encoded zip archive or uploaded to a remote location (such files can be pretty large). Afterwards it is possible to unarchive and open such files with Xcode Dev Tools.
48
27
  *
49
- * @param {string} [remotePath] - The path to the remote location, where the resulting zipped `.trace` file should be uploaded. The following protocols are supported: `http`, `https`, `ftp`. Null or empty string value (the default setting) means the content of resulting file should be zipped, encoded as Base64 and passed as the endpoint response value. An exception will be thrown if the generated file is too big to fit into the available process memory.
50
- * @param {string} [user] - The name of the user for the remote authentication. Only works if `remotePath` is provided.
51
- * @param {string} [pass] - The password for the remote authentication. Only works if `remotePath` is provided.
52
- * @param {import('axios').Method} [method] - The http multipart upload method name. Only works if `remotePath` is provided. Defaults to `PUT`
53
- * @param {string} profileName - The name of existing performance profile to stop the recording for. Multiple recorders for different profile names could be executed at the same time.
54
- * @param {Record<string,any>} [headers] - Additional headers mapping for multipart http(s) uploads
55
- * @param {string} [fileFieldName] - The name of the form field, where the file content BLOB should be stored for http(s) uploads. Defaults to `file`
56
- * @param {Record<string,any>|([string, any])[]} [formFields] - Additional form fields for multipart http(s) uploads
57
- *
58
- * @returns {Promise<string>} The resulting file in `.trace` format. This file can either be returned directly as base64-encoded `.zip` archive or uploaded to a remote location (note that such files may be large), _depending on the `remotePath` argument value._ Thereafter, the file may be unarchived and opened with Xcode Developer Tools.
28
+ * @param remotePath - The path to the remote location, where the resulting zipped `.trace` file should be uploaded. The following protocols are supported: `http`, `https`, `ftp`. Null or empty string value (the default setting) means the content of resulting file should be zipped, encoded as Base64 and passed as the endpoint response value. An exception will be thrown if the generated file is too big to fit into the available process memory.
29
+ * @param user - The name of the user for the remote authentication. Only works if `remotePath` is provided.
30
+ * @param pass - The password for the remote authentication. Only works if `remotePath` is provided.
31
+ * @param method - The http multipart upload method name. Only works if `remotePath` is provided. Defaults to `PUT`
32
+ * @param profileName - The name of existing performance profile to stop the recording for. Multiple recorders for different profile names could be executed at the same time.
33
+ * @param headers - Additional headers mapping for multipart http(s) uploads
34
+ * @param fileFieldName - The name of the form field, where the file content BLOB should be stored for http(s) uploads. Defaults to `file`
35
+ * @param formFields - Additional form fields for multipart http(s) uploads
36
+ * @returns The resulting file in `.trace` format. This file can either be returned directly as base64-encoded `.zip` archive or uploaded to a remote location (note that such files may be large), _depending on the `remotePath` argument value._ Thereafter, the file may be unarchived and opened with Xcode Developer Tools.
59
37
  * @throws {Error} If no performance recording with given profile name/device udid combination
60
38
  * has been started before or the resulting .trace file has not been generated properly.
61
- * @this {XCUITestDriver}
62
39
  */
63
- export function mobileStopPerfRecord(this: import("../driver").XCUITestDriver, remotePath?: string, user?: string, pass?: string, method?: import("axios").Method, profileName?: string, headers?: Record<string, any>, fileFieldName?: string, formFields?: Record<string, any> | ([string, any])[]): Promise<string>;
64
- export class PerfRecorder {
65
- constructor(reportRoot: any, udid: any, opts?: {});
66
- /** @type {import('teen_process').SubProcess|null} */
67
- _process: import("teen_process").SubProcess | null;
68
- _zippedReportPath: string;
69
- _timeout: any;
70
- _profileName: any;
71
- _reportPath: string;
72
- _pid: any;
73
- _udid: any;
74
- _logger: import("@appium/types").AppiumLogger;
75
- _archivePromise: Promise<string> | null;
76
- get profileName(): any;
77
- getOriginalReportPath(): Promise<string>;
40
+ export declare function mobileStopPerfRecord(this: XCUITestDriver, remotePath?: string, user?: string, pass?: string, method?: Method, profileName?: string, headers?: Record<string, any>, fileFieldName?: string, formFields?: Record<string, any> | [string, any][]): Promise<string>;
41
+ export declare class PerfRecorder {
42
+ private _process;
43
+ private _zippedReportPath;
44
+ private readonly _timeout;
45
+ private readonly _profileName;
46
+ private readonly _reportPath;
47
+ private readonly _pid;
48
+ private readonly _udid;
49
+ private readonly _logger;
50
+ private _archivePromise;
51
+ constructor(reportRoot: string, udid: string, opts?: PerfRecorderOptions);
52
+ get profileName(): string;
78
53
  getZippedReportPath(): Promise<string>;
79
54
  isRunning(): boolean;
80
- _enforceTermination(): Promise<string>;
81
55
  start(): Promise<void>;
82
56
  stop(force?: boolean): Promise<string>;
57
+ private getOriginalReportPath;
58
+ private _enforceTermination;
59
+ }
60
+ interface PerfRecorderOptions {
61
+ timeout?: number;
62
+ profileName?: string;
63
+ pid?: number;
83
64
  }
84
- export type XCUITestDriver = import("../driver").XCUITestDriver;
65
+ export {};
85
66
  //# sourceMappingURL=performance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"performance.d.ts","sourceRoot":"","sources":["../../../lib/commands/performance.js"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;;GAiBG;AACH,0FALW,MAAM,gBACN,MAAM,QACN,MAAM,GAAC,SAAS,iBA4C1B;;IA3DD;;;;;;;;;;;;;;;;;OAiBG;IACH,gEALW,MAAM,gBACN,MAAM,QACN,MAAM,GAAC,SAAS,EA4C1B;IADC,2CAAgE;;AAGlE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,4FAdW,MAAM,SACN,MAAM,SACN,MAAM,WACN,OAAO,OAAO,EAAE,MAAM,gBACtB,MAAM,YACN,MAAM,CAAC,MAAM,EAAC,GAAG,CAAC,kBAClB,MAAM,eACN,MAAM,CAAC,MAAM,EAAC,GAAG,CAAC,GAAC,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,GAElC,OAAO,CAAC,MAAM,CAAC,CAoD3B;AA2BD;IAGE,mDAeC;IAjBD,qDAAqD;IACrD,UADW,OAAO,cAAc,EAAE,UAAU,GAAC,IAAI,CACxC;IAGP,0BAA2B;IAC3B,cAAoF;IACpF,kBAA4D;IAC5D,oBAGC;IACD,UAAoB;IACpB,WAAiB;IACjB,8CAEC;IACD,wCAA2B;IAG7B,uBAEC;IAED,yCAEC;IAED,uCAsBC;IAED,qBAEC;IAED,uCAgCC;IAED,uBAiGC;IAED,uCAkBC;CACF;6BAcY,OAAO,WAAW,EAAE,cAAc"}
1
+ {"version":3,"file":"performance.d.ts","sourceRoot":"","sources":["../../../lib/commands/performance.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAE9C,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,OAAO,CAAC;AAiBlC;;;;;;;;;;;;;;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