0

In my application that I’m testing I have an option to send feedback to the customer. When I use that option, the gmail opened and then I kind of ‘locked outside’ of my application. Of course the query(“*”) returns '[]' and the command press_back_button gives me the error above. Looking around and found some solutions with root the device.

For me it is out of the question – we are developing apps for our customers and as a QA manager I cannot test different environment than the end client.

So, I’m using adb shell commands:

system("adb shell input text 'this%sis%san%sexample' ")

system("adb shell input keyevent 66") ---for enter

system("adb shell input keyevent 4") ----for go back

system("adb shell input keyevent 27") --- to take a picture.

(the entire list you can find here - ADB Shell Input Events)

But, I work blindness here.

Is there an adb shell commands equivalent for ‘query’?

Community
  • 1
  • 1
Nir Ortal
  • 77
  • 12
  • What do you want to do when you are on the gmail screen? Just take a screenshot, then return to the app? – alannichols Apr 08 '15 at 08:35
  • write a message, add subject and send it for example – Nir Ortal Apr 08 '15 at 12:39
  • Can I ask why you need to actually send an email? Wouldn't it be reasonable to assume that gmail works? That way a screenshot that shows a prepopulated email address should be enough for you to be happy the test is passing? – alannichols Apr 13 '15 at 16:44
  • this is part of our testing. also, some of the menu options are going out to the browser or take pictures or pick a picture from the gallery. sometimes it is asking you to pick a browser or pictures repository if you didnt set a default for those. there is also an issue that one of the buttons show up in the query, but if the keyboard is up and hide that button, you will get the same error when you try to press on it. --- i need a command that can tell me what i see on the screen when i'm 'out' of my apk – Nir Ortal Apr 14 '15 at 06:55
  • I've posted an answer with a way that I think should work for you to see what's on the screen, but can I ask if it is part of your testing because after you use the outside app it returns to your test app in some way? If it doesn't then I would really suggest using either screenshots or the ui dump method that i posted below to assert that the correct external app is present, and not to bother testing the external apps. For example, if you are testing external email apps then where do you draw the line, because there are so many for users to have installed? – alannichols Apr 14 '15 at 09:03
  • it can work if you test 1-2 devices. but we want to test the Xamarin test cloud - http://xamarin.com/test-cloud - and then, screenshot won't help a lot. i will try the dump method -- thank you!!!! – Nir Ortal Apr 14 '15 at 14:17

1 Answers1

0

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.

This is copied from a different question I answered - Calabash handling "Complete action using" dialog which has a little more detail if needed.

Community
  • 1
  • 1
alannichols
  • 1,496
  • 1
  • 10
  • 20