Merge lp:~canonical-platform-qa/dialer-app/custom_proxy_objects into lp:dialer-app

Proposed by Leo Arias
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 172
Merged at revision: 256
Proposed branch: lp:~canonical-platform-qa/dialer-app/custom_proxy_objects
Merge into: lp:dialer-app
Prerequisite: lp:~canonical-platform-qa/dialer-app/fake_url-dispatcher
Diff against target: 343 lines (+96/-64)
8 files modified
HACKING (+45/-6)
README (+8/-0)
tests/CMakeLists.txt (+1/-8)
tests/autopilot/CMakeLists.txt (+13/-0)
tests/autopilot/dialer_app/ListItemWithActions.py (+2/-1)
tests/autopilot/dialer_app/__init__.py (+0/-10)
tests/autopilot/dialer_app/tests/__init__.py (+25/-38)
tests/autopilot/dialer_app/tests/test_calls.py (+2/-1)
To merge this branch: bzr merge lp:~canonical-platform-qa/dialer-app/custom_proxy_objects
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Gustavo Pichorim Boiko (community) Approve
Nicholas Skaggs (community) Approve
Chris Gagnon (community) Needs Fixing
Review via email: mp+230687@code.launchpad.net

Commit message

Stop using the deprecated emulators namespace.

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
Chris Gagnon (chris.gagnon) wrote :

Looks good but can you fix the pep8 issues? (You didn't introduce them)

ListItemWithActions.py:37:1: E302 expected 2 blank lines, found 1
tests/test_calls.py:72:80: E501 line too long (86 > 79 characters)

If there were a lot I would ask for it to be fixed in a different MP, But it's only 2.

review: Needs Fixing
170. By Leo Arias

Fixed static errors.

Revision history for this message
Leo Arias (elopio) wrote :

> Looks good but can you fix the pep8 issues? (You didn't introduce them)
>
> ListItemWithActions.py:37:1: E302 expected 2 blank lines, found 1
> tests/test_calls.py:72:80: E501 line too long (86 > 79 characters)
>
> If there were a lot I would ask for it to be fixed in a different MP, But it's
> only 2.

Done. Thanks for the review.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

I know you wanted my feedback Leo; in general I am happy with this as-is. I still need to try it out with filemanager, which should happen tomorrow. But don't wait for me :-)

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
171. By Leo Arias

Merged with trunk.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
172. By Leo Arias

Merged with prerequisite.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
Yes

Did CI run pass? If not, please explain why.
No, but not related to the MR.

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes

Code looks good and works as expected!

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'HACKING'
2--- HACKING 2013-11-13 06:22:09 +0000
3+++ HACKING 2014-09-02 23:04:44 +0000
4@@ -1,5 +1,34 @@
5+dialer-app hacking guide
6+========================
7+
8+Getting dialer-app
9+------------------
10+
11+To get the main development branch of dialer-app:
12+
13+ $ bzr branch lp:dialer-app
14+
15+
16+Building the app
17+----------------
18+
19+This app is built using cmake. Here's an example on how to build it:
20+
21+ $ cmake .
22+ $ make -j 8
23+
24+
25+Running the built app
26+---------------------
27+
28+After building the app, it can be run with:
29+
30+ $ ./src/dialer-app
31+
32+
33 Test coverage
34 -------------
35+
36 dialer-app has autopilot tests which cover basic use cases like making an
37 outgoing call and receiving an incoming call. They are integration tests which
38 cover dialer-app itself, all the user session APIs below it (libofono-qt,
39@@ -11,20 +40,30 @@
40 The tests should run on both a desktop (like an Ubuntu desktop live session or
41 Otto [http://launchpad.net/otto]) and a phone environment.
42
43-How to run the tests
44---------------------
45+
46+Running the autopilot tests with the installed app
47+--------------------------------------------------
48+
49 The easiest and standard way across Ubuntu phablet packages is to install the
50 dialer-app-autopilot package and run the tests from the system Python path:
51
52- sudo apt-get install dialer-app-autopilot
53- autopilot run dialer_app
54+ $ sudo apt-get install dialer-app-autopilot
55+ $ autopilot3 run dialer_app
56
57 dialer-app-autopilot depends on ofono-phonesim-autostart to set up the
58 simulated Modem automatically, and all the other additional test dependencies
59 for autopilot. You can also run the tests right out of the source tree for
60 development:
61
62- cd tests/autopilot
63- autopilot run dialer_app
64+ $ cd tests/autopilot
65+ $ autopilot3 run dialer_app
66
67 (but you still need all the dialer-app-autopilot dependencies installed).
68+
69+
70+Running the autopilot tests with the built app
71+----------------------------------------------
72+
73+After building the app, the autopilot tests can be run with:
74+
75+ $ make test-autopilot
76
77=== added file 'README'
78--- README 1970-01-01 00:00:00 +0000
79+++ README 2014-09-02 23:04:44 +0000
80@@ -0,0 +1,8 @@
81+dialer-app
82+==========
83+
84+Dialer application for Ubuntu Touch.
85+
86+You can find information on how to compile and run this program in
87+the HACKING file, and you can find licensing information in the
88+COPYING files.
89
90=== modified file 'tests/CMakeLists.txt'
91--- tests/CMakeLists.txt 2014-05-22 14:25:18 +0000
92+++ tests/CMakeLists.txt 2014-09-02 23:04:44 +0000
93@@ -1,8 +1,1 @@
94-set(AUTOPILOT_DIR autopilot/dialer_app)
95-
96-execute_process(COMMAND python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())"
97- OUTPUT_VARIABLE PYTHON_PACKAGE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
98-
99-install(DIRECTORY ${AUTOPILOT_DIR}
100- DESTINATION ${PYTHON_PACKAGE_DIR}
101- )
102+add_subdirectory(autopilot)
103
104=== added file 'tests/autopilot/CMakeLists.txt'
105--- tests/autopilot/CMakeLists.txt 1970-01-01 00:00:00 +0000
106+++ tests/autopilot/CMakeLists.txt 2014-09-02 23:04:44 +0000
107@@ -0,0 +1,13 @@
108+set(AUTOPILOT_DIR dialer_app)
109+
110+execute_process(COMMAND python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())"
111+ OUTPUT_VARIABLE PYTHON_PACKAGE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
112+
113+install(DIRECTORY ${AUTOPILOT_DIR}
114+ DESTINATION ${PYTHON_PACKAGE_DIR}
115+ )
116+
117+add_custom_target(test-autopilot
118+ BUILD_DIR=${CMAKE_BINARY_DIR} autopilot3 run -v ${AUTOPILOT_DIR}
119+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
120+)
121
122=== modified file 'tests/autopilot/dialer_app/ListItemWithActions.py'
123--- tests/autopilot/dialer_app/ListItemWithActions.py 2014-09-02 23:04:44 +0000
124+++ tests/autopilot/dialer_app/ListItemWithActions.py 2014-09-02 23:04:44 +0000
125@@ -7,7 +7,7 @@
126 # under the terms of the GNU General Public License version 3, as published
127 # by the Free Software Foundation.
128
129-"""Dialer app autopilot emulators."""
130+"""Dialer app autopilot custom proxy objects."""
131
132 from ubuntuuitoolkit._custom_proxy_objects import _common
133
134@@ -23,6 +23,7 @@
135 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
136
137
138+
139 class HistoryDelegate(ListItemWithActions):
140
141 """Autopilot helper for the History delegate."""
142
143=== renamed file 'tests/autopilot/dialer_app/emulators.py' => 'tests/autopilot/dialer_app/__init__.py'
144--- tests/autopilot/dialer_app/emulators.py 2014-08-08 15:01:33 +0000
145+++ tests/autopilot/dialer_app/__init__.py 2014-09-02 23:04:44 +0000
146@@ -1,5 +1,5 @@
147 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
148-# Copyright 2013 Canonical
149+# Copyright 2013, 2014 Canonical
150 #
151 # This file is part of dialer-app.
152 #
153@@ -7,14 +7,15 @@
154 # under the terms of the GNU General Public License version 3, as published
155 # by the Free Software Foundation.
156
157-"""Dialer app autopilot emulators."""
158+"""Dialer app autopilot custom proxy objects."""
159
160-from autopilot.introspection.dbus import StateNotFoundError
161-from ubuntuuitoolkit import emulators as toolkit_emulators
162 import logging
163
164-
165-class MainView(toolkit_emulators.MainView):
166+import ubuntuuitoolkit
167+from autopilot import exceptions as autopilot_exceptions
168+
169+
170+class MainView(ubuntuuitoolkit.MainView):
171 def __init__(self, *args):
172 super().__init__(*args)
173 self.logger = logging.getLogger(__name__)
174@@ -56,16 +57,17 @@
175
176
177 class PageWithBottomEdge(MainView):
178- """An emulator class that makes it easy to interact with the bottom edge
179- swipe page"""
180+
181+ """Autopilot custom proxy object for PageWithBottomEdge components."""
182
183 def reveal_bottom_edge_page(self):
184 """Bring the bottom edge page to the screen"""
185 self.bottomEdgePageLoaded.wait_for(True)
186 try:
187 action_item = self.wait_select_single(objectName='bottomEdgeTip')
188- start_x = (action_item.globalRect.x +
189- (action_item.globalRect.width * 0.5))
190+ start_x = (
191+ action_item.globalRect.x +
192+ (action_item.globalRect.width * 0.5))
193 # Start swiping from the top of the component because after some
194 # seconds it gets almost fully hidden. The center will be out of
195 # view.
196@@ -74,7 +76,7 @@
197 self.pointing_device.drag(start_x, start_y, start_x, stop_y,
198 rate=2)
199 self.isReady.wait_for(True)
200- except StateNotFoundError:
201+ except autopilot_exceptions.StateNotFoundError:
202 self.logger.error('BottomEdge element not found.')
203 raise
204
205
206=== removed file 'tests/autopilot/dialer_app/__init__.py'
207--- tests/autopilot/dialer_app/__init__.py 2013-07-16 14:05:40 +0000
208+++ tests/autopilot/dialer_app/__init__.py 1970-01-01 00:00:00 +0000
209@@ -1,10 +0,0 @@
210-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
211-# Copyright 2012 Canonical
212-#
213-# This file is part of dialer-app.
214-#
215-# dialer-app is free software: you can redistribute it and/or modify it
216-# under the terms of the GNU General Public License version 3, as published
217-# by the Free Software Foundation.
218-
219-"""Marumbi autopilot tests and emulators - top level package."""
220
221=== modified file 'tests/autopilot/dialer_app/tests/__init__.py'
222--- tests/autopilot/dialer_app/tests/__init__.py 2014-09-02 23:04:44 +0000
223+++ tests/autopilot/dialer_app/tests/__init__.py 2014-09-02 23:04:44 +0000
224@@ -1,5 +1,5 @@
225 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
226-# Copyright 2012, 2013 Canonical
227+# Copyright 2012, 2013, 2014 Canonical
228 #
229 # This file is part of dialer-app.
230 #
231@@ -9,21 +9,19 @@
232
233 """Dialer App autopilot tests."""
234
235+import logging
236+import os
237+
238 import fixtures
239-from autopilot.input import Mouse, Touch, Pointer
240+import ubuntuuitoolkit
241 from autopilot.matchers import Eventually
242-from autopilot.platform import model
243 from autopilot.testcase import AutopilotTestCase
244 from testtools.matchers import Equals
245-from ubuntuuitoolkit import (
246- emulators as toolkit_emulators,
247- fixture_setup
248-)
249-from dialer_app import emulators
250+from ubuntuuitoolkit import fixture_setup
251+
252+import dialer_app
253 from dialer_app import helpers
254
255-import os
256-import logging
257
258 logger = logging.getLogger(__name__)
259
260@@ -39,27 +37,13 @@
261
262 """
263
264- if model() == 'Desktop':
265- scenarios = [
266- ('with mouse', dict(input_device_class=Mouse)),
267- ]
268- else:
269- scenarios = [
270- ('with touch', dict(input_device_class=Touch)),
271- ]
272-
273- local_location = "../../src/dialer-app"
274+ LOCAL_BINARY_PATH = 'src/dialer-app'
275+ # The path to the locally built binary, relative to the build directory.
276
277 def setUp(self):
278- self.pointing_device = Pointer(self.input_device_class.create())
279 super().setUp()
280-
281 self.set_up_locale()
282-
283- if os.path.exists(self.local_location):
284- self.launch_test_local()
285- else:
286- self.launch_test_installed()
287+ self.launch_application()
288
289 self.assertThat(self.main_view.visible, Eventually(Equals(True)))
290
291@@ -73,24 +57,27 @@
292 fixture_setup.InitctlEnvironmentVariable(LANGUAGE='en')
293 )
294
295- def launch_test_local(self):
296+ def launch_application(self):
297+ build_dir = os.environ.get('BUILD_DIR', None)
298+ if build_dir is not None:
299+ self.launch_built_application(build_dir)
300+ else:
301+ self.launch_installed_application()
302+
303+ def launch_built_application(self, build_dir):
304+ binary_path = os.path.join(build_dir, self.LOCAL_BINARY_PATH)
305 self.app = self.launch_test_application(
306- self.local_location,
307+ binary_path,
308 app_type='qt',
309- emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase
310+ emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase
311 )
312
313- def launch_test_installed(self):
314+ def launch_installed_application(self):
315 self.app = self.launch_upstart_application(
316 'dialer-app',
317- emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase
318- )
319-
320- def _click_object(self, objectName):
321- self.pointing_device.click_object(
322- self.app.wait_select_single(objectName=objectName)
323+ emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase
324 )
325
326 @property
327 def main_view(self):
328- return self.app.wait_select_single(emulators.MainView)
329+ return self.app.wait_select_single(dialer_app.MainView)
330
331=== modified file 'tests/autopilot/dialer_app/tests/test_calls.py'
332--- tests/autopilot/dialer_app/tests/test_calls.py 2014-08-26 13:35:46 +0000
333+++ tests/autopilot/dialer_app/tests/test_calls.py 2014-09-02 23:04:44 +0000
334@@ -69,7 +69,8 @@
335 def get_history_for_number(self, number):
336 # because of the bottom edge tree structure, multiple copies of the
337 # same item are returned, so just use the first one
338- return self.history_list.select_many("HistoryDelegate", phoneNumber=number)[0]
339+ return self.history_list.select_many(
340+ "HistoryDelegate", phoneNumber=number)[0]
341
342 def test_outgoing_noanswer(self):
343 """Outgoing call to a normal number, no answer"""

Subscribers

People subscribed via source and target branches