1

I am running calabash-android test for an android application. I need to attach images and videos to a particular section. I can reach the gallery section and after that, I could not select an item from the device library. Is there any way to keep a copy of video and image in my test directory and access the whenever needed? Or is there any solution to access the gallery. And one more thing is that I am integrating the test on Circle-ci later. And I don't know how can I manage it when it is on Circle-ci. All kind of help is appreciated.

Muneer Muhammed
  • 883
  • 3
  • 10
  • 29

1 Answers1

1

Calabash only has access to your app, not anything outside of it.

You will be able to put together a solution using adb to interact with the screen, using touch or keyboard events. However, this will be tied to one specific screen size, as it's done by pixels.

adb shell input tap x y

You could put the images/videos in the directory so they are the most recent, then use adb touch events to select them? It's a bit hacky but it should work.

If I've understood your question correctly, the circle ci part should probably be split out into another question, as it isn't really tied to the previous bit.

EDIT: We ended up getting it to work by running

`adb shell input tap 200 200`
alannichols
  • 1,496
  • 1
  • 10
  • 20
  • But it seems like not working . Exiting with the error "Action 'click_on_screen' unsuccessful: Click can not be completed! (RuntimeError) " . And my commad was "system("#{default_device.adb_command} shell input tap 50 50")" – Muneer Muhammed Mar 22 '16 at 05:51
  • Even I have tried https://groups.google.com/forum/#!topic/calabash-android/y4bQvX1IXW8. But not working yet. – Muneer Muhammed Mar 22 '16 at 10:08
  • My only guess would be that there is an issue with using #{default_device.adb_command} . Does it work if you just run 'adb shell input tap 50 50' from the command line? – alannichols Mar 22 '16 at 10:27
  • I did not run from command line. But instead of "tap" command " input keyevent 4" is working for me. – Muneer Muhammed Mar 22 '16 at 11:15
  • When I run the command from command line it is showing no response. – Muneer Muhammed Mar 22 '16 at 11:26
  • Can you try another adb command and see if it works? Just 'adb shell'? – alannichols Mar 22 '16 at 12:02
  • adb shell command is not working . I am getting "syntax error, unexpected tINTEGER, expecting keyword_end (SyntaxError) " if I use simply the adb shell command without #{default_device.adb_command} – Muneer Muhammed Mar 22 '16 at 12:30
  • OK cool. I'm assuming that if you rub 'adb shell' from the command line it works? If yes then I'm not too sure why 'adb shell input tap 50 50' wouldn't work... Perhaps it is something to do with what it is trying to click on at coordinates 50, 50. Does it respond any differently using other coordinates? I would get it working from the command line first before worrying about doing it from your code. – alannichols Mar 22 '16 at 13:23
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/107088/discussion-between-muneer-muhammed-and-alannichols). – Muneer Muhammed Mar 23 '16 at 04:06