Giter VIP home page Giter VIP logo

macaca-cli's People

Contributors

brunoyang avatar dead-horse avatar fengmk2 avatar paradite avatar snapre avatar xudafeng avatar yihuineng avatar zensh avatar ziczhu avatar zivyangll avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

macaca-cli's Issues

driver.quit以后,执行下一条用例无法启动server

responseHandler.js:11:12 [master] pid:2692 Recieve HTTP Request from Client[2017-10-26 11:59:12]: method: DELETE url: /wd/hub/session/886ef0cf-8387-43cf-b9f7-740c6640a41a, jsonBody: {}
macaca-ios.js:377:10 [master] pid:2692 Stoping iOS driver...
xctest-client.js:276:14 [master] pid:2692 killing deviceLogProc pid: 2710
xctest-client.js:281:14 [master] pid:2692 killing runnerProc pid: 2707
xctest-client.js:287:14 [master] pid:2692 killing iproxyProc pid: 2940
macaca-ios.js:401:10 [master] pid:2692 iOS driver cleaned up.
session.js:80:12 [master] pid:2692 Delete session, sessionId: 886ef0cf-8387-43cf-b9f7-740c6640a41a
responseHandler.js:49:14 [master] pid:2692 Send HTTP Respone to Client[2017-10-26 11:59:12]: {"sessionId":"886ef0cf-8387-43cf-b9f7-740c6640a41a","status":0}
xctest-client.js:155:16 [master] pid:2692 devicelog exit with code: null, signal: SIGKILL
xctest-client.js:231:14 [master] pid:2692 iproxy exit with code: null, signal: SIGKILL
xctest-client.js:201:16 [master] pid:2692 xctest client exit with code: null, signal: SIGKILL
responseHandler.js:11:12 [master] pid:2692 Recieve HTTP Request from Client[2017-10-26 11:59:14]: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"bundleId":"","platformName":"ios","udid":"","deviceName":""}}
session.js:47:10 [master] pid:2692 Creating session, sessionId: 6e9a922f-0a1c-452c-8a8c-91c945c64b99.
macaca-ios.js:246:12 [master] pid:2692 App "" is already installed.
macaca-ios.js:247:12 [master] pid:2692 Adopting app reuse strategy: 1.
BundleId XCTestWD.XCTestWD does not exist.
macaca-ios.js:158:10 [master] pid:2692 {
"bundleId": "",
"platformName": "ios"
}
xctest-client.js:56:14 [master] pid:2692 project path: /usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
macaca-ios.js:167:12 [master] pid:2692 Trying to start xctestwd server...
xctest-client.js:242:14 [master] pid:2692 xcode version: 9.0
XCTestWD version: 1.2.9
xctest-client.js:190:18 [master] pid:2692 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:190:18 [master] pid:2692 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:190:18 [master] pid:2692 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:190:18 [master] pid:2692 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:190:18 [master] pid:2692 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:190:18 [master] pid:2692 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:190:18 [master] pid:2692 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:190:18 [master] pid:2692 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:190:18 [master] pid:2692 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:190:18 [master] pid:2692 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:276:14 [master] pid:2692 killing deviceLogProc pid: 2950
xctest-client.js:281:14 [master] pid:2692 killing runnerProc pid: 2947
xctest-client.js:201:16 [master] pid:2692 xctest client exit with code: 65, signal: null
xctest-client.js:155:16 [master] pid:2692 devicelog exit with code: null, signal: SIGKILL
xctest-client.js:268:14 [master] pid:2692 Fail to start xctest: undefined

[email protected] 执行滑屏操作 swipe 报404

启动macaca进行android端自动化测试,执行swipe操作时报错如下

>> responseHandler.js:11:12 [master] pid:7496 Recieve HTTP Request from Client:
method: POST url: /wd/hub/session/a0bb03fd-b300-46ab-b15f-ecaa6e8bc7e4/element/t
emp/swipe, jsonBody: {"endY":200,"endX":200,"startX":200,"startY":100,"duration"
:5}
>> responseHandler.js:23:14 [master] pid:7496 Send HTTP Respone to Client: 404 N
ot Found

相关信息

macaca doctor

  macaca-doctor version: 1.0.28


  Node.js checklist:

  node env: D:\Program Files\nodejs\node.exe
  node version: v6.2.2

  Android checklist:

  JAVA version is `1.7.0_15`
  JAVA_HOME is set to `D:\Java\jdk1.7.0_15`
  ANDROID_HOME is set to `D:\sdk`
  Platforms is set to `D:\sdk\platforms\android-23`
  Android tools is set to `D:\sdk\tools\android.bat`
  ADB tool is set to `D:\sdk\platform-tools\adb.exe`
  ANT_HOME is set to `D:\apache-ant-1.9.7`

  Installed driver list:

  android: 1.1.19
  chrome: 1.0.5
  electron: 1.1.4 [out-of-date]

npm install fail

When i install cli module by typing
npm install -g macaca-cli
It do not work well and return an error below:

node ./scripts/install.js

/usr/local/lib/node_modules/macaca-cli/node_modules/node-installer/scripts/install.js:17
const fs = require('fs');
^^^^^

跑脚本报错时The environment you requested was unavailable.

环境信息:
node version: v4.5.0
npm:2.15.9
os:win7 x64
macaca:1.1.2

问题:
macaca安装成功后(运行test-sample里的macaca-desktop-sample.test.js是正常的),运行脚本报错,报错信息如下:

InternalServerError: Internal Server Error
at Object.module.exports.throw (C:\Users\XXX\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\node_modules\koa\lib\context.js:91:23)
at Object.module.exports (C:\Users\XXX\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\responseHandler.js:53:17)
at throw (native)
at onRejected (C:\Users\XXX\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:81:24)
at process._tickCallback (node.js:369:9)

1) "before all" hook

0 passing (2s)
1 failing

  1. macaca mobile sample "before all" hook:
    Error: [init({"autoAcceptAlerts":true,"platformName":"Android","package":"com.XX.android","activity":"com.XX.android.XXActivity"})] The environment you requested was unavailable.
    at C:\Users\XXX\node_modules\webdriver-client\node_modules\macaca-wd\wd\lib\webdriver.js:134:15
    at Request._callback (C:\Users\XXX\node_modules\webdriver-client\node_modules\macaca-wd\wd\lib\http-utils.js:87:7)
    at Request.self.callback (C:\Users\XXX\node_modules\webdriver-client\node_modules\macaca-wd\node_modules\request\request.js:368:22)
    at Request. (C:\Users\XXX\node_modules\webdriver-client\node_modules\macaca-wd\node_modules\request\request.js:1219:14)
    at IncomingMessage. (C:\Users\XXX\node_modules
    macaca
    \webdriver-client\node_modules\macaca-wd\node_modules\request\request.js:1167:12)
    at endReadableNT (_stream_readable.js:921:12)

v1.1.0 macaca doctor提示有误

➜  ~ sudo macaca doctor
Password:

  Node.js checklist:

  node env: /usr/local/bin/node
  node version: v5.0.0

  iOS checklist:

  Xcode is installed at: `/Applications/Xcode.app/Contents/Developer`
  Xcode Command Line Tools is ready, version: 2343.
  ios_webkit_debug_proxy is installed at: /usr/local/bin/ios_webkit_debug_proxy

  Android checklist:

  JAVA version is `1.7.0_79`
  JAVA_HOME is not set
  ANDROID_HOME is not set

  Installed driver list:

  electron: 1.0.7
  ios: 1.0.30

提示JAVA_HOME 、ANDROID_HOME is not set
但是

➜  ~ echo $JAVA_HOME && echo $ANDROID_HOME
/usr/libexec/java_home
/usr/local/opt/android-sdk

页面的值不匹配时提交到 服务端

有这样一个场景

在测试页面的数据显示是否正确的时候,

如果匹配不正确需要把当前页面的 url 和 页面的数据 提交到 一个错误收集的 服务端,以便服务端好接收到。

如何发起提交呢?

Internal Server Error

const path = require('path');
const wd = require('wd'); // 引用 wd 模块

describe('macaca mobile sample', function() {
this.timeout(5 * 60 * 1000); // mocha 设置超时时间

var driver = wd.promiseChainRemote({ // 初始化 webdriver
host: 'localhost',
port: 3456
});

before(function() {
return driver.init({
platformName: 'iOS',
udid: 'd8f6f0875320116fc5946b020a84b6dccba9d815',
bundleId: 'com.mosheberman.Surfboard'
});
});

after(function() { // 所有测试用例的统一后置动作
return driver
.sleep(1000)
.quit();
});

it('#1 should login success', function() {
return driver
.elementByName('Tap Here To Surf Again')
.click()
.sleep(3000)
.takeScreenshot(path);

});

});

Last login: Tue Apr 12 15:53:23 on ttys000
clydeiMac:~ cly$ cd /Users/cly/Desktop/macaca-test/
clydeiMac:macaca-test cly$ make test
platform= macaca run --server --verbose



index.js:62:12 [master] pid:39068 webdriver server start with config:
{ port: 3456,
ip: '192.168.3.70',
host: 'clydeiMac.local',
loaded_time: '2016-04-12 16:06:34' }
middlewares.js:31:10 [master] pid:39068 base middlewares attached
router.js:101:10 [master] pid:39068 router set
webdriver sdk launched

macaca mobile sample
responseHandler.js:24:12 [master] pid:39068 Recieve HTTP Request from Client: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"platformName":"iOS","udid":"d8f6f0875320116fc5946b020a84b6dccba9d815","bundleId":"com.mosheberman.Surfboard","browserName":"firefox","version":"","javascriptEnabled":true,"platform":"ANY"}}
session.js:22:10 [master] pid:39068 Creating session, sessionId: a4307991-cae2-4656-8e5b-5e6296358984.
responseHandler.js:56:12 [master] pid:39068 Send Error Respone to Client TypeError: Cannot read property 'substring' of undefined
responseHandler.js:62:14 [master] pid:39068 TypeError: Cannot read property 'substring' of undefined
at Function..sleep..retry..waitForCondition..exec..spawn.child.on..configApp (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/webdriver-server/lib/common/helper.js:174:10)
at WebdriverServer.start (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/webdriver-server/lib/server/index.js:39:16)
at next (native)
at onFulfilled (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/co/index.js:65:19)
at /Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/co/index.js:54:5
at Object.co (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/co/index.js:50:10)
at Object.toPromise (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/co/index.js:118:63)
at next (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/co/index.js:99:29)
at onFulfilled (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/co/index.js:69:7)
at /Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/co/index.js:54:5
at Object.co (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/co/index.js:50:10)
at Object.toPromise (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/co/index.js:118:63)
at next (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/co/index.js:99:29)
at onFulfilled (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/co/index.js:69:7)
at /Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/co/index.js:54:5
at Object.co (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/co/index.js:50:10)
responseHandler.js:81:14 [master] pid:39068 Unexcepted error TypeError

InternalServerError: Internal Server Error
at Object.module.exports.throw (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/webdriver-server/node_modules/koa/lib/context.js:91:23)
at Object.module.exports (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/webdriver-server/lib/server/responseHandler.js:82:17)
at throw (native)
at onRejected (/Users/cly/.nvm/versions/node/v4.4.0/lib/node_modules/macaca-client/node_modules/co/index.js:81:24)
at process._tickCallback (node.js:369:9)

  1. "before all" hook
    responseHandler.js:24:12 [master] pid:39068 Recieve HTTP Request from Client: method: DELETE url: /wd/hub/session, jsonBody: {}
    responseHandler.js:48:14 [master] pid:39068 Send HTTP Respone to Client: {"sessionId":"","status":0}

0 passing (4s)
1 failing

  1. macaca mobile sample "before all" hook:
    Error: [init({"platformName":"iOS","udid":"d8f6f0875320116fc5946b020a84b6dccba9d815","bundleId":"com.mosheberman.Surfboard"})] The environment you requested was unavailable.
    at endReadableNT (_stream_readable.js:905:12)

Test completed!

how to write test case?

平台: android
情况:
页面用了一个listview做的。
怎么实现点击listview上的某一个item上文字为 "登录" 的 textview的测试。
怎么实现点击listview上的某一个item上文字为 "确定" 的 Button的测试。

xctest client proxy error with: Error: connect ECONNREFUSED 172.18.156.69:8100

os: os x 10.11.6
macaca version:1.1.2
ios driver: 1.0.36
device: iPhone6S(9.3.5)
真机运行时,大概率会反复出现此错误(同样的代码步骤可以正常运行过)。出现此提示失败后,设备上过了一段时间才会自动启动起WebDriverAgent并自动关闭。

ERROR LOG:

QA-deMac-mini:~ qa$ macaca server --verbose
>> index.js:17:12 [master] pid:6048 webdriver server start with config:
 { port: 3456,
  verbose: true,
  ip: '192.168.241.195',
  host: 'QA-deMac-mini.local',
  loaded_time: '2016-09-12 18:15:55' }
>> middlewares.js:17:10 [master] pid:6048 base middlewares attached
>> router.js:108:10 [master] pid:6048 router set
>> webdriver sdk launched
>> responseHandler.js:11:12 [master] pid:6048 Recieve HTTP Request from Client: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"platformVerison":"9.3.5","platformName":"iOS","bundleId":"com.nd.app.factory.jianggongyouth","udid":"<udid>","browserName":"firefox","version":"","javascriptEnabled":true,"platform":"ANY"}}
>> session.js:47:10 [master] pid:6048 Creating session, sessionId: e9d76ab1-ae08-4d74-890b-0f4f5f1dddda.
>> xctest-client.js:43:14 [master] pid:6048 project path: /usr/local/lib/node_modules/macaca-ios/node_modules/xctest-client/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
>> macaca-ios.js:130:10 [master] pid:6048 {
    "bundleId": "com.nd.app.factory.jianggongyouth",
    "platformName": "iOS",
    "browserName": "firefox"
}
>> xctest-client.js:183:12 [master] pid:6048 xcode version: 7.3.1
>> WebDriverAgent version: 1.0.25
>> xctest-client.js:156:14 [master] pid:6048 2016-09-12 18:16:03.293 xcodebuild[6054:27353] [MT] IDETestOperationsObserverDebug: (87020BAC-33C0-4DE0-BB81-50C355B6773B) Beginning test session 87020BAC-33C0-4DE0-BB81-50C355B6773B with Xcode 7D1014 on target <DVTiOSDevice: 0x7f85c5683720> {
        deviceSerialNumber:         FK1QF2JTGRYC
        identifier:                 <udid>
        deviceClass:                iPhone
        deviceName:                 My iPhone
        deviceIdentifier:           <udid>
        productVersion:             9.3.5
        buildVersion:               13G36
        deviceSoftwareVersion:      9.3.5 (13G36)
        deviceArchitecture:         arm64
        deviceTotalCapacity:        59669319680
        deviceAvailableCapacity:    7193366528
        deviceIsTransient:          NO
        ignored:                    NO
        deviceIsBusy:               NO
        deviceIsActivated:          YES
        deviceActivationState:      Activated
        deviceType:                 <DVTDeviceType:0x7f85c53c0a90 Xcode.DeviceType.iPhone>
        supportedDeviceFamilies:    (
    1
)
        applications:              (null)
        provisioningProfiles:      (null)
        activityProgress:          -2
        activityTitle:             
        hasInternalSupport:        NO
        isSupportedOS:             YES
        developerDiskMountError:   (null)
(null)
    } (9.3.5 (13G36))

>> xctest-client.js:156:14 [master] pid:6048 2016-09-12 18:16:03.296 xcodebuild[6054:27355]  IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/qa/Library/Developer/Xcode/DerivedData/WebDriverAgent-drmzhetqodgefhaqpyureuezairh/Logs/Test/616A811A-9156-45F8-A4E1-969BE3F2DAD9/Session-2016-09-12_18:16:03-bizmtg.log

>> xctest-client.js:156:14 [master] pid:6048 MDMCreateDeltaDirectory:1920 calling MDMDirectoryDiff with:
state->old_bundle: /var/folders/7x/rvnhm1zs44j1mkq4fg6qzqqm0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/7566f7ff6f0cd873d892945ee2a11b48/<udid>/WebDriverAgentRunner-Runner.app
state->new_bundle: /Users/qa/Library/Developer/Xcode/DerivedData/WebDriverAgent-drmzhetqodgefhaqpyureuezairh/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app
state->dst_bundle: /var/folders/7x/rvnhm1zs44j1mkq4fg6qzqqm0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.BC8Qop/WebDriverAgentRunner-Runner.app_sparse.ipa/Payload//WebDriverAgentRunner-Runner.app, binaryDiff flag: FALSE
    dst_ipa: /var/folders/7x/rvnhm1zs44j1mkq4fg6qzqqm0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.BC8Qop/WebDriverAgentRunner-Runner.app_sparse.ipa

>> xctest-client.js:156:14 [master] pid:6048 __MDMDirectoryDiff_block_invoke37:1473 calling writeDictToFile with: /var/folders/7x/rvnhm1zs44j1mkq4fg6qzqqm0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.BC8Qop/WebDriverAgentRunner-Runner.app_sparse.ipa/ManifestCache.plist

>> xctest-client.js:156:14 [master] pid:6048 writeDictToFile:1278 ==== Successfully wrote Manifest cache to /var/folders/7x/rvnhm1zs44j1mkq4fg6qzqqm0000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/WebDriverAgentRunner-Runner.app.BC8Qop/WebDriverAgentRunner-Runner.app_sparse.ipa/ManifestCache.plist

>> proxy.js:54:14 [master] pid:6048 Proxy: /session:POST to http://172.18.156.69:8100/session:POST with body: {"desiredCapabilities":{"bundleId":"com.nd.app.factory.jianggongyouth","platformName":"iOS","browserName":"firefox"}}
>> proxy.js:58:18 [master] pid:6048 xctest client proxy error with: Error: connect ECONNREFUSED 172.18.156.69:8100
/usr/local/lib/node_modules/macaca-ios/node_modules/xlogger/lib/xlogger.js:169
  throw new Error(res);
  ^

Error: >> proxy.js:58:18 [master] pid:6048 xctest client proxy error with: Error: connect ECONNREFUSED 172.18.156.69:8100
    at Logger.error (/usr/local/lib/node_modules/macaca-ios/node_modules/xlogger/lib/xlogger.js:169:9)
    at Request._callback (/usr/local/lib/node_modules/macaca-ios/node_modules/xctest-client/lib/proxy.js:58:18)
    at self.callback (/usr/local/lib/node_modules/macaca-ios/node_modules/xctest-client/node_modules/request/request.js:199:22)
    at emitOne (events.js:77:13)
    at Request.emit (events.js:169:7)
    at Request.onRequestError (/usr/local/lib/node_modules/macaca-ios/node_modules/xctest-client/node_modules/request/request.js:821:8)
    at emitOne (events.js:77:13)
    at ClientRequest.emit (events.js:169:7)
    at Socket.socketErrorListener (_http_client.js:269:9)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at emitErrorNT (net.js:1269:8)
    at nextTickCallbackWith2Args (node.js:442:9)
    at process._tickCallback (node.js:356:17)

1.10更新后找不到driver

node:v4.2.1
npm: 2.14.7
OS: win7 x64

macaca 1.0.35的时候,使用macaca install electron可以安装好electron driver,desctop测试能运行。更新1.1.0以后,macaca install不存在了,npm i --save-dev macaca-electron后,使用macaca doctor看不到electron driver。然后测试报错说缺少driver。

-g 安装macaca-electron后并且升级 node到4.4.7后测试能够运行了,但是macaca doctor依然无法显示driver.

环境搭建完之后跑测试用例

clydeiMac:macaca-test-sample cly$ macaca run --verbose

index.js:30:12 [master] pid:1303 webdriver server start with config:
{ port: 3456,
window: true,
ip: '192.168.3.70',
host: 'clydeiMac.local',
loaded_time: '2016-06-12 10:46:52' }
middlewares.js:30:10 [master] pid:1303 base middlewares attached
router.js:118:10 [master] pid:1303 router set
webdriver sdk launched

macaca mobile sample

responseHandler.js:24:12 [master] pid:1303 Recieve HTTP Request from Client: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"autoAcceptAlerts":true,"platformName":"iOS","platformVersion":"9.3","deviceName":"iPhone 5s","app":"/Users/cly/macaca-test-sample/app/ios-app-bootstrap.zip"}}
session.js:60:10 [master] pid:1303 Creating session, sessionId: 4bb184ce-b250-4b35-9ee5-9249b19275de.
helper.js:205:12 [master] pid:1303 Unzipping local app form /Users/cly/macaca-test-sample/app/ios-app-bootstrap.zip
CFBundleIdentifier is xudafeng.ios-app-bootstrap
Get bundleId xudafeng.ios-app-bootstrap from plist /var/folders/d_/fd6lqsmx7jx_bcj2zvsq8hhw0000gn/T/ios-app-bootstrap.app/Info.plist
macaca-ios.js:182:10 [master] pid:1303 Get available devices [{"name":"iPhone 4s","udid":"6D681EA6-5A58-41A2-B2A5-CFAEFE8315C4","state":"Shutdown","available":true,"runtime":"iOS 9.3"},{"name":"iPhone 5","udid":"0271473C-8241-45F8-AA89-68AB2A962B63","state":"Shutdown","available":true,"runtime":"iOS 9.3"},{"name":"iPhone 5s","udid":"4D63A6A7-455E-4524-A2AD-8945440A4763","state":"Shutdown","available":true,"runtime":"iOS 9.3"},{"name":"iPhone 6","udid":"E0B98126-B342-4EB3-BEAB-B76070248688","state":"Shutdown","available":true,"runtime":"iOS 9.3"},{"name":"iPhone 6 Plus","udid":"1A292B44-0593-4685-AB98-8CB58564A033","state":"Shutdown","available":true,"runtime":"iOS 9.3"},{"name":"iPhone 6s","udid":"9748E735-DBC1-4F79-AD77-5FEC0B47EF0D","state":"Shutdown","available":true,"runtime":"iOS 9.3"},{"name":"iPhone 6s Plus","udid":"4E060382-8591-42F3-9482-9A950189BCF8","state":"Shutdown","available":true,"runtime":"iOS 9.3"},{"name":"iPad 2","udid":"30E7C063-8218-445D-9586-E12764218676","state":"Shutdown","available":true,"runtime":"iOS 9.3"},{"name":"iPad Retina","udid":"78E3792F-8E51-426F-8098-84FF8C664798","state":"Shutdown","available":true,"runtime":"iOS 9.3"},{"name":"iPad Air","udid":"7B19A7CB-A7F1-49D9-9BE8-0C0A2183BCD2","state":"Shutdown","available":true,"runtime":"iOS 9.3"},{"name":"iPad Air 2","udid":"AE713A51-57DD-4DF7-AF7C-5C407BBFA654","state":"Shutdown","available":true,"runtime":"iOS 9.3"},{"name":"iPad Pro","udid":"6DD9013C-7162-4E99-8E56-A216750DB1F8","state":"Shutdown","available":true,"runtime":"iOS 9.3"},{"name":"Apple TV 1080p","udid":"DAB3248A-624A-4710-80CA-369D97AB5CA6","state":"Shutdown","available":true,"runtime":"tvOS 9.2"},{"name":"Apple Watch - 38mm","udid":"D8C3455A-8316-40D8-8D3C-D05F6E39489D","state":"Shutdown","available":true,"runtime":"watchOS 2.2"},{"name":"Apple Watch - 42mm","udid":"220F18DA-1BA4-470C-9F5E-6BD5584D67D3","state":"Shutdown","available":true,"runtime":"watchOS 2.2"}]
macaca-ios.js:215:12 [master] pid:1303 Kill simulator failed Error: Command failed: killAll Simulator
No matching processes belonging to you were found

macaca-ios.js:221:12 [master] pid:1303 Shutdown simulator 4D63A6A7-455E-4524-A2AD-8945440A4763 failed Error: Command failed: xcrun simctl shutdown "4D63A6A7-455E-4524-A2AD-8945440A4763"
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Unable to shutdown device in current state: Shutdown

agent path: /usr/local/lib/node_modules/macaca-ios/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcworkspace
macaca-ios.js:132:10 [master] pid:1303 {
"bundleId": "xudafeng.ios-app-bootstrap",
"platformName": "iOS",
"platformVersion": "9.3",
"app": "/var/folders/d_/fd6lqsmx7jx_bcj2zvsq8hhw0000gn/T/ios-app-bootstrap.app/"
}
xctest-client.js:246:12 [master] pid:1303 xcode version: 7.3.1
xctest-client.js:150:16 [master] pid:1303 tail: /Users/cly/Library/Logs/CoreSimulator/4D63A6A7-455E-4524-A2AD-8945440A4763/system.log: No such file or directory

xctest-client.js:158:16 [master] pid:1303 bootstrap exit with code: 1, signal: null
responseHandler.js:63:12 [master] pid:1303 Send Error Respone to Client: undefined

InternalServerError: Internal Server Error
at Object.module.exports.throw (/usr/local/lib/node_modules/macaca-cli/node_modules/koa/lib/context.js:91:23)
at Object.module.exports (/usr/local/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/responseHandler.js:66:17)
at throw (native)
at onRejected (/usr/local/lib/node_modules/macaca-cli/node_modules/co/index.js:81:24)
at process._tickCallback (internal/process/next_tick.js:103:7)

1) "before all" hook

responseHandler.js:24:12 [master] pid:1303 Recieve HTTP Request from Client: method: DELETE url: /wd/hub/session, jsonBody: {}
responseHandler.js:32:14 [master] pid:1303 Send HTTP Respone to Client: 405 Method Not Allowed

2) "after all" hook

0 passing (8s)

2 failing

  1. macaca mobile sample "before all" hook:
    [init({"autoAcceptAlerts":true,"platformName":"iOS","platformVersion":"9.3","deviceName":"iPhone 5s","app":"/Users/cly/macaca-test-sample/app/ios-app-bootstrap.zip"})] The environment you requested was unavailable.
    Error: [init({"autoAcceptAlerts":true,"platformName":"iOS","platformVersion":"9.3","deviceName":"iPhone 5s","app":"app/ios-app-bootstrap.zip"})] The environment you requested was unavailable.
    at node_modules/macaca-wd/wd/lib/webdriver.js:134:15
    at Request._callback (node_modules/macaca-wd/wd/lib/http-utils.js:87:7)
    at Request.self.callback (node_modules/macaca-wd/node_modules/request/request.js:368:22)
    at Request. (node_modules/macaca-wd/node_modules/request/request.js:1219:14)
    at IncomingMessage. (node_modules/macaca-wd/node_modules/request/request.js:1167:12)
    at endReadableNT (_stream_readable.js:926:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

  2. macaca mobile sample "after all" hook:
    Error: [quit()] Unexpected data in simpleCallback.
    at exports.newError (node_modules/macaca-wd/wd/lib/utils.js:139:13)
    at . (node_modules/macaca-wd/wd/lib/callbacks.js:42:12)
    at cb (node_modules/macaca-wd/wd/lib/webdriver.js:165:22)
    at node_modules/macaca-wd/wd/lib/webdriver.js:179:5
    at Request._callback (node_modules/macaca-wd/wd/lib/http-utils.js:87:7)
    at Request.self.callback (node_modules/macaca-wd/node_modules/request/request.js:368:22)
    at Request. (node_modules/macaca-wd/node_modules/request/request.js:1219:14)
    at IncomingMessage. (node_modules/macaca-wd/node_modules/request/request.js:1167:12)
    at endReadableNT (_stream_readable.js:926:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Test completed!

macaca run 报错

/usr/local/Cellar/node/5.1.0/libexec/npm/lib/node_modules/macaca-client/node_modules/mocha/lib/utils.js:577
if (!files.length) throw new Error("cannot resolve path (or pattern) '" + path + "'");
^

Error: cannot resolve path (or pattern) 'macaca-test'
at Object.lookupFiles (/usr/local/Cellar/node/5.1.0/libexec/npm/lib/node_modules/macaca-client/node_modules/mocha/lib/utils.js:577:32)
at /usr/local/Cellar/node/5.1.0/libexec/npm/lib/node_modules/macaca-client/node_modules/mocha/bin/_mocha:320:30
at Array.forEach (native)
at Object. (/usr/local/Cellar/node/5.1.0/libexec/npm/lib/node_modules/macaca-client/node_modules/mocha/bin/_mocha:319:6)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Function.Module.runMain (module.js:457:10)
at startup (node.js:138:18)
at node.js:974:3

Test completed!

然后使用的文档进不去

case `uname` in SyntaxError: Unexpected token case (windows) with mocha

When I run macaca-mobile-sample-test.js in windows, there are some errors.

D:\myprojects\macacaSample\mobile-app-sample-nodejs>macaca run -d macaca-test\mobile-app-sample.test
.js
>> webdriver sdk launched
>> D:\myprojects\macacaSample\mobile-app-sample-nodejs\node_modules\.bin\mocha:4
case `uname` in
^^^^

SyntaxError: Unexpected token case
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:414:25)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:136:18)
    at node.js:963:3

>> Test completed!

My node version is 4.2.2. How can i fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.