【问题标题】:calabash-android: interact with status barcalabash-android:与状态栏交互
【发布时间】:2013-12-19 18:45:38
【问题描述】:

我想编写一个测试,检测带有特定文本的通知在状态栏中可见。到目前为止,我尝试使用swipe 操作来拉下通知抽屉。可悲的是,滑动只能向左和向右,而不是向下。我还尝试使用drag 操作拉下通知抽屉。

【问题讨论】:

  • 据我所知,Calabash 只对给定的应用程序事件产生影响,而不是对 Phone OS 事件产生影响。您无法使用葫芦检查超出应用程序的任何事件。
  • 正如@chathura 所说,这是不可能的。您可能想编写一个单元测试来涵盖这种情况。

标签: android statusbar calabash


【解决方案1】:

我需要做这样的事情。在这种情况下,我在 Appboy 中发送一个 PUSH 通知,并想检查我们是否收到了它。 首先,我创建了一条独特的消息,以免与其他消息混淆:

unique = Time.now.to_i
push_automation_message = "PUSH Automation Msg: #{unique}"

那么……

Then(/^I will see the push notification on Android$/) do
  output = `adb shell dumpsys notification` # dumps information about the status of the notification system service
  expect(output).to include push_automation_message
end

这个解决方案并不理想,但它是一个 MVP,直到我有工具来检查 UI。

【讨论】:

    【解决方案2】:

    我刚刚发表了一篇关于此的文章:https://techblog.badoo.com/blog/2015/06/01/testing-android-notifications-with-calabash/

    总而言之,我们使用“adb shell uiautomator dump”来获取屏幕上的视图列表,使用 xpath 来询问它们的内容,并使用“adb shell input swipe”或“adb shell input tap”来与它们交互.

    这有点笨拙,但确实有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多