Merge lp:~schwann/ubuntu-weather-app/weather-first-autopilot-test into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Günter Schwann on 2013-04-05
Status: Merged
Approved by: Martin Borho on 2013-04-25
Approved revision: 11
Merged at revision: 12
Proposed branch: lp:~schwann/ubuntu-weather-app/weather-first-autopilot-test
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 207 lines (+140/-0)
10 files modified
debian/control (+11/-0)
debian/rules (+1/-0)
debian/ubuntu-weather-app-autopilot.install (+1/-0)
tests/autopilot/install_autopilot.sh (+8/-0)
tests/autopilot/ubuntu_weather_app/__init__.py (+8/-0)
tests/autopilot/ubuntu_weather_app/emulators/__init__.py (+6/-0)
tests/autopilot/ubuntu_weather_app/emulators/main_window.py (+19/-0)
tests/autopilot/ubuntu_weather_app/tests/__init__.py (+52/-0)
tests/autopilot/ubuntu_weather_app/tests/test_mainview.py (+33/-0)
ubuntu-weather-app.qml (+1/-0)
To merge this branch: bzr merge lp:~schwann/ubuntu-weather-app/weather-first-autopilot-test
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2013-04-22
Martin Borho 2013-04-05 Approve on 2013-04-18
Michael Hall 2013-04-05 Pending
Review via email: mp+157298@code.launchpad.net

Commit message

First and simple autopilot test

Description of the change

First and simple autopilot test

To post a comment you must log in.
Martin Borho (martin-borho) wrote :

Is the print statement in WeatherTestCase.setUp needed?

Martin Borho (martin-borho) wrote :

Looks okay for me

review: Approve
9. By Günter Schwann on 2013-04-19

Merge trunk

10. By Günter Schwann on 2013-04-22

Merge trunk

11. By Günter Schwann on 2013-04-22

Add missing install file

Günter Schwann (schwann) wrote :

Martin - please top approve again

Martin Borho (martin-borho) wrote :

Hi Günter,

the daily build fails now with:

tests/autopilot/install_autopilot.sh /build/buildd/ubuntu-weather-app-0.1bzr14quantal0
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named distutils.sysconfig
dh_install --fail-missing
dh_install: ubuntu-weather-app-autopilot missing files (/usr/lib/python*/dist-packages/ubuntu_weather_app/), aborting
make[1]: *** [override_dh_install] Error 2
make[1]: Leaving directory `/build/buildd/ubuntu-weather-app-0.1bzr14quantal0'
make: *** [binary] Error 2
dpkg-buildpackage: error: /usr/bin/fakeroot debian/rules binary gave error exit statu

Is "python-setuptools" missing in debian/control for ubuntu-weather-app-autopilot?

Cheers
Martin

Günter Schwann (schwann) wrote :

Hi Martin,

do you have a link to a failing CI job? I couldn't find one, and the
debian/control file looks ok to me.

Cheers
Günter

On 05/01/2013 02:30 PM, Martin Borho wrote:
> Hi Günter,
>
> the daily build fails now with:
>
> tests/autopilot/install_autopilot.sh /build/buildd/ubuntu-weather-app-0.1bzr14quantal0
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> ImportError: No module named distutils.sysconfig
> dh_install --fail-missing
> dh_install: ubuntu-weather-app-autopilot missing files (/usr/lib/python*/dist-packages/ubuntu_weather_app/), aborting
> make[1]: *** [override_dh_install] Error 2
> make[1]: Leaving directory `/build/buildd/ubuntu-weather-app-0.1bzr14quantal0'
> make: *** [binary] Error 2
> dpkg-buildpackage: error: /usr/bin/fakeroot debian/rules binary gave error exit statu
>
>
> Is "python-setuptools" missing in debian/control for ubuntu-weather-app-autopilot?
>
> Cheers
> Martin

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2013-04-11 20:37:30 +0000
3+++ debian/control 2013-04-22 14:07:38 +0000
4@@ -16,3 +16,14 @@
5 qtdeclarative5-qtquick2-plugin
6 Description: Weather application
7 Core Weather application
8+
9+Package: ubuntu-weather-app-autopilot
10+Architecture: all
11+Depends: ${misc:Depends},
12+ python2.7,
13+ ubuntu-weather-app (= ${source:Version}),
14+ libautopilot-qt,
15+ libqt5test5,
16+ libqt5widgets5,
17+Description: Test package for the weather app
18+ Autopilot tests for the weather app package
19
20=== modified file 'debian/rules'
21--- debian/rules 2013-04-11 20:37:30 +0000
22+++ debian/rules 2013-04-22 14:07:38 +0000
23@@ -8,4 +8,5 @@
24 dh $@
25
26 override_dh_install:
27+ tests/autopilot/install_autopilot.sh $(CURDIR)
28 dh_install --fail-missing
29
30=== added file 'debian/ubuntu-weather-app-autopilot.install'
31--- debian/ubuntu-weather-app-autopilot.install 1970-01-01 00:00:00 +0000
32+++ debian/ubuntu-weather-app-autopilot.install 2013-04-22 14:07:38 +0000
33@@ -0,0 +1,1 @@
34+/usr/lib/python*/dist-packages/ubuntu_weather_app/
35
36=== added directory 'tests'
37=== added directory 'tests/autopilot'
38=== added file 'tests/autopilot/install_autopilot.sh'
39--- tests/autopilot/install_autopilot.sh 1970-01-01 00:00:00 +0000
40+++ tests/autopilot/install_autopilot.sh 2013-04-22 14:07:38 +0000
41@@ -0,0 +1,8 @@
42+#!/bin/bash
43+
44+PYDIR=`python -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()'`
45+CURDIR=$1
46+
47+mkdir -p ${CURDIR}/debian/tmp${PYDIR}
48+cp -r tests/autopilot/ubuntu_weather_app ${CURDIR}/debian/tmp${PYDIR}
49+
50
51=== added directory 'tests/autopilot/ubuntu_weather_app'
52=== added file 'tests/autopilot/ubuntu_weather_app/__init__.py'
53--- tests/autopilot/ubuntu_weather_app/__init__.py 1970-01-01 00:00:00 +0000
54+++ tests/autopilot/ubuntu_weather_app/__init__.py 2013-04-22 14:07:38 +0000
55@@ -0,0 +1,8 @@
56+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
57+# Copyright 2013 Canonical
58+#
59+# This program is free software: you can redistribute it and/or modify it
60+# under the terms of the GNU General Public License version 3, as published
61+# by the Free Software Foundation.
62+
63+"""weather app autopilot tests and emulators - top level package."""
64
65=== added directory 'tests/autopilot/ubuntu_weather_app/emulators'
66=== added file 'tests/autopilot/ubuntu_weather_app/emulators/__init__.py'
67--- tests/autopilot/ubuntu_weather_app/emulators/__init__.py 1970-01-01 00:00:00 +0000
68+++ tests/autopilot/ubuntu_weather_app/emulators/__init__.py 2013-04-22 14:07:38 +0000
69@@ -0,0 +1,6 @@
70+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
71+# Copyright 2013 Canonical
72+#
73+# This program is free software: you can redistribute it and/or modify it
74+# under the terms of the GNU General Public License version 3, as published
75+# by the Free Software Foundation.
76
77=== added file 'tests/autopilot/ubuntu_weather_app/emulators/main_window.py'
78--- tests/autopilot/ubuntu_weather_app/emulators/main_window.py 1970-01-01 00:00:00 +0000
79+++ tests/autopilot/ubuntu_weather_app/emulators/main_window.py 2013-04-22 14:07:38 +0000
80@@ -0,0 +1,19 @@
81+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
82+# Copyright 2013 Canonical
83+#
84+# This program is free software: you can redistribute it and/or modify it
85+# under the terms of the GNU General Public License version 3, as published
86+# by the Free Software Foundation.
87+
88+
89+class MainWindow(object):
90+ """An emulator class that makes it easy to interact with the weather app"""
91+
92+ def __init__(self, app):
93+ self.app = app
94+
95+ def get_qml_view(self):
96+ return self.app.select_single("QQuickView")
97+
98+ def get_tabs(self):
99+ return self.app.select_single("Tabs", objectName="Tabs")
100
101=== added directory 'tests/autopilot/ubuntu_weather_app/tests'
102=== added file 'tests/autopilot/ubuntu_weather_app/tests/__init__.py'
103--- tests/autopilot/ubuntu_weather_app/tests/__init__.py 1970-01-01 00:00:00 +0000
104+++ tests/autopilot/ubuntu_weather_app/tests/__init__.py 2013-04-22 14:07:38 +0000
105@@ -0,0 +1,52 @@
106+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
107+# Copyright 2013 Canonical
108+#
109+# This program is free software: you can redistribute it and/or modify it
110+# under the terms of the GNU General Public License version 3, as published
111+# by the Free Software Foundation.
112+
113+"""weather-app autopilot tests."""
114+
115+import os.path
116+import glob
117+
118+from autopilot.introspection.qt import QtIntrospectionTestMixin
119+from autopilot.testcase import AutopilotTestCase
120+
121+from ubuntu_weather_app.emulators.main_window import MainWindow
122+
123+
124+class WeatherTestCase(AutopilotTestCase, QtIntrospectionTestMixin):
125+
126+ """A common test case class that provides several useful methods for
127+ weather app tests."""
128+
129+ def setUp(self):
130+ super(WeatherTestCase, self).setUp()
131+ # Lets assume we are installed system wide if this file is in /usr
132+ if os.path.realpath(__file__).startswith("/usr/"):
133+ self.launch_test_installed()
134+ else:
135+ self.launch_test_local()
136+
137+ """Workaround to find the qmlscene binary via shell globbing.
138+ This is needed since we can't rely on qt5-default being installed on
139+ devices to make qmlscene available in the path"""
140+ def qmlscene(self):
141+ return glob.glob("/usr/lib/*/qt5/bin/qmlscene")[0]
142+
143+ def launch_test_local(self):
144+ self.app = self.launch_test_application(self.qmlscene(),
145+ "../../ubuntu-weather-app.qml")
146+
147+ def launch_test_installed(self):
148+ main_qml = "/usr/share/ubuntu-weather-app/ubutnu-weather-app.qml"
149+ self.app = self.launch_test_application(self.qmlscene(), main_qml)
150+
151+ @staticmethod
152+ def running_on_device():
153+ return os.path.isfile('/system/usr/idc/autopilot-finger.idc')
154+
155+ @property
156+ def main_window(self):
157+ return MainWindow(self.app)
158
159=== added file 'tests/autopilot/ubuntu_weather_app/tests/test_mainview.py'
160--- tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 1970-01-01 00:00:00 +0000
161+++ tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-04-22 14:07:38 +0000
162@@ -0,0 +1,33 @@
163+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
164+# Copyright 2013 Canonical
165+#
166+# This program is free software: you can redistribute it and/or modify it
167+# under the terms of the GNU General Public License version 3, as published
168+# by the Free Software Foundation.
169+
170+"""Tests for Weather app"""
171+
172+from __future__ import absolute_import
173+
174+from testtools.matchers import Equals
175+from autopilot.matchers import Eventually
176+
177+from ubuntu_weather_app.tests import WeatherTestCase
178+
179+
180+class TestMainView(WeatherTestCase):
181+ """Tests creating weather"""
182+
183+ """ This is needed to wait for the application to start.
184+ In the testfarm, the application may take some time to show up."""
185+ def setUp(self):
186+ super(TestMainView, self).setUp()
187+ self.assertThat(self.main_window.get_qml_view().visible,
188+ Eventually(Equals(True)))
189+
190+ def tearDown(self):
191+ super(TestMainView, self).tearDown()
192+
193+ def test_tabs(self):
194+ tabs = self.main_window.get_tabs()
195+ self.assertThat(tabs.selectedTabIndex, Eventually(Equals(0)))
196
197=== modified file 'ubuntu-weather-app.qml'
198--- ubuntu-weather-app.qml 2013-04-20 18:33:26 +0000
199+++ ubuntu-weather-app.qml 2013-04-22 14:07:38 +0000
200@@ -95,6 +95,7 @@
201
202 Tabs {
203 id: tabs
204+ objectName: "Tabs"
205 anchors.fill: parent
206 Tab {}
207 }

Subscribers

People subscribed via source and target branches