appium-xcuitest-driver 7.13.0 → 7.15.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 (59) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/build/lib/app-infos-cache.d.ts +46 -0
  3. package/build/lib/app-infos-cache.d.ts.map +1 -0
  4. package/build/lib/app-infos-cache.js +156 -0
  5. package/build/lib/app-infos-cache.js.map +1 -0
  6. package/build/lib/app-utils.d.ts +60 -51
  7. package/build/lib/app-utils.d.ts.map +1 -1
  8. package/build/lib/app-utils.js +496 -182
  9. package/build/lib/app-utils.js.map +1 -1
  10. package/build/lib/commands/app-management.d.ts +5 -4
  11. package/build/lib/commands/app-management.d.ts.map +1 -1
  12. package/build/lib/commands/app-management.js +14 -7
  13. package/build/lib/commands/app-management.js.map +1 -1
  14. package/build/lib/commands/app-strings.d.ts +5 -2
  15. package/build/lib/commands/app-strings.d.ts.map +1 -1
  16. package/build/lib/commands/app-strings.js +6 -3
  17. package/build/lib/commands/app-strings.js.map +1 -1
  18. package/build/lib/commands/file-movement.js +1 -1
  19. package/build/lib/commands/file-movement.js.map +1 -1
  20. package/build/lib/commands/types.d.ts +1 -0
  21. package/build/lib/commands/types.d.ts.map +1 -1
  22. package/build/lib/commands/xctest-record-screen.d.ts +1 -1
  23. package/build/lib/desired-caps.d.ts +2 -0
  24. package/build/lib/desired-caps.d.ts.map +1 -1
  25. package/build/lib/desired-caps.js +1 -0
  26. package/build/lib/desired-caps.js.map +1 -1
  27. package/build/lib/driver.d.ts +35 -40
  28. package/build/lib/driver.d.ts.map +1 -1
  29. package/build/lib/driver.js +15 -99
  30. package/build/lib/driver.js.map +1 -1
  31. package/build/lib/execute-method-map.d.ts +1 -1
  32. package/build/lib/execute-method-map.js +1 -1
  33. package/build/lib/execute-method-map.js.map +1 -1
  34. package/build/lib/ios-fs-helpers.d.ts +30 -15
  35. package/build/lib/ios-fs-helpers.d.ts.map +1 -1
  36. package/build/lib/ios-fs-helpers.js +54 -21
  37. package/build/lib/ios-fs-helpers.js.map +1 -1
  38. package/build/lib/real-device-management.d.ts +0 -5
  39. package/build/lib/real-device-management.d.ts.map +1 -1
  40. package/build/lib/real-device-management.js +8 -5
  41. package/build/lib/real-device-management.js.map +1 -1
  42. package/build/lib/real-device.d.ts +13 -9
  43. package/build/lib/real-device.d.ts.map +1 -1
  44. package/build/lib/real-device.js +49 -75
  45. package/build/lib/real-device.js.map +1 -1
  46. package/lib/app-infos-cache.js +159 -0
  47. package/lib/app-utils.js +529 -193
  48. package/lib/commands/app-management.js +20 -9
  49. package/lib/commands/app-strings.js +6 -3
  50. package/lib/commands/file-movement.js +1 -1
  51. package/lib/commands/types.ts +1 -0
  52. package/lib/desired-caps.js +1 -0
  53. package/lib/driver.js +17 -120
  54. package/lib/execute-method-map.ts +1 -1
  55. package/lib/ios-fs-helpers.js +57 -23
  56. package/lib/real-device-management.js +7 -5
  57. package/lib/real-device.js +62 -88
  58. package/npm-shrinkwrap.json +40 -32
  59. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [7.15.0](https://github.com/appium/appium-xcuitest-driver/compare/v7.14.0...v7.15.0) (2024-04-26)
2
+
3
+
4
+ ### Features
5
+
6
+ * Avoid unzipping of real device .ipa bundles ([#2388](https://github.com/appium/appium-xcuitest-driver/issues/2388)) ([520168a](https://github.com/appium/appium-xcuitest-driver/commit/520168aa7d8c230a44da136b9e8d21971c4ef8f8))
7
+
8
+ ## [7.14.0](https://github.com/appium/appium-xcuitest-driver/compare/v7.13.0...v7.14.0) (2024-04-23)
9
+
10
+
11
+ ### Features
12
+
13
+ * Perform bundles extraction in stream ([#2387](https://github.com/appium/appium-xcuitest-driver/issues/2387)) ([b04cebd](https://github.com/appium/appium-xcuitest-driver/commit/b04cebd99418b0e6d55d3c1813700779248e6541))
14
+
1
15
  ## [7.13.0](https://github.com/appium/appium-xcuitest-driver/compare/v7.12.0...v7.13.0) (2024-04-18)
2
16
 
3
17
 
@@ -0,0 +1,46 @@
1
+ export class AppInfosCache {
2
+ /**
3
+ * @param {import('@appium/types').AppiumLogger} log
4
+ */
5
+ constructor(log: import('@appium/types').AppiumLogger);
6
+ log: import("@appium/types").AppiumLogger;
7
+ /**
8
+ *
9
+ * @param {string} appPath
10
+ * @param {string} propertyName
11
+ * @returns {Promise<any>}
12
+ */
13
+ extractManifestProperty(appPath: string, propertyName: string): Promise<any>;
14
+ /**
15
+ *
16
+ * @param {string} appPath
17
+ * @returns {Promise<string>}
18
+ */
19
+ extractBundleId(appPath: string): Promise<string>;
20
+ /**
21
+ *
22
+ * @param {string} appPath
23
+ * @returns {Promise<string>}
24
+ */
25
+ extractBundleVersion(appPath: string): Promise<string>;
26
+ /**
27
+ *
28
+ * @param {string} appPath
29
+ * @returns {Promise<string[]>}
30
+ */
31
+ extractAppPlatforms(appPath: string): Promise<string[]>;
32
+ /**
33
+ *
34
+ * @param {string} appPath
35
+ * @returns {Promise<string>}
36
+ */
37
+ extractExecutableName(appPath: string): Promise<string>;
38
+ /**
39
+ *
40
+ * @param {string} appPath Full path to the .ipa or .app bundle
41
+ * @returns {Promise<import('@appium/types').StringRecord>} The payload of the manifest plist
42
+ * @throws {Error} If the given app is not a valid bundle
43
+ */
44
+ put(appPath: string): Promise<import('@appium/types').StringRecord>;
45
+ }
46
+ //# sourceMappingURL=app-infos-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-infos-cache.d.ts","sourceRoot":"","sources":["../../lib/app-infos-cache.js"],"names":[],"mappings":"AAcA;IACE;;OAEG;IACH,iBAFW,OAAO,eAAe,EAAE,YAAY,EAI9C;IADC,0CAAc;IAGhB;;;;;OAKG;IACH,iCAJW,MAAM,gBACN,MAAM,GACJ,QAAQ,GAAG,CAAC,CAMxB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,QAAQ,MAAM,CAAC,CAI3B;IAED;;;;OAIG;IACH,8BAHW,MAAM,GACJ,QAAQ,MAAM,CAAC,CAI3B;IAED;;;;OAIG;IACH,6BAHW,MAAM,GACJ,QAAQ,MAAM,EAAE,CAAC,CAQ7B;IAED;;;;OAIG;IACH,+BAHW,MAAM,GACJ,QAAQ,MAAM,CAAC,CAI3B;IAED;;;;;OAKG;IACH,aAJW,MAAM,GACJ,QAAQ,OAAO,eAAe,EAAE,YAAY,CAAC,CAgFzD;CACF"}
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AppInfosCache = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const support_1 = require("appium/support");
10
+ const lru_cache_1 = require("lru-cache");
11
+ const bluebird_1 = __importDefault(require("bluebird"));
12
+ /** @type {LRUCache<string, import('@appium/types').StringRecord>} */
13
+ const MANIFEST_CACHE = new lru_cache_1.LRUCache({
14
+ max: 40,
15
+ updateAgeOnHas: true,
16
+ });
17
+ const MANIFEST_FILE_NAME = 'Info.plist';
18
+ const MAX_MANIFEST_SIZE = 1024 * 1024; // 1 MiB
19
+ class AppInfosCache {
20
+ /**
21
+ * @param {import('@appium/types').AppiumLogger} log
22
+ */
23
+ constructor(log) {
24
+ this.log = log;
25
+ }
26
+ /**
27
+ *
28
+ * @param {string} appPath
29
+ * @param {string} propertyName
30
+ * @returns {Promise<any>}
31
+ */
32
+ async extractManifestProperty(appPath, propertyName) {
33
+ const result = (await this.put(appPath))[propertyName];
34
+ this.log.debug(`${propertyName}: ${JSON.stringify(result)}`);
35
+ return result;
36
+ }
37
+ /**
38
+ *
39
+ * @param {string} appPath
40
+ * @returns {Promise<string>}
41
+ */
42
+ async extractBundleId(appPath) {
43
+ return await this.extractManifestProperty(appPath, 'CFBundleIdentifier');
44
+ }
45
+ /**
46
+ *
47
+ * @param {string} appPath
48
+ * @returns {Promise<string>}
49
+ */
50
+ async extractBundleVersion(appPath) {
51
+ return await this.extractManifestProperty(appPath, 'CFBundleVersion');
52
+ }
53
+ /**
54
+ *
55
+ * @param {string} appPath
56
+ * @returns {Promise<string[]>}
57
+ */
58
+ async extractAppPlatforms(appPath) {
59
+ const result = await this.extractManifestProperty(appPath, 'CFBundleSupportedPlatforms');
60
+ if (!Array.isArray(result)) {
61
+ throw new Error(`${path_1.default.basename(appPath)}': CFBundleSupportedPlatforms is not a valid list`);
62
+ }
63
+ return result;
64
+ }
65
+ /**
66
+ *
67
+ * @param {string} appPath
68
+ * @returns {Promise<string>}
69
+ */
70
+ async extractExecutableName(appPath) {
71
+ return await this.extractManifestProperty(appPath, 'CFBundleExecutable');
72
+ }
73
+ /**
74
+ *
75
+ * @param {string} appPath Full path to the .ipa or .app bundle
76
+ * @returns {Promise<import('@appium/types').StringRecord>} The payload of the manifest plist
77
+ * @throws {Error} If the given app is not a valid bundle
78
+ */
79
+ async put(appPath) {
80
+ const readPlist = async (/** @type {string} */ plistPath) => {
81
+ try {
82
+ return await support_1.plist.parsePlistFile(plistPath);
83
+ }
84
+ catch (e) {
85
+ this.log.debug(e.stack);
86
+ throw new Error(`Cannot parse ${MANIFEST_FILE_NAME} of '${appPath}'. Is it a valid application bundle?`);
87
+ }
88
+ };
89
+ if ((await support_1.fs.stat(appPath)).isFile()) {
90
+ /** @type {import('@appium/types').StringRecord|undefined} */
91
+ let manifestPayload;
92
+ /** @type {Error|undefined} */
93
+ let lastError;
94
+ try {
95
+ await support_1.zip.readEntries(appPath, async ({ entry, extractEntryTo }) => {
96
+ if (!lodash_1.default.endsWith(entry.fileName, `.app/${MANIFEST_FILE_NAME}`)) {
97
+ return true;
98
+ }
99
+ const hash = `${entry.crc32}`;
100
+ if (MANIFEST_CACHE.has(hash)) {
101
+ manifestPayload = MANIFEST_CACHE.get(hash);
102
+ return false;
103
+ }
104
+ const tmpRoot = await support_1.tempDir.openDir();
105
+ try {
106
+ await extractEntryTo(tmpRoot);
107
+ const plistPath = path_1.default.resolve(tmpRoot, entry.fileName);
108
+ manifestPayload = await readPlist(plistPath);
109
+ if (entry.uncompressedSize <= MAX_MANIFEST_SIZE && lodash_1.default.isPlainObject(manifestPayload)) {
110
+ this.log.debug(`Caching the manifest for ${manifestPayload?.CFBundleIdentifier} app ` +
111
+ `from an archived source using the key '${hash}'`);
112
+ MANIFEST_CACHE.set(hash, manifestPayload);
113
+ }
114
+ }
115
+ catch (e) {
116
+ this.log.debug(e.stack);
117
+ lastError = e;
118
+ }
119
+ finally {
120
+ await support_1.fs.rimraf(tmpRoot);
121
+ }
122
+ return false;
123
+ });
124
+ }
125
+ catch (e) {
126
+ this.log.debug(e.stack);
127
+ throw new Error(`Cannot find ${MANIFEST_FILE_NAME} in '${appPath}'. Is it a valid application bundle?`);
128
+ }
129
+ if (!manifestPayload) {
130
+ let errorMessage = `Cannot extract ${MANIFEST_FILE_NAME} from '${appPath}'. Is it a valid application bundle?`;
131
+ if (lastError) {
132
+ errorMessage += ` Original error: ${lastError.message}`;
133
+ }
134
+ throw new Error(errorMessage);
135
+ }
136
+ return manifestPayload;
137
+ }
138
+ // appPath points to a folder
139
+ const manifestPath = path_1.default.join(appPath, MANIFEST_FILE_NAME);
140
+ const hash = await support_1.fs.hash(manifestPath);
141
+ if (MANIFEST_CACHE.has(hash)) {
142
+ return /** @type {import('@appium/types').StringRecord} */ (MANIFEST_CACHE.get(hash));
143
+ }
144
+ const [payload, stat] = await bluebird_1.default.all([
145
+ readPlist(manifestPath),
146
+ support_1.fs.stat(manifestPath),
147
+ ]);
148
+ if (stat.size <= MAX_MANIFEST_SIZE && lodash_1.default.isPlainObject(payload)) {
149
+ this.log.debug(`Caching the manifest for ${payload.CFBundleIdentifier} app from a file source using the key '${hash}'`);
150
+ MANIFEST_CACHE.set(hash, payload);
151
+ }
152
+ return payload;
153
+ }
154
+ }
155
+ exports.AppInfosCache = AppInfosCache;
156
+ //# sourceMappingURL=app-infos-cache.js.map
@@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
+ * platform where it is going to be installed and tested.
2
4
  *
3
- * @param {string} app
4
- * @returns {Promise<string>}
5
+ * @this {XCUITestDriver}
6
+ * @returns {Promise<void>}
7
+ * @throws {Error} If bundle architecture does not match the expected device architecture.
5
8
  */
6
- export function extractBundleId(app: string): Promise<string>;
9
+ export function verifyApplicationPlatform(this: import("./driver").XCUITestDriver): Promise<void>;
7
10
  /**
8
- *
9
- * @param {string} app
10
- * @returns {Promise<string>}
11
+ * @typedef {Object} LocalizableStringsOptions
12
+ * @property {string} [app]
13
+ * @property {string} [language='en']
14
+ * @property {string} [localizableStringsDir]
15
+ * @property {string} [stringFile]
16
+ * @property {boolean} [strictMode]
11
17
  */
12
- export function extractBundleVersion(app: string): Promise<string>;
13
18
  /**
19
+ * Extracts string resources from an app
14
20
  *
15
- * @param {string} app
16
- * @returns {Promise<string[]>}
21
+ * @this {XCUITestDriver}
22
+ * @param {LocalizableStringsOptions} opts
23
+ * @returns {Promise<import('@appium/types').StringRecord>}
17
24
  */
18
- export function fetchSupportedAppPlatforms(app: string): Promise<string[]>;
25
+ export function parseLocalizableStrings(this: import("./driver").XCUITestDriver, opts?: LocalizableStringsOptions): Promise<import('@appium/types').StringRecord>;
19
26
  /**
20
- * @typedef {Object} PlatformOpts
21
- *
22
- * @property {boolean} isSimulator - Whether the destination platform is a Simulator
23
- * @property {boolean} isTvOS - Whether the destination platform is a Simulator
27
+ * @typedef {Object} UnzipInfo
28
+ * @property {string} rootDir
29
+ * @property {number} archiveSize
24
30
  */
25
31
  /**
26
- * Verify whether the given application is compatible to the
27
- * platform where it is going to be installed and tested.
28
- *
29
- * @param {string} app - The actual path to the application bundle
30
- * @param {PlatformOpts} expectedPlatform
31
- * @throws {Error} If bundle architecture does not match the expected device architecture.
32
- */
33
- export function verifyApplicationPlatform(app: string, expectedPlatform: PlatformOpts): Promise<void>;
34
- export function parseLocalizableStrings(opts: any): Promise<{}>;
35
- /**
36
- * Check whether the given path on the file system points to the .app bundle root
37
- *
38
- * @param {string} appPath Possible .app bundle root
39
- * @returns {Promise<boolean>} Whether the given path points to an .app bundle
40
- */
41
- export function isAppBundle(appPath: string): Promise<boolean>;
42
- /**
43
- * Extract the given archive and looks for items with given extensions in it
32
+ * Unzips a ZIP archive on the local file system.
44
33
  *
45
34
  * @param {string} archivePath Full path to a .zip archive
46
- * @param {Array<string>} appExtensions List of matching item extensions
47
- * @returns {Promise<[string, string[]]>} Tuple, where the first element points to
48
- * a temporary folder root where the archive has been extracted and the second item
49
- * contains a list of relative paths to matched items
35
+ * @returns {Promise<UnzipInfo>} temporary folder root where the archive has been extracted
50
36
  */
51
- export function findApps(archivePath: string, appExtensions: Array<string>): Promise<[string, string[]]>;
37
+ export function unzipFile(archivePath: string): Promise<UnzipInfo>;
52
38
  /**
53
- * Moves the application bundle to a newly created temporary folder
39
+ * Unzips a ZIP archive from a stream.
40
+ * Uses bdstar tool for this purpose.
41
+ * This allows to optimize the time needed to prepare the app under test
42
+ * to MAX(download, unzip) instead of SUM(download, unzip)
54
43
  *
55
- * @param {string} appRoot Full path to the .app bundle
56
- * @returns {Promise<string>} The new path to the app bundle.
57
- * The name of the app bundle remains though
44
+ * @param {import('node:stream').Readable} zipStream
45
+ * @returns {Promise<UnzipInfo>}
58
46
  */
59
- export function isolateAppBundle(appRoot: string): Promise<string>;
47
+ export function unzipStream(zipStream: import('node:stream').Readable): Promise<UnzipInfo>;
60
48
  /**
61
49
  * Builds Safari preferences object based on the given session capabilities
62
50
  *
@@ -64,17 +52,38 @@ export function isolateAppBundle(appRoot: string): Promise<string>;
64
52
  * @return {Promise<import('@appium/types').StringRecord>}
65
53
  */
66
54
  export function buildSafariPreferences(opts: import('./driver').XCUITestDriverOpts): Promise<import('@appium/types').StringRecord>;
55
+ /**
56
+ * The callback invoked by configureApp helper
57
+ * when it is necessary to download the remote application.
58
+ * We assume the remote file could be anythingm, but only
59
+ * .zip and .ipa formats are supported.
60
+ * A .zip archive can contain one or more
61
+ *
62
+ * @this {XCUITestDriver}
63
+ * @param {import('@appium/types').DownloadAppOptions} opts
64
+ * @returns {Promise<string>}
65
+ */
66
+ export function onDownloadApp(this: import("./driver").XCUITestDriver, { stream, headers }: import('@appium/types').DownloadAppOptions): Promise<string>;
67
+ /**
68
+ * @this {XCUITestDriver}
69
+ * @param {import('@appium/types').PostProcessOptions} opts
70
+ * @returns {Promise<import('@appium/types').PostProcessResult|false>}
71
+ */
72
+ export function onPostConfigureApp(this: import("./driver").XCUITestDriver, { cachedAppInfo, isUrl, appPath }: import('@appium/types').PostProcessOptions): Promise<import('@appium/types').PostProcessResult | false>;
67
73
  export const SAFARI_BUNDLE_ID: "com.apple.mobilesafari";
68
74
  export const APP_EXT: ".app";
69
75
  export const IPA_EXT: ".ipa";
70
- export type PlatformOpts = {
71
- /**
72
- * - Whether the destination platform is a Simulator
73
- */
74
- isSimulator: boolean;
75
- /**
76
- * - Whether the destination platform is a Simulator
77
- */
78
- isTvOS: boolean;
76
+ export const SUPPORTED_EXTENSIONS: string[];
77
+ export type LocalizableStringsOptions = {
78
+ app?: string | undefined;
79
+ language?: string | undefined;
80
+ localizableStringsDir?: string | undefined;
81
+ stringFile?: string | undefined;
82
+ strictMode?: boolean | undefined;
83
+ };
84
+ export type UnzipInfo = {
85
+ rootDir: string;
86
+ archiveSize: number;
79
87
  };
88
+ export type XCUITestDriver = import('./driver').XCUITestDriver;
80
89
  //# sourceMappingURL=app-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-utils.d.ts","sourceRoot":"","sources":["../../lib/app-utils.js"],"names":[],"mappings":"AAsDA;;;;GAIG;AACH,qCAHW,MAAM,GACJ,QAAQ,MAAM,CAAC,CAM3B;AAED;;;;GAIG;AACH,0CAHW,MAAM,GACJ,QAAQ,MAAM,CAAC,CAI3B;AAWD;;;;GAIG;AACH,gDAHW,MAAM,GACJ,QAAQ,MAAM,EAAE,CAAC,CAgB7B;AAED;;;;;GAKG;AAEH;;;;;;;GAOG;AACH,+CAJW,MAAM,oBACN,YAA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