Merge lp:~nskaggs/ubuntu-clock-app/switch-emulators-to-proxy-object into lp:ubuntu-clock-app/saucy
- switch-emulators-to-proxy-object
- Merge into saucy
Status: | Rejected |
---|---|
Rejected by: | Nicholas Skaggs |
Proposed branch: | lp:~nskaggs/ubuntu-clock-app/switch-emulators-to-proxy-object |
Merge into: | lp:ubuntu-clock-app/saucy |
Diff against target: |
306 lines (+40/-42) 3 files modified
tests/autopilot/ubuntu_clock_app/__init__.py (+1/-1) tests/autopilot/ubuntu_clock_app/helpers.py (+32/-32) tests/autopilot/ubuntu_clock_app/tests/__init__.py (+7/-9) |
To merge this branch: | bzr merge lp:~nskaggs/ubuntu-clock-app/switch-emulators-to-proxy-object |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Needs Fixing | |
Ubuntu Clock Developers | Pending | ||
Review via email: mp+227103@code.launchpad.net |
Commit message
Switch to custom proxy object emulator, instead of calling via old emulators module.
Description of the change
Switch to custom proxy object emulator, instead of calling via old emulators module.
Also cleanup write method for textfield as https:/
Nicholas Skaggs (nskaggs) wrote : | # |
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:462
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Nekhelesh Ramananthan (nik90) wrote : | # |
Nice I like the simplicity of just calling ubuntuuitoolkit
>I renamed emulators.py to custom_
Considering that this file mainly houses classes and functions that help tests, wouldn't something along the lines of clock_helper.py be more suitable? custom_
But otherwise looks good.
Nekhelesh Ramananthan (nik90) wrote : | # |
I will test this MP on the phone tomorrow before approving. I just did the code review for now.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:463
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Nicholas Skaggs (nskaggs) wrote : | # |
@nik, yes custom_
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:464
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Leo Arias (elopio) wrote : | # |
11 === renamed file 'tests/
12 --- tests/autopilot
What we are doing actually is to put most of the things that were on ubuntu_
If it grows to big, I started moving some of the objects into ubuntu_
173 - # TODO: This wait to ensure that the textfield is visible before
174 - # entering text should be part of the SDK emulator. Until then, it has
175 - # been added here. http://
176 - name_alarm.
On the text field helper, we are waiting for it to be focused, not to be visible. I left a comment on that bug saying that now I think it's the caller who should wait for the UI to be ready to receive input.
But anyway, I have done nothing yet to remove this wait. If it's no longer needed, then it's because the clock UI changed, not because the bug is fixed.
Nicholas Skaggs (nskaggs) wrote : | # |
> What we are doing actually is to put most of the things that were on
> ubuntu_
> If it grows to big, I started moving some of the objects into
> ubuntu_
>
Thanks for writing that out. I was fumbling over words trying to explain that the emulators.py file more or less is legacy, so a name isn't really worth worrying about. Though we need one until we move things ;)
> 173 - # TODO: This wait to ensure that the textfield is visible before
> 174 - # entering text should be part of the SDK emulator. Until then, it
> has
> 175 - # been added here. http://
> 176 - name_alarm.
>
> On the text field helper, we are waiting for it to be focused, not to be
> visible. I left a comment on that bug saying that now I think it's the caller
> who should wait for the UI to be ready to receive input.
> But anyway, I have done nothing yet to remove this wait. If it's no longer
> needed, then it's because the clock UI changed, not because the bug is fixed.
When I check the helper, it indeed showed you are waiting for the object to be focused; but inherently if it's focused it's writeable. I guess we can argue semantics about being visible. The point is, if it's focused it's ready to receive input which is what we need. Visible lies anyway, so if you are wanting to know if the item is onscreen and visible, that's really for the test writer I agree.
Nicholas Skaggs (nskaggs) wrote : | # |
Leo, I just re-read your comment. So you are saying the isFocused property can be true, while at the same time the object can be not ready to receive input? That seems a bit.. weird.
Leo Arias (elopio) wrote : | # |
> Leo, I just re-read your comment. So you are saying the isFocused property can
> be true, while at the same time the object can be not ready to receive input?
> That seems a bit.. weird.
No, the original issue iirc was that we were clicking the textfield before it was visible. So it never got the focus. I might be wrong though, Nik has a younger brain so he might remember more.
Leo Arias (elopio) wrote : | # |
Anyway, for better traceability it would be better if you remove the #TODO in a different branch. That way we can revert them independently in case we break something.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:466
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 467. By Nicholas Skaggs
-
flake8 happiness
Nicholas Skaggs (nskaggs) wrote : | # |
> Anyway, for better traceability it would be better if you remove the #TODO in
> a different branch. That way we can revert them independently in case we break
> something.
True, I've done this.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:467
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:467
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:467
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Nekhelesh Ramananthan (nik90) wrote : | # |
> > Anyway, for better traceability it would be better if you remove the #TODO
> in
> > a different branch. That way we can revert them independently in case we
> break
> > something.
>
> True, I've done this.
Lets not remove any current workarounds present in the old clock app since it might not be worth the effort considering that the new clock app will replace the old clock app in another week or two. I am concentrating on getting the new clock app AP tests ready to make the replacement happen.
Nicholas Skaggs (nskaggs) wrote : | # |
I've set this as WIP and will abandon it likely once the transition happens unless something unforeseen occurs.
Unmerged revisions
- 467. By Nicholas Skaggs
-
flake8 happiness
- 466. By Nicholas Skaggs
-
undo extraneous TODO removal to keep MP focused
- 465. By Nicholas Skaggs
-
rename custom_
proxy_objects to helpers - 464. By Nicholas Skaggs
-
fix Base to be base
- 463. By Nicholas Skaggs
-
fix multivalue call
- 462. By Nicholas Skaggs
-
fix flake8
- 461. By Nicholas Skaggs
-
change emulators to custom proxy objects
Preview Diff
1 | === modified file 'tests/autopilot/ubuntu_clock_app/__init__.py' |
2 | --- tests/autopilot/ubuntu_clock_app/__init__.py 2013-04-10 03:05:19 +0000 |
3 | +++ tests/autopilot/ubuntu_clock_app/__init__.py 2014-07-21 15:31:00 +0000 |
4 | @@ -16,4 +16,4 @@ |
5 | # |
6 | # Authored by: Renato Araujo Oliveira Filho <renato@canonical.com> |
7 | |
8 | -"""clock-app autopilot tests and emulators - top level package.""" |
9 | +"""clock-app autopilot tests and helpers - top level package.""" |
10 | |
11 | === renamed file 'tests/autopilot/ubuntu_clock_app/emulators.py' => 'tests/autopilot/ubuntu_clock_app/helpers.py' |
12 | --- tests/autopilot/ubuntu_clock_app/emulators.py 2014-07-05 07:58:53 +0000 |
13 | +++ tests/autopilot/ubuntu_clock_app/helpers.py 2014-07-21 15:31:00 +0000 |
14 | @@ -24,17 +24,17 @@ |
15 | from autopilot.introspection import dbus |
16 | from autopilot import logging as autopilot_logging |
17 | |
18 | -from ubuntuuitoolkit import emulators as toolkit_emulators |
19 | +import ubuntuuitoolkit |
20 | |
21 | logger = logging.getLogger(__name__) |
22 | |
23 | |
24 | -class ClockEmulatorException(toolkit_emulators.ToolkitEmulatorException): |
25 | - |
26 | - """Exception raised when there is an error with the emulator.""" |
27 | - |
28 | - |
29 | -class MainView(toolkit_emulators.MainView): |
30 | +class ClockHelperException(ubuntuuitoolkit.ToolkitException): |
31 | + |
32 | + """Exception raised when there is an error with the toolkit helpers.""" |
33 | + |
34 | + |
35 | +class MainView(ubuntuuitoolkit.MainView): |
36 | |
37 | @autopilot_logging.log_action(logger.info) |
38 | def open_timer(self): |
39 | @@ -76,12 +76,12 @@ |
40 | return self.wait_select_single(ClockPage) |
41 | |
42 | |
43 | -class LabelDots(toolkit_emulators.TextField): |
44 | +class LabelDots(ubuntuuitoolkit.TextField): |
45 | |
46 | """Autopilot helper for the LabelDots component.""" |
47 | |
48 | |
49 | -class Page(toolkit_emulators.UbuntuUIToolkitEmulatorBase): |
50 | +class Page(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
51 | |
52 | """Autopilot helper for Pages.""" |
53 | |
54 | @@ -141,7 +141,7 @@ |
55 | def _get_saved_world_city_list(self): |
56 | """Return the saved world city listview object""" |
57 | return self.wait_select_single( |
58 | - toolkit_emulators.QQuickListView, objectName='listWorldClocks') |
59 | + ubuntuuitoolkit.QQuickListView, objectName='listWorldClocks') |
60 | |
61 | @autopilot_logging.log_action(logger.info) |
62 | def add_world_city(self, index): |
63 | @@ -155,7 +155,7 @@ |
64 | try: |
65 | self._confirm_world_city_addition(index) |
66 | except AssertionError: |
67 | - raise ClockEmulatorException('Error adding world city.') |
68 | + raise ClockHelperException('Error adding world city.') |
69 | |
70 | def _click_add_city_button(self): |
71 | """Click the add city header button""" |
72 | @@ -188,7 +188,7 @@ |
73 | try: |
74 | self._confirm_world_city_deletion(old_count=old_world_city_count) |
75 | except AssertionError: |
76 | - raise ClockEmulatorException('Error deleting world city.') |
77 | + raise ClockHelperException('Error deleting world city.') |
78 | |
79 | def _get_saved_world_city(self, index): |
80 | """Return saved world city object""" |
81 | @@ -245,7 +245,7 @@ |
82 | self._click_back_button() |
83 | |
84 | |
85 | -class WorldClock(toolkit_emulators.UbuntuUIToolkitEmulatorBase): |
86 | +class WorldClock(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
87 | |
88 | """Autopilot helper for the World Clock Page""" |
89 | |
90 | @@ -256,7 +256,7 @@ |
91 | |
92 | """ |
93 | city = self.wait_select_single( |
94 | - toolkit_emulators.Base, objectName='worldcity{}'.format(index)) |
95 | + ubuntuuitoolkit.base, objectName='worldcity{}'.format(index)) |
96 | self.pointing_device.click_object(city) |
97 | |
98 | |
99 | @@ -279,7 +279,7 @@ |
100 | def enable_show_seconds_option(self): |
101 | """Enable the show seconds option""" |
102 | show_seconds_checkbox = self.proxy_object.wait_select_single( |
103 | - toolkit_emulators.CheckBox, objectName='showSecondsCheckbox') |
104 | + ubuntuuitoolkit.CheckBox, objectName='showSecondsCheckbox') |
105 | show_seconds_checkbox.check() |
106 | |
107 | @autopilot_logging.log_action(logger.info) |
108 | @@ -290,7 +290,7 @@ |
109 | |
110 | """ |
111 | time_format_selector = self.proxy_object.wait_select_single( |
112 | - toolkit_emulators.OptionSelector, objectName='timeFormatSelector') |
113 | + ubuntuuitoolkit.OptionSelector, objectName='timeFormatSelector') |
114 | |
115 | time_format_selector.select_option('Label', text=format) |
116 | |
117 | @@ -379,7 +379,7 @@ |
118 | def _get_saved_alarms_list(self): |
119 | """Return the saved alarm list""" |
120 | return self.wait_select_single( |
121 | - toolkit_emulators.QQuickListView, objectName='listSavedAlarm') |
122 | + ubuntuuitoolkit.QQuickListView, objectName='listSavedAlarm') |
123 | |
124 | @autopilot_logging.log_action(logger.info) |
125 | def add_single_alarm(self, name, day): |
126 | @@ -433,7 +433,7 @@ |
127 | try: |
128 | self._get_saved_alarms_list().count.wait_for(count + 1) |
129 | except AssertionError: |
130 | - raise ClockEmulatorException('Error creating alarm.') |
131 | + raise ClockHelperException('Error creating alarm.') |
132 | |
133 | def _click_add_alarm_button(self): |
134 | """Click the add alarm header button.""" |
135 | @@ -451,7 +451,7 @@ |
136 | """Delete an alarm at the specified index.""" |
137 | old_alarm_count = self.get_num_of_alarms() |
138 | alarm = self.wait_select_single( |
139 | - toolkit_emulators.Base, objectName='alarm{}'.format(index)) |
140 | + ubuntuuitoolkit.base, objectName='alarm{}'.format(index)) |
141 | if not self.main_view.wideAspect: |
142 | self.drag_page_up() |
143 | alarm.swipe_to_delete() |
144 | @@ -459,13 +459,13 @@ |
145 | try: |
146 | self._get_saved_alarms_list().count.wait_for(old_alarm_count - 1) |
147 | except AssertionError: |
148 | - raise ClockEmulatorException('Error deleting alarm.') |
149 | + raise ClockHelperException('Error deleting alarm.') |
150 | |
151 | @autopilot_logging.log_action(logger.info) |
152 | def toggle_alarm(self, index): |
153 | """Toggle an alarm on/off.""" |
154 | alarm = self.wait_select_single( |
155 | - toolkit_emulators.CheckBox, |
156 | + ubuntuuitoolkit.CheckBox, |
157 | objectName='listAlarmStatus{}'.format(index)) |
158 | if not self.main_view.wideAspect: |
159 | self.drag_page_up() |
160 | @@ -492,7 +492,7 @@ |
161 | # TODO: Check the alarm enabled status once the bug at |
162 | # http://pad.lv/1272337 is resolved |
163 | # enabled = self.select_single( |
164 | - # toolkit_emulators.CheckBox, |
165 | + # ubuntuuitoolkit.CheckBox, |
166 | # objectName='listAlarmStatus{}'.format(index)).checked |
167 | alarms.append((name, recurrence)) |
168 | return alarms |
169 | @@ -574,7 +574,7 @@ |
170 | def enable_recurring_alarm_type_switch(self): |
171 | """Enable the recurring alarm type switch""" |
172 | alarm_type_checkbox = self.wait_select_single( |
173 | - toolkit_emulators.CheckBox, objectName='RepeatSelector') |
174 | + ubuntuuitoolkit.CheckBox, objectName='RepeatSelector') |
175 | alarm_type_checkbox.check() |
176 | |
177 | @autopilot_logging.log_action(logger.info) |
178 | @@ -585,7 +585,7 @@ |
179 | |
180 | """ |
181 | day_option_selector = self.select_single( |
182 | - toolkit_emulators.OptionSelector, objectName='OccursSelector') |
183 | + ubuntuuitoolkit.OptionSelector, objectName='OccursSelector') |
184 | |
185 | # Wait for the option selector to expand |
186 | if not day_option_selector.currentlyExpanded: |
187 | @@ -614,7 +614,7 @@ |
188 | def _open_recurring_alarm_dialog(self): |
189 | """Open the recurring alarm dialogue.""" |
190 | recurring_option = self.wait_select_single( |
191 | - toolkit_emulators.MultiValue, objectName='OccurrenceList') |
192 | + ubuntuuitoolkit.listitems.MultiValue, objectName='OccurrenceList') |
193 | self.pointing_device.click_object(recurring_option) |
194 | alarm_days_dialog = self.main_view.wait_select_single( |
195 | AlarmDays, objectName='alarmDaysDialog') |
196 | @@ -622,7 +622,7 @@ |
197 | return alarm_days_dialog |
198 | |
199 | |
200 | -class AlarmDays(toolkit_emulators.UbuntuUIToolkitEmulatorBase): |
201 | +class AlarmDays(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
202 | |
203 | """Autopilot helper for the Alarm Days dialog.""" |
204 | |
205 | @@ -647,7 +647,7 @@ |
206 | day_element_label = self.wait_select_single( |
207 | 'Label', objectName='repeatDaysLabel{}'.format(index)) |
208 | day_element = self.wait_select_single( |
209 | - toolkit_emulators.CheckBox, |
210 | + ubuntuuitoolkit.CheckBox, |
211 | objectName='repeatDaysSwitch{}'.format(index)) |
212 | if day_element_label.text in days_to_select: |
213 | day_element.check() |
214 | @@ -656,7 +656,7 @@ |
215 | day_element.uncheck() |
216 | |
217 | if days_to_select != []: |
218 | - raise ClockEmulatorException( |
219 | + raise ClockHelperException( |
220 | "Can't enable the alarm for days {}".format(days_to_select)) |
221 | |
222 | def _click_confirm_recurring_alarm_days(self): |
223 | @@ -712,7 +712,7 @@ |
224 | name_label.visible.wait_for(True) |
225 | name_label.write(name) |
226 | if name_label.text != name: |
227 | - raise ClockEmulatorException('Failed to write the timer name.') |
228 | + raise ClockHelperException('Failed to write the timer name.') |
229 | |
230 | def _set_time(self): |
231 | """Set the timer hour and minute""" |
232 | @@ -728,7 +728,7 @@ |
233 | sleep(1) |
234 | timeout += 1 |
235 | |
236 | - # TODO we need a dialer hand emulator, with proper self-tests. |
237 | + # TODO we need a dialer hand helper, with proper self-tests. |
238 | # --elopio -2014-01-31 |
239 | minute = self._get_timer_minute_hand() |
240 | # make sure timer is set |
241 | @@ -802,7 +802,7 @@ |
242 | |
243 | """ |
244 | presets_list = self.wait_select_single( |
245 | - toolkit_emulators.QQuickListView, objectName='listTimerPreset') |
246 | + ubuntuuitoolkit.QQuickListView, objectName='listTimerPreset') |
247 | presets_list.click_element('preset{}'.format(index)) |
248 | |
249 | def get_current_time(self): |
250 | @@ -835,6 +835,6 @@ |
251 | if not self.main_view.wideAspect: |
252 | self.drag_page_up() |
253 | preset = self.select_single( |
254 | - toolkit_emulators.Standard, objectName='preset{}'.format(index)) |
255 | + ubuntuuitoolkit.Standard, objectName='preset{}'.format(index)) |
256 | preset.swipe_to_delete() |
257 | preset.confirm_removal() |
258 | |
259 | === modified file 'tests/autopilot/ubuntu_clock_app/tests/__init__.py' |
260 | --- tests/autopilot/ubuntu_clock_app/tests/__init__.py 2014-06-27 15:22:04 +0000 |
261 | +++ tests/autopilot/ubuntu_clock_app/tests/__init__.py 2014-07-21 15:31:00 +0000 |
262 | @@ -26,12 +26,10 @@ |
263 | |
264 | from autopilot import input |
265 | from autopilot.platform import model |
266 | -from ubuntuuitoolkit import ( |
267 | - base, |
268 | - emulators as toolkit_emulators |
269 | -) |
270 | +from ubuntuuitoolkit import base |
271 | +import ubuntuuitoolkit |
272 | |
273 | -from ubuntu_clock_app import emulators |
274 | +from ubuntu_clock_app import helpers |
275 | |
276 | logger = logging.getLogger(__name__) |
277 | |
278 | @@ -73,19 +71,19 @@ |
279 | base.get_qmlscene_launch_command(), |
280 | self.local_location, |
281 | app_type='qt', |
282 | - emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
283 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
284 | |
285 | def launch_test_installed(self): |
286 | self.app = self.launch_test_application( |
287 | base.get_qmlscene_launch_command(), |
288 | self.installed_location, |
289 | app_type='qt', |
290 | - emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
291 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
292 | |
293 | def launch_test_click(self): |
294 | self.app = self.launch_click_package( |
295 | "com.ubuntu.clock", |
296 | - emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
297 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
298 | |
299 | def temp_move_sqlite_db(self): |
300 | try: |
301 | @@ -118,4 +116,4 @@ |
302 | |
303 | @property |
304 | def main_view(self): |
305 | - return self.app.wait_select_single(emulators.MainView) |
306 | + return self.app.wait_select_single(helpers.MainView) |
Left a note about the exception removal.
Also, I renamed emulators.py to custom_ proxy_objects. py. I also used helpers sometimes. Do we like this naming?