最近在iOS上开始使用Calabash。
我有一个简单的代码执行touch("label marked:'Username'")
,然后使用keyboard_enter_text
输入文本,但出于某种原因,当我从命令行通过黄瓜运行或没有在Rubymine中设置断点时,代码只运行没有产生所需的结果,触摸似乎没有做任何事情,键盘没有激活。我在真实设备上这样做,(我尝试了各种设备)。
如果我使用断点使用ruby mine调试代码,它会产生所需的结果。
我有以下设置
$ xcode-select --print-path /Applications/Xcode.app/Contents/Developer $ xcodebuild -version Xcode 6.1.1 Build version 6A2008a $ calabash-ios version 0.11.4 curl http://:37265/version {"app_version":"4.3", "outcome":"SUCCESS", "app_id":"****", "simulator_device":"", "version":"0.11.4", "app_name":"***", "iphone_app_emulated_on_ipad":false, "4inch":true, "git":{"remote_origin":"git@github.com:calabash\/calabash-ios-server.git", "branch":"master","revision":"bcc992b"}, "screen_dimensions":{"scale":2,"width":640,"sample":1,"height":1136}, "iOS_version":"7.1.2", "system":"iPhone5,2","simulator":""}
我已检查过我的应用与正确的calabash.framework相关联,并且它与宝石版本0.11.4相匹配
当我使用ruby mine进行调试时,步骤成功运行(触摸工作并且键盘被激活),无论我从命令行运行还是在Ruby矿中没有断点运行,触摸似乎都失败而没有发出任何警告或错误。不确定是什么导致它,我已经从Xcode 6.1升级到Xcode 6.1.1,这也没有帮助。
我注意到过去人们报告的类似问题,但他们已经使用旧版本的calabash iOS gem并且应该已经修复了0.11.4
当我在DEBUG模式下运行应用程序时,DEBUG = 1且HTTP_DEBUG = 1,我可以在下面看到
触摸无法执行任何操作的命令行
`
! CONNECT TO <ip>:37265
! CONNECTION ESTABLISHED
POST /map HTTP/1.1
Content-Type: application/x-www-form-urlencoded
User-Agent: HTTPClient/1.0 (2.3.4.1, ruby 2.1.5 (2014-11-13))
Accept: */*
Date: Fri, 27 Feb 2015 16:19:55 GMT
Content-Length: 97
Host: <ip>:37265
{"query":"view marked:'Problems signing in?'","operation":{"method_name":"query","arguments":[]}}
= Response
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Length: 66
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Date: Fri, 27 Feb 2015 16:19:56 GMT
Accept-Ranges: bytes
Access-Control-Max-Age: 3000
{"status_bar_orientation":"down","results":[],"outcome":"SUCCESS"}
`
使用断点从ruby mine运行调试
CONNECT TO <ip>:37265
! CONNECTION ESTABLISHED
POST /map HTTP/1.1
Content-Type: application/x-www-form-urlencoded
User-Agent: HTTPClient/1.0 (2.3.4.1, ruby 1.9.3 (2013-06-27))
Accept: */*
Date: Fri, 27 Feb 2015 16:18:07 GMT
Content-Length: 97
Host: <ip>:37265
{"query":"view marked:'Problems signing in?'","operation":{"method_name":"query","arguments":[]}}
= Response
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Length: 478
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Date: Fri, 27 Feb 2015 16:18:08 GMT
Accept-Ranges: bytes
Access-Control-Max-Age: 3000
{"status_bar_orientation":"down","results":[{"text":"Problems signing in?","enabled":true,"rect":{"center_x":160,"y":504,"width":200,"x":60,"center_y":526,"height":44},"id":null,"description":"<UILabel: 0x14dde8d0; frame = (60 504; 200 44); text = 'Problems signing in?'; gestureRecognizers = <NSArray: 0x14dde1f0>; layer = <CALayer: 0x14dde980>>","label":"Problems signing in?","alpha":1,"class":"UILabel","frame":{"y":504,"width":200,"x":60,"height":44}}],"outcome":"SUCCESS"}= Request
` 我们可以看到Rubymine中的调试运行似乎返回有关第一次运行中缺少的帧纵坐标的信息
/ strong/folders/25/9_sb609576jcmgdbqt553ps08n5b5c/T/run_loop20150227-8208-1g7ccvv/run_loop.out的日志输出运行失败
2015-02-27 16:19:51.871 instruments[8229:591f] WebKit Threading Violation - initial use of WebKit from a secondary thread. 2015-02-27 16:19:56 +0000 Default: OUTPUT_JSON: {"status":"success","value":true,"index":0} END_OUTPUT
对于成功调试运行(激活触摸和键盘)/var/folders/25/9_sb609576jcmgdbqt553ps08n5b5c/T/run_loop20150227-7941-1c6mznp/run_loop.out
2015-02-27 16:18:00.085 instruments[7962:4f17] WebKit Threading Violation - initial use of WebKit from a secondary thread. 2015-02-27 16:18:04 +0000 Default: OUTPUT_JSON: {"status":"success","value":true,"index":0} END_OUTPUT
run_loop.out似乎也没有给出任何指示。
我错过了什么吗?为什么触摸没有任何效果,也没有激活键盘。任何帮助表示赞赏。
答案 0 :(得分:0)
我有几点建议。这些不是明确的答案,但文本太长,无法发表评论。
我注意到过去人们报告的类似问题,但他们已经使用旧版本的calabash iOS gem并且应该已经修复了0.11.4
您可以将您的gem和服务器更新到最新的0.13.0吗?自0.11.4以来有很多修正。
您是否有可能看到这个:NSLog output can cause apps to become unresponsive during testing.?
在调试时工作
我怀疑这是因为时间问题,但在我看到irb中执行的一些步骤或命令列表之前我无法确认。