Merge lp:~canonical-platform-qa/unity8/update-autopilot-tests-for-ap1.6 into lp:unity8

Proposed by Christopher Lee
Status: Work in progress
Proposed branch: lp:~canonical-platform-qa/unity8/update-autopilot-tests-for-ap1.6
Merge into: lp:unity8
Diff against target: 235 lines (+62/-22)
7 files modified
tests/autopilot/unity8/dash.py (+5/-2)
tests/autopilot/unity8/indicators/__init__.py (+4/-3)
tests/autopilot/unity8/indicators/tests/test_action_latency.py (+9/-2)
tests/autopilot/unity8/shell/__init__.py (+3/-3)
tests/autopilot/unity8/shell/tests/test_notifications.py (+13/-5)
tests/autopilot/unity8/shell/tests/test_tutorial.py (+21/-7)
tests/autopilot/unity8/tutorial.py (+7/-0)
To merge this branch: bzr merge lp:~canonical-platform-qa/unity8/update-autopilot-tests-for-ap1.6
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity Team Pending
Review via email: mp+262417@code.launchpad.net

Commit message

Update autopilot tests and helpers to work with autopilot 1.6

Description of the change

Updating the autopilot tests and helpers to work with the upcoming autopilot 1.6 release that will change the autopilot/cpo behaviour.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :
1825. By Christopher Lee

Merge trunk and fix conflicts with emulator changes/removals

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

Please clean your tags as described in https://wiki.ubuntu.com/Process/Merges/Checklists/Unity8

Unmerged revisions

1825. By Christopher Lee

Merge trunk and fix conflicts with emulator changes/removals

1824. By Christopher Lee

Fix use of DisplayIndicatorPage instead of IndicatorPage

1823. By Christopher Lee

Example using new CPO query name method

1822. By Christopher Lee

Initial updating of tests for autopilot 1.6 changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/unity8/dash.py'
2--- tests/autopilot/unity8/dash.py 2015-06-22 15:47:34 +0000
3+++ tests/autopilot/unity8/dash.py 2015-07-06 02:12:14 +0000
4@@ -100,7 +100,7 @@
5 'No scope found with id {0}'.format(scope_id))
6
7 def _get_scope_from_loader(self, loader):
8- return loader.wait_select_single('GenericScopeView')
9+ return loader.wait_select_single(GenericScopeView)
10
11 def _open_scope_scrolling(self, scope_loader):
12 scroll = self._get_scroll_direction(scope_loader)
13@@ -173,7 +173,10 @@
14
15 def _get_search_text_field(self):
16 page_header = self._get_current_page_header()
17- return page_header.select_single(objectName='searchTextField')
18+ return page_header.select_single(
19+ ubuntuuitoolkit.TextField,
20+ objectName='searchTextField'
21+ )
22
23 def _get_current_page_header(self):
24 dashContentList = self.select_single(objectName="dashContentList")
25
26=== modified file 'tests/autopilot/unity8/indicators/__init__.py'
27--- tests/autopilot/unity8/indicators/__init__.py 2015-04-28 15:20:13 +0000
28+++ tests/autopilot/unity8/indicators/__init__.py 2015-07-06 02:12:14 +0000
29@@ -61,8 +61,9 @@
30 indicator_rotation_icon = self._main_window.select_single(
31 objectName=self._name+'-panelItem')
32 self._main_window.pointing_device.click_object(indicator_rotation_icon)
33- return self._main_window.wait_select_single(
34- objectName=self._name+'-page')
35+ return DisplayIndicatorPage.from_proxy_object(
36+ self._main_window.wait_select_single(objectName=self._name+'-page')
37+ )
38
39 def _make_indicator_icon_visible(self):
40 indicators_bar = self._main_window.select_single('IndicatorsBar')
41@@ -158,7 +159,7 @@
42 'SwitchMenu', objectName='indicator.action.switch')
43
44 def get_slider(self):
45- return self.select_single(objectName='slider')
46+ return self.select_single(Slider, objectName='slider')
47
48 def get_slider_menu(self):
49 return self.select_single(objectName='indicator.action.slider')
50
51=== modified file 'tests/autopilot/unity8/indicators/tests/test_action_latency.py'
52--- tests/autopilot/unity8/indicators/tests/test_action_latency.py 2015-05-06 16:30:15 +0000
53+++ tests/autopilot/unity8/indicators/tests/test_action_latency.py 2015-07-06 02:12:14 +0000
54@@ -22,7 +22,10 @@
55 fixture_setup,
56 indicators,
57 )
58-from unity8.indicators import tests
59+from unity8.indicators import (
60+ TestIndicatorPage,
61+ tests
62+)
63
64 from autopilot.matchers import Eventually
65 from testtools.matchers import Equals, NotEquals
66@@ -43,7 +46,11 @@
67 self.indicator.is_indicator_icon_visible(),
68 Eventually(Equals(True), timeout=20)
69 )
70- self.indicator_page = self.indicator.open()
71+ # Force to be TestIndicatorPage as CPOs need to be explicit, can't just
72+ # select using objectName.
73+ self.indicator_page = TestIndicatorPage.from_proxy_object(
74+ self.indicator.open()
75+ )
76
77 def launch_indicator_service(self):
78 launch_service_fixture = \
79
80=== modified file 'tests/autopilot/unity8/shell/__init__.py'
81--- tests/autopilot/unity8/shell/__init__.py 2015-06-22 15:47:34 +0000
82+++ tests/autopilot/unity8/shell/__init__.py 2015-07-06 02:12:14 +0000
83@@ -31,6 +31,7 @@
84 greeter,
85 launcher as launcher_helpers
86 )
87+from unity8.indicators import DisplayIndicatorPage
88
89
90 logger = logging.getLogger(__name__)
91@@ -127,9 +128,8 @@
92 )
93
94 def _get_indicator_page(self, indicator_name):
95- return self.select_single(
96- 'IndicatorPage',
97- objectName=indicator_name+'-page'
98+ return DisplayIndicatorPage.from_proxy_object(
99+ self.select_single(objectName=indicator_name+'-page')
100 )
101
102 @autopilot_logging.log_action(logger.info)
103
104=== added directory 'tests/autopilot/unity8/shell/emulators'
105=== modified file 'tests/autopilot/unity8/shell/tests/test_notifications.py'
106--- tests/autopilot/unity8/shell/tests/test_notifications.py 2015-05-15 07:15:36 +0000
107+++ tests/autopilot/unity8/shell/tests/test_notifications.py 2015-07-06 02:12:14 +0000
108@@ -28,7 +28,10 @@
109 from autopilot.matchers import Eventually
110 from gi.repository import Notify
111 from testtools.matchers import Equals, NotEquals
112-from ubuntuuitoolkit import ubuntu_scenarios
113+from ubuntuuitoolkit import (
114+ UbuntuUIToolkitCustomProxyObjectBase,
115+ ubuntu_scenarios
116+)
117
118 from unity8 import shell
119 from unity8.process_helpers import unlock_unity
120@@ -38,6 +41,11 @@
121 logger = logging.getLogger(__name__)
122
123
124+# CPO to assist during testing (gives it a pointing_device)
125+class Notification(UbuntuUIToolkitCustomProxyObjectBase):
126+ pass
127+
128+
129 class NotificationsBase(UnityTestCase):
130 """Base class for all notification tests that provides helper methods."""
131
132@@ -143,7 +151,7 @@
133 )
134
135 get_notification = lambda: notify_list.wait_select_single(
136- 'Notification', objectName='notification1')
137+ Notification, objectName='notification1')
138 notification = get_notification()
139
140 notification.pointing_device.click_object(
141@@ -185,7 +193,7 @@
142 # verify and interact with the triggered snap-decision notification
143 notify_list = self._get_notifications_list()
144 get_notification = lambda: notify_list.wait_select_single(
145- 'Notification', objectName='notification1')
146+ Notification, objectName='notification1')
147 notification = get_notification()
148 self._assert_notification(
149 notification, summary, body, False, False, 1.0)
150@@ -234,7 +242,7 @@
151 # verify and interact with the triggered snap-decision notification
152 notify_list = self._get_notifications_list()
153 get_notification = lambda: notify_list.wait_select_single(
154- 'Notification', objectName='notification1')
155+ Notification, objectName='notification1')
156 notification = get_notification()
157 self._assert_notification(
158 notification, summary, body, True, False, 1.0)
159@@ -282,7 +290,7 @@
160 # verify and interact with the triggered snap-decision notification
161 notify_list = self._get_notifications_list()
162 get_notification = lambda: notify_list.wait_select_single(
163- 'Notification', objectName='notification1')
164+ Notification, objectName='notification1')
165 notification = get_notification()
166 self._assert_notification(
167 notification, summary, body, True, False, 1.0)
168
169=== modified file 'tests/autopilot/unity8/shell/tests/test_tutorial.py'
170--- tests/autopilot/unity8/shell/tests/test_tutorial.py 2015-04-29 19:21:18 +0000
171+++ tests/autopilot/unity8/shell/tests/test_tutorial.py 2015-07-06 02:12:14 +0000
172@@ -24,8 +24,7 @@
173 fixture_setup,
174 tests
175 )
176-# unused import to load the tutorial helpers custom proxy objects.
177-from unity8 import tutorial as tutorial_helpers # NOQA
178+from unity8.tutorial import TutorialPage
179
180
181 class TutorialTestCase(tests.UnityTestCase):
182@@ -43,15 +42,30 @@
183 tutorial = self.unity.select_single('Tutorial')
184 self.assertThat(tutorial.running, Eventually(Equals(True)))
185 greeter.swipe()
186- page = self.unity.wait_select_single(objectName='tutorialLeft')
187+ page = self.unity.wait_select_single(
188+ TutorialPage,
189+ objectName='tutorialLeft'
190+ )
191 page.short_swipe_right()
192- page = self.unity.wait_select_single(objectName='tutorialLeftFinish')
193+ page = self.unity.wait_select_single(
194+ TutorialPage,
195+ objectName='tutorialLeftFinish'
196+ )
197 page.tap()
198- page = self.unity.wait_select_single(objectName='tutorialRight')
199+ page = self.unity.wait_select_single(
200+ TutorialPage,
201+ objectName='tutorialRight'
202+ )
203 page.swipe_left()
204 page.tap()
205- page = self.unity.wait_select_single(objectName='tutorialBottom')
206+ page = self.unity.wait_select_single(
207+ TutorialPage,
208+ objectName='tutorialBottom'
209+ )
210 page.swipe_up()
211- page = self.unity.wait_select_single(objectName='tutorialBottomFinish')
212+ page = self.unity.wait_select_single(
213+ TutorialPage,
214+ objectName='tutorialBottomFinish'
215+ )
216 page.tap()
217 self.assertThat(tutorial.running, Eventually(Equals(False)))
218
219=== modified file 'tests/autopilot/unity8/tutorial.py'
220--- tests/autopilot/unity8/tutorial.py 2015-04-29 19:21:18 +0000
221+++ tests/autopilot/unity8/tutorial.py 2015-07-06 02:12:14 +0000
222@@ -38,6 +38,13 @@
223 b'TutorialLeftFinish', b'TutorialRight',
224 b'TutorialBottom', b'TutorialBottomFinish')
225
226+ @classmethod
227+ def get_type_query_name(cls):
228+ # Tutorial page name can be different, validate_dbus_object will remove
229+ # the chaff.
230+ # Note. this is not a very efficient query
231+ return '*'
232+
233 @autopilot.logging.log_action(logger.info)
234 def short_swipe_right(self):
235 self.shown.wait_for(True)

Subscribers

People subscribed via source and target branches