Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
469 views
in Technique[技术] by (71.8m points)

android - Calabash handling "Complete action using" dialog

I want to test sharing functionality of an app but I have no idea how to handle android dialog "Complete action using" (Facebook, Gmail etc.)
When I use query("*") it is returning an empty set of fields.
Is there any way to handle such system dialogs using Calabash or any other way to test such functionality as sharing?

I am running my tests on physical device.

Edit: If there is no way to check whether the dialog has been opened or not, then maybe it is possible using adb shell or something like that?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It's not a very elegant solution but you can simulate screen touches using adb. There is an answer that covers it here - simulating touch using ADB

Edit: Adding some details on using adb to dump a file of all of the UI elements.

In the android sdk in the platforms/android-L folder there is a tool called uiautomater.jar that adb can use to run tests (though I've never used it for that) and to dump an xml file of the visible elements.

adb shell uiautomator dump test.xml

will create the xml file (on the device not your computer) that you could then look through in your code to check for the pop up you want. If you want to interact with the pop up then you can use the coordinates given in the xml dump to pick which one you want and use an adb touch event to click it.

Not a pretty solution but hopefully not too difficult to work into your tests :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...