首先先參考這篇文章一步一步的安裝:傳送門,我是成功的體驗(yàn)了PC版的例子:
make custom-reporter Test sample for PC with custom reporter
在安裝過程中有遇到一些問題:
比如我其他的驅(qū)動(dòng)都是下載正常的。只有macaca-android驅(qū)動(dòng)無法下載,報(bào)錯(cuò)日志如下:
npm ERR! node v6.10.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! Failed at the uiautomator-client@1.1.9 install script 'node ./scripts/build.js'.
好像是說uiautomator-clientpackage是有問題的。有可能是我npm下載不全的原因。以后有機(jī)會(huì)要把這個(gè)問題解決。
解決方法:
我直接去GitHub里面下載:傳送門,然后放在~/lib/node_modules里面,在重命名:macaca-android
macaca doctor
Installed driver list:
android: 1.1.34
chrome: 1.0.5
ios: 1.0.67
跑例子
文章里的樣例鏈接已經(jīng)不存在了,需要在這個(gè)里面下載樣例:官方樣例
修改文件:
/下載目錄/sample-nodejs-master/macaca-test里面找到sample-nodejs-master/macaca-test.js
把browserName:browser 改成 'electron'
到樣例項(xiàng)目有文件package.json 的目錄下 ,執(zhí)行npm i 為樣例項(xiàng)目安裝macaca執(zhí)行環(huán)境依賴
qian@qian-K45VM:~/macaca/sample-nodejs-master$ npm i
執(zhí)行成功日志:
qian@qian-K45VM:~/macaca/sample-nodejs-master$ make test
make test-ios Test sample for iOS
make test-android Test sample for Android
make test-ios-safari Test sample for iOS Safari
make test-android-chrome Test sample for Android Chrome
make test-desktop-electron Test sample for Desktop PC
make test-desktop-chrome Test sample for Desktop PC
make custom-reporter Test sample for PC with custom reporter
執(zhí)行用例:
qian@qian-K45VM:~/macaca/sample-nodejs-master$ make custom-reporter