Calabash-tests fail when running on device when screen lock kicks in

634 views
Skip to first unread message

Ian H

unread,
Jul 27, 2012, 9:52:17 AM7/27/12
to calabash...@googlegroups.com
Is there a way of inserting into calabash-android run "wake up" or something to unlock the screen?

I cant figure out a way of doing this, I've turned it off in settings but still kicks in after a while. This is going on my ci server so i need it to wake up!

Thanks,
Ian

Sampo Niskanen

unread,
Aug 13, 2012, 9:29:37 AM8/13/12
to calabash...@googlegroups.com
Hi,

I'm having the same issue.  When the screen is locked, all the tests fail.  On Samsung Galaxy phones it's impossible to set the screen lock delay to be longer than 10 minutes, so you have to manually unlock the screen before any tests are run.

Wakey Droid is a minimalist app that allows waking up the phone from the command line using adb (which just starts the app).  As a workaround, you could install the app on the phone and run the adb command before the tests, but this seems like something that should be part of Calabash.

The source code for Wakey Droid is available (http://bitmote.com/index.php?pages/Wakey-Droid) and is only ~20 lines long.  I tried to hack together an action that would do the same, but it didn't work.  I omitted the setContentView and postDelayed parts, which evidently are necessary, or some of the XML configuration.  Does someone have an idea how to get this working?


Regards,
    Sampo N.
Message has been deleted

Jonas Maturana Larsen

unread,
Oct 19, 2012, 1:58:25 AM10/19/12
to calabash...@googlegroups.com
Hi guys,

Have you tried 0.3.2?
We have made an attempt at unlocking the screen. I would really like to hear if it solves your problems.

- Jonas

On Thursday, October 18, 2012 at 16:53 , Mark Barzilay wrote:

Same here. Have not found a way of solving this yet. One possible workaround might be to run the tests on a high frequency so the timer that locks the screen doesnt kick in.

Mark Barzilay

unread,
Oct 23, 2012, 5:36:58 AM10/23/12
to calabash...@googlegroups.com
Hi Jonas,

Thanks for the update. Hmm, I tried the new calabash-android version but it did not wake up the device for me (tested on Android 2.3 and 4.0.3). Should it work out of the box? Is there anything I can provide (e.g. log) to debug this issue? Im still using Wakey Droid as a workaround.

Best Regards,
Mark

Adam Niedzielski

unread,
Oct 25, 2012, 2:28:16 AM10/25/12
to calabash...@googlegroups.com
Have you changed app_life_cycle_hooks.rb file in your testing directory from this:

require 'calabash-android/management/
adb'

Before do |scenario|
  start_test_server_in_background
end

After do
    shutdown_test_server
end

to this:

require 'calabash-android/management/adb'
require 'calabash-android/operations'
include Calabash::Android::Operations

AfterConfiguration do |config|
  wake_up
end

Before do |scenario|
  start_test_server_in_background
end

After do
    shutdown_test_server
end


??

Mark Barzilay

unread,
Oct 25, 2012, 7:23:48 AM10/25/12
to calabash...@googlegroups.com
Thanks for the feedback, I was still missing the wake_up call, obviously. Adding that worked for me. Many thanks for the support.

Christopher Gilroy

unread,
May 28, 2015, 12:32:28 PM5/28/15
to calabash...@googlegroups.com
I followed all the instructions placed here, but what I am seeing is the device waking up, but the screen not unlocking and the Phone just goes back to sleep. Tests Fail... I tried adding a swipe to the test, but that didn't do anything, so... What else can I do to fix this?

Thanks
Reply all
Reply to author
Forward
0 new messages