Merge lp:~robru/cordova-ubuntu-tests/keep-screen-on into lp:cordova-ubuntu-tests

Proposed by Robert Bruce Park
Status: Merged
Approved by: Robert Bruce Park
Approved revision: 32
Merged at revision: 30
Proposed branch: lp:~robru/cordova-ubuntu-tests/keep-screen-on
Merge into: lp:cordova-ubuntu-tests
Diff against target: 38 lines (+4/-2)
2 files modified
tests/autopilot/cordova_ubuntu/tests/__init__.py (+4/-0)
tests/autopilot/cordova_ubuntu/tests/test_mobilespec.py (+0/-2)
To merge this branch: bzr merge lp:~robru/cordova-ubuntu-tests/keep-screen-on
Reviewer Review Type Date Requested Status
Víctor R. Ruiz (community) Needs Fixing
Robert Bruce Park (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+194216@code.launchpad.net

Commit message

Move the mouse around to keep the screen awake.

Description of the change

Cordova's is the only autopilot test I've ever seen that does not use any mouse/touch/pointer at all. As a result of this, the screen tends to blank during testing. I'm not entirely certain, but I think this screen blanking may result in some intermittent test failing.

So, here i just fiddle with the mouse at the start of each test, ensuring that the screen stays awake during the entire testsuite.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Víctor R. Ruiz (vrruiz) wrote :

This tests should also work on the desktop, where Touch is not available. Use this instead:

    @property
    def pointer(self):
        """ Return pointer """
        return Pointer(self.input_device_class.create())

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Robert Bruce Park (robru) wrote :

No, that doesn't work, Victor. I'm not sure why it doesn't, but the screen sleeps with that code.

Try this branch with and without revision 32... revision 31 works fine on desktop, and keeps phones awake. With revision 32 (your pointer code), it doesn't keep the phone awake.

32. By Robert Bruce Park

Merge trunk.

Revision history for this message
Robert Bruce Park (robru) wrote :

With this branch as-is I am reliably getting mouse movement on both the device and the desktop, both of which are preventing sleep. Victor, I suspect your way only works with autopilot-1.4, because it gives me errors that input_device_class doesn't exist.

We should land this for now and then if there's any problems later (eg, after the autopilot 1.4 transition is complete), we can switch to your way.

review: Approve
Revision history for this message
Víctor R. Ruiz (vrruiz) wrote :

Touch is supposed to work only in the phone, not in the desktop, that's why you need the pointer property. Also, above is 1.3 code, but the class inherits UbuntuUIToolkitAppTestCase.

I didn't approve your merge proposal, because I'm trying to solve this in the correct way, which is fixing either autopilot-touch or phablet-tools. It seems it impacts other tests as well. Probably this code must be removed in the future.

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/autopilot/cordova_ubuntu/tests/__init__.py'
--- tests/autopilot/cordova_ubuntu/tests/__init__.py 2013-10-16 17:03:11 +0000
+++ tests/autopilot/cordova_ubuntu/tests/__init__.py 2013-11-07 20:18:44 +0000
@@ -21,6 +21,7 @@
2121
22class CordovaUbuntuTestCase(AutopilotTestCase):22class CordovaUbuntuTestCase(AutopilotTestCase):
23 """ Base class for Cordova Ubuntu Test Cases """23 """ Base class for Cordova Ubuntu Test Cases """
24 pointer = Pointer(Touch.create())
24 LOCAL_CORDOVA_CONTAINER_PATH = os.path.abspath("%s/%s" % (os.path.dirname(os.path.realpath(__file__)),25 LOCAL_CORDOVA_CONTAINER_PATH = os.path.abspath("%s/%s" % (os.path.dirname(os.path.realpath(__file__)),
25 '../../tools/qml/main-local.qml'))26 '../../tools/qml/main-local.qml'))
26 INSTALLED_CORDOVA_CONTAINER_PATH = '/usr/share/cordova-ubuntu-tests/autopilot-tests/qml/main.qml'27 INSTALLED_CORDOVA_CONTAINER_PATH = '/usr/share/cordova-ubuntu-tests/autopilot-tests/qml/main.qml'
@@ -53,6 +54,9 @@
5354
54 def tearDown(self):55 def tearDown(self):
55 super(CordovaUbuntuTestCase, self).tearDown()56 super(CordovaUbuntuTestCase, self).tearDown()
57 # Twiddle the mouse to keep the screen awake during testing.
58 self.pointer.move(150,150)
59 self.pointer.click()
5660
57 def pick_app_launcher(self, app_path):61 def pick_app_launcher(self, app_path):
58 """ Force Qt app introspection """62 """ Force Qt app introspection """
5963
=== modified file 'tests/autopilot/cordova_ubuntu/tests/test_mobilespec.py'
--- tests/autopilot/cordova_ubuntu/tests/test_mobilespec.py 2013-10-16 21:39:32 +0000
+++ tests/autopilot/cordova_ubuntu/tests/test_mobilespec.py 2013-11-07 20:18:44 +0000
@@ -12,7 +12,6 @@
1212
13from testtools.matchers import Equals13from testtools.matchers import Equals
14from autopilot.matchers import Eventually14from autopilot.matchers import Eventually
15from unittest import skip
1615
17from cordova_ubuntu.tests import CordovaUbuntuTestCase16from cordova_ubuntu.tests import CordovaUbuntuTestCase
18from unittest import skipIf17from unittest import skipIf
@@ -132,4 +131,3 @@
132 @skipIf('arm' in ARCH, 'This feature not yet supported on ARM.')131 @skipIf('arm' in ARCH, 'This feature not yet supported on ARM.')
133 def test_whitelist(self):132 def test_whitelist(self):
134 self.run_mobilespec('whitelist', 'TEST-whitelist.xml')133 self.run_mobilespec('whitelist', 'TEST-whitelist.xml')
135

Subscribers

People subscribed via source and target branches