Merge lp:~renatofilho/ubuntu-clock-app/autopilot into lp:ubuntu-clock-app/saucy

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 28
Merged at revision: 35
Proposed branch: lp:~renatofilho/ubuntu-clock-app/autopilot
Merge into: lp:ubuntu-clock-app/saucy
Diff against target: 246 lines (+198/-0)
7 files modified
clock/ClockPage.qml (+2/-0)
debian/control (+9/-0)
tests/autopilot/clock_app/__init__.py (+19/-0)
tests/autopilot/clock_app/emulators/__init__.py (+18/-0)
tests/autopilot/clock_app/emulators/main_window.py (+31/-0)
tests/autopilot/clock_app/tests/__init__.py (+70/-0)
tests/autopilot/clock_app/tests/test_clock.py (+49/-0)
To merge this branch: bzr merge lp:~renatofilho/ubuntu-clock-app/autopilot
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Nekhelesh Ramananthan Approve
Review via email: mp+157982@code.launchpad.net

Commit message

Initial autopilot structure.

Description of the change

* Listing autopilot tests:
cd tests/autopilot
autopilot list clock_app

* Running all autopilot tests:
cd tests/autopilot
autopilot run clock_app

* Running specific test:
cd tests/autopilot
autopilot run clock_app.tests.test_clock.TestClock.test_label_value

OBS: you will need to install autopilot-phablet from https://launchpad.net/~phablet-team/+archive/tools

To post a comment you must log in.
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

In https://launchpad.net/~phablet-team/+archive/tools, the autopilot package is not available for precise. Will it be backported? Only the android-tools and phablet-tools is there for precise.

review: Needs Information
Revision history for this message
Michael Zanetti (mzanetti) wrote :

Autopilot can be installed from the autopilot ppa. So far we didn't have autopilot-phablet on precise. I just copied the quantal package to precise. Lets hope it works

https://launchpad.net/~autopilot/+archive/ppa

One note, on precise you can't use the new libautopilot-qt, but need to install its predecessor autopilot-qt5.

Hope this helps,
Michael

26. By Renato Araujo Oliveira Filho

Do not compare the time values due the problem with different system locale.

27. By Renato Araujo Oliveira Filho

Added missing import

28. By Renato Araujo Oliveira Filho

Merged mainline.

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

lgtm. It finally works on my comp. Nice to have autopilots tests landing for clock-app. Thanks renato!

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)
Revision history for this message
David Planella (dpm) wrote :

Al 16/04/13 16:27, En/na Nekhelesh Ramananthan ha escrit:
> The proposal to merge lp:~renatofilho/ubuntu-clock-app/autopilot into lp:ubuntu-clock-app has been updated.
>
> Status: Needs review => Approved
>
> For more details, see:
> https://code.launchpad.net/~renatofilho/ubuntu-clock-app/autopilot/+merge/157982
>

A quick note Renato: I've noticed some of the comments mention other
apps. For example:

"""An emulator class that makes it easy to interact with the camera-app."""

"""A common test case class that provides several useful methods for
mediaplayer-app tests."""

It's a very minor thing, but it might be worth replacing "camera-app"
and "mediaplayer-app" with "clock app" before landing this branch.

Cheers,
David.

--
David Planella
Ubuntu App Development Liaison
http://gplus.to/dplanella / @dplanella
www.ubuntu.com / www.davidplanella.org

Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'clock/ClockPage.qml'
2--- clock/ClockPage.qml 2013-04-11 19:49:04 +0000
3+++ clock/ClockPage.qml 2013-04-16 13:28:23 +0000
4@@ -57,6 +57,8 @@
5 Label {
6 id: currentTimeLabel
7
8+ objectName: "currentTimeLabel"
9+
10 width: parent.width; height: parent.height / 4
11 horizontalAlignment: Text.AlignHCenter
12 verticalAlignment: Text.AlignVCenter
13
14=== modified file 'debian/control'
15--- debian/control 2013-04-11 20:19:21 +0000
16+++ debian/control 2013-04-16 13:28:23 +0000
17@@ -17,3 +17,12 @@
18 qtdeclarative5-qtquick2-plugin,
19 Description: Clock application
20 Ubuntu Core Clock application which provides Stopwatch, Timer, Alarm and Clock functionalities.
21+
22+Package: ubuntu-clock-autopilot
23+Architecture: all
24+Depends: libautopilot-qt,
25+ libqt5test5,
26+ ubuntu-clock-app (= ${source:Version}),
27+Description: Autopilot tests for Ubuntu Clock Application
28+ This package contains autopilot tests for the Ubuntu Clock application.
29+
30
31=== added directory 'tests'
32=== added directory 'tests/autopilot'
33=== added directory 'tests/autopilot/clock_app'
34=== added file 'tests/autopilot/clock_app/__init__.py'
35--- tests/autopilot/clock_app/__init__.py 1970-01-01 00:00:00 +0000
36+++ tests/autopilot/clock_app/__init__.py 2013-04-16 13:28:23 +0000
37@@ -0,0 +1,19 @@
38+# -#- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -#-
39+#
40+# Copyright (C) 2013 Canonical Ltd
41+#
42+# This program is free software: you can redistribute it and/or modify
43+# it under the terms of the GNU General Public License version 3 as
44+# published by the Free Software Foundation.
45+#
46+# This program is distributed in the hope that it will be useful,
47+# but WITHOUT ANY WARRANTY; without even the implied warranty of
48+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49+# GNU General Public License for more details.
50+#
51+# You should have received a copy of the GNU General Public License
52+# along with this program. If not, see <http://www.gnu.org/licenses/>.
53+#
54+# Authored by: Renato Araujo Oliveira Filho <renato@canonical.com>
55+
56+"""clock-app autopilot tests and emulators - top level package."""
57
58=== added directory 'tests/autopilot/clock_app/emulators'
59=== added file 'tests/autopilot/clock_app/emulators/__init__.py'
60--- tests/autopilot/clock_app/emulators/__init__.py 1970-01-01 00:00:00 +0000
61+++ tests/autopilot/clock_app/emulators/__init__.py 2013-04-16 13:28:23 +0000
62@@ -0,0 +1,18 @@
63+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
64+#
65+# Copyright (C) 2013 Canonical Ltd
66+#
67+# This program is free software: you can redistribute it and/or modify
68+# it under the terms of the GNU General Public License version 3 as
69+# published by the Free Software Foundation.
70+#
71+# This program is distributed in the hope that it will be useful,
72+# but WITHOUT ANY WARRANTY; without even the implied warranty of
73+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
74+# GNU General Public License for more details.
75+#
76+# You should have received a copy of the GNU General Public License
77+# along with this program. If not, see <http://www.gnu.org/licenses/>.
78+#
79+# Authored by: Renato Araujo Oliveira Filho <renato@canonical.com>
80+
81
82=== added file 'tests/autopilot/clock_app/emulators/main_window.py'
83--- tests/autopilot/clock_app/emulators/main_window.py 1970-01-01 00:00:00 +0000
84+++ tests/autopilot/clock_app/emulators/main_window.py 2013-04-16 13:28:23 +0000
85@@ -0,0 +1,31 @@
86+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
87+#
88+# Copyright (C) 2013 Canonical Ltd
89+#
90+# This program is free software: you can redistribute it and/or modify
91+# it under the terms of the GNU General Public License version 3 as
92+# published by the Free Software Foundation.
93+#
94+# This program is distributed in the hope that it will be useful,
95+# but WITHOUT ANY WARRANTY; without even the implied warranty of
96+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
97+# GNU General Public License for more details.
98+#
99+# You should have received a copy of the GNU General Public License
100+# along with this program. If not, see <http://www.gnu.org/licenses/>.
101+#
102+# Authored by: Renato Araujo Oliveira Filho <renato@canonical.com>
103+
104+
105+class MainWindow(object):
106+ """An emulator class that makes it easy to interact with the camera-app."""
107+
108+ def __init__(self, app):
109+ self.app = app
110+
111+ def get_qml_view(self):
112+ """Get the main QML view"""
113+ return self.app.select_single("QQuickView")
114+
115+ def get_object(self, typeName, name):
116+ return self.app.select_single(typeName, objectName=name)
117
118=== added directory 'tests/autopilot/clock_app/tests'
119=== added file 'tests/autopilot/clock_app/tests/__init__.py'
120--- tests/autopilot/clock_app/tests/__init__.py 1970-01-01 00:00:00 +0000
121+++ tests/autopilot/clock_app/tests/__init__.py 2013-04-16 13:28:23 +0000
122@@ -0,0 +1,70 @@
123+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
124+#
125+# Copyright (C) 2013 Canonical Ltd
126+#
127+# This program is free software: you can redistribute it and/or modify
128+# it under the terms of the GNU General Public License version 3 as
129+# published by the Free Software Foundation.
130+#
131+# This program is distributed in the hope that it will be useful,
132+# but WITHOUT ANY WARRANTY; without even the implied warranty of
133+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
134+# GNU General Public License for more details.
135+#
136+# You should have received a copy of the GNU General Public License
137+# along with this program. If not, see <http://www.gnu.org/licenses/>.
138+#
139+# Authored by: Renato Araujo Oliveira Filho <renato@canonical.com>
140+
141+
142+"""clock-app autopilot tests."""
143+
144+import os.path
145+import os
146+
147+from autopilot.introspection.qt import QtIntrospectionTestMixin
148+from autopilot.testcase import AutopilotTestCase
149+
150+from clock_app.emulators.main_window import MainWindow
151+
152+class ClockAppTestCase(AutopilotTestCase, QtIntrospectionTestMixin):
153+
154+ """A common test case class that provides several useful methods for mediaplayer-app tests."""
155+
156+ def setUp(self):
157+ super(ClockAppTestCase, self).setUp()
158+
159+ def launch_app(self, movie_file=None):
160+ if movie_file == None:
161+ movie_file = ""
162+ # Lets assume we are installed system wide if this file is somewhere in /usr
163+ if os.path.realpath(__file__).startswith("/usr/"):
164+ self.launch_test_installed(movie_file)
165+ else:
166+ self.launch_test_local(movie_file)
167+
168+ def launch_test_local(self, movie_file):
169+ self.app = self.launch_test_application(
170+ "qmlscene",
171+ "../../ubuntu-clock-app.qml"
172+ )
173+
174+ def launch_test_installed(self, movie_file):
175+ if self.running_on_device():
176+ self.app = self.launch_test_application(
177+ "ubuntu-clock-app",
178+ "--fullscreen "
179+ )
180+ else:
181+ self.app = self.launch_test_application(
182+ "ubuntu-clock-app.qml"
183+ )
184+
185+ @staticmethod
186+ def running_on_device():
187+ return os.path.isfile('/system/usr/idc/autopilot-finger.idc')
188+
189+ @property
190+ def main_window(self):
191+ return MainWindow(self.app)
192+
193
194=== added file 'tests/autopilot/clock_app/tests/test_clock.py'
195--- tests/autopilot/clock_app/tests/test_clock.py 1970-01-01 00:00:00 +0000
196+++ tests/autopilot/clock_app/tests/test_clock.py 2013-04-16 13:28:23 +0000
197@@ -0,0 +1,49 @@
198+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
199+#
200+# Copyright (C) 2013 Canonical Ltd
201+#
202+# This program is free software: you can redistribute it and/or modify
203+# it under the terms of the GNU General Public License version 3 as
204+# published by the Free Software Foundation.
205+#
206+# This program is distributed in the hope that it will be useful,
207+# but WITHOUT ANY WARRANTY; without even the implied warranty of
208+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
209+# GNU General Public License for more details.
210+#
211+# You should have received a copy of the GNU General Public License
212+# along with this program. If not, see <http://www.gnu.org/licenses/>.
213+#
214+# Authored by: Renato Araujo Oliveira Filho <renato@canonical.com>
215+
216+
217+"""Tests for the Clock App"""
218+
219+from __future__ import absolute_import
220+
221+from testtools.matchers import Equals, NotEquals
222+from autopilot.matchers import Eventually
223+
224+from clock_app.tests import ClockAppTestCase
225+
226+import time
227+
228+class TestClock(ClockAppTestCase):
229+ """Tests the clock page features"""
230+
231+ """ This is needed to wait for the application to start.
232+ In the testfarm, the application may take some time to show up."""
233+ def setUp(self):
234+ super(TestClock, self).setUp()
235+ self.launch_app()
236+ self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True)))
237+
238+ def tearDown(self):
239+ super(TestClock, self).tearDown()
240+
241+ """ Test if the clock labels contains the correct time """
242+ def test_label_value(self):
243+ label = self.main_window.get_object("Label", "currentTimeLabel")
244+
245+ # TODO: investigate a way to get the system wide format for time and compare the values
246+ self.assertThat(label.text, Eventually(NotEquals('')))

Subscribers

People subscribed via source and target branches