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
=== modified file 'HACKING'
--- HACKING 2013-11-13 06:22:09 +0000
+++ HACKING 2014-09-02 23:04:44 +0000
@@ -1,5 +1,34 @@
1dialer-app hacking guide
2========================
3
4Getting dialer-app
5------------------
6
7To get the main development branch of dialer-app:
8
9 $ bzr branch lp:dialer-app
10
11
12Building the app
13----------------
14
15This app is built using cmake. Here's an example on how to build it:
16
17 $ cmake .
18 $ make -j 8
19
20
21Running the built app
22---------------------
23
24After building the app, it can be run with:
25
26 $ ./src/dialer-app
27
28
1Test coverage29Test coverage
2-------------30-------------
31
3dialer-app has autopilot tests which cover basic use cases like making an32dialer-app has autopilot tests which cover basic use cases like making an
4outgoing call and receiving an incoming call. They are integration tests which33outgoing call and receiving an incoming call. They are integration tests which
5cover dialer-app itself, all the user session APIs below it (libofono-qt,34cover dialer-app itself, all the user session APIs below it (libofono-qt,
@@ -11,20 +40,30 @@
11The tests should run on both a desktop (like an Ubuntu desktop live session or40The tests should run on both a desktop (like an Ubuntu desktop live session or
12Otto [http://launchpad.net/otto]) and a phone environment.41Otto [http://launchpad.net/otto]) and a phone environment.
1342
14How to run the tests43
15--------------------44Running the autopilot tests with the installed app
45--------------------------------------------------
46
16The easiest and standard way across Ubuntu phablet packages is to install the47The easiest and standard way across Ubuntu phablet packages is to install the
17dialer-app-autopilot package and run the tests from the system Python path:48dialer-app-autopilot package and run the tests from the system Python path:
1849
19 sudo apt-get install dialer-app-autopilot50 $ sudo apt-get install dialer-app-autopilot
20 autopilot run dialer_app51 $ autopilot3 run dialer_app
2152
22dialer-app-autopilot depends on ofono-phonesim-autostart to set up the53dialer-app-autopilot depends on ofono-phonesim-autostart to set up the
23simulated Modem automatically, and all the other additional test dependencies54simulated Modem automatically, and all the other additional test dependencies
24for autopilot. You can also run the tests right out of the source tree for55for autopilot. You can also run the tests right out of the source tree for
25development:56development:
2657
27 cd tests/autopilot58 $ cd tests/autopilot
28 autopilot run dialer_app59 $ autopilot3 run dialer_app
2960
30(but you still need all the dialer-app-autopilot dependencies installed).61(but you still need all the dialer-app-autopilot dependencies installed).
62
63
64Running the autopilot tests with the built app
65----------------------------------------------
66
67After building the app, the autopilot tests can be run with:
68
69 $ make test-autopilot
3170
=== added file 'README'
--- README 1970-01-01 00:00:00 +0000
+++ README 2014-09-02 23:04:44 +0000
@@ -0,0 +1,8 @@
1dialer-app
2==========
3
4Dialer application for Ubuntu Touch.
5
6You can find information on how to compile and run this program in
7the HACKING file, and you can find licensing information in the
8COPYING files.
09
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2014-05-22 14:25:18 +0000
+++ tests/CMakeLists.txt 2014-09-02 23:04:44 +0000
@@ -1,8 +1,1 @@
1set(AUTOPILOT_DIR autopilot/dialer_app)1add_subdirectory(autopilot)
2
3execute_process(COMMAND python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())"
4 OUTPUT_VARIABLE PYTHON_PACKAGE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
5
6install(DIRECTORY ${AUTOPILOT_DIR}
7 DESTINATION ${PYTHON_PACKAGE_DIR}
8 )
92
=== added file 'tests/autopilot/CMakeLists.txt'
--- tests/autopilot/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/autopilot/CMakeLists.txt 2014-09-02 23:04:44 +0000
@@ -0,0 +1,13 @@
1set(AUTOPILOT_DIR dialer_app)
2
3execute_process(COMMAND python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())"
4 OUTPUT_VARIABLE PYTHON_PACKAGE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
5
6install(DIRECTORY ${AUTOPILOT_DIR}
7 DESTINATION ${PYTHON_PACKAGE_DIR}
8 )
9
10add_custom_target(test-autopilot
11 BUILD_DIR=${CMAKE_BINARY_DIR} autopilot3 run -v ${AUTOPILOT_DIR}
12 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
13)
014
=== modified file 'tests/autopilot/dialer_app/ListItemWithActions.py'
--- tests/autopilot/dialer_app/ListItemWithActions.py 2014-09-02 23:04:44 +0000
+++ tests/autopilot/dialer_app/ListItemWithActions.py 2014-09-02 23:04:44 +0000
@@ -7,7 +7,7 @@
7# under the terms of the GNU General Public License version 3, as published7# under the terms of the GNU General Public License version 3, as published
8# by the Free Software Foundation.8# by the Free Software Foundation.
99
10"""Dialer app autopilot emulators."""10"""Dialer app autopilot custom proxy objects."""
1111
12from ubuntuuitoolkit._custom_proxy_objects import _common12from ubuntuuitoolkit._custom_proxy_objects import _common
1313
@@ -23,6 +23,7 @@
23 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)23 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
2424
2525
26
26class HistoryDelegate(ListItemWithActions):27class HistoryDelegate(ListItemWithActions):
2728
28 """Autopilot helper for the History delegate."""29 """Autopilot helper for the History delegate."""
2930
=== renamed file 'tests/autopilot/dialer_app/emulators.py' => 'tests/autopilot/dialer_app/__init__.py'
--- tests/autopilot/dialer_app/emulators.py 2014-08-08 15:01:33 +0000
+++ tests/autopilot/dialer_app/__init__.py 2014-09-02 23:04:44 +0000
@@ -1,5 +1,5 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2# Copyright 2013 Canonical2# Copyright 2013, 2014 Canonical
3#3#
4# This file is part of dialer-app.4# This file is part of dialer-app.
5#5#
@@ -7,14 +7,15 @@
7# under the terms of the GNU General Public License version 3, as published7# under the terms of the GNU General Public License version 3, as published
8# by the Free Software Foundation.8# by the Free Software Foundation.
99
10"""Dialer app autopilot emulators."""10"""Dialer app autopilot custom proxy objects."""
1111
12from autopilot.introspection.dbus import StateNotFoundError
13from ubuntuuitoolkit import emulators as toolkit_emulators
14import logging12import logging
1513
1614import ubuntuuitoolkit
17class MainView(toolkit_emulators.MainView):15from autopilot import exceptions as autopilot_exceptions
16
17
18class MainView(ubuntuuitoolkit.MainView):
18 def __init__(self, *args):19 def __init__(self, *args):
19 super().__init__(*args)20 super().__init__(*args)
20 self.logger = logging.getLogger(__name__)21 self.logger = logging.getLogger(__name__)
@@ -56,16 +57,17 @@
5657
5758
58class PageWithBottomEdge(MainView):59class PageWithBottomEdge(MainView):
59 """An emulator class that makes it easy to interact with the bottom edge60
60 swipe page"""61 """Autopilot custom proxy object for PageWithBottomEdge components."""
6162
62 def reveal_bottom_edge_page(self):63 def reveal_bottom_edge_page(self):
63 """Bring the bottom edge page to the screen"""64 """Bring the bottom edge page to the screen"""
64 self.bottomEdgePageLoaded.wait_for(True)65 self.bottomEdgePageLoaded.wait_for(True)
65 try:66 try:
66 action_item = self.wait_select_single(objectName='bottomEdgeTip')67 action_item = self.wait_select_single(objectName='bottomEdgeTip')
67 start_x = (action_item.globalRect.x +68 start_x = (
68 (action_item.globalRect.width * 0.5))69 action_item.globalRect.x +
70 (action_item.globalRect.width * 0.5))
69 # Start swiping from the top of the component because after some71 # Start swiping from the top of the component because after some
70 # seconds it gets almost fully hidden. The center will be out of72 # seconds it gets almost fully hidden. The center will be out of
71 # view.73 # view.
@@ -74,7 +76,7 @@
74 self.pointing_device.drag(start_x, start_y, start_x, stop_y,76 self.pointing_device.drag(start_x, start_y, start_x, stop_y,
75 rate=2)77 rate=2)
76 self.isReady.wait_for(True)78 self.isReady.wait_for(True)
77 except StateNotFoundError:79 except autopilot_exceptions.StateNotFoundError:
78 self.logger.error('BottomEdge element not found.')80 self.logger.error('BottomEdge element not found.')
79 raise81 raise
8082
8183
=== removed file 'tests/autopilot/dialer_app/__init__.py'
--- tests/autopilot/dialer_app/__init__.py 2013-07-16 14:05:40 +0000
+++ tests/autopilot/dialer_app/__init__.py 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2# Copyright 2012 Canonical
3#
4# This file is part of dialer-app.
5#
6# dialer-app is free software: you can redistribute it and/or modify it
7# under the terms of the GNU General Public License version 3, as published
8# by the Free Software Foundation.
9
10"""Marumbi autopilot tests and emulators - top level package."""
110
=== modified file 'tests/autopilot/dialer_app/tests/__init__.py'
--- tests/autopilot/dialer_app/tests/__init__.py 2014-09-02 23:04:44 +0000
+++ tests/autopilot/dialer_app/tests/__init__.py 2014-09-02 23:04:44 +0000
@@ -1,5 +1,5 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2# Copyright 2012, 2013 Canonical2# Copyright 2012, 2013, 2014 Canonical
3#3#
4# This file is part of dialer-app.4# This file is part of dialer-app.
5#5#
@@ -9,21 +9,19 @@
99
10"""Dialer App autopilot tests."""10"""Dialer App autopilot tests."""
1111
12import logging
13import os
14
12import fixtures15import fixtures
13from autopilot.input import Mouse, Touch, Pointer16import ubuntuuitoolkit
14from autopilot.matchers import Eventually17from autopilot.matchers import Eventually
15from autopilot.platform import model
16from autopilot.testcase import AutopilotTestCase18from autopilot.testcase import AutopilotTestCase
17from testtools.matchers import Equals19from testtools.matchers import Equals
18from ubuntuuitoolkit import (20from ubuntuuitoolkit import fixture_setup
19 emulators as toolkit_emulators,21
20 fixture_setup22import dialer_app
21)
22from dialer_app import emulators
23from dialer_app import helpers23from dialer_app import helpers
2424
25import os
26import logging
2725
28logger = logging.getLogger(__name__)26logger = logging.getLogger(__name__)
2927
@@ -39,27 +37,13 @@
3937
40 """38 """
4139
42 if model() == 'Desktop':40 LOCAL_BINARY_PATH = 'src/dialer-app'
43 scenarios = [41 # The path to the locally built binary, relative to the build directory.
44 ('with mouse', dict(input_device_class=Mouse)),
45 ]
46 else:
47 scenarios = [
48 ('with touch', dict(input_device_class=Touch)),
49 ]
50
51 local_location = "../../src/dialer-app"
5242
53 def setUp(self):43 def setUp(self):
54 self.pointing_device = Pointer(self.input_device_class.create())
55 super().setUp()44 super().setUp()
56
57 self.set_up_locale()45 self.set_up_locale()
5846 self.launch_application()
59 if os.path.exists(self.local_location):
60 self.launch_test_local()
61 else:
62 self.launch_test_installed()
6347
64 self.assertThat(self.main_view.visible, Eventually(Equals(True)))48 self.assertThat(self.main_view.visible, Eventually(Equals(True)))
6549
@@ -73,24 +57,27 @@
73 fixture_setup.InitctlEnvironmentVariable(LANGUAGE='en')57 fixture_setup.InitctlEnvironmentVariable(LANGUAGE='en')
74 )58 )
7559
76 def launch_test_local(self):60 def launch_application(self):
61 build_dir = os.environ.get('BUILD_DIR', None)
62 if build_dir is not None:
63 self.launch_built_application(build_dir)
64 else:
65 self.launch_installed_application()
66
67 def launch_built_application(self, build_dir):
68 binary_path = os.path.join(build_dir, self.LOCAL_BINARY_PATH)
77 self.app = self.launch_test_application(69 self.app = self.launch_test_application(
78 self.local_location,70 binary_path,
79 app_type='qt',71 app_type='qt',
80 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase72 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase
81 )73 )
8274
83 def launch_test_installed(self):75 def launch_installed_application(self):
84 self.app = self.launch_upstart_application(76 self.app = self.launch_upstart_application(
85 'dialer-app',77 'dialer-app',
86 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase78 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase
87 )
88
89 def _click_object(self, objectName):
90 self.pointing_device.click_object(
91 self.app.wait_select_single(objectName=objectName)
92 )79 )
9380
94 @property81 @property
95 def main_view(self):82 def main_view(self):
96 return self.app.wait_select_single(emulators.MainView)83 return self.app.wait_select_single(dialer_app.MainView)
9784
=== modified file 'tests/autopilot/dialer_app/tests/test_calls.py'
--- tests/autopilot/dialer_app/tests/test_calls.py 2014-08-26 13:35:46 +0000
+++ tests/autopilot/dialer_app/tests/test_calls.py 2014-09-02 23:04:44 +0000
@@ -69,7 +69,8 @@
69 def get_history_for_number(self, number):69 def get_history_for_number(self, number):
70 # because of the bottom edge tree structure, multiple copies of the70 # because of the bottom edge tree structure, multiple copies of the
71 # same item are returned, so just use the first one71 # same item are returned, so just use the first one
72 return self.history_list.select_many("HistoryDelegate", phoneNumber=number)[0]72 return self.history_list.select_many(
73 "HistoryDelegate", phoneNumber=number)[0]
7374
74 def test_outgoing_noanswer(self):75 def test_outgoing_noanswer(self):
75 """Outgoing call to a normal number, no answer"""76 """Outgoing call to a normal number, no answer"""

Subscribers

People subscribed via source and target branches