Merge lp:~nik90/ubuntu-clock-app/add-stopwatch-ap-tests into lp:ubuntu-clock-app

Proposed by Nekhelesh Ramananthan
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
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 LapsListDelegate.qml
- 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.

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
466. By Nekhelesh Ramananthan

Updated debian changelog

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michal Predotka (mpredotka) wrote :

It works the same from a user point of view. QML code looks good to me.

review: Approve
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

I tested that branch and it is working perfectly for me.
I didn't notice any regression.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/MainPage.qml'
--- app/MainPage.qml 2016-03-03 00:28:40 +0000
+++ app/MainPage.qml 2016-03-03 14:51:35 +0000
@@ -107,13 +107,42 @@
107 }107 }
108 }108 }
109109
110
111
110 ListView {112 ListView {
111 id: listview113 id: listview
114 objectName: "pageListView"
115
116 // Property required only in autopilot to check if listitem has finished moving
117 property alias isMoving: moveAnimation.running
118
119 function moveToStopwatchPage() {
120 moveAnimation.moveTo(listview.originX + listview.width)
121 listview.currentIndex = 1
122 }
123
124 function moveToClockPage() {
125 moveAnimation.moveTo(listview.originX)
126 listview.currentIndex = 0
127 }
128
129 UbuntuNumberAnimation {
130 id: moveAnimation
131 objectName: "pageListViewAnimation"
132
133 target: listview
134 property: "contentX"
135 function moveTo(contentX) {
136 from = listview.contentX
137 to = contentX
138 start()
139 }
140 }
112141
113 // Show the stopwatch page on app startup if it is running142 // Show the stopwatch page on app startup if it is running
114 Component.onCompleted: {143 Component.onCompleted: {
115 if (stopwatchPage.isRunning) {144 if (stopwatchPage.isRunning) {
116 positionViewAtIndex(1, ListView.SnapPosition)145 moveToStopwatchPage()
117 }146 }
118 }147 }
119148
@@ -128,7 +157,5 @@
128 orientation: ListView.Horizontal157 orientation: ListView.Horizontal
129 snapMode: ListView.SnapOneItem158 snapMode: ListView.SnapOneItem
130 interactive: false159 interactive: false
131 highlightMoveDuration: UbuntuAnimation.BriskDuration
132 highlightRangeMode: ListView.StrictlyEnforceRange
133 }160 }
134}161}
135162
=== modified file 'app/components/HeaderNavigation.qml'
--- app/components/HeaderNavigation.qml 2016-02-29 12:42:02 +0000
+++ app/components/HeaderNavigation.qml 2016-03-03 14:51:35 +0000
@@ -31,15 +31,21 @@
31 spacing: units.gu(2)31 spacing: units.gu(2)
3232
33 ActionIcon {33 ActionIcon {
34 id: clockNavigationButton
35 objectName: "clockNavigationButton"
36
34 icon.name: "clock"37 icon.name: "clock"
35 icon.color: listview.currentIndex === 0 ? "#19b6ee" : "#5d5d5d" // #TODO: Replace with UbuntuColors.Blue and UbuntuColors.Slate after OTA-1038 icon.color: listview.currentIndex === 0 ? "#19b6ee" : "#5d5d5d" // #TODO: Replace with UbuntuColors.Blue and UbuntuColors.Slate after OTA-10
36 onClicked: listview.currentIndex = 039 onClicked: listview.moveToClockPage()
37 }40 }
38 41
39 ActionIcon {42 ActionIcon {
43 id: stopwatchNavigationButton
44 objectName: "stopwatchNavigationButton"
45
40 icon.name: "stopwatch"46 icon.name: "stopwatch"
41 icon.color: listview.currentIndex === 1 ? "#19b6ee" : "#5d5d5d" // #TODO: Replace with UbuntuColors.Blue and UbuntuColors.Slate after OTA-1047 icon.color: listview.currentIndex === 1 ? "#19b6ee" : "#5d5d5d" // #TODO: Replace with UbuntuColors.Blue and UbuntuColors.Slate after OTA-10
42 onClicked: listview.currentIndex = 148 onClicked: listview.moveToStopwatchPage()
43 }49 }
44 }50 }
45 51
4652
=== modified file 'app/stopwatch/CMakeLists.txt'
--- app/stopwatch/CMakeLists.txt 2015-08-25 01:02:54 +0000
+++ app/stopwatch/CMakeLists.txt 2016-03-03 14:51:35 +0000
@@ -1,5 +1,6 @@
1set(STOPWATCH_QML_JS_FILES1set(STOPWATCH_QML_JS_FILES
2 LapListView.qml2 LapListView.qml
3 LapsListDelegate.qml
3 StopwatchFace.qml4 StopwatchFace.qml
4 StopwatchPage.qml5 StopwatchPage.qml
5)6)
67
=== modified file 'app/stopwatch/LapListView.qml'
--- app/stopwatch/LapListView.qml 2016-02-26 10:00:54 +0000
+++ app/stopwatch/LapListView.qml 2016-03-03 14:51:35 +0000
@@ -20,11 +20,10 @@
20import Ubuntu.Components 1.320import Ubuntu.Components 1.3
21import Stopwatch 1.021import Stopwatch 1.0
2222
23UbuntuListView {23ListView {
24 id: lapListView24 id: lapListView
2525
26 clip: true26 clip: true
27 currentIndex: -1
2827
29 StopwatchFormatTime {28 StopwatchFormatTime {
30 id: stopwatchFormatTime29 id: stopwatchFormatTime
@@ -75,18 +74,18 @@
75 }74 }
76 }75 }
7776
78 delegate: ListItem {77 delegate: LapsListDelegate {
79 divider.visible: true78 id: lapsListItem
79 objectName: "lapsListItem" + index
80
80 divider.anchors.leftMargin: units.gu(2)81 divider.anchors.leftMargin: units.gu(2)
81 divider.anchors.right: parent.right
82 divider.anchors.rightMargin: units.gu(2)82 divider.anchors.rightMargin: units.gu(2)
8383
84 width: parent.width
85 anchors.horizontalCenter: parent.horizontalCenter
86
87 leadingActions: ListItemActions {84 leadingActions: ListItemActions {
88 actions: [85 actions: [
89 Action {86 Action {
87 id: swipeDeleteAction
88 objectName: "swipeDeleteAction"
90 iconName: "delete"89 iconName: "delete"
91 onTriggered: {90 onTriggered: {
92 stopwatchEngine.removeLap(index)91 stopwatchEngine.removeLap(index)
@@ -95,48 +94,10 @@
95 ]94 ]
96 }95 }
9796
98 Row {97 indexLabel: "#%1".arg(Number(count - index).toLocaleString(Qt.locale(), "f", 0))
99 anchors {98 lapTimeLabel: stopwatchFormatTime.lapTimeToString(model.laptime) + "."
100 left: parent.left99 lapMilliTimeLabel: stopwatchFormatTime.millisToString(model.laptime)
101 right: parent.right100 totalTimeLabel: stopwatchFormatTime.lapTimeToString(model.totaltime) + "."
102 verticalCenter: parent.verticalCenter101 totalMilliTimeLabel: stopwatchFormatTime.millisToString(model.totaltime)
103 leftMargin: units.gu(3)
104 rightMargin: units.gu(2)
105 }
106
107 Label {
108 text: "#%1".arg(Number(count - index).toLocaleString(Qt.locale(), "f", 0))
109 width: parent.width / 5
110 horizontalAlignment: Text.AlignLeft
111 }
112
113 Item {
114 width: 2* parent.width / 5
115 height: childrenRect.height
116 Row {
117 anchors.horizontalCenter: parent.horizontalCenter
118 Label {
119 text: stopwatchFormatTime.lapTimeToString(model.laptime) + "."
120 }
121 Label {
122 text: stopwatchFormatTime.millisToString(model.laptime)
123 }
124 }
125 }
126
127 Item {
128 width: 2 * parent.width / 5
129 height: childrenRect.height
130 Row {
131 anchors.right: parent.right
132 Label {
133 text: stopwatchFormatTime.lapTimeToString(model.totaltime) + "."
134 }
135 Label {
136 text: stopwatchFormatTime.millisToString(model.totaltime)
137 }
138 }
139 }
140 }
141 }102 }
142}103}
143104
=== added file 'app/stopwatch/LapsListDelegate.qml'
--- app/stopwatch/LapsListDelegate.qml 1970-01-01 00:00:00 +0000
+++ app/stopwatch/LapsListDelegate.qml 2016-03-03 14:51:35 +0000
@@ -0,0 +1,81 @@
1/*
2 * Copyright (C) 2016 Canonical Ltd
3 *
4 * This file is part of Ubuntu Clock App
5 *
6 * Ubuntu Clock App is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 3 as
8 * published by the Free Software Foundation.
9 *
10 * Ubuntu Clock App is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19
20import QtQuick 2.4
21import Ubuntu.Components 1.3
22
23ListItem {
24 id: lapsListItem
25
26 property string indexLabel
27 property string lapTimeLabel
28 property string lapMilliTimeLabel
29 property string totalTimeLabel
30 property string totalMilliTimeLabel
31
32 Row {
33 anchors {
34 left: parent.left
35 right: parent.right
36 verticalCenter: parent.verticalCenter
37 leftMargin: units.gu(3)
38 rightMargin: units.gu(2)
39 }
40
41 Label {
42 id: _indexLabel
43 text: indexLabel
44 width: parent.width / 5
45 horizontalAlignment: Text.AlignLeft
46 }
47
48 Item {
49 id: lapTimeContainer
50 width: 2* parent.width / 5
51 height: childrenRect.height
52 Row {
53 anchors.horizontalCenter: parent.horizontalCenter
54 Label {
55 id: _lapTimeLabel
56 text: lapTimeLabel
57 }
58 Label {
59 id: _lapMilliTimeLabel
60 text: lapMilliTimeLabel
61 }
62 }
63 }
64
65 Item {
66 width: 2 * parent.width / 5
67 height: childrenRect.height
68 Row {
69 anchors.right: parent.right
70 Label {
71 id: _totalTimeLabel
72 text: totalTimeLabel
73 }
74 Label {
75 id: _totalMilliTimeLabel
76 text: totalMilliTimeLabel
77 }
78 }
79 }
80 }
81}
082
=== modified file 'app/stopwatch/StopwatchFace.qml'
--- app/stopwatch/StopwatchFace.qml 2016-03-02 12:04:48 +0000
+++ app/stopwatch/StopwatchFace.qml 2016-03-03 14:51:35 +0000
@@ -35,6 +35,7 @@
3535
36 Label {36 Label {
37 id: time37 id: time
38 objectName: "stopwatchTime"
3839
39 text: stopwatchFormatTime.millisToTimeString(milliseconds, true)40 text: stopwatchFormatTime.millisToTimeString(milliseconds, true)
40 font.pixelSize: units.dp(36)41 font.pixelSize: units.dp(36)
@@ -44,6 +45,7 @@
4445
45 Label {46 Label {
46 id: miliseconds47 id: miliseconds
48 objectName: "stopwatchMilliseconds"
4749
48 text: stopwatchFormatTime.millisToString(milliseconds)50 text: stopwatchFormatTime.millisToString(milliseconds)
49 textSize: Label.Large51 textSize: Label.Large
5052
=== modified file 'app/stopwatch/StopwatchPage.qml'
--- app/stopwatch/StopwatchPage.qml 2016-02-25 22:16:54 +0000
+++ app/stopwatch/StopwatchPage.qml 2016-03-03 14:51:35 +0000
@@ -71,7 +71,8 @@
71 }71 }
7272
73 Button {73 Button {
74 id: stopButton74 id: startStopButton
75 objectName: "startAndStopButton"
7576
76 width: parent.width / 2 - units.gu(1)77 width: parent.width / 2 - units.gu(1)
77 height: units.gu(4)78 height: units.gu(4)
@@ -94,6 +95,7 @@
9495
95 Button {96 Button {
96 id: lapButton97 id: lapButton
98 objectName: "lapAndClearButton"
9799
98 text: stopwatchEngine.running ? i18n.tr("Lap") : i18n.tr("Clear")100 text: stopwatchEngine.running ? i18n.tr("Lap") : i18n.tr("Clear")
99 width: parent.width / 2 - units.gu(1)101 width: parent.width / 2 - units.gu(1)
@@ -138,6 +140,7 @@
138 id: lapListViewComponent140 id: lapListViewComponent
139 LapListView {141 LapListView {
140 id: lapListView142 id: lapListView
143 objectName: "lapsList"
141 model: stopwatchEngine144 model: stopwatchEngine
142 }145 }
143 }146 }
144147
=== modified file 'debian/changelog'
--- debian/changelog 2016-03-03 11:58:53 +0000
+++ debian/changelog 2016-03-03 14:51:35 +0000
@@ -4,6 +4,9 @@
4 * Dynamic loading of ListView in ExpandableListItem4 * Dynamic loading of ListView in ExpandableListItem
5 * Removed all vertical positioning overrides of trailing icon in ListItem.5 * Removed all vertical positioning overrides of trailing icon in ListItem.
6 * Fixed failing autopilot tests in trunk (LP: #1552489)6 * Fixed failing autopilot tests in trunk (LP: #1552489)
7 * Added Stopwatch autopilot tests for adding/deleting laps, checking
8 start, pause and stop stopwatch states. (LP: #1490206)
9 * Moved laps list delegate into its own file
710
8 -- Nekhelesh <krnekhelesh@nik90-laptop> Wed, 02 Mar 2016 19:30:48 +010011 -- Nekhelesh <krnekhelesh@nik90-laptop> Wed, 02 Mar 2016 19:30:48 +0100
912
1013
=== modified file 'tests/autopilot/ubuntu_clock_app/__init__.py'
--- tests/autopilot/ubuntu_clock_app/__init__.py 2016-03-03 07:02:42 +0000
+++ tests/autopilot/ubuntu_clock_app/__init__.py 2016-03-03 14:51:35 +0000
@@ -20,7 +20,7 @@
2020
21from autopilot import logging as autopilot_logging21from autopilot import logging as autopilot_logging
22from autopilot.introspection import dbus22from autopilot.introspection import dbus
23from testtools.matchers import GreaterThan23from testtools.matchers import (NotEquals, Equals, GreaterThan)
2424
25from ubuntuuitoolkit import (25from ubuntuuitoolkit import (
26 MainView, UbuntuUIToolkitCustomProxyObjectBase, pickers, UCListItem)26 MainView, UbuntuUIToolkitCustomProxyObjectBase, pickers, UCListItem)
@@ -83,6 +83,18 @@
83 return self.wait_select_single("WorldCityList",83 return self.wait_select_single("WorldCityList",
84 objectName="worldCityList")84 objectName="worldCityList")
8585
86 @autopilot_logging.log_action(logger.info)
87 def open_stopwatch(self):
88 """Open the Stopwatch Page.
89
90 :return: the Stopwatch Page.
91
92 """
93 mainPage = self.get_main_page()
94 mainPage.press_header_navigation_button(
95 'stopwatchNavigationButton')
96 return self.wait_select_single(StopwatchPage)
97
8698
87class Page(UbuntuUIToolkitCustomProxyObjectBase):99class Page(UbuntuUIToolkitCustomProxyObjectBase):
88 """Autopilot helper for Pages."""100 """Autopilot helper for Pages."""
@@ -120,6 +132,153 @@
120 logger.error('BottomEdge element not found.')132 logger.error('BottomEdge element not found.')
121 raise133 raise
122134
135 def press_header_navigation_button(self, button_object_name):
136 """Press the passed custom navigation button
137
138 :param button_object_name: Object name of navigation button
139
140 """
141 navigation_button = self.wait_select_single(
142 'ActionIcon', objectName=button_object_name)
143 self.pointing_device.click_object(navigation_button)
144 page_list_view = self.wait_select_single(
145 'QQuickListView', objectName="pageListView")
146 page_list_view.isMoving.wait_for(False)
147
148
149class StopwatchPage(Page):
150 """Autopilot helper for the Stopwatch page."""
151
152 @autopilot_logging.log_action(logger.info)
153 def start_stopwatch(self):
154 self._click_start_stop_button()
155
156 try:
157 self._get_start_stop_button().text.wait_for("Stop")
158 self._get_lap_clear_button().text.wait_for("Lap")
159 self._get_stopwatch_time().text.wait_for(
160 NotEquals("00:00:00"))
161 self._get_stopwatch_milliseconds().text.wait_for(
162 NotEquals("000"))
163 except AssertionError:
164 raise ClockEmulatorException(
165 'Incorrect stopwatch run state')
166
167 @autopilot_logging.log_action(logger.info)
168 def stop_stopwatch(self):
169 self._click_start_stop_button()
170
171 try:
172 self._get_start_stop_button().text.wait_for("Resume")
173 self._get_lap_clear_button().text.wait_for("Clear")
174 self._get_stopwatch_time().text.wait_for(
175 NotEquals("00:00:00"))
176 self._get_stopwatch_milliseconds().text.wait_for(
177 NotEquals("000"))
178 except AssertionError:
179 raise ClockEmulatorException(
180 'Incorrect stopwatch pause state')
181
182 @autopilot_logging.log_action(logger.info)
183 def clear_stopwatch(self):
184 self._click_lap_clear_button()
185
186 try:
187 self._get_start_stop_button().text.wait_for("Start")
188 self._get_stopwatch_time().text.wait_for(
189 Equals("00:00:00"))
190 self._get_stopwatch_milliseconds().text.wait_for(
191 Equals("000"))
192 except AssertionError:
193 raise ClockEmulatorException(
194 'Invalid stopwatch clear state')
195
196 @autopilot_logging.log_action(logger.info)
197 def add_lap(self):
198 old_count = self._get_laps_count()
199 self._click_lap_clear_button()
200
201 try:
202 self._get_laps_list_view().count.wait_for(
203 Equals(old_count + 1))
204 except AssertionError:
205 raise ClockEmulatorException(
206 'Laps count did not increase on pressing the add lap \
207 button')
208
209 @autopilot_logging.log_action(logger.info)
210 def delete_lap(self, index):
211 old_count = self._get_laps_count()
212 laps_list = self._get_laps_list_view()
213
214 lap = laps_list.wait_select_single(
215 "LapsListDelegate", objectName="lapsListItem{}".format(index))
216 lap.click_remove_action()
217
218 try:
219 self._get_laps_list_view().count.wait_for(
220 Equals(old_count - 1))
221 except AssertionError:
222 raise ClockEmulatorException(
223 'Laps count did not decrease on deleting the lap')
224
225 def _get_laps_count(self):
226 return int(self._get_laps_list_view().count)
227
228 def _get_laps_list_view(self):
229 return self.wait_select_single("QQuickListView",
230 objectName="lapsList")
231
232 @autopilot_logging.log_action(logger.info)
233 def clean_up_test(self):
234 if self._get_start_stop_button().text == "Stop":
235 self._click_start_stop_button()
236
237 if self._get_lap_clear_button().text == "Clear":
238 self._click_lap_clear_button()
239
240 def _get_stopwatch_time(self):
241 """Return the stopwatch time object"""
242 stopwatch_time = self.wait_select_single(
243 "UCLabel", objectName="stopwatchTime")
244 return stopwatch_time
245
246 def _get_stopwatch_milliseconds(self):
247 """Return the stopwatch milliseconds object"""
248 stopwatch_milliseconds = self.wait_select_single(
249 "UCLabel", objectName="stopwatchMilliseconds")
250 return stopwatch_milliseconds
251
252 def _get_start_stop_button(self):
253 """Return the start/stop button"""
254 start_stop_button = self.wait_select_single(
255 "Button", objectName="startAndStopButton")
256 return start_stop_button
257
258 def _get_lap_clear_button(self):
259 """Return the lap/clear button"""
260 lap_clear_button = self.wait_select_single(
261 "Button", objectName="lapAndClearButton")
262 return lap_clear_button
263
264 def _click_start_stop_button(self):
265 """Press the start/stop button"""
266 start_stop_button = self._get_start_stop_button()
267 self.pointing_device.click_object(start_stop_button)
268
269 def _click_lap_clear_button(self):
270 """Press the lap/clear button"""
271 lap_clear_button = self._get_lap_clear_button()
272 self.pointing_device.click_object(lap_clear_button)
273
274
275class LapsListDelegate(UCListItem):
276 """Autopilot helper for laps list delegate"""
277
278 def click_remove_action(self):
279 return self.trigger_leading_action('swipeDeleteAction',
280 self.wait_until_destroyed)
281
123282
124class ClockPage(Page):283class ClockPage(Page):
125 """Autopilot helper for the Clock page."""284 """Autopilot helper for the Clock page."""
126285
=== modified file 'tests/autopilot/ubuntu_clock_app/tests/test_alarm.py'
--- tests/autopilot/ubuntu_clock_app/tests/test_alarm.py 2016-03-03 07:02:42 +0000
+++ tests/autopilot/ubuntu_clock_app/tests/test_alarm.py 2016-03-03 14:51:35 +0000
@@ -22,12 +22,13 @@
2222
23from autopilot.matchers import Eventually23from autopilot.matchers import Eventually
24from testtools.matchers import Equals24from testtools.matchers import Equals
25
25from ubuntu_clock_app.tests import ClockAppTestCase26from ubuntu_clock_app.tests import ClockAppTestCase
2627
2728
28class TestAlarm(ClockAppTestCase):29class TestAlarm(ClockAppTestCase):
29
30 """Tests the alarm page features"""30 """Tests the alarm page features"""
31
31 scenarios = [32 scenarios = [
32 ('random',33 ('random',
33 {'alarm_name': 'Random days Alarm Test',34 {'alarm_name': 'Random days Alarm Test',
@@ -55,7 +56,7 @@
55 ]56 ]
5657
57 def setUp(self):58 def setUp(self):
58 """ This is needed to wait for the application to start.59 """This is needed to wait for the application to start.
5960
60 In the testfarm, the application may take some time to show up.61 In the testfarm, the application may take some time to show up.
6162
6263
=== modified file 'tests/autopilot/ubuntu_clock_app/tests/test_clock.py'
--- tests/autopilot/ubuntu_clock_app/tests/test_clock.py 2016-03-03 00:28:40 +0000
+++ tests/autopilot/ubuntu_clock_app/tests/test_clock.py 2016-03-03 14:51:35 +0000
@@ -27,7 +27,6 @@
2727
2828
29class TestClock(ClockAppTestCase):29class TestClock(ClockAppTestCase):
30
31 """Test the clock page features."""30 """Test the clock page features."""
3231
33 def setUp(self):32 def setUp(self):
3433
=== added file 'tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py'
--- tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_clock_app/tests/test_stopwatch.py 2016-03-03 14:51:35 +0000
@@ -0,0 +1,63 @@
1# Copyright (C) 2016 Canonical Ltd
2#
3# This file is part of Ubuntu Clock App
4#
5# Ubuntu Clock App is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 3 as
7# published by the Free Software Foundation.
8#
9# Ubuntu Clock App is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17"""
18Tests for the Clock App, stopwatch page.
19"""
20
21from __future__ import absolute_import
22
23from autopilot.matchers import Eventually
24from testtools.matchers import Equals
25
26from ubuntu_clock_app.tests import ClockAppTestCase
27
28
29class TestStopwatch(ClockAppTestCase):
30 """Tests the stopwatch feature"""
31
32 def setUp(self):
33 """This is needed to wait for the application to start.
34
35 In the testfarm, the application may take some time to show up.
36
37 """
38 super(TestStopwatch, self).setUp()
39 self.assertThat(
40 self.app.main_view.visible, Eventually(Equals(True)))
41
42 self.page = self.app.main_view.open_stopwatch()
43
44 def test_pressing_gui_button_starts_stops_clears_stopwatch(self):
45 """Test to check if stopwatch can be started, stopped and
46 cleared using the UI buttons"""
47
48 self.page.start_stopwatch()
49 self.page.stop_stopwatch()
50 self.page.clear_stopwatch()
51
52 def test_pressing_lap_button_adds_laps(self):
53 """Test to check if stopwatch laps can be created"""
54 self.page.start_stopwatch()
55 self.page.add_lap()
56 self.page.clean_up_test()
57
58 def test_swipe_delete_button_deletes_laps(self):
59 """Test to check if laps can be deleted by swiping right"""
60 self.page.start_stopwatch()
61 self.page.add_lap()
62 self.page.delete_lap(0)
63 self.page.clean_up_test()

Subscribers

People subscribed via source and target branches