iPhone 8+ 运行 screenshot 方法报错
-
Macaca Version: 2.0.12
-
Macaca Doctor Logs: macaca-doctor version: 2.0.3
Node.js checklist:
node env: /usr/local/bin/node node version: v7.6.0
iOS checklist:
Xcode Command Line Tools is ready, version: 2347. xcodebuild version: 9.0 iproxy[usbmuxd] is installed at:
/usr/local/bin/iproxyios_webkit_debug_proxy is installed at:/usr/local/bin/ios_webkit_debug_proxycarthage is installed, version: 0.23.0Android checklist:
JAVA version is
1.8.0_111JAVA_HOME is set to/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/HomeANDROID_HOME is set to/Users/***/Library/Android/sdkPlatforms is set to/Users/***/Library/Android/sdk/platforms/android-26ADB tool is set to/Users/***/Library/Android/sdk/platform-tools/adbgradle is installed, version: 3.5Installed driver list:
ios: 2.0.28
-
Operate System: macOS, 10.12.6
-
Programming Language: java
iPhone 8+(11.0)运行 takeScreenshot、saveScreenshot 方法报错。 用例日志: Running macaca.client.SampleTest 2017-11-02 11:10:24 Request:http://localhost:3456/wd/hub/session:{"desiredCapabilities":{"bundleId":"","platformName":"ios","udid":"55cb923aab3c8ef473186c36b22f64fd8c56550a"}} 2017-11-02 11:10:40 Response:{"sessionId":"3d7b2b7e-4b20-43e2-811d-c037c607f5d8","status":0,"value":{"bundleId":"","platformName":"ios","udid":"55cb923aab3c8ef473186c36b22f64fd8c56550a"}} 2017-11-02 11:10:40 Request:http://localhost:3456/wd/hub/session/3d7b2b7e-4b20-43e2-811d-c037c607f5d8/screenshot 2017-11-02 11:11:08 Response:Internal Server Error Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 44.955 sec <<< FAILURE! test_case_1(macaca.client.SampleTest) Time elapsed: 44.425 sec <<< ERROR! com.alibaba.fastjson.JSONException: syntax error, pos 1, json : Internal Server Error at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1361) at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1268) at com.alibaba.fastjson.JSON.parse(JSON.java:137) at com.alibaba.fastjson.JSON.parse(JSON.java:128) at com.alibaba.fastjson.JSON.parseObject(JSON.java:201) at macaca.client.common.Utils.getRequest(Utils.java:75) at macaca.client.common.Utils.request(Utils.java:160) at macaca.client.commands.ScreenShot.takeScreenshot(ScreenShot.java:26) at macaca.client.MacacaClient.takeScreenshot(MacacaClient.java:1140) at macaca.client.SampleTest.test_case_1(SampleTest.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Results :
Tests in error: test_case_1(macaca.client.SampleTest): syntax error, pos 1, json : Internal Server Error
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 48.110 s [INFO] Finished at: 2017-11-02T11:11:08+08:00 [INFO] Final Memory: 21M/311M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project macacaclient: There are test failures. [ERROR] [ERROR] Please refer to /Users/****/Desktop/macacaSourceCode/wd.java/target/surefire-reports for the individual test results. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
server 日志:
index.js:18:12 [master] pid:37446 webdriver server start with config: { port: 3456, verbose: true, always: true, ip: '172.17.61.210', host: '-Pro.local', loaded_time: '2017-11-02 11:09:51' } middlewares.js:17:10 [master] pid:37446 base middlewares attached router.js:133:10 [master] pid:37446 router set webdriver sdk launched responseHandler.js:11:12 [master] pid:37446 Recieve HTTP Request from Client[2017-11-02 11:10:24]: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"bundleId":"","platformName":"ios","udid":"55cb923aab3c8ef473186c36b22f64fd8c56550a"}} session.js:47:10 [master] pid:37446 Creating session, sessionId: 3d7b2b7e-4b20-43e2-811d-c037c607f5d8. /usr/local/lib/node_modules/macaca-ios/node_modules/.0.1.4@ios-device/node_modules/ios-deploy/build/Release/ios-deploy macaca-ios.js:246:12 [master] pid:37446 App "" is already installed. macaca-ios.js:247:12 [master] pid:37446 Adopting app reuse strategy: 1. BundleId XCTestWD.XCTestWD does not exist. macaca-ios.js:158:10 [master] pid:37446 { "bundleId": "", "platformName": "ios" } xctest-client.js:56:14 [master] pid:37446 project path: /usr/local/lib/node_modules/macaca-ios/node_modules/.1.3.0@xctestwd/XCTestWD/XCTestWD.xcodeproj macaca-ios.js:167:12 [master] pid:37446 Trying to start xctestwd server... xctest-client.js:242:14 [master] pid:37446 xcode version: 9.0 XCTestWD version: 1.3.0 xctest-client.js:190:18 [master] pid:37446 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/.1.3.0@xctestwd/XCTestWD/XCTestWD.xcodeproj xctest-client.js:190:18 [master] pid:37446 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/.1.3.0@xctestwd/XCTestWD/XCTestWD.xcodeproj xctestwd start with port: 8001 proxy.js:55:14 [master] pid:37446 Proxy: /wd/hub/session:POST to http://localhost:8001/wd/hub/session:POST with body: {"desiredCapabilities":{"bundleId":"","platformName":"ios"}} proxy.js:85:20 [master] pid:37446 Got response with status 200: {"sessionId":null,"status":0,"value":{"sessionId":"DD81A0D2-C7AC-4BE4-BD6A-AC8A58480A4B","capabilities":{"browserName":"","device":"iphone","sdkVersion":"11.0","CFBundleIdentifier":"... responseHandler.js:49:14 [master] pid:37446 Send HTTP Respone to Client[2017-11-02 11:10:40]: {"sessionId":"3d7b2b7e-4b243e2-811d-c037c607f5d8","status":0,"value":"{"bundleId":"","platformName":"ios","udid":"55cb923aab3c8ef473186c36b22f64fd8c56550a"}"} responseHandler.js:11:12 [master] pid:37446 Recieve HTTP Request from Client[2017-11-02 11:10:40]: method: GET url: /wd/hub/session/3d7b2b7e-4b20-43e2-811d-c037c607f5d8/screenshot, jsonBody: {} proxy.js:55:14 [master] pid:37446 Proxy: /wd/hub/session/3d7b2b7e-4b20-43e2-811d-c037c607f5d8/screenshot:GET to http://localhost:8001/wd/hub/session/DD81A0D2-C7AC-4BE4-BD6A-AC8A58480A4B/screenshot:GET with body: xctest-client.js:190:18 [master] pid:37446 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/.1.3.0@xctestwd/XCTestWD/XCTestWD.xcodeproj proxy.js:63:22 [master] pid:37446 xctest client proxy error with: Error: socket hang up xctest-client.js:190:18 [master] pid:37446 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/.1.3.0@xctestwd/XCTestWD/XCTestWD.xcodeproj xctest-client.js:190:18 [master] pid:37446 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/.1.3.0@xctestwd/XCTestWD/XCTestWD.xcodeproj xctest-client.js:190:18 [master] pid:37446 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/.1.3.0@xctestwd/XCTestWD/XCTestWD.xcodeproj proxy.js:63:22 [master] pid:37446 xctest client proxy error with: Error: socket hang up proxy.js:63:22 [master] pid:37446 xctest client proxy error with: Error: socket hang up xctest-client.js:190:18 [master] pid:37446 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/.1.3.0@xctestwd/XCTestWD/XCTestWD.xcodeproj xctest-client.js:276:14 [master] pid:37446 killing deviceLogProc pid: 37483 xctest-client.js:281:14 [master] pid:37446 killing runnerProc pid: 37480 xctest-client.js:287:14 [master] pid:37446 killing iproxyProc pid: 37553 xctest-client.js:201:16 [master] pid:37446 xctest client exit with code: 65, signal: null xctest-client.js:155:16 [master] pid:37446 devicelog exit with code: null, signal: SIGKILL xctest-client.js:231:14 [master] pid:37446 iproxy exit with code: null, signal: SIGKILL proxy.js:63:22 [master] pid:37446 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:37446 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:37446 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:37446 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:37446 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:37446 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:37446 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:37446 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 responseHandler.js:56:12 [master] pid:37446 Send Error Respone to Client: Error: connect ECONNREFUSED 127.0.0.1:8001 responseHandler.js:62:14 [master] pid:37446 Error: connect ECONNREFUSED 127.0.0.1:8001 at Object.exports._errnoException (util.js:1028:11) at exports._exceptionWithHostPort (util.js:1051:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
Error: connect ECONNREFUSED 127.0.0.1:8001 at Object.exports._errnoException (util.js:1028:11) at exports._exceptionWithHostPort (util.js:1051:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
升级 macaca-ios到最新
@xudafeng macaca-ios已升级至最新,xctestwd版本1.3.4。运行到screenshot就socket hang up,然后xctestwd会自动重启。然后就运行失败了。这种问题目前只在8+上遇到了,iPhone 7(11.0.2) 没有这样的问题。截取日志如下:
proxy.js:55:14 [master] pid:61950 Proxy: /wd/hub/session/e188a6d1-2dc2-493d-91ec-4c3d41cdcb0b/screenshot:GET to http://localhost:8001/wd/hub/session/490EB1B4-0454-4449-8956-BED4EF2234A4/screenshot:GET with body: xctest-client.js:190:18 [master] pid:61950 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/.1.3.4@xctestwd/XCTestWD/XCTestWD.xcodeproj proxy.js:63:22 [master] pid:61950 xctest client proxy error with: Error: socket hang up xctest-client.js:190:18 [master] pid:61950 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/.1.3.4@xctestwd/XCTestWD/XCTestWD.xcodeproj xctest-client.js:190:18 [master] pid:61950 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/.1.3.4@xctestwd/XCTestWD/XCTestWD.xcodeproj xctest-client.js:190:18 [master] pid:61950 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/.1.3.4@xctestwd/XCTestWD/XCTestWD.xcodeproj proxy.js:63:22 [master] pid:61950 xctest client proxy error with: Error: socket hang up proxy.js:63:22 [master] pid:61950 xctest client proxy error with: Error: socket hang up xctest-client.js:190:18 [master] pid:61950 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/.1.3.4@xctestwd/XCTestWD/XCTestWD.xcodeproj xctest-client.js:276:14 [master] pid:61950 killing deviceLogProc pid: 61975 xctest-client.js:281:14 [master] pid:61950 killing runnerProc pid: 61972 xctest-client.js:287:14 [master] pid:61950 killing iproxyProc pid: 62359 xctest-client.js:201:16 [master] pid:61950 xctest client exit with code: 65, signal: null xctest-client.js:155:16 [master] pid:61950 devicelog exit with code: null, signal: SIGKILL xctest-client.js:231:14 [master] pid:61950 iproxy exit with code: null, signal: SIGKILL proxy.js:63:22 [master] pid:61950 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:61950 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:61950 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:61950 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:61950 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:61950 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:61950 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 proxy.js:63:22 [master] pid:61950 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001 responseHandler.js:56:12 [master] pid:61950 Send Error Respone to Client: Error: connect ECONNREFUSED 127.0.0.1:8001 responseHandler.js:62:14 [master] pid:61950 Error: connect ECONNREFUSED 127.0.0.1:8001 at Object.exports._errnoException (util.js:1028:11) at exports._exceptionWithHostPort (util.js:1051:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
Error: connect ECONNREFUSED 127.0.0.1:8001 at Object.exports._errnoException (util.js:1028:11) at exports._exceptionWithHostPort (util.js:1051:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)