Merge lp:~mzanetti/reminders-app/qmltest3 into lp:reminders-app

Proposed by Michael Zanetti on 2015-03-21
Status: Needs review
Proposed branch: lp:~mzanetti/reminders-app/qmltest3
Merge into: lp:reminders-app
Prerequisite: lp:~mzanetti/reminders-app/qmltest2
Diff against target: 325 lines (+156/-14)
8 files modified
src/app/qml/components/EditTagsDialog.qml (+4/-0)
src/app/qml/components/ListItemWithActions.qml (+2/-0)
src/app/qml/components/NotebooksDelegate.qml (+3/-2)
src/app/qml/components/NotesDelegate.qml (+2/-0)
src/app/qml/ui/SetReminderPage.qml (+1/-0)
src/app/qml/ui/SetReminderView.qml (+3/-0)
tests/qml/RemindersTestCase.qml (+53/-0)
tests/qml/tst_NotesPage.qml (+88/-12)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/qmltest3
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Needs Fixing on 2015-11-10
Nicholas Skaggs (community) Needs Fixing on 2015-11-10
Riccardo Padovani 2015-03-21 Needs Information on 2015-07-29
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing on 2015-03-21
Review via email: mp+253753@code.launchpad.net

Commit message

add more tests for the NotePage

* setting/unsetting a reminder
* tagging/untagging a note

To post a comment you must log in.
Riccardo Padovani (rpadovani) wrote :

Thanks for working on this :-)

I left some comments inline - nothing wrong, but I'm not sure about some choices

review: Needs Information
review: Needs Fixing (continuous-integration)

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/reminders-app-autolanding/2/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/102/console

review: Needs Fixing (continuous-integration)
Nicholas Skaggs (nskaggs) wrote :

Text conflict in debian/control
Text conflict in src/app/qml/components/EditTagsDialog.qml
Text conflict in src/app/qml/components/ListItemWithActions.qml

review: Needs Fixing

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/reminders-app-autolanding/259/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/378/console

review: Needs Fixing (continuous-integration)

Unmerged revisions

299. By Michael Zanetti on 2015-03-21

add more tests for the NotePage

* setting/unsetting a reminder
* tagging/untagging a note

298. By Michael Zanetti on 2015-03-21

more build-deps update

297. By Michael Zanetti on 2015-03-21

update build-deps

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/qml/components/EditTagsDialog.qml'
2--- src/app/qml/components/EditTagsDialog.qml 2015-02-27 22:43:12 +0000
3+++ src/app/qml/components/EditTagsDialog.qml 2015-03-21 04:19:08 +0000
4@@ -41,6 +41,7 @@
5
6 TextField {
7 id: textField
8+ objectName: "newTagTextField"
9 Layout.fillWidth: true
10 placeholderText: i18n.tr("Create a new tag")
11
12@@ -70,6 +71,7 @@
13 }
14
15 Button {
16+ objectName: "createTagButton"
17 text: i18n.tr("Create tag")
18 color: UbuntuColors.orange
19 enabled: textField.text.replace(/\s+/g, '') !== ''; // Not only whitespaces!
20@@ -91,6 +93,7 @@
21 model: tags
22
23 delegate: OptionSelectorDelegate {
24+ objectName: "tagDelegate" + index
25 text: model.name
26 selected: root.note ? root.note.tagGuids.indexOf(model.guid) !== -1 : false
27
28@@ -112,6 +115,7 @@
29
30 Button {
31 id: closeButton
32+ objectName: "tagsDialogCloseButton"
33 Layout.preferredWidth: parent.width - units.gu(2)
34 Layout.alignment: Qt.AlignHCenter
35
36
37=== modified file 'src/app/qml/components/ListItemWithActions.qml'
38--- src/app/qml/components/ListItemWithActions.qml 2015-02-13 01:02:58 +0000
39+++ src/app/qml/components/ListItemWithActions.qml 2015-03-21 04:19:08 +0000
40@@ -196,6 +196,7 @@
41 color: UbuntuColors.red
42
43 Icon {
44+ objectName: "leftAction"
45 anchors {
46 centerIn: parent
47 horizontalCenterOffset: actionThreshold / 2
48@@ -233,6 +234,7 @@
49
50 model: _showActions ? _visibleRightSideActions : []
51 Item {
52+ objectName: "rightAction" + index
53 property alias image: img
54
55 height: rightActionsView.height
56
57=== modified file 'src/app/qml/components/NotebooksDelegate.qml'
58--- src/app/qml/components/NotebooksDelegate.qml 2015-03-04 00:23:45 +0000
59+++ src/app/qml/components/NotebooksDelegate.qml 2015-03-21 04:19:08 +0000
60@@ -133,12 +133,13 @@
61 horizontalAlignment: Text.AlignRight
62 }
63 Icon {
64- anchors { left: parent.left; verticalCenter: parent.verticalCenter; right: parent.right }
65 height: width
66+ width: parent.width
67+
68 name: "go-next"
69 }
70 Icon {
71- anchors { left: parent.left; bottom: parent.bottom; right: parent.right }
72+ width: parent.width
73 height: width
74 name: model.loading ? "sync-updating" : model.syncError ? "sync-error" : model.synced ? "sync-idle" : "sync-offline"
75 visible: NotesStore.username !== "@local" && (!model.synced || model.syncError || model.loading)
76
77=== modified file 'src/app/qml/components/NotesDelegate.qml'
78--- src/app/qml/components/NotesDelegate.qml 2015-02-23 18:44:26 +0000
79+++ src/app/qml/components/NotesDelegate.qml 2015-03-21 04:19:08 +0000
80@@ -129,6 +129,7 @@
81 }
82
83 Label {
84+ objectName: "tagsLabel"
85 Layout.fillWidth: true
86 text: root.tags
87 wrapMode: Text.WordWrap
88@@ -143,6 +144,7 @@
89 width: units.gu(2)
90
91 Icon {
92+ objectName: "reminderIcon"
93 anchors { left: parent.left; top: parent.top; right: parent.right }
94 height: width
95 name: root.reminder ? "alarm-clock" : ""
96
97=== modified file 'src/app/qml/ui/SetReminderPage.qml'
98--- src/app/qml/ui/SetReminderPage.qml 2014-09-23 12:39:27 +0000
99+++ src/app/qml/ui/SetReminderPage.qml 2015-03-21 04:19:08 +0000
100@@ -23,6 +23,7 @@
101
102 Page {
103 id: root
104+ objectName: "setReminderPage"
105 title: setReminderView.title
106 property alias note: setReminderView.note
107
108
109=== modified file 'src/app/qml/ui/SetReminderView.qml'
110--- src/app/qml/ui/SetReminderView.qml 2014-12-08 10:25:48 +0000
111+++ src/app/qml/ui/SetReminderView.qml 2015-03-21 04:19:08 +0000
112@@ -25,6 +25,7 @@
113
114 Item {
115 id: root
116+ objectName: "setReminderView"
117 property string title: note.title
118 property var note
119
120@@ -72,6 +73,7 @@
121 RowLayout {
122 Layout.fillWidth: true
123 Button {
124+ objectName: "deleteButton"
125 // TRANSLATORS: Button that deletes a reminder
126 text: i18n.tr("Delete")
127 Layout.fillWidth: true
128@@ -83,6 +85,7 @@
129 }
130 }
131 Button {
132+ objectName: "saveButton"
133 Layout.fillWidth: true
134 // TRANSLATORS: Button that saves a reminder
135 text: i18n.tr("Save")
136
137=== added file 'tests/qml/RemindersTestCase.qml'
138--- tests/qml/RemindersTestCase.qml 1970-01-01 00:00:00 +0000
139+++ tests/qml/RemindersTestCase.qml 2015-03-21 04:19:08 +0000
140@@ -0,0 +1,53 @@
141+import QtQuick 2.2
142+import QtTest 1.0
143+import Ubuntu.Components 1.1
144+import Ubuntu.Test 0.1
145+import Evernote 0.1
146+
147+import '../../src/app/qml/'
148+
149+
150+UbuntuTestCase {
151+
152+ // toIndex: 1, 2, 3 for rightActions, -1 for leftAction, defaults to 1
153+ function dragListItemWithAction(delegate, actionIndex) {
154+ if (actionIndex == undefined) {
155+ actionIndex = 1;
156+ }
157+ tryCompare(delegate, "_showActions", false);
158+ waitForRendering(delegate);
159+
160+ var x = delegate.width / 2;
161+ var y = delegate.height / 2;
162+ var dx = units.gu(30) * -actionIndex;
163+ mousePress(delegate, 1, 1);
164+ mouseMoveSlowly(delegate, x, y, dx, 0, 10, 20);
165+ mouseRelease(delegate, x + dx, y);
166+ waitForRendering(delegate);
167+ tryCompare(delegate, "swipping", false);
168+
169+ var action;
170+ if (actionIndex == -1) {
171+ action = findChildWaiting(delegate, "leftAction");
172+ } else {
173+ print("FAIL searching for rightaction","rightAction" + (actionIndex - 1))
174+ action = findChildWaiting(delegate, "rightAction" + (actionIndex - 1));
175+ }
176+ print("#### found action", action)
177+ mouseClick(action, 1, 1)
178+ if (actionIndex >= 0) {
179+ tryCompare(delegate, "_showActions", false);
180+ }
181+ waitForRendering(delegate)
182+ }
183+
184+ function findChildWaiting(root, objectName, timeout) {
185+ if (timeout == undefined) {
186+ timeout = 2000;
187+ }
188+
189+ tryCompareFunction(function() {return findChild(root, objectName) != null}, true, timeout);
190+ return findChild(root, objectName);
191+ }
192+}
193+
194
195=== modified file 'tests/qml/tst_NotesPage.qml'
196--- tests/qml/tst_NotesPage.qml 2015-03-21 04:19:08 +0000
197+++ tests/qml/tst_NotesPage.qml 2015-03-21 04:19:08 +0000
198@@ -28,8 +28,25 @@
199 Item {
200 id: root
201
202- width: units.gu(40)
203- height: units.gu(60)
204+ width: units.gu(46)
205+ height: units.gu(64)
206+
207+
208+ Rectangle {
209+ id: loading
210+ anchors { left: parent.left; bottom: parent.bottom }
211+ height: units.gu(1)
212+ width: height
213+ color: "black"
214+ z: 2
215+ NumberAnimation on rotation {
216+ from: 0
217+ to: 360
218+ running: loading.visible == true
219+ loops: Animation.Infinite
220+ duration: 900
221+ }
222+ }
223
224 QtObject {
225 id: preferences
226@@ -53,8 +70,8 @@
227 property bool phone: true
228 }
229
230- UbuntuTestCase {
231- id: notebooksDelegateTestCase
232+ RemindersTestCase {
233+ id: notesPageTestCase
234 name: 'notebooksDelegateTestCase'
235 when: windowShown
236
237@@ -131,15 +148,8 @@
238 waitForRendering(mainView);
239
240 var delegate = findChild(mainView, "notesDelegate0");
241+ dragListItemWithAction(delegate, -1);
242
243- var x = delegate.width / 2
244- var y = delegate.height / 2
245- var dx = delegate.width / 2
246- mousePress(delegate, 1, 1)
247- mouseMoveSlowly(delegate, x, y, dx, 0, 10, 20)
248- mouseRelease(delegate, x + dx, y)
249- waitForRendering(mainView)
250- mouseClick(delegate, units.gu(3), y)
251 tryCompare(NotesStore, "count", 0);
252 }
253
254@@ -177,5 +187,71 @@
255 compare(delegate.title, "testNote" + data.sortOrder[i]);
256 }
257 }
258+
259+ function test_setReminder() {
260+ var note = createNote("testNote1");
261+
262+ var noteDelegate = findChild(mainView, "notesDelegate0");
263+ var reminderIcon = findChild(noteDelegate, "reminderIcon");
264+
265+ // Make sure no reminder set yet.
266+ tryCompare(reminderIcon, "visible", false);
267+
268+ dragListItemWithAction(noteDelegate, 1);
269+
270+ var setReminderView = findChildWaiting(root, "setReminderView");
271+ var saveButton = findChild(setReminderView, "saveButton");
272+
273+ waitForRendering(setReminderView);
274+ mouseClick(saveButton, 1, 1)
275+
276+ tryCompare(reminderIcon, "visible", true);
277+
278+ waitForRendering(mainView)
279+ dragListItemWithAction(noteDelegate, 1);
280+
281+ setReminderView = findChildWaiting(root, "setReminderView");
282+ var deleteButton = findChild(setReminderView, "deleteButton");
283+
284+ waitForRendering(setReminderView);
285+ mouseClick(deleteButton, 1, 1);
286+
287+ tryCompare(reminderIcon, "visible", false)
288+
289+ }
290+
291+ function test_tag() {
292+ var note = createNote("testNote1");
293+ var noteDelegate = findChild(mainView, "notesDelegate0");
294+
295+ dragListItemWithAction(noteDelegate, 2)
296+
297+ var newTagTextField = findChildWaiting(root, "newTagTextField");
298+ mouseClick(newTagTextField, 1, 1);
299+
300+ typeString("testTag1");
301+
302+ var createTagButton = findChild(root, "createTagButton");
303+ mouseClick(createTagButton, 1, 1);
304+
305+ var closeButton = findChild(root, "tagsDialogCloseButton");
306+ mouseClick(closeButton, 1, 1);
307+
308+ tryCompareFunction(function() {return findChild(root, "createTagButton") == null}, true);
309+
310+ var tagsLabel = findChild(noteDelegate, "tagsLabel");
311+ tryCompare(tagsLabel, "text", "testTag1")
312+
313+ dragListItemWithAction(noteDelegate, 2);
314+
315+
316+ var testTagDelegate = findChildWaiting(root, "tagDelegate0");
317+ mouseClick(testTagDelegate, 1, 1);
318+
319+ closeButton = findChild(root, "tagsDialogCloseButton");
320+ mouseClick(closeButton, 1, 1);
321+
322+ tryCompare(tagsLabel, "text", "")
323+ }
324 }
325 }

Subscribers

People subscribed via source and target branches