appium-adb
Advanced tools
Comparing version 2.3.1 to 2.4.0
@@ -121,2 +121,23 @@ import log from '../logger.js'; | ||
methods.inputText = async function (text) { | ||
/* jshint ignore:start */ | ||
// need to escape whitespace and ( ) < > | ; & * \ ~ " ' | ||
text = text | ||
.replace('\\', '\\\\') | ||
.replace('(', '\(') | ||
.replace(')', '\)') | ||
.replace('<', '\<') | ||
.replace('>', '\>') | ||
.replace('|', '\|') | ||
.replace(';', '\;') | ||
.replace('&', '\&') | ||
.replace('*', '\*') | ||
.replace('~', '\~') | ||
.replace('"', '\"') | ||
.replace("'", "\'") | ||
.replace(' ', '%s'); | ||
/* jshint ignore:end */ | ||
await this.shell(['input', 'text', `'${text}'`]); | ||
}; | ||
methods.lock = async function () { | ||
@@ -347,3 +368,3 @@ let locked = await this.isScreenLocked(); | ||
await this.restartAdb(); | ||
await this.waitForDevice(); | ||
await this.waitForDevice(60); | ||
await this.startLogcat(); | ||
@@ -350,0 +371,0 @@ } catch (e) { |
{ | ||
"name": "appium-adb", | ||
"version": "2.3.1", | ||
"version": "2.4.0", | ||
"description": "Android Debug Bridge interface", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
@@ -116,2 +116,13 @@ import chai from 'chai'; | ||
})); | ||
describe('inputText', withMocks({adb}, (mocks) => { | ||
it('should call shell with correct args', async () => { | ||
let text = 'some text'; | ||
let expectedText = 'some%stext'; | ||
mocks.adb.expects("shell") | ||
.once().withExactArgs(['input', 'text', `'${expectedText}'`]) | ||
.returns(""); | ||
await adb.inputText(text); | ||
mocks.adb.verify(); | ||
}); | ||
})); | ||
describe('lock', withMocks({adb, log}, (mocks) => { | ||
@@ -118,0 +129,0 @@ it('should call isScreenLocked, keyevent and errorAndThrow', async () => { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22232537
10953
4
7