diff --git a/Makefile b/Makefile index 158a509..42dc83e 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ git_version = $$(git branch 2>/dev/null | sed -e '/^[^*]/d'-e's/* \(.*\)/\1/') npm_bin= $$(npm bin) +custom_port = `${npm_bin}/detect-port 3458 -s` all: test install: @@ -55,5 +56,9 @@ custom-reporter: npm install macaca-simple-reportor --save-dev macaca doctor CUSTOM_DIR=macaca-logs/desktop-browser-sample macaca run --verbose --reporter macaca-simple-reportor -d ./macaca-test/desktop-browser-sample.test.js +custom-port: + #npm install macaca-electron --save-dev + ${npm_bin}/macaca doctor + MACACA_SERVER_PORT=${custom_port} browser=electron ${npm_bin}/macaca run --no-window --verbose -d ./macaca-test/desktop-browser-sample.test.js -p ${custom_port} .PHONY: test-pc diff --git a/macaca-test/desktop-browser-sample.test.js b/macaca-test/desktop-browser-sample.test.js index 274a2bb..29b89f1 100644 --- a/macaca-test/desktop-browser-sample.test.js +++ b/macaca-test/desktop-browser-sample.test.js @@ -6,6 +6,8 @@ const wd = require('macaca-wd'); const diffImage = require('./utils.js').diffImage; + + var browser = process.env.browser || 'electron'; browser = browser.toLowerCase(); @@ -14,7 +16,7 @@ describe('macaca desktop sample', function() { var driver = wd.promiseChainRemote({ host: 'localhost', - port: 3456 + port: process.env.MACACA_SERVER_PORT || 3456 }); before(() => { diff --git a/package.json b/package.json index 5a4f1b1..80ef49b 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ }, "devDependencies": { "blink-diff": "^1.0.13", + "detect-port": "^1.1.4", "macaca-cli": "^2.0.0", "macaca-simple-reportor": "^1.0.0", "macaca-utils": "^0.1.8",