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

feat: add disableSuppressAccessibilityService #376

Merged
merged 9 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from 5 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
3 changes: 3 additions & 0 deletions lib/desired-caps.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ let uiautomatorCapConstraints = {
},
appWaitForLaunch: {
isBoolean: true
},
disableSuppressAccessibilityService: {
isBoolean: true
}
};

Expand Down
1 change: 1 addition & 0 deletions lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ class AndroidUiautomator2Driver extends BaseDriver {
appPackage: this.opts.appPackage,
appActivity: this.opts.appActivity,
disableWindowAnimation: !!this.opts.disableWindowAnimation,
disableSuppressAccessibilityService: this.opts.disableSuppressAccessibilityService,
});
this.proxyReqRes = this.uiautomator2.proxyReqRes.bind(this.uiautomator2);

Expand Down
4 changes: 4 additions & 0 deletions lib/uiautomator2.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class UiAutomator2Server {
}
this[req] = opts[req];
}
this.disableSuppressAccessibilityService = opts.disableSuppressAccessibilityService;
this.jwproxy = new JWProxy({
server: this.host,
port: this.systemPort,
Expand Down Expand Up @@ -252,6 +253,9 @@ class UiAutomator2Server {
if (this.disableWindowAnimation) {
cmd.push('--no-window-animation');
}
if (_.isBoolean(this.disableSuppressAccessibilityService)) {
cmd.push(`-e DISABLE_SUPPRESS_ACCESSIBILITY_SERVICES ${this.disableSuppressAccessibilityService}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

should it look like cmd.push('-e', 'DISABLE_SUPPRESS_ACCESSIBILITY_SERVICES', `${this.disableSuppressAccessibilityService}`) ?

}
cmd.push(INSTRUMENTATION_TARGET);
const instrumentationProcess = this.adb.createSubProcess(['shell', ...cmd]);
instrumentationProcess.on('output', (stdout, stderr) => {
Expand Down
8 changes: 7 additions & 1 deletion test/unit/driver-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,13 @@ describe('driver.js', function () {
sandbox.stub(driver, 'addDeviceInfoToCaps');

driver.uiautomator2 = new UiAutomator2Server({
adb: ADB.createADB(), tmpDir: 'tmp', systemPort: 4724, host: 'localhost', devicePort: 6790, disableWindowAnimation: false
adb: ADB.createADB(),
tmpDir: 'tmp',
systemPort: 4724,
host: 'localhost',
devicePort: 6790,
disableWindowAnimation: false,
disableSuppressAccessibilityService: false,
});
sandbox.stub(driver.uiautomator2, 'startSession');
});
Expand Down
9 changes: 7 additions & 2 deletions test/unit/uiautomator2-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ describe('UiAutomator2', function () {
let uiautomator2;
beforeEach(function () {
uiautomator2 = new UiAutomator2Server({
adb, tmpDir: 'tmp', systemPort: 4724,
host: 'localhost', devicePort: 6790, disableWindowAnimation: false
adb,
tmpDir: 'tmp',
systemPort: 4724,
host: 'localhost',
devicePort: 6790,
disableWindowAnimation: false,
disableSuppressAccessibilityService: false
});
});
afterEach(function () {
Expand Down