macaca icon indicating copy to clipboard operation
macaca copied to clipboard

iOS 真机运行失败

Open ftvbftvbq opened this issue 10 years ago • 47 comments

真机调试文档

  • https://testerhome.com/topics/12428

遇到iOS真机问题(证书问题为主),请看如下文章

  • https://testerhome.com/topics/5804
  • https://testerhome.com/topics/6503

ftvbftvbq avatar May 10 '16 03:05 ftvbftvbq

@ftvbftvbq 你是测试什么流程?

xudafeng avatar May 10 '16 04:05 xudafeng

我没有测试很复杂的流程,我本意是想打开app,点击一个按钮,我早上全局安装了webpack,这个有影响吗?这个东西我自己要用,昨天还是正常的,没有问题,我看到runner和另外一个在真机上安装成功过的。

ftvbftvbq avatar May 10 '16 05:05 ftvbftvbq

我升级xcode到最新版,不知道能不能解决,等我最新回复吧,下载需要时间。

ftvbftvbq avatar May 10 '16 05:05 ftvbftvbq

全部代码贴一下,其实是按照那个真机贴在改的:

const path = require('path');
const wd = require('wd');

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

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

  before(function() { // iOS需要传 udid 和 bundleId
    return driver.init({
      platformName: 'iOS',
      udid: 'xxxxxxxx', //这里我都填写了正确的信息,考虑到隐私性,这里不写出来,实际没问题
      bundleId: 'xxxxxxxxx'
    });
  });

  it('#1 test', function() { 
    return driver
          .elementByNameIfExists('我')
          .elementByName('我')
          .click();
  });

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

ftvbftvbq avatar May 10 '16 05:05 ftvbftvbq

@ftvbftvbq 与webpack没任何关系奥

xudafeng avatar May 10 '16 06:05 xudafeng

除了我目前升级xcode外,还有其他fix issue的建议吗?

ftvbftvbq avatar May 10 '16 06:05 ftvbftvbq

xcode已经升级到最新,还行报错,No matching provisioning profiles found: No provisioning profiles with a valid signing identity (i.e. certificate and private key pair) matching the bundle identifier “com.facebook.xctweb-driver-agent” were found.

ftvbftvbq avatar May 10 '16 08:05 ftvbftvbq

这个问题是provisioning file导致,如果签名下加了设备就需要在preferance--account中点击 view detail,然后,重新download下所有的数据到本地来就解决了,谢谢!那个帖子上的问题我也回复下。

ftvbftvbq avatar May 10 '16 09:05 ftvbftvbq

@ftvbftvbq 欢迎把解决方式具体说明一下,我们可以把这个问题放到 FAQ 里面,谢谢使用!

ziczhu avatar May 10 '16 13:05 ziczhu

这个问题导致的原因主要是很多人共用一个帐户,然后,有人后来在证书下加了设备,而你本地这些证书没有更新到最新的,导致的这个报错;解决方法已经在上面提到过了:如果签名下加了设备就需要在preferance--account中点击 view detail,然后,重新download下所有的数据到本地来就解决了,谢谢!

ftvbftvbq avatar May 11 '16 10:05 ftvbftvbq

https://testerhome.com/topics/4549

xudafeng avatar Jun 07 '16 05:06 xudafeng

hi,我通过执行 macaca run --rebose出现报错`>> xctest-client.js:219:14 [master] pid:5762 2016-06-07 13:05:49.184 xcodebuild[5820:606252] IDETestOperationsObserverDebug: Writing diagnostic log for test session to: /Users/djx/Library/Developer/Xcode/DerivedData/WebDriverAgent-dgapfvuoqjmpyehcyyvidqwjgymp/Logs/Test/35444B56-E5B2-4BDB-AC05-57432CC2C0C2/Session-2016-06-07_13:05:49-sfvLju.log

xctest-client.js:219:14 [master] pid:5762 Testing failed: Implicit conversion loses floating-point precision: 'double _Nullable' to 'CGFloat' (aka 'float')

xctest-client.js:219:14 [master] pid:5762 Implicit conversion loses floating-point precision: 'double _Nullable' to 'CGFloat' (aka 'float') Implicit conversion loses floating-point precision: 'double _Nullable' to 'CGFloat' (aka 'float') Implicit conversion loses floating-point precision: 'double _Nullable' to 'CGFloat' (aka 'float') Implicit conversion loses floating-point precision: 'double _Nullable' to 'CGFloat' (aka 'float') Implicit conversion increases floating-point precision: 'CGFloat' (aka 'float') to 'NSTimeInterval' (aka 'double') Implicit conversion loses floating-point precision: 'double _Nullable' to 'CGFloat' (aka 'float') Implicit conversion loses floating-point precision: 'double _Nullable' to 'CGFloat' (aka 'float') ** TEST FAILED **

The following build commands failed: CompileC /Users/djx/Library/Developer/Xcode/DerivedData/WebDriverAgent-dgapfvuoqjmpyehcyyvidqwjgymp/Build/Intermediates/WebDriverAgent.build/Debug-iphoneos/XCTWebDriverAgentLib.build/Objects-normal/armv7/FBElementCommands.o XCTWebDriverAgentLib/Commands/FBElementCommands.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure)

我的脚本也很简单

const path = require('path');
const wd = require('wd');

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

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

  before(function() { // 与 Android 最大不同是无需指定 APP 的路径,需要传 udid 和 bundleId
    return driver.init({ 
      platformName: 'ios',
      deviceName: 'iPod touch(2)',
      platformVersion: '9.3.2',
      udid: 'xx',
      bundleId: 'xx'
    });
  });

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

  it('#1 should login success', function() { // 测试一下 login
    return driver
        .waitForElementByName('发现')
        .click()
        .sleep(1000)
        .waitForElementByName('智玩')
        .click()
        .sleep(5000);
  });

});

ryzn0518 avatar Jun 07 '16 05:06 ryzn0518

@diaojunxian 是小米手环团队,主要依赖蓝牙功能,所以真机这边需要处理下 @brunoyang

xudafeng avatar Jun 07 '16 05:06 xudafeng

不好意思,重贴一下,完全模仿官方例子

const path = require('path');
const wd = require('wd');

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

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

  before(function() { // 与 Android 最大不同是无需指定 APP 的路径,需要传 udid 和 bundleId
    return driver.init({ 
      platformName: 'ios',
      deviceName: 'iPod touch(2)',
      platformVersion: '9.3.2',
      udid: 'xx',
      bundleId: 'xx'
    });
  });

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

  it('#1 should login success', function() { // 测试一下 login
    return driver
        .waitForElementByName('发现')
        .click()
        .sleep(1000)
        .waitForElementByName('智玩')
        .click()
        .sleep(5000);
  });

});

ryzn0518 avatar Jun 07 '16 05:06 ryzn0518

@brunoyang 这个怎么样了啊

xudafeng avatar Jun 13 '16 02:06 xudafeng

@diaojunxian 尝试一下

  • 报错信息:No matching provisioning profiles found: No provisioning profiles with a valid signing identity (i.e. certificate and private key pair) matching the bundle identifier "com.facebook.xctweb-driver-agent" were found.
  • 原因:多人公用一个账户,其他人往该账户下添加设备后,本地没有更新证书到最新
  • 解决方案:点击 preferance => account => view detail => 更新证书即可

brunoyang avatar Jun 13 '16 04:06 brunoyang

@brunoyang 之前已解决试过,没有修复这个问题

ryzn0518 avatar Jun 13 '16 04:06 ryzn0518

@diaojunxian 现在log可以贴一下吗

xudafeng avatar Jun 13 '16 06:06 xudafeng

@brunoyang

>> macaca-ios.js:132:10 [master] pid:7791 {
    "bundleId": "HM.wristband2",
    "platformName": "ios",
    "platformVersion": "9.3.2"
}
>> xctest-client.js:246:12 [master] pid:7791 xcode version: 7.3.1
>> xctest-client.js:219:14 [master] pid:7791 2016-06-13 15:07:36.050 xcodebuild[7800:625862] [MT] IDETestOperationsObserverDebug: (58BE1F8A-287C-4228-8A2B-F8E19359CF56) Beginning test session 58BE1F8A-287C-4228-8A2B-F8E19359CF56 with Xcode 7D1014 on target <DVTiOSDevice: 0x7f85005f8bc0> {
        deviceSerialNumber:         CCQN6EZ0G22Y
        identifier:                 5d2d323666d505449e9a67cbd3fccc8ff80baadf
        deviceClass:                iPod
        deviceName:                 iPod touch (2)
        deviceIdentifier:           5d2d323666d505449e9a67cbd3fccc8ff80baadf
        productVersion:             9.3.2
        buildVersion:               13F69
        deviceSoftwareVersion:      9.3.2 (13F69)
        deviceArchitecture:         armv7f
        deviceTotalCapacity:        13470396416
        deviceAvailableCapacity:    483987456
        deviceIsTransient:          NO
        ignored:                    NO
        deviceIsBusy:               NO
        deviceIsActivated:          YES
        deviceActivationState:      Activated
        deviceType:                 <DVTDeviceType:0x7f8502d45400 Xcode.DeviceType.iPhone>
        supportedDeviceFamilies:    (
    1
)
        applications:              (null)
        provisioningProfiles:      (null)
        activityProgress:          -2
        activityTitle:             
        hasInternalSupport:        NO
        isSupportedOS:             YES
        developerDiskMountError:   (null)
(null)
    } (9.3.2 (13F69))

>> xctest-client.js:219:14 [master] pid:7791 2016-06-13 15:07:36.051 xcodebuild[7800:625896]  IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/djx/Library/Developer/Xcode/DerivedData/WebDriverAgent-dgapfvuoqjmpyehcyyvidqwjgymp/Logs/Test/08813FB1-8EAD-4D24-96CC-8D58BA68BB44/Session-2016-06-13_15:07:36-hp5CAb.log

>> xctest-client.js:219:14 [master] pid:7791 
Testing failed:
    Implicit conversion loses floating-point precision: 'double' to 'CGFloat' (aka 'float')

>> xctest-client.js:219:14 [master] pid:7791    Implicit conversion increases floating-point precision: 'CGFloat' (aka 'float') to 'NSTimeInterval' (aka 'double')
** TEST FAILED **


The following build commands failed:
    CompileC /Users/djx/Library/Developer/Xcode/DerivedData/WebDriverAgent-dgapfvuoqjmpyehcyyvidqwjgymp/Build/Intermediates/WebDriverAgent.build/Debug-iphoneos/XCTWebDriverAgentLib.build/Objects-normal/armv7/FBCustomCommands.o XCTWebDriverAgentLib/Commands/FBCustomCommands.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

>> xctest-client.js:227:14 [master] pid:7791 xctest client exit with code: 65, signal: null
>> responseHandler.js:24:12 [master] pid:7791 Recieve HTTP Request from Client: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"platformName":"ios","deviceName":"iPod touch(2)","platformVersion":"9.3.2","udid":"5d2d323666d505449e9a67cbd3fccc8ff80baadf","bundleId":"HM.wristband2"}}
>> session.js:24:10 [master] pid:7791 Creating session, sessionId: 0e0b9986-b27e-4468-a930-c4e3709f1e62.
>> agent path: /usr/local/lib/node_modules/macaca-ios/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcworkspace
>> macaca-ios.js:132:10 [master] pid:7791 {
    "bundleId": "HM.wristband2",
    "platformName": "ios",
    "platformVersion": "9.3.2"
}
>> xctest-client.js:246:12 [master] pid:7791 xcode version: 7.3.1
>> xctest-client.js:219:14 [master] pid:7791 2016-06-13 15:09:22.942 xcodebuild[7825:626748] [MT] IDETestOperationsObserverDebug: (E89B3887-2D0D-4F9B-AFA8-4E5519927DC3) Beginning test session E89B3887-2D0D-4F9B-AFA8-4E5519927DC3 with Xcode 7D1014 on target <DVTiOSDevice: 0x7fc85d130940> {
        deviceSerialNumber:         CCQN6EZ0G22Y
        identifier:                 5d2d323666d505449e9a67cbd3fccc8ff80baadf
        deviceClass:                iPod
        deviceName:                 iPod touch (2)
        deviceIdentifier:           5d2d323666d505449e9a67cbd3fccc8ff80baadf
        productVersion:             9.3.2
        buildVersion:               13F69
        deviceSoftwareVersion:      9.3.2 (13F69)
        deviceArchitecture:         armv7f
        deviceTotalCapacity:        13470396416
        deviceAvailableCapacity:    483946496
        deviceIsTransient:          NO
        ignored:                    NO
        deviceIsBusy:               NO
        deviceIsActivated:          YES
        deviceActivationState:      Activated
        deviceType:                 <DVTDeviceType:0x7fc85cd418c0 Xcode.DeviceType.iPhone>
        supportedDeviceFamilies:    (
    1
)
        applications:              (null)
        provisioningProfiles:      (null)
        activityProgress:          -2
        activityTitle:             
        hasInternalSupport:        NO
        isSupportedOS:             YES
        developerDiskMountError:   (null)
(null)
    } (9.3.2 (13F69))

>> xctest-client.js:219:14 [master] pid:7791 2016-06-13 15:09:22.943 xcodebuild[7825:626771]  IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/djx/Library/Developer/Xcode/DerivedData/WebDriverAgent-dgapfvuoqjmpyehcyyvidqwjgymp/Logs/Test/27997A82-2F80-4C82-8D55-8B29F45B37F6/Session-2016-06-13_15:09:22-b3v8zl.log

>> xctest-client.js:219:14 [master] pid:7791 
Testing failed:

>> xctest-client.js:219:14 [master] pid:7791    Implicit conversion loses floating-point precision: 'double' to 'CGFloat' (aka 'float')
    Implicit conversion increases floating-point precision: 'CGFloat' (aka 'float') to 'NSTimeInterval' (aka 'double')
** TEST FAILED **


The following build commands failed:
    CompileC /Users/djx/Library/Developer/Xcode/DerivedData/WebDriverAgent-dgapfvuoqjmpyehcyyvidqwjgymp/Build/Intermediates/WebDriverAgent.build/Debug-iphoneos/XCTWebDriverAgentLib.build/Objects-normal/armv7/FBCustomCommands.o XCTWebDriverAgentLib/Commands/FBCustomCommands.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

>> xctest-client.js:227:14 [master] pid:7791 xctest client exit with code: 65, signal: null
>> responseHandler.js:24:12 [master] pid:7791 Recieve HTTP Request from Client: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"platformName":"ios","deviceName":"iPod touch(2)","platformVersion":"9.3.2","udid":"5d2d323666d505449e9a67cbd3fccc8ff80baadf","bundleId":"HM.wristband2"}}
>> session.js:24:10 [master] pid:7791 Creating session, sessionId: 1d643da3-0ad4-4d5b-bf6d-ac69d6c7aad7.
>> agent path: /usr/local/lib/node_modules/macaca-ios/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcworkspace
>> macaca-ios.js:132:10 [master] pid:7791 {
    "bundleId": "HM.wristband2",
    "platformName": "ios",
    "platformVersion": "9.3.2"
}
>> xctest-client.js:246:12 [master] pid:7791 xcode version: 7.3.1
>> xctest-client.js:219:14 [master] pid:7791 2016-06-13 15:11:21.971 xcodebuild[7849:627644] [MT] IDETestOperationsObserverDebug: (1E40C4E4-DB20-4D02-8866-4A91C1B2C448) Beginning test session 1E40C4E4-DB20-4D02-8866-4A91C1B2C448 with Xcode 7D1014 on target <DVTiOSDevice: 0x7f86d610f200> {
        deviceSerialNumber:         CCQN6EZ0G22Y
        identifier:                 5d2d323666d505449e9a67cbd3fccc8ff80baadf
        deviceClass:                iPod
        deviceName:                 iPod touch (2)
        deviceIdentifier:           5d2d323666d505449e9a67cbd3fccc8ff80baadf
        productVersion:             9.3.2
        buildVersion:               13F69
        deviceSoftwareVersion:      9.3.2 (13F69)
        deviceArchitecture:         armv7f
        deviceTotalCapacity:        13470396416
        deviceAvailableCapacity:    483815424
        deviceIsTransient:          NO
        ignored:                    NO
        deviceIsBusy:               NO
        deviceIsActivated:          YES
        deviceActivationState:      Activated
        deviceType:                 <DVTDeviceType:0x7f86d3663cd0 Xcode.DeviceType.iPhone>
        supportedDeviceFamilies:    (
    1
)
        applications:              (null)
        provisioningProfiles:      (null)
        activityProgress:          -2
        activityTitle:             
        hasInternalSupport:        NO
        isSupportedOS:             YES
        developerDiskMountError:   (null)
(null)
    } (9.3.2 (13F69))

>> xctest-client.js:219:14 [master] pid:7791 2016-06-13 15:11:21.972 xcodebuild[7849:627658]  IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/djx/Library/Developer/Xcode/DerivedData/WebDriverAgent-dgapfvuoqjmpyehcyyvidqwjgymp/Logs/Test/F1CE5C96-594A-494C-8E6F-2A89C8054E5F/Session-2016-06-13_15:11:21-EL9fgL.log

>> xctest-client.js:219:14 [master] pid:7791 
Testing failed:

>> xctest-client.js:219:14 [master] pid:7791    Implicit conversion loses floating-point precision: 'double' to 'CGFloat' (aka 'float')
    Implicit conversion increases floating-point precision: 'CGFloat' (aka 'float') to 'NSTimeInterval' (aka 'double')
** TEST FAILED **


The following build commands failed:
    CompileC /Users/djx/Library/Developer/Xcode/DerivedData/WebDriverAgent-dgapfvuoqjmpyehcyyvidqwjgymp/Build/Intermediates/WebDriverAgent.build/Debug-iphoneos/XCTWebDriverAgentLib.build/Objects-normal/armv7/FBCustomCommands.o XCTWebDriverAgentLib/Commands/FBCustomCommands.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

>> xctest-client.js:227:14 [master] pid:7791 xctest client exit with code: 65, signal: null
>> 
>>     1) "before all" hook

>> responseHandler.js:24:12 [master] pid:7791 Recieve HTTP Request from Client: method: DELETE url: /wd/hub/session, jsonBody: {}
>> responseHandler.js:32:14 [master] pid:7791 Send HTTP Respone to Client: 405 Method Not Allowed
>> 
>>     2) "after all" hook


>> 

>>   0 passing (5m)

>>   2 failing

>> 

>>   1) macaca mobile sample "before all" hook:
     Error: timeout of 300000ms exceeded. Ensure the done() callback is being called in this test.



>>   2) macaca mobile sample "after all" hook:
     Error: [quit()] Unexpected data in simpleCallback.
      at exports.newError (node_modules/.npminstall/wd/0.4.0/wd/lib/utils.js:139:13)
      at .<anonymous> (node_modules/.npminstall/wd/0.4.0/wd/lib/callbacks.js:42:12)
      at cb (node_modules/.npminstall/wd/0.4.0/wd/lib/webdriver.js:160:22)
      at node_modules/.npminstall/wd/0.4.0/wd/lib/webdriver.js:174:5
      at Request._callback (node_modules/.npminstall/wd/0.4.0/wd/lib/http-utils.js:87:7)
      at Request.self.callback (node_modules/.npminstall/request/2.55.0/request/request.js:368:22)
      at Request.<anonymous> (node_modules/.npminstall/request/2.55.0/request/request.js:1219:14)
      at IncomingMessage.<anonymous> (node_modules/.npminstall/request/2.55.0/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!

ryzn0518 avatar Jun 13 '16 07:06 ryzn0518

@xudafeng 日志已经贴上,在上一个回复

ryzn0518 avatar Jun 13 '16 11:06 ryzn0518