Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new json source extension #2506

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/commands/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ const commands = {

const {
pageSourceExcludedAttributes: excludedAttributes,
useJSONSource
useJSONSource,
useNewJSONSource,
} = await this.settings.getSettings();
const hasExcludedAttributes = _.isString(excludedAttributes) && !_.isEmpty(excludedAttributes);
if (useJSONSource) {
if (useNewJSONSource) {
const srcTree = await this.mobileGetSource('newJson');
return getSourceXml(getTreeForXML(srcTree));
}
else if (useJSONSource) {
const srcTree = await this.mobileGetSource('json', hasExcludedAttributes ? excludedAttributes : undefined);
return getSourceXml(getTreeForXML(srcTree));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export interface View {
* one to fetch.
* - `json`: Similar to `xml`, but the tree hierarchy is represented as JSON elements.
*/
export type SourceFormat = 'xml' | 'json' | 'description';
export type SourceFormat = 'xml' | 'json' | 'description' | 'newJson';

/** @deprecated */
export type AppInstallStrategy = 'serial' | 'parallel' | 'ios-deploy';
Expand Down
3 changes: 3 additions & 0 deletions lib/desired-caps.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ const desiredCapConstraints = /** @type {const} */ ({
useJSONSource: {
isBoolean: true,
},
useNewJSONSource: {
isBoolean: true,
},
enforceFreshSimulatorCreation: {
isBoolean: true,
},
Expand Down
5 changes: 5 additions & 0 deletions lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const DEFAULT_SETTINGS = {
nativeWebTap: false,
nativeWebTapStrict: false,
useJSONSource: false,
useNewJSONSource: true,
webScreenshotMode: 'native',
shouldUseCompactResponses: true,
elementResponseAttributes: 'type,label',
Expand Down Expand Up @@ -438,6 +439,10 @@ export class XCUITestDriver extends BaseDriver {
if (_.has(this.opts, 'nativeWebTapStrict')) {
await this.updateSettings({nativeWebTapStrict: this.opts.nativeWebTapStrict});
}
// ensure we track useNewJSONSource capability as a setting as well
if (_.has(this.opts, 'useNewJSONSource')) {
await this.updateSettings({useNewJSONSource: this.opts.useNewJSONSource});
}
// ensure we track useJSONSource capability as a setting as well
if (_.has(this.opts, 'useJSONSource')) {
await this.updateSettings({useJSONSource: this.opts.useJSONSource});
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"npm": ">=8"
},
"appium": {
"driverName": "xcuitest",
"automationName": "XCUITest",
"driverName": "xcuitestdriver",
"automationName": "XCUITestDriver",
"platformNames": [
"iOS",
"tvOS"
Expand Down Expand Up @@ -81,7 +81,7 @@
"appium-ios-device": "^2.7.23",
"appium-ios-simulator": "^6.1.7",
"appium-remote-debugger": "^12.1.1",
"appium-webdriveragent": "^8.12.0",
"appium-webdriveragent": "github:qa-pilot/WebDriverAgent#master",
"appium-xcode": "^5.1.4",
"async-lock": "^1.4.0",
"asyncbox": "^3.0.0",
Expand Down
Loading