uiautomatorwd
Advanced tools
Comparing version 1.0.45 to 1.0.46
@@ -17,5 +17,5 @@ # Contributing to UIAutomatorWD | ||
``` shell | ||
``` bash | ||
$ adb forward tcp:9001 tcp:9001 | ||
$ curl -l -H "Content-type: application/json" -X POST -d '{"value": "//*[@resource-id=\"android:id/tabs\"]/android.widget.LinearLayout[2]/android.widget.ImageView[1]","using":"xpath"}' http://localhost:9001/wd/hub/session/xxxxxxxx/element/1/click | ||
``` |
@@ -28,3 +28,3 @@ 'use strict'; | ||
_.waitForCondition = function(func, wait/*ms*/, interval/*ms*/) { | ||
_.waitForCondition = function(func, wait, interval) { | ||
wait = wait || 5000; | ||
@@ -48,3 +48,3 @@ interval = interval || 500; | ||
if (!!isOk) { | ||
if (isOk) { | ||
resolve(); | ||
@@ -51,0 +51,0 @@ } else { |
@@ -68,3 +68,3 @@ 'use strict'; | ||
if (!body) { | ||
logger.debug(`UIAutomatorWD client proxy received no data.`); | ||
logger.debug('UIAutomatorWD client proxy received no data.'); | ||
return _reject('No data received from UIAutomatorWD Server.'); | ||
@@ -71,0 +71,0 @@ } |
'use strict'; | ||
const detectPort = require('detect-port'); | ||
const _ = require('./helper'); | ||
const logger = require('./logger'); | ||
@@ -9,2 +8,4 @@ const WDProxy = require('./proxy'); | ||
const detectPort = _.detectPort; | ||
function UIAutomator(options) { | ||
@@ -20,4 +21,5 @@ this.adb = null; | ||
UIAutomator.prototype.init = function *(adb) { | ||
UIAutomator.prototype.init = function *(adb, permissionPatterns) { | ||
this.adb = adb; | ||
this.permissionPatterns = permissionPatterns; | ||
this.proxyPort = yield detectPort(this.proxyPort); | ||
@@ -31,3 +33,2 @@ this.initProxy(); | ||
} catch (e) { | ||
/// the packages may not be installed yet | ||
logger.warn(e.stack); | ||
@@ -54,3 +55,3 @@ } | ||
return new Promise(resolve => { | ||
let args = `shell am instrument -w -r -e port ${this.proxyPort} -e class ${UIAUTOMATORWD.PACKAGE_NAME} ${UIAUTOMATORWD.TEST_PACKAGE}.test/${UIAUTOMATORWD.RUNNER_CLASS}`.split(' '); | ||
let args = `shell am instrument -w -r -e permissionPattern ${this.permissionPatterns} -e port ${this.proxyPort} -e class ${UIAUTOMATORWD.PACKAGE_NAME} ${UIAUTOMATORWD.TEST_PACKAGE}.test/${UIAUTOMATORWD.RUNNER_CLASS}`.split(' '); | ||
@@ -57,0 +58,0 @@ var proc = this.adb.spawn(args, { |
{ | ||
"name": "uiautomatorwd", | ||
"version": "1.0.45", | ||
"version": "1.0.46", | ||
"description": "Node.js wrapper for UIAutomator2", | ||
@@ -15,3 +15,2 @@ "keywords": [ | ||
"dependencies": { | ||
"detect-port": "^1.1.4", | ||
"gradle": "^1.0.1", | ||
@@ -24,16 +23,16 @@ "macaca-adb": "~1.0.2", | ||
"devDependencies": { | ||
"co-mocha": "~1.1.2", | ||
"eslint": "^4.13.1", | ||
"eslint-plugin-mocha": "^4.11.0", | ||
"istanbul": "*", | ||
"jshint": "*", | ||
"mocha": "*", | ||
"pre-commit": "*", | ||
"should": "^8.0.2" | ||
"pre-commit": "*" | ||
}, | ||
"scripts": { | ||
"test": "make test", | ||
"jshint": "make jshint", | ||
"test": "istanbul cover `npm bin`/_mocha", | ||
"lint": "eslint --fix lib test", | ||
"ci": "npm run lint && npm run test", | ||
"install": "node ./scripts/build.js" | ||
}, | ||
"pre-commit": [ | ||
"jshint" | ||
"lint" | ||
], | ||
@@ -40,0 +39,0 @@ "homepage": "https://github.com/macacajs/uiautomatorwd", |
@@ -14,3 +14,3 @@ # UIAutomatorWD | ||
[travis-url]: https://travis-ci.org/macacajs/UIAutomatorWD | ||
[node-image]: https://img.shields.io/badge/node.js-%3E=_6-green.svg?style=flat-square | ||
[node-image]: https://img.shields.io/badge/node.js-%3E=_8-green.svg?style=flat-square | ||
[node-url]: http://nodejs.org/download/ | ||
@@ -22,3 +22,3 @@ [download-image]: https://img.shields.io/npm/dm/uiautomatorwd.svg?style=flat-square | ||
``` bash | ||
```bash | ||
$ npm i uiautomatorwd --save | ||
@@ -29,4 +29,8 @@ ``` | ||
## Development | ||
- [CONTRIBUTING.md](./CONTRIBUTING.md) | ||
## License | ||
The MIT License (MIT) |
@@ -10,3 +10,6 @@ #!/usr/bin/env node | ||
var args = ['assembleDebug', 'assembleDebugAndroidTest']; | ||
var args = [ | ||
'assembleDebug', | ||
'assembleDebugAndroidTest' | ||
]; | ||
@@ -13,0 +16,0 @@ args.push(`-PmavenMirrorUrl=${process.env.MAVEN_MIRROR_URL || ''}`); |
'use strict'; | ||
require('should'); | ||
const _ = require('xutil'); | ||
//const ADB = require('macaca-adb'); | ||
const assert = require('assert'); | ||
@@ -11,10 +10,5 @@ const UIAutomator = require('..'); | ||
var client = new UIAutomator(); | ||
it('should be ok', function() { | ||
client.should.be.ok(); | ||
if (!_.isExistedFile(UIAutomator.UIAUTOMATORWD.APK_BUILD_PATH)) { | ||
throw 'apk file build failed'; | ||
} | ||
assert(_.isExistedFile(UIAutomator.UIAUTOMATORWD.APK_BUILD_PATH), true); | ||
/* | ||
@@ -21,0 +15,0 @@ var adb = new ADB(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
230099
5
5
3195
34
2
- Removeddetect-port@^1.1.4