appium-webdriveragent 11.0.2 → 11.1.1
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 +12 -0
- package/WebDriverAgent.xcodeproj/project.pbxproj +15 -3
- package/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m +1 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBCustomActions.h +27 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBCustomActions.m +127 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBWebDriverAttributes.m +6 -0
- package/WebDriverAgentLib/Commands/FBSessionCommands.m +4 -0
- package/WebDriverAgentLib/Info.plist +2 -2
- package/WebDriverAgentLib/Routing/FBElement.h +3 -0
- package/WebDriverAgentLib/Utilities/FBConfiguration.h +11 -0
- package/WebDriverAgentLib/Utilities/FBConfiguration.m +11 -0
- package/WebDriverAgentLib/Utilities/FBSettings.h +1 -0
- package/WebDriverAgentLib/Utilities/FBSettings.m +1 -0
- package/WebDriverAgentLib/Utilities/FBXPath.m +23 -0
- package/WebDriverAgentLib/Utilities/XCTestPrivateSymbols.h +4 -0
- package/WebDriverAgentLib/Utilities/XCTestPrivateSymbols.m +15 -4
- package/WebDriverAgentTests/IntegrationApp/Classes/ViewController.m +22 -0
- package/WebDriverAgentTests/IntegrationApp/Resources/Base.lproj/Main.storyboard +43 -40
- package/WebDriverAgentTests/IntegrationTests/FBElementAttributeTests.m +10 -0
- package/WebDriverAgentTests/UnitTests/Doubles/XCElementSnapshotDouble.h +1 -0
- package/WebDriverAgentTests/UnitTests/Doubles/XCElementSnapshotDouble.m +1 -5
- package/WebDriverAgentTests/UnitTests/Doubles/XCUIElementDouble.h +1 -0
- package/WebDriverAgentTests/UnitTests/Doubles/XCUIElementDouble.m +1 -0
- package/WebDriverAgentTests/UnitTests/FBXPathTests.m +6 -3
- package/WebDriverAgentTests/UnitTests_tvOS/Doubles/XCUIElementDouble.h +1 -0
- package/WebDriverAgentTests/UnitTests_tvOS/Doubles/XCUIElementDouble.m +1 -0
- package/build/lib/utils.d.ts +0 -12
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +0 -51
- package/build/lib/utils.js.map +1 -1
- package/build/lib/webdriveragent.d.ts.map +1 -1
- package/build/lib/webdriveragent.js +0 -1
- package/build/lib/webdriveragent.js.map +1 -1
- package/build/lib/xcodebuild.d.ts +1 -6
- package/build/lib/xcodebuild.d.ts.map +1 -1
- package/build/lib/xcodebuild.js +5 -24
- package/build/lib/xcodebuild.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/lib/utils.ts +1 -52
- package/lib/webdriveragent.ts +0 -1
- package/lib/xcodebuild.ts +6 -28
- package/package.json +1 -1
package/lib/utils.ts
CHANGED
|
@@ -4,15 +4,13 @@ import path, { dirname } from 'node:path';
|
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { log } from './logger';
|
|
6
6
|
import _ from 'lodash';
|
|
7
|
-
import {
|
|
7
|
+
import { PLATFORM_NAME_TVOS } from './constants';
|
|
8
8
|
import B from 'bluebird';
|
|
9
9
|
import _fs from 'node:fs';
|
|
10
10
|
import { waitForCondition } from 'asyncbox';
|
|
11
11
|
import { arch } from 'node:os';
|
|
12
12
|
import type { DeviceInfo } from './types';
|
|
13
13
|
|
|
14
|
-
const PROJECT_FILE = 'project.pbxproj';
|
|
15
|
-
|
|
16
14
|
// Get current filename - works in both CommonJS and ESM
|
|
17
15
|
const currentFilename =
|
|
18
16
|
typeof __filename !== 'undefined'
|
|
@@ -94,47 +92,6 @@ export function isTvOS (platformName: string): boolean {
|
|
|
94
92
|
return _.toLower(platformName) === _.toLower(PLATFORM_NAME_TVOS);
|
|
95
93
|
}
|
|
96
94
|
|
|
97
|
-
/**
|
|
98
|
-
* Update WebDriverAgentRunner project bundle ID with newBundleId.
|
|
99
|
-
* This method assumes project file is in the correct state.
|
|
100
|
-
* @param agentPath - Path to the .xcodeproj directory.
|
|
101
|
-
* @param newBundleId the new bundle ID used to update.
|
|
102
|
-
*/
|
|
103
|
-
export async function updateProjectFile (agentPath: string, newBundleId: string): Promise<void> {
|
|
104
|
-
const projectFilePath = path.resolve(agentPath, PROJECT_FILE);
|
|
105
|
-
try {
|
|
106
|
-
// Assuming projectFilePath is in the correct state, create .old from projectFilePath
|
|
107
|
-
await fs.copyFile(projectFilePath, `${projectFilePath}.old`);
|
|
108
|
-
await replaceInFile(projectFilePath, new RegExp(_.escapeRegExp(WDA_RUNNER_BUNDLE_ID), 'g'), newBundleId);
|
|
109
|
-
log.debug(`Successfully updated '${projectFilePath}' with bundle id '${newBundleId}'`);
|
|
110
|
-
} catch (err: any) {
|
|
111
|
-
log.debug(`Error updating project file: ${err.message}`);
|
|
112
|
-
log.warn(`Unable to update project file '${projectFilePath}' with ` +
|
|
113
|
-
`bundle id '${newBundleId}'. WebDriverAgent may not start`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Reset WebDriverAgentRunner project bundle ID to correct state.
|
|
119
|
-
* @param agentPath - Path to the .xcodeproj directory.
|
|
120
|
-
*/
|
|
121
|
-
export async function resetProjectFile (agentPath: string): Promise<void> {
|
|
122
|
-
const projectFilePath = path.join(agentPath, PROJECT_FILE);
|
|
123
|
-
try {
|
|
124
|
-
// restore projectFilePath from .old file
|
|
125
|
-
if (!await fs.exists(`${projectFilePath}.old`)) {
|
|
126
|
-
return; // no need to reset
|
|
127
|
-
}
|
|
128
|
-
await fs.mv(`${projectFilePath}.old`, projectFilePath);
|
|
129
|
-
log.debug(`Successfully reset '${projectFilePath}' with bundle id '${WDA_RUNNER_BUNDLE_ID}'`);
|
|
130
|
-
} catch (err: any) {
|
|
131
|
-
log.debug(`Error resetting project file: ${err.message}`);
|
|
132
|
-
log.warn(`Unable to reset project file '${projectFilePath}' with ` +
|
|
133
|
-
`bundle id '${WDA_RUNNER_BUNDLE_ID}'. WebDriverAgent has been ` +
|
|
134
|
-
`modified and not returned to the original state.`);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
95
|
export async function setRealDeviceSecurity (keychainPath: string, keychainPassword: string): Promise<void> {
|
|
139
96
|
log.debug('Setting security for iOS device');
|
|
140
97
|
await exec('security', ['-v', 'list-keychains', '-s', keychainPath]);
|
|
@@ -382,12 +339,4 @@ async function getPIDsUsingPattern (pattern: string): Promise<string[]> {
|
|
|
382
339
|
}
|
|
383
340
|
}
|
|
384
341
|
|
|
385
|
-
async function replaceInFile (file: string, find: string | RegExp, replace: string): Promise<void> {
|
|
386
|
-
const contents = await fs.readFile(file, 'utf8');
|
|
387
|
-
|
|
388
|
-
const newContents = contents.replace(find, replace);
|
|
389
|
-
if (newContents !== contents) {
|
|
390
|
-
await fs.writeFile(file, newContents, 'utf8');
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
342
|
|
package/lib/webdriveragent.ts
CHANGED
|
@@ -355,7 +355,6 @@ export class WebDriverAgent {
|
|
|
355
355
|
this.log.info('Shutting down sub-processes');
|
|
356
356
|
if (this._xcodebuild) {
|
|
357
357
|
await this.xcodebuild.quit();
|
|
358
|
-
await this.xcodebuild.reset();
|
|
359
358
|
}
|
|
360
359
|
} else {
|
|
361
360
|
this.log.debug('Do not stop xcodebuild nor XCTest session ' +
|
package/lib/xcodebuild.ts
CHANGED
|
@@ -6,8 +6,7 @@ import { log as defaultLogger } from './logger';
|
|
|
6
6
|
import B from 'bluebird';
|
|
7
7
|
import {
|
|
8
8
|
setRealDeviceSecurity, setXctestrunFile,
|
|
9
|
-
|
|
10
|
-
getWDAUpgradeTimestamp, isTvOS
|
|
9
|
+
killProcess, getWDAUpgradeTimestamp, isTvOS
|
|
11
10
|
} from './utils';
|
|
12
11
|
import _ from 'lodash';
|
|
13
12
|
import path from 'path';
|
|
@@ -135,7 +134,7 @@ export class XcodeBuild {
|
|
|
135
134
|
|
|
136
135
|
/**
|
|
137
136
|
* Initializes the XcodeBuild instance with a no-session proxy.
|
|
138
|
-
* Sets up xctestrun file if needed
|
|
137
|
+
* Sets up xctestrun file if needed.
|
|
139
138
|
* @param noSessionProxy - The proxy instance for WDA communication
|
|
140
139
|
*/
|
|
141
140
|
async init (noSessionProxy: NoSessionProxy): Promise<void> {
|
|
@@ -157,19 +156,6 @@ export class XcodeBuild {
|
|
|
157
156
|
});
|
|
158
157
|
return;
|
|
159
158
|
}
|
|
160
|
-
|
|
161
|
-
// if necessary, update the bundleId to user's specification
|
|
162
|
-
if (this.realDevice) {
|
|
163
|
-
// In case the project still has the user specific bundle ID, reset the project file first.
|
|
164
|
-
// - We do this reset even if updatedWDABundleId is not specified,
|
|
165
|
-
// since the previous updatedWDABundleId test has generated the user specific bundle ID project file.
|
|
166
|
-
// - We don't call resetProjectFile for simulator,
|
|
167
|
-
// since simulator test run will work with any user specific bundle ID.
|
|
168
|
-
await resetProjectFile(this.agentPath);
|
|
169
|
-
if (this.updatedWDABundleId) {
|
|
170
|
-
await updateProjectFile(this.agentPath, this.updatedWDABundleId);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
159
|
}
|
|
174
160
|
|
|
175
161
|
/**
|
|
@@ -211,17 +197,6 @@ export class XcodeBuild {
|
|
|
211
197
|
return await this._derivedDataPathPromise;
|
|
212
198
|
}
|
|
213
199
|
|
|
214
|
-
/**
|
|
215
|
-
* Resets the project file to its original state.
|
|
216
|
-
* Restores the bundle ID to the original value for real devices if it was modified.
|
|
217
|
-
*/
|
|
218
|
-
async reset (): Promise<void> {
|
|
219
|
-
// if necessary, reset the bundleId to original value
|
|
220
|
-
if (this.realDevice && this.updatedWDABundleId) {
|
|
221
|
-
await resetProjectFile(this.agentPath);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
200
|
/**
|
|
226
201
|
* Pre-builds WebDriverAgent before launching tests.
|
|
227
202
|
* Performs a build-only operation and sets usePrebuiltWDA flag.
|
|
@@ -360,7 +335,7 @@ export class XcodeBuild {
|
|
|
360
335
|
}
|
|
361
336
|
args.push('-destination', `id=${this.device.udid}`);
|
|
362
337
|
|
|
363
|
-
let versionMatch;
|
|
338
|
+
let versionMatch: RegExpMatchArray | null = null;
|
|
364
339
|
if (this.platformVersion && (versionMatch = new RegExp(/^(\d+)\.(\d+)/).exec(this.platformVersion))) {
|
|
365
340
|
args.push(
|
|
366
341
|
`${isTvOS(this.platformName || '') ? 'TV' : 'IPHONE'}OS_DEPLOYMENT_TARGET=${versionMatch[1]}.${versionMatch[2]}`
|
|
@@ -383,6 +358,9 @@ export class XcodeBuild {
|
|
|
383
358
|
`CODE_SIGN_IDENTITY=${this.xcodeSigningId}`,
|
|
384
359
|
);
|
|
385
360
|
}
|
|
361
|
+
if (this.updatedWDABundleId) {
|
|
362
|
+
args.push(`PRODUCT_BUNDLE_IDENTIFIER=${this.updatedWDABundleId}`);
|
|
363
|
+
}
|
|
386
364
|
}
|
|
387
365
|
|
|
388
366
|
if (!process.env.APPIUM_XCUITEST_TREAT_WARNINGS_AS_ERRORS) {
|