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
1=== modified file 'tests/autopilot/cordova_ubuntu/tests/__init__.py'
2--- tests/autopilot/cordova_ubuntu/tests/__init__.py 2013-10-16 17:03:11 +0000
3+++ tests/autopilot/cordova_ubuntu/tests/__init__.py 2013-11-07 20:18:44 +0000
4@@ -21,6 +21,7 @@
5
6 class CordovaUbuntuTestCase(AutopilotTestCase):
7 """ Base class for Cordova Ubuntu Test Cases """
8+ pointer = Pointer(Touch.create())
9 LOCAL_CORDOVA_CONTAINER_PATH = os.path.abspath("%s/%s" % (os.path.dirname(os.path.realpath(__file__)),
10 '../../tools/qml/main-local.qml'))
11 INSTALLED_CORDOVA_CONTAINER_PATH = '/usr/share/cordova-ubuntu-tests/autopilot-tests/qml/main.qml'
12@@ -53,6 +54,9 @@
13
14 def tearDown(self):
15 super(CordovaUbuntuTestCase, self).tearDown()
16+ # Twiddle the mouse to keep the screen awake during testing.
17+ self.pointer.move(150,150)
18+ self.pointer.click()
19
20 def pick_app_launcher(self, app_path):
21 """ Force Qt app introspection """
22
23=== modified file 'tests/autopilot/cordova_ubuntu/tests/test_mobilespec.py'
24--- tests/autopilot/cordova_ubuntu/tests/test_mobilespec.py 2013-10-16 21:39:32 +0000
25+++ tests/autopilot/cordova_ubuntu/tests/test_mobilespec.py 2013-11-07 20:18:44 +0000
26@@ -12,7 +12,6 @@
27
28 from testtools.matchers import Equals
29 from autopilot.matchers import Eventually
30-from unittest import skip
31
32 from cordova_ubuntu.tests import CordovaUbuntuTestCase
33 from unittest import skipIf
34@@ -132,4 +131,3 @@
35 @skipIf('arm' in ARCH, 'This feature not yet supported on ARM.')
36 def test_whitelist(self):
37 self.run_mobilespec('whitelist', 'TEST-whitelist.xml')
38-

Subscribers

People subscribed via source and target branches