Skip to content
Merged
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ Differences noted here
|`reduceMotion`| It allows to turn on/off reduce motion accessibility preference. Setting reduceMotion `on` helps to reduce flakiness during tests. Only fon simulators | e.g `true` |
|`permissions`| Allows to set permissions for the specified application bundle on Simulator only. The capability value is expected to be a valid JSON string with `{"<bundleId1>": {"<serviceName1>": "<serviceStatus1>", ...}, ...}` format. It is required that `applesimutils` package is installed and available in PATH. The list of available service names and statuses can be found at https://github.com/wix/AppleSimulatorUtils. | e. g. `{"com.apple.mobilecal": {"calendar": "YES"}}` |
|`screenshotQuality`| Changes the quality of phone display screenshots following [xctest/xctimagequality](https://developer.apple.com/documentation/xctest/xctimagequality?language=objc) Default value is `1`. `0` is the highest and `2` is the lowest quality. You can also change it via [settings](https://github.com/appium/appium/blob/master/docs/en/advanced-concepts/settings.md) command. `0` might cause OutOfMemory crash on high-resolution devices like iPad Pro. | e.g. `0`, `1`, `2` |
|`skipLogCapture`|Skips to start capturing logs such as crash, system, safari console and safari network. It might improve performance such as network. Log related commands will not work. Defaults to `false`. |`true` or `false`|

## Development<a id="development"></a>

Expand Down
3 changes: 3 additions & 0 deletions lib/desired-caps.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ let desiredCapConstraints = _.defaults({
screenshotQuality: {
isNumber: true
},
skipLogCapture: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary if the desired capability is specified in appium-ios-driver.

Copy link
Member Author

@KazuCocoa KazuCocoa Feb 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove here after appium-boneyard/appium-ios-driver#355 and publish new version.
(In this PR or as another PR)

isBoolean: true
},
}, iosDesiredCapConstraints);

export { desiredCapConstraints };
Expand Down
9 changes: 9 additions & 0 deletions lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class XCUITestDriver extends BaseDriver {
];
this.resetIos();
this.settings = new DeviceSettings(DEFAULT_SETTINGS, this.onSettingsUpdate.bind(this));
this.logs = {};

// memoize functions here, so that they are done on a per-instance basis
for (const fn of MEMOIZED_FUNCTIONS) {
Expand Down Expand Up @@ -333,7 +334,15 @@ class XCUITestDriver extends BaseDriver {

await this.runReset();

const memoizedLogInfo = _.memoize(function () {
log.info("'skipLogCapture' is set. Skipping starting logs such as crash, system, safari console and safari network.");
});
const startLogCapture = async () => {
if (this.opts.skipLogCapture) {
memoizedLogInfo();
return false;
}

const result = await this.startLogCapture();
if (result) {
this.logEvent('logCaptureStarted');
Expand Down
17 changes: 17 additions & 0 deletions test/unit/driver-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,23 @@ describe('driver commands', function () {
const resCaps = await driver.createSession(caps);
resCaps[1].javascriptEnabled.should.be.true;
});

it('should call startLogCapture', async function () {
const c = { ... caps };
Object.assign(c, {skipLogCapture: false});
this.timeout(MOCHA_LONG_TIMEOUT);
const resCaps = await driver.createSession(c);
resCaps[1].javascriptEnabled.should.be.true;
driver.startLogCapture.called.should.be.true;
});
it('should not call startLogCapture', async function () {
const c = { ... caps };
Object.assign(c, {skipLogCapture: true});
this.timeout(MOCHA_LONG_TIMEOUT);
const resCaps = await driver.createSession(c);
resCaps[1].javascriptEnabled.should.be.true;
driver.startLogCapture.called.should.be.false;
});
});

describe('startIWDP()', function () {
Expand Down