Merge lp:~osomon/ubuntu-calendar-app/fix-ap-tests-new-event into lp:ubuntu-calendar-app

Proposed by Olivier Tilloy
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 94
Merged at revision: 90
Proposed branch: lp:~osomon/ubuntu-calendar-app/fix-ap-tests-new-event
Merge into: lp:ubuntu-calendar-app
Diff against target: 617 lines (+135/-289)
8 files modified
NewEvent.qml (+15/-0)
calendar.qml (+4/-3)
debian/control (+1/-0)
tests/autopilot/calendar_app/emulators/main_view.py (+32/-27)
tests/autopilot/calendar_app/emulators/ubuntusdk.py (+0/-156)
tests/autopilot/calendar_app/tests/__init__.py (+12/-14)
tests/autopilot/calendar_app/tests/test_calendar.py (+67/-85)
tests/autopilot/calendar_app/tests/test_monthview.py (+4/-4)
To merge this branch: bzr merge lp:~osomon/ubuntu-calendar-app/fix-ap-tests-new-event
Reviewer Review Type Date Requested Status
Günter Schwann (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Francis Ginther Needs Fixing
Review via email: mp+180847@code.launchpad.net

Commit message

Fix failing autopilot tests on devices.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

Olivier, I have found the source of the failures. The toolbar is still being animated while the button is being clicked. As a result, the click occurs outside of the window. The animation is likely faster on desktop and the phone image, so this only shows up on the jenkins VM.

To fix this, I borrowed some code from lp:ubuntu-ui-toolkit to wait for the animation to complete before clicking on the button. I applied the changes on top of your branch and retested:
 - https://code.launchpad.net/~fginther/ubuntu-calendar-app/fix-ap-tests-new-event
 - http://91.189.93.70:8080/job/generic-mediumtests/397/

The test still does not pass, but it's now for a different issue.

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

Thanks Francis for digging into the issue!
I’ve had a look at the remaining failing test, and I know why it’s failing.

91. By Olivier Tilloy

Use the Ubuntu UITK emulators.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
92. By Olivier Tilloy

Ensure the end time of the new event is always greater than the start time.

93. By Olivier Tilloy

More tests cleanup.

94. By Olivier Tilloy

Remove an unused file.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Günter Schwann (schwann) wrote :

Looks good, and works fine

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NewEvent.qml'
2--- NewEvent.qml 2013-08-03 05:33:40 +0000
3+++ NewEvent.qml 2013-08-20 10:35:35 +0000
4@@ -86,6 +86,7 @@
5 margins: units.gu(1)
6 }
7 onClicked: {
8+ internal.clearFocus()
9 var popupObj = PopupUtils.open(timePicker);
10 popupObj.accepted.connect(function(startHour, startMinute) {
11 var newDate = startDate;
12@@ -119,6 +120,7 @@
13 margins: units.gu(1)
14 }
15 onClicked: {
16+ internal.clearFocus()
17 var popupObj = PopupUtils.open(timePicker);
18 popupObj.accepted.connect(function(endHour, endMinute) {
19 var newDate = endDate;
20@@ -180,6 +182,8 @@
21 }
22
23 onClicked: {
24+ internal.clearFocus()
25+
26 var error = 0;
27
28 if (startDate > endDate)
29@@ -208,4 +212,15 @@
30 }
31 }
32 }
33+
34+ QtObject {
35+ id: internal
36+
37+ function clearFocus() {
38+ Qt.inputMethod.hide()
39+ titleEdit.focus = false
40+ locationEdit.focus = false
41+ personEdit.focus = false
42+ }
43+ }
44 }
45
46=== modified file 'calendar.qml'
47--- calendar.qml 2013-08-01 22:04:52 +0000
48+++ calendar.qml 2013-08-20 10:35:35 +0000
49@@ -21,23 +21,23 @@
50
51 tools: ToolbarItems {
52 ToolbarButton {
53- action: Action {
54+ action: Action {
55 iconSource: Qt.resolvedUrl("avatar.png")
56 text: i18n.tr("To-do")
57 onTriggered:; // FIXME
58 }
59 }
60 ToolbarButton {
61+ objectName: "neweventbutton"
62 action: Action {
63- objectName: "neweventbutton"
64 iconSource: Qt.resolvedUrl("avatar.png")
65 text: i18n.tr("New Event")
66 onTriggered: monthViewPage.newEvent()
67 }
68 }
69 ToolbarButton {
70+ objectName: "timelinebutton"
71 action: Action {
72- objectName: "timelinebutton"
73 iconSource: Qt.resolvedUrl("avatar.png")
74 text: i18n.tr("Timeline")
75 onTriggered: {
76@@ -52,6 +52,7 @@
77 }
78 }
79 ToolbarButton {
80+ objectName: "todaybutton"
81 action: Action {
82 iconSource: Qt.resolvedUrl("avatar.png");
83 text: i18n.tr("Today");
84
85=== modified file 'debian/control'
86--- debian/control 2013-07-23 09:26:41 +0000
87+++ debian/control 2013-08-20 10:35:35 +0000
88@@ -29,6 +29,7 @@
89 libqt5test5,
90 calendar-app (= ${source:Version}),
91 python-dateutil,
92+ ubuntu-ui-toolkit-autopilot,
93 Description: Autopilot tests for Ubuntu Calendar Application
94 This package contains autopilot tests for the Ubuntu Calendar application.
95
96
97=== renamed file 'tests/autopilot/calendar_app/emulators/main_window.py' => 'tests/autopilot/calendar_app/emulators/main_view.py'
98--- tests/autopilot/calendar_app/emulators/main_window.py 2013-08-15 12:05:10 +0000
99+++ tests/autopilot/calendar_app/emulators/main_view.py 2013-08-20 10:35:35 +0000
100@@ -7,47 +7,52 @@
101
102 """Calendar app autopilot emulators."""
103
104-
105-class MainWindow(object):
106- """An emulator class that makes it easy to interact with the
107- calendar-app.
108-
109- """
110- def __init__(self, app):
111- self.app = app
112+from ubuntuuitoolkit import emulators as uitk
113+
114+
115+class MainView(uitk.MainView):
116+
117+ """
118+ An emulator class that makes it easy to interact with the calendar-app.
119+ """
120
121 def get_event_view(self):
122- return self.app.select_single("EventView")
123+ return self.select_single("EventView")
124+
125+ def get_month_view(self):
126+ return self.select_single("MonthView")
127+
128+ def get_title_label(self, title):
129+ return self.select_single("Label", text=title)
130
131 def get_new_event(self):
132- return self.app.select_single("NewEvent")
133+ return self.select_single("NewEvent")
134
135 def get_new_event_name_input_box(self):
136- return self.app.select_single("TextField", objectName="newEventName")
137+ new_event = self.get_new_event()
138+ return new_event.select_single("TextField", objectName="newEventName")
139
140 def get_event_start_time_field(self):
141- return self.app.select_single("Button", objectName="startTimeInput")
142+ new_event = self.get_new_event()
143+ return new_event.select_single("Button", objectName="startTimeInput")
144
145 def get_event_end_time_field(self):
146- return self.app.select_single("Button", objectName="endTimeInput")
147+ new_event = self.get_new_event()
148+ return new_event.select_single("Button", objectName="endTimeInput")
149
150 def get_event_location_field(self):
151- return self.app.select_single(
152- "TextField", objectName="eventLocationInput")
153+ new_event = self.get_new_event()
154+ return new_event.select_single("TextField",
155+ objectName="eventLocationInput")
156
157 def get_event_people_field(self):
158- return self.app.select_single(
159- "TextField", objectName="eventPeopleInput")
160-
161- def get_month_view(self):
162- return self.app.select_single("MonthView")
163-
164- def get_time_picker_ok_button(self):
165- return self.app.select_single(
166- "Button", objectName="TimePickerOKButton")
167+ new_event = self.get_new_event()
168+ return new_event.select_single("TextField",
169+ objectName="eventPeopleInput")
170
171 def get_event_save_button(self):
172- return self.app.select_single("Button", objectName="eventSaveButton")
173+ new_event = self.get_new_event()
174+ return new_event.select_single("Button", objectName="eventSaveButton")
175
176- def get_title_label(self, title):
177- return self.app.select_many("Label", text=title)
178+ def get_time_picker(self):
179+ return self.select_single("TimePicker")
180
181=== removed file 'tests/autopilot/calendar_app/emulators/ubuntusdk.py'
182--- tests/autopilot/calendar_app/emulators/ubuntusdk.py 2013-08-02 05:21:01 +0000
183+++ tests/autopilot/calendar_app/emulators/ubuntusdk.py 1970-01-01 00:00:00 +0000
184@@ -1,156 +0,0 @@
185-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
186-#
187-# Copyright (C) 2013 Canonical Ltd
188-#
189-# This program is free software: you can redistribute it and/or modify
190-# it under the terms of the GNU General Public License version 3 as
191-# published by the Free Software Foundation.
192-#
193-# This program is distributed in the hope that it will be useful,
194-# but WITHOUT ANY WARRANTY; without even the implied warranty of
195-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
196-# GNU General Public License for more details.
197-#
198-# You should have received a copy of the GNU General Public License
199-# along with this program. If not, see <http://www.gnu.org/licenses/>.
200-#
201-# Authored by: Nicholas Skaggs <nicholas.skaggs@canonical.com>
202-
203-
204-class ubuntusdk(object):
205- """An emulator class that makes it easy to interact with the ubuntu sdk
206- applications."""
207-
208- def __init__(self, autopilot, app):
209- self.app = app
210- self.autopilot = autopilot
211-
212- def get_qml_view(self):
213- """Get the main QML view"""
214- return self.app.select_single("QQuickView")
215-
216- def get_object(self, typeName, name):
217- """Get a specific object"""
218- return self.app.select_single(typeName, objectName=name)
219-
220- def get_objects(self, typeName, name):
221- """Get more than one object"""
222- return self.app.select_many(typeName, objectName=name)
223-
224- def get_tabs(self):
225- """Return all tabs"""
226- return self.app.select_single("Tabs")
227-
228- def switch_to_tab(self, tab):
229- """Switch to the specified tab number"""
230- tabs = self.get_tabs()
231- currentTab = tabs.selectedTabIndex
232-
233- #perform operations until tab == currentTab
234- while tab != currentTab:
235- if tab > currentTab:
236- self._next_tab()
237- if tab < currentTab:
238- self._previous_tab()
239- currentTab = tabs.selectedTabIndex
240-
241- def _previous_tab(self):
242- """Switch to the previous tab"""
243- qmlView = self.get_qml_view()
244-
245- startX = int(qmlView.x + qmlView.width * 0.10)
246- stopX = int(qmlView.x + qmlView.width * 0.45)
247- lineY = int(qmlView.y + qmlView.height * 0.05)
248-
249- self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY)
250- self.autopilot.pointing_device.move(startX, lineY)
251- self.autopilot.pointing_device.click()
252- self.autopilot.pointing_device.click()
253-
254- def _next_tab(self):
255- """Switch to the next tab"""
256- qmlView = self.get_qml_view()
257-
258- startX = int(qmlView.x + qmlView.width * 0.45)
259- stopX = int(qmlView.x + qmlView.width * 0.10)
260- lineY = int(qmlView.y + qmlView.height * 0.05)
261-
262- self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY)
263- self.autopilot.pointing_device.move(startX, lineY)
264- self.autopilot.pointing_device.click()
265- self.autopilot.pointing_device.click()
266-
267- def toggle_toolbar(self):
268- """Toggle the toolbar between revealed and hidden"""
269- #check and see if the toolbar is open or not
270- if self.get_toolbar().opened:
271- self.hide_toolbar()
272- else:
273- self.open_toolbar()
274-
275- def get_toolbar(self):
276- """Returns the toolbar in the main events view."""
277- return self.app.select_single("Toolbar")
278-
279- def get_toolbar_buttons(self):
280- """Returns the list of buttons in the toolbar"""
281- toolbar = self.get_toolbar()
282- items = toolbar.select_single("ToolbarItems")
283- return items.select_many("ActionItem")
284-
285- def get_toolbar_button(self, buttonLabel):
286- """Returns the toolbar button with a given label"""
287- # FIXME: this is not reliable as labels may be localized
288- buttons = self.get_toolbar_buttons()
289- for button in buttons:
290- if button.text == buttonLabel:
291- return button
292- return None
293-
294- def click_toolbar_button(self, buttonLabel):
295- """Clicks the toolbar button with buttonLabel"""
296- toolbar = self.get_toolbar()
297- if not toolbar.opened:
298- self.open_toolbar()
299- button = self.get_toolbar_button(buttonLabel)
300- self.autopilot.pointing_device.click_object(button)
301-
302- def open_toolbar(self):
303- """Open the toolbar"""
304- qmlView = self.get_qml_view()
305-
306- lineX = int(qmlView.x + qmlView.width * 0.50)
307- startY = int(qmlView.y + qmlView.height - 1)
308- stopY = int(qmlView.y + qmlView.height * 0.95)
309-
310- self.autopilot.pointing_device.drag(lineX, startY, lineX, stopY)
311-
312- def hide_toolbar(self):
313- """Hide the toolbar"""
314- qmlView = self.get_qml_view()
315-
316- lineX = int(qmlView.x + qmlView.width * 0.50)
317- startY = int(qmlView.y + qmlView.height * 0.95)
318- stopY = int(qmlView.y + qmlView.height - 1)
319-
320- self.autopilot.pointing_device.drag(lineX, startY, lineX, stopY)
321-
322- def set_popup_value(self, popover, button, value):
323- """Changes the given popover selector to the request value
324- At the moment this only works for values that are currently visible. To
325- access the remaining items, a help method to drag and recheck is
326- needed."""
327- #The popover is assumed to be the following format
328- #Component {
329- # id: actionSelectionPopover
330- #
331- #ActionSelectionPopover {
332- # actions: ActionList {
333- # Action {
334-
335- popList = self.get_object("ActionSelectionPopover", popover)
336- itemList = popList.select_many("Label")
337- for item in itemList:
338- if item.text == value:
339- self.autopilot.pointing_device.click_object(item)
340- return item
341
342=== modified file 'tests/autopilot/calendar_app/tests/__init__.py'
343--- tests/autopilot/calendar_app/tests/__init__.py 2013-08-05 08:30:19 +0000
344+++ tests/autopilot/calendar_app/tests/__init__.py 2013-08-20 10:35:35 +0000
345@@ -16,8 +16,9 @@
346
347 from testtools.matchers import Equals
348
349-from calendar_app.emulators.main_window import MainWindow
350-from calendar_app.emulators.ubuntusdk import ubuntusdk
351+from ubuntuuitoolkit import emulators as uitk
352+
353+from calendar_app.emulators.main_view import MainView
354
355
356 class CalendarTestCase(AutopilotTestCase):
357@@ -40,26 +41,23 @@
358 self.launch_test_local()
359 else:
360 self.launch_test_installed()
361- self.assertThat(self.ubuntusdk.get_qml_view().visible,
362- Eventually(Equals(True)))
363+ self.assertThat(self.main_view.visible, Eventually(Equals(True)))
364
365 def launch_test_local(self):
366 self.app = self.launch_test_application(
367 "qmlscene",
368 self.local_location,
369- app_type='qt')
370+ app_type='qt',
371+ emulator_base=uitk.UbuntuUIToolkitEmulatorBase)
372
373 def launch_test_installed(self):
374 self.app = self.launch_test_application(
375 "qmlscene",
376 "/usr/share/calendar-app/calendar.qml",
377 "--desktop_file_hint=/usr/share/applications/calendar-app.desktop",
378- app_type='qt')
379-
380- @property
381- def main_window(self):
382- return MainWindow(self.app)
383-
384- @property
385- def ubuntusdk(self):
386- return ubuntusdk(self, self.app)
387+ app_type='qt',
388+ emulator_base=uitk.UbuntuUIToolkitEmulatorBase)
389+
390+ @property
391+ def main_view(self):
392+ return self.app.select_single(MainView)
393
394=== modified file 'tests/autopilot/calendar_app/tests/test_calendar.py'
395--- tests/autopilot/calendar_app/tests/test_calendar.py 2013-08-15 12:36:28 +0000
396+++ tests/autopilot/calendar_app/tests/test_calendar.py 2013-08-20 10:35:35 +0000
397@@ -11,122 +11,104 @@
398
399 from autopilot.matchers import Eventually
400
401-from testtools.matchers import Equals, NotEquals
402+from testtools.matchers import Equals, Not, Is
403
404 import time
405
406 from calendar_app.tests import CalendarTestCase
407
408
409-class TestMainWindow(CalendarTestCase):
410+class TestMainView(CalendarTestCase):
411
412 def test_timeline_view_shows(self):
413- """test timeline view"""
414-
415- event_view = self.main_window.get_event_view()
416-
417- self.assertThat(
418- event_view.eventViewType, Eventually(Equals("DiaryView.qml")))
419- self.ubuntusdk.click_toolbar_button("Timeline")
420- self.assertThat(
421- event_view.eventViewType, Eventually(Equals("TimeLineView.qml")))
422- self.ubuntusdk.click_toolbar_button("Diary")
423- self.assertThat(
424- event_view.eventViewType, Eventually(Equals("DiaryView.qml")))
425+ event_view = self.main_view.get_event_view()
426+ self.assertThat(event_view.eventViewType,
427+ Eventually(Equals("DiaryView.qml")))
428+
429+ self.main_view.open_toolbar().click_button("timelinebutton")
430+ self.assertThat(event_view.eventViewType,
431+ Eventually(Equals("TimeLineView.qml")))
432+
433+ self.main_view.open_toolbar().click_button("timelinebutton")
434+ self.assertThat(event_view.eventViewType,
435+ Eventually(Equals("DiaryView.qml")))
436+
437+ def scroll_time_picker_to_time(self, picker, hours, minutes):
438+ # Scroll hours to selected value
439+ scroller = picker.select_single("Scroller", objectName="hourScroller")
440+ x = int(scroller.globalRect[0] + scroller.globalRect[2] / 2)
441+ y = int(scroller.globalRect[1] + 0.9 * scroller.globalRect[3])
442+ self.pointing_device.move(x, y)
443+ while (scroller.currentIndex != hours):
444+ self.pointing_device.click()
445+ scroller.currentIndex.wait_for((scroller.currentIndex + 1) % 24)
446+ # Scroll minutes to selected value
447+ scroller = picker.select_single("Scroller",
448+ objectName="minuteScroller")
449+ x = int(scroller.globalRect[0] + scroller.globalRect[2] / 2)
450+ y = int(scroller.globalRect[1] + 0.9 * scroller.globalRect[3])
451+ self.pointing_device.move(x, y)
452+ while (scroller.currentIndex != minutes):
453+ self.pointing_device.click()
454+ scroller.currentIndex.wait_for((scroller.currentIndex + 1) % 60)
455
456 def test_new_event(self):
457 """test add new event """
458
459 #click on new event button
460- self.ubuntusdk.click_toolbar_button('New Event')
461-
462- #grab all the fields
463- #event_view = self.main_window.get_event_view()
464- event_name_field = self.main_window.get_new_event_name_input_box()
465- start_time_field = self.main_window.get_event_start_time_field()
466- location_field = self.main_window.get_event_location_field()
467- people_field = self.main_window.get_event_people_field()
468- save_button = self.main_window.get_event_save_button()
469+ self.main_view.open_toolbar().click_button("neweventbutton")
470+ self.assertThat(self.main_view.get_new_event,
471+ Eventually(Not(Is(None))))
472
473 #input a new event name
474- self.assertThat(
475- self.main_window.get_new_event().visible, Eventually(Equals(True)))
476- eventTitle = "Test event" + str(time.time())
477-
478+ eventTitle = "Test event " + str(int(time.time()))
479+ event_name_field = self.main_view.get_new_event_name_input_box()
480 self.pointing_device.click_object(event_name_field)
481+ self.assertThat(event_name_field.activeFocus, Eventually(Equals(True)))
482 self.keyboard.type(eventTitle)
483 self.assertThat(event_name_field.text, Eventually(Equals(eventTitle)))
484
485- #input start time
486- self.assertThat(
487- lambda: self.main_window.get_event_start_time_field(),
488- Eventually(NotEquals(None)))
489+ # Set the start time
490+ start_time_field = self.main_view.get_event_start_time_field()
491 self.pointing_device.click_object(start_time_field)
492-
493- #change hour
494- timePicker = self.app.select_single("TimePicker")
495- self.assertThat(timePicker.visible, Eventually(Equals(True)))
496-
497- hourScroller = self.ubuntusdk.get_object("Scroller", "hourScroller")
498- self.assertThat(hourScroller.visible, Eventually(Equals(True)))
499-
500- y_Hscroller = hourScroller.globalRect[1]
501- height_Hscroller = hourScroller.globalRect[3]
502- x_Hscroller = hourScroller.globalRect[0]
503- width_Hscroller = hourScroller.globalRect[2]
504-
505- self.pointing_device.drag(
506- int(x_Hscroller + (width_Hscroller / 4)),
507- int((y_Hscroller + ((height_Hscroller / 4) * 3))),
508- int(x_Hscroller + (width_Hscroller / 4)),
509- int((y_Hscroller + ((height_Hscroller / 4) * 2))))
510-
511- #change minutes
512- minuteScroller = self.ubuntusdk.get_object(
513- "Scroller", "minuteScroller")
514- self.assertThat(
515- minuteScroller.visible, Eventually(Equals(True)))
516-
517- y_Mscroller = minuteScroller.globalRect[1]
518- height_Mscroller = minuteScroller.globalRect[3]
519- x_Mscroller = minuteScroller.globalRect[0]
520- width_Mscroller = minuteScroller.globalRect[2]
521-
522- self.pointing_device.drag(
523- int(x_Mscroller + (width_Mscroller / 4)),
524- int((y_Mscroller + ((height_Mscroller / 4) * 3))),
525- int(x_Mscroller + (width_Mscroller / 4)),
526- int((y_Mscroller + ((height_Mscroller / 4) * 2))))
527-
528- #click ok button
529- timepicker_ok_button = self.main_window.get_time_picker_ok_button()
530- self.assertThat(
531- lambda: self.main_window.get_time_picker_ok_button(),
532- Eventually(NotEquals(None)))
533- self.pointing_device.click_object(timepicker_ok_button)
534-
535- self.assertThat(
536- lambda: self.main_window.get_new_event().visible,
537- Eventually(Equals(True)))
538+ self.assertThat(self.main_view.get_time_picker,
539+ Eventually(Not(Is(None))))
540+ picker = self.main_view.get_time_picker()
541+ self.scroll_time_picker_to_time(picker, 10, 15)
542+ ok = picker.select_single("Button", objectName="TimePickerOKButton")
543+ self.pointing_device.click_object(ok)
544+ self.assertThat(self.main_view.get_time_picker, Eventually(Is(None)))
545+
546+ # Set the end time
547+ end_time_field = self.main_view.get_event_end_time_field()
548+ self.pointing_device.click_object(end_time_field)
549+ self.assertThat(self.main_view.get_time_picker,
550+ Eventually(Not(Is(None))))
551+ picker = self.main_view.get_time_picker()
552+ self.scroll_time_picker_to_time(picker, 11, 45)
553+ ok = picker.select_single("Button", objectName="TimePickerOKButton")
554+ self.pointing_device.click_object(ok)
555+ self.assertThat(self.main_view.get_time_picker, Eventually(Is(None)))
556
557 #input location
558+ location_field = self.main_view.get_event_location_field()
559 self.pointing_device.click_object(location_field)
560+ self.assertThat(location_field.activeFocus, Eventually(Equals(True)))
561 self.keyboard.type("My location")
562 self.assertThat(location_field.text, Eventually(Equals("My location")))
563
564 #input people
565+ people_field = self.main_view.get_event_people_field()
566 self.pointing_device.click_object(people_field)
567+ self.assertThat(people_field.activeFocus, Eventually(Equals(True)))
568 self.keyboard.type("Me")
569 self.assertThat(people_field.text, Eventually(Equals("Me")))
570
571- #click save button
572- save_button = self.main_window.get_event_save_button()
573- self.assertThat(
574- lambda: self.main_window.get_event_save_button(),
575- Eventually(NotEquals(None)))
576+ #click save button
577+ save_button = self.main_view.get_event_save_button()
578 self.pointing_device.click_object(save_button)
579+ self.assertThat(self.main_view.get_new_event, Eventually(Is(None)))
580
581 #verify that the event has been created in timeline
582- self.assertThat(
583- lambda: self.main_window.get_title_label(eventTitle),
584- Eventually(NotEquals(None)))
585+ self.assertThat(lambda: self.main_view.get_title_label(eventTitle),
586+ Eventually(Not(Is(None))))
587
588=== modified file 'tests/autopilot/calendar_app/tests/test_monthview.py'
589--- tests/autopilot/calendar_app/tests/test_monthview.py 2013-08-05 09:40:28 +0000
590+++ tests/autopilot/calendar_app/tests/test_monthview.py 2013-08-20 10:35:35 +0000
591@@ -20,14 +20,14 @@
592 from dateutil.relativedelta import relativedelta
593
594
595-class TestMainWindow(CalendarTestCase):
596+class TestMonthView(CalendarTestCase):
597
598 def get_currentDayStart(self):
599- month_view = self.main_window.get_month_view()
600+ month_view = self.main_view.get_month_view()
601 return datetime.fromtimestamp(month_view.currentDayStart)
602
603 def change_month(self, delta):
604- month_view = self.main_window.get_month_view()
605+ month_view = self.main_view.get_month_view()
606 y_line = month_view.globalRect[1] + month_view.globalRect[3] / 2
607 x_pad = 0.15
608 sign = int(math.copysign(1, delta))
609@@ -47,7 +47,7 @@
610 def _test_go_to_today(self, delta):
611 start = self.get_currentDayStart()
612 self.change_month(delta)
613- self.ubuntusdk.click_toolbar_button("Today")
614+ self.main_view.open_toolbar().click_button("todaybutton")
615 self.assertThat(lambda: self.get_currentDayStart().day,
616 Eventually(Equals(start.day)))
617 self.assertThat(lambda: self.get_currentDayStart().month,

Subscribers

People subscribed via source and target branches

to status/vote changes: