1

Recently started with Calabash on iOS. I have a simple code that does a touch("label marked:'Username'") and then uses keyboard_enter_text to enter the text, but for some reason when I run this via cucumber from command line or without setting breakpoints in Rubymine the code just runs and does not produce the desired result and the touch does not seem to do anything and the keyboard is not activated. I am doing this on a real device, (I have tried various devices).

How ever if I debug the code using ruby mine using breakpoint it produces the desired result.

I have the below setup

    $ 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":""} 

I have checked that My App is linked with the correct calabash.framework and that it matches the gem version 0.11.4

When I debug using ruby mine then the steps run successfully (the touch works and the keyboard is activated), how ever when I run from command line or run without breakpoints in Ruby mine, the touch just seems to fail without issuing any warnings or errors. Not sure what is causing it, I have upgraded from Xcode 6.1 to Xcode 6.1.1 and that too did not help.

I have noticed similar issues reported by people in the past, but they have been around older versions of the calabash iOS gem and supposed to have been fixed in 0.11.4

When I run the app in DEBUG mode with DEBUG=1 and HTTP_DEBUG=1 I can see below

Command line run in which touch does not do anything

`

! 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"}

`

Debug run from ruby mine using breakpoint

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

` As we can see the debug run in Rubymine seems to return information about frame ordinates that are missing in the first run

The log output at /var/folders/25/9_sb609576jcmgdbqt553ps08n5b5c/T/run_loop20150227-8208-1g7ccvv/run_loop.out for the failed run

    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

And for the successful debug run (that activated the touch and the keyboard) at /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

The run_loop.out does not seem to give any indication either.

Am I missing something ? Why does the touch not have any effect and not activate the keyboard. Any help is appreciated.

4

1 回答 1

0

我有几个建议。这些不是明确的答案,但文本太长,无法发表评论。

我注意到过去人们报告的类似问题,但它们一直存在于旧版本的葫芦 iOS gem 中,并且应该已在 0.11.4 中修复

你能把你的 gem 和服务器更新到最新的 0.13.0 吗?自 0.11.4 以来已进行了许多修复。

您是否有可能看到:NSLog 输出可能导致应用程序在测试期间变得无响应。?

调试时工作

我怀疑这是因为时间问题,但在看到一些步骤或在 irb 中执行的命令列表之前我无法确认。

于 2015-03-02T18:07:20.413 回答