2

我正在将 Calabash 集成到一个大型项目中。我有 Calabash 在测试应用程序中工作,所以我知道我的安装和环境设置正确。我正在使用可访问性标签和 .feature 文件来点击按钮并在字段中输入文本。它工作得很好。

然而,我的“真实”项目更大更复杂。即使配置与我的测试应用程序相同(请参阅下面的统计信息),当我在真实应用程序上运行一个简单的 .feature 文件时,我会得到不稳定的结果:大约 80% 的时间,它甚至在通过“ .feature 文件的“给定”行,并最终超时并显示以下消息:

Retrying.. HTTPClient::ReceiveTimeoutError: (execution expired)

我注意到在这些情况下,当我尝试使用鼠标与之交互时,该应用程序完全没有响应。它似乎已经冻结了。还有一个 UIAlertView 应该出现,但从未出现。请注意,当我从 XCode(相同的“-cal”目标)启动模拟器时,它永远不会冻结。我可以与之交互,UIAlert 出现,一切正常。

另外 20% 的时间,它将使它在我的 .feature 文件中更进一步——它会有效地通过“Given”行,可能还有其他行,只要它们不涉及与屏幕交互。任何敲击或键入命令都会导致它挂起并最终超时,并显示与上述相同的“执行过期”消息。

经过大量调查,我消除了此应用程序和我的测试应用程序的环境/配置之间的任何可能差异,并确定我的应用程序一定有一些 Calabash 真的不喜欢的地方!不幸的是,我对葫芦太不熟悉了,不知道从哪里开始寻找。任何帮助,将不胜感激。

Calabash 团队要求的诊断:

> xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
> xcodebuild -version
Xcode 6.1
Build version 6A1052d
> calabash-ios version
0.11.3
> calabash.framework/Resources/version
0.11.3
irb(main):006:0> server_version
{
                    "app_version" => "0.10",
                        "outcome" => "SUCCESS",
                         "app_id" => "<redacted>",
           "simulator_device" => "iPhone",
                        "version" => "0.11.3",
                       "app_name" => "<redacted>",
    "iphone_app_emulated_on_ipad" => false,
                          "4inch" => true,
                            "git" => {
        "remote_origin" => "git@github.com:calabash/calabash-ios-server.git",
               "branch" => "master",
             "revision" => "40c6245"
    },
          "screen_dimensions" => {
         "scale" => 2,
         "width" => 640,
        "sample" => 1,
        "height" => 1136
    },
                    "iOS_version" => "8.1",
                         "system" => "x86_64",
                      "simulator" => ""
}
4

3 回答 3

1

您是否尝试过将葫芦更新到 0.13?并且您添加了 CFNetwork 框架吗?

你是否添加了 -force_load "$(SRCROOT)/calabash.framework/calabash" -lstdc++?

对不起,缺乏信息,这就是我能想到的?如果你已经解决了这个问题。你能关掉它吗?

于 2015-04-20T09:56:47.567 回答
0

There's also a UIAlertView that should be appearing, but never does. Note that when I launch the simulator from XCode (the same "-cal" target), it never freezes up. I can interact with it, the UIAlert comes up, everything works fine.

The other 20% of the time, it will make it a little further into my .feature file than that- it will effectively pass the "Given" line, and possibly others, so long as they do not involve interacting with the screen. Any tapping or typing commands will cause it to hang and eventually time out with the same "execution expired" message as above.

Calabash tries to dismiss privacy alerts automatically. At the moment, there is no way to opt out of this behavior (there is an open issue in run-loop).

I think what is happening is that the UIAlertView is appearing before instruments can take control of your app. A detailed discussion about this topic and solutions can be found on the Managing Privacy Alerts wiki page.

Briefly, you need to delay the appearance of the UIAlertView.

于 2015-05-01T13:23:58.340 回答
0

您可以使用 calabash-ios 控制台成功启动模拟器吗?

尝试编辑并使用它来运行已经构建 -cal 目标

DEBUG=1 DEVICE_TARGET='iPhone 5s (7.1 Simulator)' SDK_VERSION=7.1 PLATFORM=iphone cucumber -v --format html --out iphone.html $BASE_PATH/your-app/features/TESTCASE.feature
于 2014-10-29T18:19:55.830 回答