我想编写一个测试,检测在状态栏中可见带有特定文本的通知。到目前为止,我尝试使用该swipe
操作来拉下通知抽屉。可悲的是,滑动只能向左和向右,而不是向下。我还尝试使用该drag
操作来拉下通知抽屉。
问问题
1167 次
2 回答
3
我需要做这样的事情。在这种情况下,我在 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。
于 2014-09-10T21:05:17.897 回答
0
我刚刚发表了一篇关于此的文章: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”来与它们交互。
这有点笨拙,但它确实有效。
于 2015-06-01T13:38:09.533 回答