Merge lp:~nik90/ubuntu-clock-app/add-stopwatch-ap-tests into lp:ubuntu-clock-app
- add-stopwatch-ap-tests
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Bartosz Kosiorek | ||||
Approved revision: | 466 | ||||
Merged at revision: | 456 | ||||
Proposed branch: | lp:~nik90/ubuntu-clock-app/add-stopwatch-ap-tests | ||||
Merge into: | lp:ubuntu-clock-app | ||||
Prerequisite: | lp:~nik90/ubuntu-clock-app/fix-failing-ap-tests | ||||
Diff against target: |
634 lines (+367/-61) 12 files modified
app/MainPage.qml (+30/-3) app/components/HeaderNavigation.qml (+8/-2) app/stopwatch/CMakeLists.txt (+1/-0) app/stopwatch/LapListView.qml (+12/-51) app/stopwatch/LapsListDelegate.qml (+81/-0) app/stopwatch/StopwatchFace.qml (+2/-0) app/stopwatch/StopwatchPage.qml (+4/-1) debian/changelog (+3/-0) tests/autopilot/ubuntu_clock_app/__init__.py (+160/-1) tests/autopilot/ubuntu_clock_app/tests/test_alarm.py (+3/-2) tests/autopilot/ubuntu_clock_app/tests/test_clock.py (+0/-1) tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py (+63/-0) |
||||
To merge this branch: | bzr merge lp:~nik90/ubuntu-clock-app/add-stopwatch-ap-tests | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Bartosz Kosiorek | Approve | ||
Michal Predotka | Approve | ||
Jenkins Bot | continuous-integration | Approve | |
Review via email: mp+287919@code.launchpad.net |
Commit message
Added 3 stopwatch tests,
- Tests to checking adding/deleting laps
- Test to check if stopwatch state meets design during run, pause and stop state
- Moved laps list item delegate into its own file LapsListDelegat
- Changed page switch code to be compatible with autopilot (no visual change)
Description of the change
Added stopwatch tests
IMPORTANT NOTE: In order to detect that stopwatchPage has fully loaded in Autopilot, it was necessary to rewrite the page switch code in MainPage.qml. Rest assured it isn't too much of a code change. That said, test the UX and see if it is *exactly* the same as before.
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:465
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
- 466. By Nekhelesh Ramananthan
-
Updated debian changelog
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:466
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:466
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Michal Predotka (mpredotka) wrote : | # |
It works the same from a user point of view. QML code looks good to me.
Bartosz Kosiorek (gang65) wrote : | # |
I tested that branch and it is working perfectly for me.
I didn't notice any regression.
Preview Diff
1 | === modified file 'app/MainPage.qml' |
2 | --- app/MainPage.qml 2016-03-03 00:28:40 +0000 |
3 | +++ app/MainPage.qml 2016-03-03 14:51:35 +0000 |
4 | @@ -107,13 +107,42 @@ |
5 | } |
6 | } |
7 | |
8 | + |
9 | + |
10 | ListView { |
11 | id: listview |
12 | + objectName: "pageListView" |
13 | + |
14 | + // Property required only in autopilot to check if listitem has finished moving |
15 | + property alias isMoving: moveAnimation.running |
16 | + |
17 | + function moveToStopwatchPage() { |
18 | + moveAnimation.moveTo(listview.originX + listview.width) |
19 | + listview.currentIndex = 1 |
20 | + } |
21 | + |
22 | + function moveToClockPage() { |
23 | + moveAnimation.moveTo(listview.originX) |
24 | + listview.currentIndex = 0 |
25 | + } |
26 | + |
27 | + UbuntuNumberAnimation { |
28 | + id: moveAnimation |
29 | + objectName: "pageListViewAnimation" |
30 | + |
31 | + target: listview |
32 | + property: "contentX" |
33 | + function moveTo(contentX) { |
34 | + from = listview.contentX |
35 | + to = contentX |
36 | + start() |
37 | + } |
38 | + } |
39 | |
40 | // Show the stopwatch page on app startup if it is running |
41 | Component.onCompleted: { |
42 | if (stopwatchPage.isRunning) { |
43 | - positionViewAtIndex(1, ListView.SnapPosition) |
44 | + moveToStopwatchPage() |
45 | } |
46 | } |
47 | |
48 | @@ -128,7 +157,5 @@ |
49 | orientation: ListView.Horizontal |
50 | snapMode: ListView.SnapOneItem |
51 | interactive: false |
52 | - highlightMoveDuration: UbuntuAnimation.BriskDuration |
53 | - highlightRangeMode: ListView.StrictlyEnforceRange |
54 | } |
55 | } |
56 | |
57 | === modified file 'app/components/HeaderNavigation.qml' |
58 | --- app/components/HeaderNavigation.qml 2016-02-29 12:42:02 +0000 |
59 | +++ app/components/HeaderNavigation.qml 2016-03-03 14:51:35 +0000 |
60 | @@ -31,15 +31,21 @@ |
61 | spacing: units.gu(2) |
62 | |
63 | ActionIcon { |
64 | + id: clockNavigationButton |
65 | + objectName: "clockNavigationButton" |
66 | + |
67 | icon.name: "clock" |
68 | icon.color: listview.currentIndex === 0 ? "#19b6ee" : "#5d5d5d" // #TODO: Replace with UbuntuColors.Blue and UbuntuColors.Slate after OTA-10 |
69 | - onClicked: listview.currentIndex = 0 |
70 | + onClicked: listview.moveToClockPage() |
71 | } |
72 | |
73 | ActionIcon { |
74 | + id: stopwatchNavigationButton |
75 | + objectName: "stopwatchNavigationButton" |
76 | + |
77 | icon.name: "stopwatch" |
78 | icon.color: listview.currentIndex === 1 ? "#19b6ee" : "#5d5d5d" // #TODO: Replace with UbuntuColors.Blue and UbuntuColors.Slate after OTA-10 |
79 | - onClicked: listview.currentIndex = 1 |
80 | + onClicked: listview.moveToStopwatchPage() |
81 | } |
82 | } |
83 | |
84 | |
85 | === modified file 'app/stopwatch/CMakeLists.txt' |
86 | --- app/stopwatch/CMakeLists.txt 2015-08-25 01:02:54 +0000 |
87 | +++ app/stopwatch/CMakeLists.txt 2016-03-03 14:51:35 +0000 |
88 | @@ -1,5 +1,6 @@ |
89 | set(STOPWATCH_QML_JS_FILES |
90 | LapListView.qml |
91 | + LapsListDelegate.qml |
92 | StopwatchFace.qml |
93 | StopwatchPage.qml |
94 | ) |
95 | |
96 | === modified file 'app/stopwatch/LapListView.qml' |
97 | --- app/stopwatch/LapListView.qml 2016-02-26 10:00:54 +0000 |
98 | +++ app/stopwatch/LapListView.qml 2016-03-03 14:51:35 +0000 |
99 | @@ -20,11 +20,10 @@ |
100 | import Ubuntu.Components 1.3 |
101 | import Stopwatch 1.0 |
102 | |
103 | -UbuntuListView { |
104 | +ListView { |
105 | id: lapListView |
106 | |
107 | clip: true |
108 | - currentIndex: -1 |
109 | |
110 | StopwatchFormatTime { |
111 | id: stopwatchFormatTime |
112 | @@ -75,18 +74,18 @@ |
113 | } |
114 | } |
115 | |
116 | - delegate: ListItem { |
117 | - divider.visible: true |
118 | + delegate: LapsListDelegate { |
119 | + id: lapsListItem |
120 | + objectName: "lapsListItem" + index |
121 | + |
122 | divider.anchors.leftMargin: units.gu(2) |
123 | - divider.anchors.right: parent.right |
124 | divider.anchors.rightMargin: units.gu(2) |
125 | |
126 | - width: parent.width |
127 | - anchors.horizontalCenter: parent.horizontalCenter |
128 | - |
129 | leadingActions: ListItemActions { |
130 | actions: [ |
131 | Action { |
132 | + id: swipeDeleteAction |
133 | + objectName: "swipeDeleteAction" |
134 | iconName: "delete" |
135 | onTriggered: { |
136 | stopwatchEngine.removeLap(index) |
137 | @@ -95,48 +94,10 @@ |
138 | ] |
139 | } |
140 | |
141 | - Row { |
142 | - anchors { |
143 | - left: parent.left |
144 | - right: parent.right |
145 | - verticalCenter: parent.verticalCenter |
146 | - leftMargin: units.gu(3) |
147 | - rightMargin: units.gu(2) |
148 | - } |
149 | - |
150 | - Label { |
151 | - text: "#%1".arg(Number(count - index).toLocaleString(Qt.locale(), "f", 0)) |
152 | - width: parent.width / 5 |
153 | - horizontalAlignment: Text.AlignLeft |
154 | - } |
155 | - |
156 | - Item { |
157 | - width: 2* parent.width / 5 |
158 | - height: childrenRect.height |
159 | - Row { |
160 | - anchors.horizontalCenter: parent.horizontalCenter |
161 | - Label { |
162 | - text: stopwatchFormatTime.lapTimeToString(model.laptime) + "." |
163 | - } |
164 | - Label { |
165 | - text: stopwatchFormatTime.millisToString(model.laptime) |
166 | - } |
167 | - } |
168 | - } |
169 | - |
170 | - Item { |
171 | - width: 2 * parent.width / 5 |
172 | - height: childrenRect.height |
173 | - Row { |
174 | - anchors.right: parent.right |
175 | - Label { |
176 | - text: stopwatchFormatTime.lapTimeToString(model.totaltime) + "." |
177 | - } |
178 | - Label { |
179 | - text: stopwatchFormatTime.millisToString(model.totaltime) |
180 | - } |
181 | - } |
182 | - } |
183 | - } |
184 | + indexLabel: "#%1".arg(Number(count - index).toLocaleString(Qt.locale(), "f", 0)) |
185 | + lapTimeLabel: stopwatchFormatTime.lapTimeToString(model.laptime) + "." |
186 | + lapMilliTimeLabel: stopwatchFormatTime.millisToString(model.laptime) |
187 | + totalTimeLabel: stopwatchFormatTime.lapTimeToString(model.totaltime) + "." |
188 | + totalMilliTimeLabel: stopwatchFormatTime.millisToString(model.totaltime) |
189 | } |
190 | } |
191 | |
192 | === added file 'app/stopwatch/LapsListDelegate.qml' |
193 | --- app/stopwatch/LapsListDelegate.qml 1970-01-01 00:00:00 +0000 |
194 | +++ app/stopwatch/LapsListDelegate.qml 2016-03-03 14:51:35 +0000 |
195 | @@ -0,0 +1,81 @@ |
196 | +/* |
197 | + * Copyright (C) 2016 Canonical Ltd |
198 | + * |
199 | + * This file is part of Ubuntu Clock App |
200 | + * |
201 | + * Ubuntu Clock App is free software: you can redistribute it and/or modify |
202 | + * it under the terms of the GNU General Public License version 3 as |
203 | + * published by the Free Software Foundation. |
204 | + * |
205 | + * Ubuntu Clock App is distributed in the hope that it will be useful, |
206 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
207 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
208 | + * GNU General Public License for more details. |
209 | + * |
210 | + * You should have received a copy of the GNU General Public License |
211 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
212 | + */ |
213 | + |
214 | + |
215 | +import QtQuick 2.4 |
216 | +import Ubuntu.Components 1.3 |
217 | + |
218 | +ListItem { |
219 | + id: lapsListItem |
220 | + |
221 | + property string indexLabel |
222 | + property string lapTimeLabel |
223 | + property string lapMilliTimeLabel |
224 | + property string totalTimeLabel |
225 | + property string totalMilliTimeLabel |
226 | + |
227 | + Row { |
228 | + anchors { |
229 | + left: parent.left |
230 | + right: parent.right |
231 | + verticalCenter: parent.verticalCenter |
232 | + leftMargin: units.gu(3) |
233 | + rightMargin: units.gu(2) |
234 | + } |
235 | + |
236 | + Label { |
237 | + id: _indexLabel |
238 | + text: indexLabel |
239 | + width: parent.width / 5 |
240 | + horizontalAlignment: Text.AlignLeft |
241 | + } |
242 | + |
243 | + Item { |
244 | + id: lapTimeContainer |
245 | + width: 2* parent.width / 5 |
246 | + height: childrenRect.height |
247 | + Row { |
248 | + anchors.horizontalCenter: parent.horizontalCenter |
249 | + Label { |
250 | + id: _lapTimeLabel |
251 | + text: lapTimeLabel |
252 | + } |
253 | + Label { |
254 | + id: _lapMilliTimeLabel |
255 | + text: lapMilliTimeLabel |
256 | + } |
257 | + } |
258 | + } |
259 | + |
260 | + Item { |
261 | + width: 2 * parent.width / 5 |
262 | + height: childrenRect.height |
263 | + Row { |
264 | + anchors.right: parent.right |
265 | + Label { |
266 | + id: _totalTimeLabel |
267 | + text: totalTimeLabel |
268 | + } |
269 | + Label { |
270 | + id: _totalMilliTimeLabel |
271 | + text: totalMilliTimeLabel |
272 | + } |
273 | + } |
274 | + } |
275 | + } |
276 | +} |
277 | |
278 | === modified file 'app/stopwatch/StopwatchFace.qml' |
279 | --- app/stopwatch/StopwatchFace.qml 2016-03-02 12:04:48 +0000 |
280 | +++ app/stopwatch/StopwatchFace.qml 2016-03-03 14:51:35 +0000 |
281 | @@ -35,6 +35,7 @@ |
282 | |
283 | Label { |
284 | id: time |
285 | + objectName: "stopwatchTime" |
286 | |
287 | text: stopwatchFormatTime.millisToTimeString(milliseconds, true) |
288 | font.pixelSize: units.dp(36) |
289 | @@ -44,6 +45,7 @@ |
290 | |
291 | Label { |
292 | id: miliseconds |
293 | + objectName: "stopwatchMilliseconds" |
294 | |
295 | text: stopwatchFormatTime.millisToString(milliseconds) |
296 | textSize: Label.Large |
297 | |
298 | === modified file 'app/stopwatch/StopwatchPage.qml' |
299 | --- app/stopwatch/StopwatchPage.qml 2016-02-25 22:16:54 +0000 |
300 | +++ app/stopwatch/StopwatchPage.qml 2016-03-03 14:51:35 +0000 |
301 | @@ -71,7 +71,8 @@ |
302 | } |
303 | |
304 | Button { |
305 | - id: stopButton |
306 | + id: startStopButton |
307 | + objectName: "startAndStopButton" |
308 | |
309 | width: parent.width / 2 - units.gu(1) |
310 | height: units.gu(4) |
311 | @@ -94,6 +95,7 @@ |
312 | |
313 | Button { |
314 | id: lapButton |
315 | + objectName: "lapAndClearButton" |
316 | |
317 | text: stopwatchEngine.running ? i18n.tr("Lap") : i18n.tr("Clear") |
318 | width: parent.width / 2 - units.gu(1) |
319 | @@ -138,6 +140,7 @@ |
320 | id: lapListViewComponent |
321 | LapListView { |
322 | id: lapListView |
323 | + objectName: "lapsList" |
324 | model: stopwatchEngine |
325 | } |
326 | } |
327 | |
328 | === modified file 'debian/changelog' |
329 | --- debian/changelog 2016-03-03 11:58:53 +0000 |
330 | +++ debian/changelog 2016-03-03 14:51:35 +0000 |
331 | @@ -4,6 +4,9 @@ |
332 | * Dynamic loading of ListView in ExpandableListItem |
333 | * Removed all vertical positioning overrides of trailing icon in ListItem. |
334 | * Fixed failing autopilot tests in trunk (LP: #1552489) |
335 | + * Added Stopwatch autopilot tests for adding/deleting laps, checking |
336 | + start, pause and stop stopwatch states. (LP: #1490206) |
337 | + * Moved laps list delegate into its own file |
338 | |
339 | -- Nekhelesh <krnekhelesh@nik90-laptop> Wed, 02 Mar 2016 19:30:48 +0100 |
340 | |
341 | |
342 | === modified file 'tests/autopilot/ubuntu_clock_app/__init__.py' |
343 | --- tests/autopilot/ubuntu_clock_app/__init__.py 2016-03-03 07:02:42 +0000 |
344 | +++ tests/autopilot/ubuntu_clock_app/__init__.py 2016-03-03 14:51:35 +0000 |
345 | @@ -20,7 +20,7 @@ |
346 | |
347 | from autopilot import logging as autopilot_logging |
348 | from autopilot.introspection import dbus |
349 | -from testtools.matchers import GreaterThan |
350 | +from testtools.matchers import (NotEquals, Equals, GreaterThan) |
351 | |
352 | from ubuntuuitoolkit import ( |
353 | MainView, UbuntuUIToolkitCustomProxyObjectBase, pickers, UCListItem) |
354 | @@ -83,6 +83,18 @@ |
355 | return self.wait_select_single("WorldCityList", |
356 | objectName="worldCityList") |
357 | |
358 | + @autopilot_logging.log_action(logger.info) |
359 | + def open_stopwatch(self): |
360 | + """Open the Stopwatch Page. |
361 | + |
362 | + :return: the Stopwatch Page. |
363 | + |
364 | + """ |
365 | + mainPage = self.get_main_page() |
366 | + mainPage.press_header_navigation_button( |
367 | + 'stopwatchNavigationButton') |
368 | + return self.wait_select_single(StopwatchPage) |
369 | + |
370 | |
371 | class Page(UbuntuUIToolkitCustomProxyObjectBase): |
372 | """Autopilot helper for Pages.""" |
373 | @@ -120,6 +132,153 @@ |
374 | logger.error('BottomEdge element not found.') |
375 | raise |
376 | |
377 | + def press_header_navigation_button(self, button_object_name): |
378 | + """Press the passed custom navigation button |
379 | + |
380 | + :param button_object_name: Object name of navigation button |
381 | + |
382 | + """ |
383 | + navigation_button = self.wait_select_single( |
384 | + 'ActionIcon', objectName=button_object_name) |
385 | + self.pointing_device.click_object(navigation_button) |
386 | + page_list_view = self.wait_select_single( |
387 | + 'QQuickListView', objectName="pageListView") |
388 | + page_list_view.isMoving.wait_for(False) |
389 | + |
390 | + |
391 | +class StopwatchPage(Page): |
392 | + """Autopilot helper for the Stopwatch page.""" |
393 | + |
394 | + @autopilot_logging.log_action(logger.info) |
395 | + def start_stopwatch(self): |
396 | + self._click_start_stop_button() |
397 | + |
398 | + try: |
399 | + self._get_start_stop_button().text.wait_for("Stop") |
400 | + self._get_lap_clear_button().text.wait_for("Lap") |
401 | + self._get_stopwatch_time().text.wait_for( |
402 | + NotEquals("00:00:00")) |
403 | + self._get_stopwatch_milliseconds().text.wait_for( |
404 | + NotEquals("000")) |
405 | + except AssertionError: |
406 | + raise ClockEmulatorException( |
407 | + 'Incorrect stopwatch run state') |
408 | + |
409 | + @autopilot_logging.log_action(logger.info) |
410 | + def stop_stopwatch(self): |
411 | + self._click_start_stop_button() |
412 | + |
413 | + try: |
414 | + self._get_start_stop_button().text.wait_for("Resume") |
415 | + self._get_lap_clear_button().text.wait_for("Clear") |
416 | + self._get_stopwatch_time().text.wait_for( |
417 | + NotEquals("00:00:00")) |
418 | + self._get_stopwatch_milliseconds().text.wait_for( |
419 | + NotEquals("000")) |
420 | + except AssertionError: |
421 | + raise ClockEmulatorException( |
422 | + 'Incorrect stopwatch pause state') |
423 | + |
424 | + @autopilot_logging.log_action(logger.info) |
425 | + def clear_stopwatch(self): |
426 | + self._click_lap_clear_button() |
427 | + |
428 | + try: |
429 | + self._get_start_stop_button().text.wait_for("Start") |
430 | + self._get_stopwatch_time().text.wait_for( |
431 | + Equals("00:00:00")) |
432 | + self._get_stopwatch_milliseconds().text.wait_for( |
433 | + Equals("000")) |
434 | + except AssertionError: |
435 | + raise ClockEmulatorException( |
436 | + 'Invalid stopwatch clear state') |
437 | + |
438 | + @autopilot_logging.log_action(logger.info) |
439 | + def add_lap(self): |
440 | + old_count = self._get_laps_count() |
441 | + self._click_lap_clear_button() |
442 | + |
443 | + try: |
444 | + self._get_laps_list_view().count.wait_for( |
445 | + Equals(old_count + 1)) |
446 | + except AssertionError: |
447 | + raise ClockEmulatorException( |
448 | + 'Laps count did not increase on pressing the add lap \ |
449 | + button') |
450 | + |
451 | + @autopilot_logging.log_action(logger.info) |
452 | + def delete_lap(self, index): |
453 | + old_count = self._get_laps_count() |
454 | + laps_list = self._get_laps_list_view() |
455 | + |
456 | + lap = laps_list.wait_select_single( |
457 | + "LapsListDelegate", objectName="lapsListItem{}".format(index)) |
458 | + lap.click_remove_action() |
459 | + |
460 | + try: |
461 | + self._get_laps_list_view().count.wait_for( |
462 | + Equals(old_count - 1)) |
463 | + except AssertionError: |
464 | + raise ClockEmulatorException( |
465 | + 'Laps count did not decrease on deleting the lap') |
466 | + |
467 | + def _get_laps_count(self): |
468 | + return int(self._get_laps_list_view().count) |
469 | + |
470 | + def _get_laps_list_view(self): |
471 | + return self.wait_select_single("QQuickListView", |
472 | + objectName="lapsList") |
473 | + |
474 | + @autopilot_logging.log_action(logger.info) |
475 | + def clean_up_test(self): |
476 | + if self._get_start_stop_button().text == "Stop": |
477 | + self._click_start_stop_button() |
478 | + |
479 | + if self._get_lap_clear_button().text == "Clear": |
480 | + self._click_lap_clear_button() |
481 | + |
482 | + def _get_stopwatch_time(self): |
483 | + """Return the stopwatch time object""" |
484 | + stopwatch_time = self.wait_select_single( |
485 | + "UCLabel", objectName="stopwatchTime") |
486 | + return stopwatch_time |
487 | + |
488 | + def _get_stopwatch_milliseconds(self): |
489 | + """Return the stopwatch milliseconds object""" |
490 | + stopwatch_milliseconds = self.wait_select_single( |
491 | + "UCLabel", objectName="stopwatchMilliseconds") |
492 | + return stopwatch_milliseconds |
493 | + |
494 | + def _get_start_stop_button(self): |
495 | + """Return the start/stop button""" |
496 | + start_stop_button = self.wait_select_single( |
497 | + "Button", objectName="startAndStopButton") |
498 | + return start_stop_button |
499 | + |
500 | + def _get_lap_clear_button(self): |
501 | + """Return the lap/clear button""" |
502 | + lap_clear_button = self.wait_select_single( |
503 | + "Button", objectName="lapAndClearButton") |
504 | + return lap_clear_button |
505 | + |
506 | + def _click_start_stop_button(self): |
507 | + """Press the start/stop button""" |
508 | + start_stop_button = self._get_start_stop_button() |
509 | + self.pointing_device.click_object(start_stop_button) |
510 | + |
511 | + def _click_lap_clear_button(self): |
512 | + """Press the lap/clear button""" |
513 | + lap_clear_button = self._get_lap_clear_button() |
514 | + self.pointing_device.click_object(lap_clear_button) |
515 | + |
516 | + |
517 | +class LapsListDelegate(UCListItem): |
518 | + """Autopilot helper for laps list delegate""" |
519 | + |
520 | + def click_remove_action(self): |
521 | + return self.trigger_leading_action('swipeDeleteAction', |
522 | + self.wait_until_destroyed) |
523 | + |
524 | |
525 | class ClockPage(Page): |
526 | """Autopilot helper for the Clock page.""" |
527 | |
528 | === modified file 'tests/autopilot/ubuntu_clock_app/tests/test_alarm.py' |
529 | --- tests/autopilot/ubuntu_clock_app/tests/test_alarm.py 2016-03-03 07:02:42 +0000 |
530 | +++ tests/autopilot/ubuntu_clock_app/tests/test_alarm.py 2016-03-03 14:51:35 +0000 |
531 | @@ -22,12 +22,13 @@ |
532 | |
533 | from autopilot.matchers import Eventually |
534 | from testtools.matchers import Equals |
535 | + |
536 | from ubuntu_clock_app.tests import ClockAppTestCase |
537 | |
538 | |
539 | class TestAlarm(ClockAppTestCase): |
540 | - |
541 | """Tests the alarm page features""" |
542 | + |
543 | scenarios = [ |
544 | ('random', |
545 | {'alarm_name': 'Random days Alarm Test', |
546 | @@ -55,7 +56,7 @@ |
547 | ] |
548 | |
549 | def setUp(self): |
550 | - """ This is needed to wait for the application to start. |
551 | + """This is needed to wait for the application to start. |
552 | |
553 | In the testfarm, the application may take some time to show up. |
554 | |
555 | |
556 | === modified file 'tests/autopilot/ubuntu_clock_app/tests/test_clock.py' |
557 | --- tests/autopilot/ubuntu_clock_app/tests/test_clock.py 2016-03-03 00:28:40 +0000 |
558 | +++ tests/autopilot/ubuntu_clock_app/tests/test_clock.py 2016-03-03 14:51:35 +0000 |
559 | @@ -27,7 +27,6 @@ |
560 | |
561 | |
562 | class TestClock(ClockAppTestCase): |
563 | - |
564 | """Test the clock page features.""" |
565 | |
566 | def setUp(self): |
567 | |
568 | === added file 'tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py' |
569 | --- tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py 1970-01-01 00:00:00 +0000 |
570 | +++ tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py 2016-03-03 14:51:35 +0000 |
571 | @@ -0,0 +1,63 @@ |
572 | +# Copyright (C) 2016 Canonical Ltd |
573 | +# |
574 | +# This file is part of Ubuntu Clock App |
575 | +# |
576 | +# Ubuntu Clock App is free software: you can redistribute it and/or modify |
577 | +# it under the terms of the GNU General Public License version 3 as |
578 | +# published by the Free Software Foundation. |
579 | +# |
580 | +# Ubuntu Clock App is distributed in the hope that it will be useful, |
581 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
582 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
583 | +# GNU General Public License for more details. |
584 | +# |
585 | +# You should have received a copy of the GNU General Public License |
586 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
587 | + |
588 | +""" |
589 | +Tests for the Clock App, stopwatch page. |
590 | +""" |
591 | + |
592 | +from __future__ import absolute_import |
593 | + |
594 | +from autopilot.matchers import Eventually |
595 | +from testtools.matchers import Equals |
596 | + |
597 | +from ubuntu_clock_app.tests import ClockAppTestCase |
598 | + |
599 | + |
600 | +class TestStopwatch(ClockAppTestCase): |
601 | + """Tests the stopwatch feature""" |
602 | + |
603 | + def setUp(self): |
604 | + """This is needed to wait for the application to start. |
605 | + |
606 | + In the testfarm, the application may take some time to show up. |
607 | + |
608 | + """ |
609 | + super(TestStopwatch, self).setUp() |
610 | + self.assertThat( |
611 | + self.app.main_view.visible, Eventually(Equals(True))) |
612 | + |
613 | + self.page = self.app.main_view.open_stopwatch() |
614 | + |
615 | + def test_pressing_gui_button_starts_stops_clears_stopwatch(self): |
616 | + """Test to check if stopwatch can be started, stopped and |
617 | + cleared using the UI buttons""" |
618 | + |
619 | + self.page.start_stopwatch() |
620 | + self.page.stop_stopwatch() |
621 | + self.page.clear_stopwatch() |
622 | + |
623 | + def test_pressing_lap_button_adds_laps(self): |
624 | + """Test to check if stopwatch laps can be created""" |
625 | + self.page.start_stopwatch() |
626 | + self.page.add_lap() |
627 | + self.page.clean_up_test() |
628 | + |
629 | + def test_swipe_delete_button_deletes_laps(self): |
630 | + """Test to check if laps can be deleted by swiping right""" |
631 | + self.page.start_stopwatch() |
632 | + self.page.add_lap() |
633 | + self.page.delete_lap(0) |
634 | + self.page.clean_up_test() |
PASSED: Continuous integration, rev:464 /core-apps- jenkins. ubuntu. com/job/ clock-app- ci/88/ /core-apps- jenkins. ubuntu. com/job/ generic- update- mp/677/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /core-apps- jenkins. ubuntu. com/job/ clock-app- ci/88/rebuild
https:/