Merge lp:~om26er/ubuntu-weather-app/port_autopilot_1.3 into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Omer Akram on 2013-05-31
Status: Merged
Approved by: Martin Borho on 2013-05-31
Approved revision: 27
Merged at revision: 27
Proposed branch: lp:~om26er/ubuntu-weather-app/port_autopilot_1.3
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 83 lines (+25/-16)
2 files modified
tests/autopilot/ubuntu_weather_app/tests/__init__.py (+23/-14)
tests/autopilot/ubuntu_weather_app/tests/test_mainview.py (+2/-2)
To merge this branch: bzr merge lp:~om26er/ubuntu-weather-app/port_autopilot_1.3
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2013-05-31
Martin Borho 2013-05-31 Approve on 2013-05-31
Review via email: mp+166792@code.launchpad.net

Commit message

Port autopilot tests to 1.3

Description of the change

Port autopilot tests to 1.3

To post a comment you must log in.
review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntu_weather_app/tests/__init__.py'
2--- tests/autopilot/ubuntu_weather_app/tests/__init__.py 2013-04-22 13:20:27 +0000
3+++ tests/autopilot/ubuntu_weather_app/tests/__init__.py 2013-05-31 13:26:50 +0000
4@@ -10,24 +10,32 @@
5 import os.path
6 import glob
7
8-from autopilot.introspection.qt import QtIntrospectionTestMixin
9+from autopilot.input import Mouse, Touch, Pointer
10+from autopilot.platform import model
11 from autopilot.testcase import AutopilotTestCase
12
13 from ubuntu_weather_app.emulators.main_window import MainWindow
14
15
16-class WeatherTestCase(AutopilotTestCase, QtIntrospectionTestMixin):
17+class WeatherTestCase(AutopilotTestCase):
18
19 """A common test case class that provides several useful methods for
20 weather app tests."""
21
22+ if model() == 'Desktop':
23+ scenarios = [('with mouse', dict(input_device_class=Mouse))]
24+ else:
25+ scenarios = [('with touch', dict(input_device_class=Touch))]
26+
27+ local_location = "../../ubuntu-weather-app.qml"
28+
29 def setUp(self):
30+ self.pointing_device = Pointer(self.input_device_class.create())
31 super(WeatherTestCase, self).setUp()
32- # Lets assume we are installed system wide if this file is in /usr
33- if os.path.realpath(__file__).startswith("/usr/"):
34+ if os.path.exists(self.local_location):
35+ self.launch_test_local()
36+ else:
37 self.launch_test_installed()
38- else:
39- self.launch_test_local()
40
41 """Workaround to find the qmlscene binary via shell globbing.
42 This is needed since we can't rely on qt5-default being installed on
43@@ -36,16 +44,17 @@
44 return glob.glob("/usr/lib/*/qt5/bin/qmlscene")[0]
45
46 def launch_test_local(self):
47- self.app = self.launch_test_application(self.qmlscene(),
48- "../../ubuntu-weather-app.qml")
49+ self.app = self.launch_test_application(
50+ self.qmlscene(),
51+ self.local_location,
52+ app_type='qt')
53
54 def launch_test_installed(self):
55- main_qml = "/usr/share/ubuntu-weather-app/ubutnu-weather-app.qml"
56- self.app = self.launch_test_application(self.qmlscene(), main_qml)
57-
58- @staticmethod
59- def running_on_device():
60- return os.path.isfile('/system/usr/idc/autopilot-finger.idc')
61+ self.app = self.launch_test_application(
62+ self.qmlscene(),
63+ "/usr/share/ubuntu-weather-app/ubuntu-weather-app.qml",
64+ "--desktop_file_hint=/usr/share/applications/ubuntu-weather-app.desktop",
65+ app_type='qt')
66
67 @property
68 def main_window(self):
69
70=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_mainview.py'
71--- tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-04-22 13:20:27 +0000
72+++ tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-05-31 13:26:50 +0000
73@@ -22,8 +22,8 @@
74 In the testfarm, the application may take some time to show up."""
75 def setUp(self):
76 super(TestMainView, self).setUp()
77- self.assertThat(self.main_window.get_qml_view().visible,
78- Eventually(Equals(True)))
79+ self.assertThat(
80+ self.main_window.get_qml_view().visible, Eventually(Equals(True)))
81
82 def tearDown(self):
83 super(TestMainView, self).tearDown()

Subscribers

People subscribed via source and target branches