Merge lp:~carla-sella/ubuntu-calendar-app/calendar-app into lp:ubuntu-calendar-app
- calendar-app
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~carla-sella/ubuntu-calendar-app/calendar-app |
Merge into: | lp:ubuntu-calendar-app |
Diff against target: |
205 lines (+97/-16) 3 files modified
TimePicker.qml (+4/-0) tests/autopilot/calendar_app/emulators/main_window.py (+30/-0) tests/autopilot/calendar_app/tests/test_calendar.py (+63/-16) |
To merge this branch: | bzr merge lp:~carla-sella/ubuntu-calendar-app/calendar-app |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Olivier Tilloy (community) | Approve | ||
Carla Sella (community) | Needs Resubmitting | ||
Ubuntu Calendar Developers | Pending | ||
Review via email: mp+179795@code.launchpad.net |
This proposal has been superseded by a proposal from 2013-08-19.
Commit message
Calendar app autopilot new event test
Description of the change
Calendar app autopilot new event test
Nicholas Skaggs (nskaggs) wrote : | # |
Olivier Tilloy (osomon) wrote : | # |
101 +## @unittest.
102 +## "See http://
Instead of commented out, the skip decorator should be removed altogether, as bug #1206048 is now fixed.
Olivier Tilloy (osomon) wrote : | # |
30 + objectName: "OKButton"
That’s a very generic name, probably too generic. If in the future the app gets more popups, there will probably be several "OK buttons".
Olivier Tilloy (osomon) wrote : | # |
84 +from time import sleep
This import is unused, can you please remove it?
Olivier Tilloy (osomon) wrote : | # |
79 +import math
Same for this import, it seems it is unused.
Olivier Tilloy (osomon) wrote : | # |
148 + self.pointing_
149 + (y_Hscroller+
150 + x_Hscroller+
151 + (y_Hscroller+
You should ensure you always pass integers as parameters to .drag(…), so you need to surround each parameter with int(…).
Olivier Tilloy (osomon) wrote : | # |
182 + #---> TODO input end time
So this MR is not complete yet, is it? If not complete, please set its status to "Work in progress", and set it back to "Needs review" once it is actually ready. Thanks!
Carla Sella (carla-sella) wrote : | # |
The test is complete for now even if it can be improved, but for the moment we want to run it as it is.
Carla Sella (carla-sella) : | # |
Nicholas Skaggs (nskaggs) wrote : | # |
A minor nitpick; I would add eventually to these lines:
self.assertThat
and
self.assertThat
Carla Sella (carla-sella) wrote : | # |
If I add eventually to the two lines you suggested, I get this error: TypeError: Eventually is only usable with attributes that have a wait_for function or callable objects.
Olivier Tilloy (osomon) wrote : | # |
172 + save_button = self.main_
173 + self.assertThat
179 + title_label = self.main_
180 + self.assertThat
This is not doing what you think it does: because 'save_button' and 'title_label' are assigned before defining the lambda function, they contain static values, so the lambda is useless. For it to be useful, you need to use it like that:
lambda: self.main_
lambda: self.main_
And since you’re comparing to None, instead of using Equals (or NotEquals), you should use the identity matcher, Is, like that:
self.
Carla Sella (carla-sella) wrote : | # |
Thanks Olivier, I fixed the two asserts, hope they are ok now.
Olivier Tilloy (osomon) wrote : | # |
42 - def get_month_
43 - return self.app.
Removing this breaks all the other existing tests. Please revert this change.
Olivier Tilloy (osomon) wrote : | # |
92 - @unittest.
93 - "See http://
Now that you removed this decorator, the "import unittest" line should be removed from tests/autopilot
Olivier Tilloy (osomon) wrote : | # |
pyflakes reports 4 warnings, all of them easily fixable by just removing unused code:
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
Carla Sella (carla-sella) wrote : | # |
Hope everything's fine now :p.
Thanks Olilvier.
Olivier Tilloy (osomon) wrote : | # |
> 42 - def get_month_
> 43 - return self.app.
>
> Removing this breaks all the other existing tests. Please revert this change.
This one still needs to be fixed, all the other autopilot tests are currently failing because of this removal.
Carla Sella (carla-sella) : | # |
Olivier Tilloy (osomon) wrote : | # |
Looks good, thanks Carla!
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Olivier Tilloy (osomon) wrote : | # |
Apparently the builder is now considering pep8 warnings as errors…
I’ll fix all the warnings in trunk in a separate branch and we’ll get it merged first, so that you have to address only those that are related to your changes in this branch.
Olivier Tilloy (osomon) wrote : | # |
> Apparently the builder is now considering pep8 warnings as errors…
> I’ll fix all the warnings in trunk in a separate branch and we’ll get it
> merged first, so that you have to address only those that are related to your
> changes in this branch.
In fact it appears all the pep8 warnings were introduced by your changes, the trunk is "clean".
To get a list of all the warnings, simply install 'pep8' on your machine, and from within your branch, run `pep8 tests`.
This will print out a list of warnings, usually self-explanatory on how to fix them.
Carla Sella (carla-sella) : | # |
Olivier Tilloy (osomon) wrote : | # |
I’m still getting 20 pep8 warnings:
$ pep8 tests
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
tests/autopilot
If you add whitespaces around the "+" operator, this should fix it.
Carla Sella (carla-sella) : | # |
Olivier Tilloy (osomon) wrote : | # |
Yes, looks like all the warnings are fixed now! Thanks for your patience Carla :)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) : | # |
- 88. By Carla Sella
-
Calendar app autopilot new event test.
Approved by Ubuntu Phone Apps Jenkins Bot, Olivier Tilloy.
- 89. By Carla Sella
-
Added asserts for error on location field in new event test.
- 90. By Carla Sella
-
Added a couple of minor fixes.
- 91. By Carla Sella
-
Work in progress for fixing new event test.
- 92. By Carla Sella
-
Fixed code on animation fields, except the time picker.
Unmerged revisions
- 92. By Carla Sella
-
Fixed code on animation fields, except the time picker.
- 91. By Carla Sella
-
Work in progress for fixing new event test.
- 90. By Carla Sella
-
Added a couple of minor fixes.
- 89. By Carla Sella
-
Added asserts for error on location field in new event test.
Preview Diff
1 | === modified file 'TimePicker.qml' |
2 | --- TimePicker.qml 2013-07-11 13:26:41 +0000 |
3 | +++ TimePicker.qml 2013-08-15 12:37:20 +0000 |
4 | @@ -40,18 +40,21 @@ |
5 | height: units.gu(24) |
6 | Scroller { |
7 | id: hourScroller |
8 | + objectName: "hourScroller" |
9 | anchors { |
10 | top: parent.top |
11 | bottom: parent.bottom |
12 | } |
13 | width: parent.width / 2 |
14 | labelText: i18n.tr("Hour") |
15 | + |
16 | min: 00 |
17 | max: 23 |
18 | currentIndex: priv.now.getHours() |
19 | } |
20 | Scroller { |
21 | id: minuteScroller |
22 | + objectName: "minuteScroller" |
23 | anchors { |
24 | top: parent.top |
25 | bottom: parent.bottom |
26 | @@ -75,6 +78,7 @@ |
27 | width: (parent.width - parent.spacing) / 2 |
28 | } |
29 | Button { |
30 | + objectName: "TimePickerOKButton" |
31 | text: i18n.tr("OK") |
32 | color: "#dd4814" |
33 | |
34 | |
35 | === modified file 'tests/autopilot/calendar_app/emulators/main_window.py' |
36 | --- tests/autopilot/calendar_app/emulators/main_window.py 2013-07-19 14:15:17 +0000 |
37 | +++ tests/autopilot/calendar_app/emulators/main_window.py 2013-08-15 12:37:20 +0000 |
38 | @@ -19,5 +19,35 @@ |
39 | def get_event_view(self): |
40 | return self.app.select_single("EventView") |
41 | |
42 | + def get_new_event(self): |
43 | + return self.app.select_single("NewEvent") |
44 | + |
45 | + def get_new_event_name_input_box(self): |
46 | + return self.app.select_single("TextField", objectName="newEventName") |
47 | + |
48 | + def get_event_start_time_field(self): |
49 | + return self.app.select_single("Button", objectName="startTimeInput") |
50 | + |
51 | + def get_event_end_time_field(self): |
52 | + return self.app.select_single("Button", objectName="endTimeInput") |
53 | + |
54 | + def get_event_location_field(self): |
55 | + return self.app.select_single( |
56 | + "TextField", objectName="eventLocationInput") |
57 | + |
58 | + def get_event_people_field(self): |
59 | + return self.app.select_single( |
60 | + "TextField", objectName="eventPeopleInput") |
61 | + |
62 | def get_month_view(self): |
63 | return self.app.select_single("MonthView") |
64 | + |
65 | + def get_time_picker_ok_button(self): |
66 | + return self.app.select_single( |
67 | + "Button", objectName="TimePickerOKButton") |
68 | + |
69 | + def get_event_save_button(self): |
70 | + return self.app.select_single("Button", objectName="eventSaveButton") |
71 | + |
72 | + def get_title_label(self, title): |
73 | + return self.app.select_many("Label", text=title) |
74 | |
75 | === modified file 'tests/autopilot/calendar_app/tests/test_calendar.py' |
76 | --- tests/autopilot/calendar_app/tests/test_calendar.py 2013-08-05 08:37:43 +0000 |
77 | +++ tests/autopilot/calendar_app/tests/test_calendar.py 2013-08-15 12:37:20 +0000 |
78 | @@ -14,7 +14,6 @@ |
79 | from testtools.matchers import Equals, NotEquals |
80 | |
81 | import time |
82 | -import unittest |
83 | |
84 | from calendar_app.tests import CalendarTestCase |
85 | |
86 | @@ -22,6 +21,8 @@ |
87 | class TestMainWindow(CalendarTestCase): |
88 | |
89 | def test_timeline_view_shows(self): |
90 | + """test timeline view""" |
91 | + |
92 | event_view = self.main_window.get_event_view() |
93 | |
94 | self.assertThat( |
95 | @@ -33,9 +34,9 @@ |
96 | self.assertThat( |
97 | event_view.eventViewType, Eventually(Equals("DiaryView.qml"))) |
98 | |
99 | - @unittest.skip("Adding a new event is broken, needs fixing. " |
100 | - "See http://pad.lv/1206048.") |
101 | def test_new_event(self): |
102 | + """test add new event """ |
103 | + |
104 | #click on new event button |
105 | self.ubuntusdk.click_toolbar_button('New Event') |
106 | |
107 | @@ -43,12 +44,13 @@ |
108 | #event_view = self.main_window.get_event_view() |
109 | event_name_field = self.main_window.get_new_event_name_input_box() |
110 | start_time_field = self.main_window.get_event_start_time_field() |
111 | - end_time_field = self.main_window.get_event_end_time_field() |
112 | location_field = self.main_window.get_event_location_field() |
113 | people_field = self.main_window.get_event_people_field() |
114 | save_button = self.main_window.get_event_save_button() |
115 | |
116 | #input a new event name |
117 | + self.assertThat( |
118 | + self.main_window.get_new_event().visible, Eventually(Equals(True))) |
119 | eventTitle = "Test event" + str(time.time()) |
120 | |
121 | self.pointing_device.click_object(event_name_field) |
122 | @@ -56,16 +58,56 @@ |
123 | self.assertThat(event_name_field.text, Eventually(Equals(eventTitle))) |
124 | |
125 | #input start time |
126 | + self.assertThat( |
127 | + lambda: self.main_window.get_event_start_time_field(), |
128 | + Eventually(NotEquals(None))) |
129 | self.pointing_device.click_object(start_time_field) |
130 | - self.keyboard.press_and_release("Ctrl+a") |
131 | - self.keyboard.type("11") |
132 | - self.assertThat(start_time_field.text, Eventually(Equals("11"))) |
133 | - |
134 | - #input end time |
135 | - self.pointing_device.click_object(end_time_field) |
136 | - self.keyboard.press_and_release("Ctrl+a") |
137 | - self.keyboard.type("00") |
138 | - self.assertThat(end_time_field.text, Eventually(Equals("00"))) |
139 | + |
140 | + #change hour |
141 | + timePicker = self.app.select_single("TimePicker") |
142 | + self.assertThat(timePicker.visible, Eventually(Equals(True))) |
143 | + |
144 | + hourScroller = self.ubuntusdk.get_object("Scroller", "hourScroller") |
145 | + self.assertThat(hourScroller.visible, Eventually(Equals(True))) |
146 | + |
147 | + y_Hscroller = hourScroller.globalRect[1] |
148 | + height_Hscroller = hourScroller.globalRect[3] |
149 | + x_Hscroller = hourScroller.globalRect[0] |
150 | + width_Hscroller = hourScroller.globalRect[2] |
151 | + |
152 | + self.pointing_device.drag( |
153 | + int(x_Hscroller + (width_Hscroller / 4)), |
154 | + int((y_Hscroller + ((height_Hscroller / 4) * 3))), |
155 | + int(x_Hscroller + (width_Hscroller / 4)), |
156 | + int((y_Hscroller + ((height_Hscroller / 4) * 2)))) |
157 | + |
158 | + #change minutes |
159 | + minuteScroller = self.ubuntusdk.get_object( |
160 | + "Scroller", "minuteScroller") |
161 | + self.assertThat( |
162 | + minuteScroller.visible, Eventually(Equals(True))) |
163 | + |
164 | + y_Mscroller = minuteScroller.globalRect[1] |
165 | + height_Mscroller = minuteScroller.globalRect[3] |
166 | + x_Mscroller = minuteScroller.globalRect[0] |
167 | + width_Mscroller = minuteScroller.globalRect[2] |
168 | + |
169 | + self.pointing_device.drag( |
170 | + int(x_Mscroller + (width_Mscroller / 4)), |
171 | + int((y_Mscroller + ((height_Mscroller / 4) * 3))), |
172 | + int(x_Mscroller + (width_Mscroller / 4)), |
173 | + int((y_Mscroller + ((height_Mscroller / 4) * 2)))) |
174 | + |
175 | + #click ok button |
176 | + timepicker_ok_button = self.main_window.get_time_picker_ok_button() |
177 | + self.assertThat( |
178 | + lambda: self.main_window.get_time_picker_ok_button(), |
179 | + Eventually(NotEquals(None))) |
180 | + self.pointing_device.click_object(timepicker_ok_button) |
181 | + |
182 | + self.assertThat( |
183 | + lambda: self.main_window.get_new_event().visible, |
184 | + Eventually(Equals(True))) |
185 | |
186 | #input location |
187 | self.pointing_device.click_object(location_field) |
188 | @@ -77,9 +119,14 @@ |
189 | self.keyboard.type("Me") |
190 | self.assertThat(people_field.text, Eventually(Equals("Me"))) |
191 | |
192 | - #click save button |
193 | + #click save button |
194 | + save_button = self.main_window.get_event_save_button() |
195 | + self.assertThat( |
196 | + lambda: self.main_window.get_event_save_button(), |
197 | + Eventually(NotEquals(None))) |
198 | self.pointing_device.click_object(save_button) |
199 | |
200 | #verify that the event has been created in timeline |
201 | - title_label = lambda: self.main_window.get_title_label(eventTitle) |
202 | - self.assertThat(title_label, Eventually(NotEquals(None))) |
203 | + self.assertThat( |
204 | + lambda: self.main_window.get_title_label(eventTitle), |
205 | + Eventually(NotEquals(None))) |
Going to give this a whirl on a device -- if anyone can try it on a galaxy nexus or nexus 4, that would be great. I'll try on the nexus 10.