Merge lp:~nskaggs/ubuntu-calendar-app/add-jenkins-info into lp:ubuntu-calendar-app

Proposed by Nicholas Skaggs
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 768
Merged at revision: 771
Proposed branch: lp:~nskaggs/ubuntu-calendar-app/add-jenkins-info
Merge into: lp:ubuntu-calendar-app
Diff against target: 1199 lines (+30/-1027)
10 files modified
README.mergeproposal (+3/-0)
tests/autopilot/calendar_app/__init__.py (+26/-363)
tests/autopilot/calendar_app/tests/test_custom_proxy_objects.py (+0/-30)
tests/autopilot/calendar_app/tests/test_data.py (+0/-31)
tests/autopilot/calendar_app/tests/test_dayview.py (+0/-120)
tests/autopilot/calendar_app/tests/test_management.py (+1/-17)
tests/autopilot/calendar_app/tests/test_monthview.py (+0/-147)
tests/autopilot/calendar_app/tests/test_new_event.py (+0/-36)
tests/autopilot/calendar_app/tests/test_weekview.py (+0/-177)
tests/autopilot/calendar_app/tests/test_yearview.py (+0/-106)
To merge this branch: bzr merge lp:~nskaggs/ubuntu-calendar-app/add-jenkins-info
Reviewer Review Type Date Requested Status
Nekhelesh Ramananthan Approve
Jenkins Bot continuous-integration Approve
Review via email: mp+288158@code.launchpad.net

Commit message

Add jenkins info

Description of the change

Add jenkins info

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
Nekhelesh Ramananthan (nik90) wrote :

I think you forgot to add lp:~nskaggs/ubuntu-calendar-app/reduce-ap-tests as a prerequisite to this branch :)

Revision history for this message
Nekhelesh Ramananthan (nik90) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.mergeproposal'
2--- README.mergeproposal 2015-12-13 22:01:52 +0000
3+++ README.mergeproposal 2016-03-04 19:54:53 +0000
4@@ -29,3 +29,6 @@
5 The above checklist is more of a guideline to help calendar app trunk stay buildable,
6 stable and up to date.
7
8+Jenkins
9+=======
10+In addition to manual reviews, merge proposals are subject to being run in jenkins to ensure the application builds and any unit tests are successful. For more information on jenkins and how it works, see the [Core Apps Jenkins Wiki](https://wiki.ubuntu.com/Touch/CoreApps/Jenkins)
11\ No newline at end of file
12
13=== modified file 'tests/autopilot/calendar_app/__init__.py'
14--- tests/autopilot/calendar_app/__init__.py 2016-02-01 19:48:19 +0000
15+++ tests/autopilot/calendar_app/__init__.py 2016-03-04 19:54:53 +0000
16@@ -70,55 +70,13 @@
17
18 # click on tab action
19 tab_button = self.wait_select_single(objectName='tab_%s_button'%tabName)
20- self.pointing_device.click_object(tab_button)
21+ self.pointing_device.click_object(tab_button)
22
23 @autopilot.logging.log_action(logger.info)
24 def click_action_button(self, action):
25 current_tab = self.select_single('Tab', visible=True)
26 button = current_tab.wait_select_single(objectName='%s_button'%action)
27- self.pointing_device.click_object(button)
28-
29- @autopilot.logging.log_action(logger.info)
30- def go_to_month_view(self):
31- """Open the month view.
32-
33- :return: The Month View page.
34-
35- """
36- month_tab = self.select_single('Tab', objectName='monthTab')
37- if not month_tab.visible:
38- self.switch_to_tab('monthTab')
39- else:
40- logger.debug('The month View page is already opened.')
41- return self.get_month_view(month_tab)
42-
43- @autopilot.logging.log_action(logger.info)
44- def go_to_week_view(self):
45- """Open the week view.
46-
47- :return: The Week View page.
48-
49- """
50- week_tab = self.select_single('Tab', objectName='weekTab')
51- if not week_tab.visible:
52- self.switch_to_tab('weekTab')
53- else:
54- logger.debug('The week View page is already opened.')
55- return self.get_week_view(week_tab)
56-
57- @autopilot.logging.log_action(logger.info)
58- def go_to_year_view(self):
59- """Open the year view.
60-
61- :return: The Year View page.
62-
63- """
64- year_tab = self.select_single('Tab', objectName='yearTab')
65- if not year_tab.visible:
66- self.switch_to_tab('yearTab')
67- else:
68- logger.debug('The Year View page is already opened.')
69- return self.get_year_view(year_tab)
70+ self.pointing_device.click_object(button)
71
72 @autopilot.logging.log_action(logger.info)
73 def go_to_day_view(self):
74@@ -169,121 +127,26 @@
75 return self.wait_select_single(
76 CalendarChoicePopup, objectName="calendarchoicepopup")
77
78- def set_picker(self, field, mode, value):
79- # open picker
80- self.pointing_device.click_object(field)
81- # valid options are date or time; assume date if invalid/no option
82- if mode == 'time':
83- mode_value = 'Hours|Minutes'
84- else:
85- mode_value = 'Years|Months|Days'
86- picker = self.wait_select_single(
87- ubuntuuitoolkit.pickers.DatePicker, mode=mode_value, visible=True)
88- if mode_value == 'Hours|Minutes':
89- picker.pick_time(value)
90- else:
91- picker.pick_date(value)
92- # close picker
93- self.pointing_device.click_object(field)
94-
95- def get_event_view(self, parent_object=None):
96- if parent_object is None:
97- parent_object = self
98- return parent_object.wait_select_single("EventView")
99-
100 def get_event_details(self, parent_object=None):
101 if parent_object is None:
102 parent_object = self
103 return parent_object.wait_select_single(EventDetails,
104 objectName='eventDetails')
105-
106- def get_month_view(self, parent_object=None):
107- if parent_object is None:
108- parent_object = self
109- return parent_object.wait_select_single(MonthView,
110- objectName='monthViewPage')
111-
112- def get_year_view(self, parent_object=None):
113- if parent_object is None:
114- parent_object = self
115- return parent_object.wait_select_single(YearView,
116- objectName='yearViewPage')
117-
118 def get_day_view(self, parent_object=None):
119 if parent_object is None:
120 parent_object = self
121 return parent_object.wait_select_single(DayView,
122 objectName='dayViewPage')
123
124- def get_week_view(self, parent_object=None):
125- if parent_object is None:
126- parent_object = self
127- return parent_object.wait_select_single(WeekView,
128- objectName='weekViewPage')
129-
130 def get_agenda_view(self, parent_object=None):
131 if parent_object is None:
132 parent_object = self
133 return parent_object.wait_select_single(AgendaView,
134 objectName='AgendaView')
135
136- def get_label_with_text(self, text, root=None):
137- if root is None:
138- root = self
139- labels = root.select_many("Label", text=text)
140- if (len(labels) > 0):
141- return labels[0]
142- else:
143- return None
144-
145- def get_month_year(self, component):
146- return self.wait_select_single(
147- "Label", objectName="monthYearLabel").text
148-
149- def get_year(self, component):
150- return int(component.wait_select_single(
151- "Label", objectName="yearLabel").text)
152-
153- def get_month_name(self, component):
154- return component.wait_select_single(
155- "Label", objectName="monthLabel").text
156-
157- def safe_swipe_view(self, direction, view, date):
158- """
159- direction: direction to swipe
160- view: the view you are swiping against
161- date: a function object of the view
162- """
163- timeout = 0
164- before = date
165- # try up to 3 times to swipe
166- while timeout < 3 and date == before:
167- self._swipe(direction, view)
168- # check for up to 3 seconds after swipe for view
169- # to have changed before trying again
170- for x in range(0, 3):
171- if date != before:
172- break
173- sleep(1)
174- timeout += 1
175-
176- def swipe_view(self, direction, view, x_pad=0.08):
177- """Swipe the given view to left or right.
178-
179- Args:
180- direction: if 1 it swipes from right to left, if -1 from
181- left right.
182-
183- """
184-
185- start = (-direction * x_pad) % 1
186- stop = (direction * x_pad) % 1
187-
188- y_line = view.globalRect[1] + view.globalRect[3] / 2
189- x_start = view.globalRect[0] + view.globalRect[2] * start
190- x_stop = view.globalRect[0] + view.globalRect[2] * stop
191-
192- self.pointing_device.drag(x_start, y_line, x_stop, y_line)
193+ @autopilot.logging.log_action(logger.info)
194+ def press_header_custombackbutton(self):
195+ self.click_custom_back_button()
196
197 def swipe_view_vertical(self, direction, view, y_pad=0.08):
198 """Swipe the given view to up or down.
199@@ -302,215 +165,6 @@
200 self.pointing_device.drag(x_line, y_start, x_line, y_stop)
201 sleep(1)
202
203- def to_local_date(self, date):
204- utc = date.replace(tzinfo=tz.tzutc())
205- local = utc.astimezone(tz.tzlocal())
206- return local
207-
208- def press_header_todaybutton(self):
209- self.click_action_button('todaybutton')
210-
211- @autopilot.logging.log_action(logger.info)
212- def get_color_picker_dialog(self):
213- return self.wait_select_single(
214- "ColorPickerDialog", objectName="colorPickerDialog")
215-
216- @autopilot.logging.log_action(logger.info)
217- def press_header_custombackbutton(self):
218- self.click_custom_back_button()
219-
220-
221-class YearView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
222-
223- """Autopilot helper for the Year View page."""
224-
225- def get_selected_day(self):
226- """Return the selected day.
227-
228- :returns: A today calendar object
229-
230- """
231- month = self.get_selected_month()
232- try:
233- today = month.select_single(
234- 'MonthComponentDateDelegate',
235- isCurrentMonth=True, isToday=True)
236- except exceptions.StateNotFoundError:
237- raise CalendarException('No day is selected on the visible year.')
238- else:
239- return today
240-
241- def get_selected_month(self):
242- """Return the selected month.
243-
244- :returns: A month calendar object
245-
246- """
247- current_year_grid = self._get_current_year_grid()
248- return self._get_month_component(current_year_grid,
249- current_year_grid.scrollMonth)
250-
251- def get_day(self, monthNumber, dayNumber):
252- """Return the day object.
253- :param monthNumber the numeric month to get
254- :param dayNumber the numeric day to get
255- :returns: A month calendar object
256-
257- """
258- month = self.get_month(monthNumber)
259-
260- try:
261- day = month.select_single('MonthComponentDateDelegate',
262- date=dayNumber)
263- except exceptions.StateNotFoundError:
264- raise CalendarException('%s not found in %s' % (
265- dayNumber, monthNumber))
266- else:
267- return day
268-
269- def get_month(self, monthNumber):
270- """Return the month object.
271- :param monthNumber the numeric month to get
272- :returns: A month calendar object
273-
274- """
275- current_year_grid = self._get_current_year_grid()
276- # the monthcomponents start at zero, thus subtract 1 to get month
277- return self._find_month_component(current_year_grid, monthNumber - 1)
278-
279- def _get_current_year_grid(self):
280- path_view_base = self.select_single(
281- 'PathViewBase', objectName='yearPathView')
282- return path_view_base.select_single(
283- "YearViewDelegate", isCurrentItem=True)
284-
285- def _find_month_component(self, grid, index):
286- try:
287- month = self._get_month_component(grid, index)
288- except exceptions.StateNotFoundError:
289- month = self._swipe_to_find_month_component(grid, index)
290- if month is None:
291- raise CalendarException('Month {} not found.'.format(index))
292- else:
293- return month
294-
295- def _get_month_component(self, grid, index):
296- return grid.select_single(
297- 'MonthComponent',
298- objectName='monthComponent{}'.format(index))
299-
300- def _swipe_to_find_month_component(self, grid, index):
301- month = None
302- grid.swipe_to_top()
303- while not grid.atYEnd:
304- try:
305- month = self._get_month_component(grid, index)
306- except exceptions.StateNotFoundError:
307- # FIXME do not call the private _get_containers.
308- # Reported as bug http://pad.lv/1365674
309- # --elopio - 2014-09-04
310- grid.swipe_to_show_more_below(grid._get_containers())
311- else:
312- break
313- return month
314-
315-
316-class WeekView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
317-
318- """Autopilot helper for the Week View page."""
319-
320- def get_current_weeknumber(self):
321- return self._get_timeline_base().weekNumber
322-
323- def _get_timeline_base(self):
324- return self.select_single("TimeLineBaseComponent", isActive=True)
325-
326- def _get_timeline_header(self):
327- return self._get_timeline_base().select_single(objectName="viewHeader")
328-
329- def _get_date_label_headers(self):
330- return self._get_timeline_header().select_many("Label",
331- objectName="dateLabel")
332-
333- def _get_pathview_base(self):
334- # return self.select_single('PathViewBase',
335- # objectname='weekviewpathbase')
336- # why do you hate me autopilot? ^^
337- return self.select_single('PathViewBase')
338-
339- def change_week(self, delta):
340- direction = int(math.copysign(1, delta))
341- main_view = self.get_root_instance().select_single(MainView)
342-
343- pathview_base = self._get_pathview_base()
344-
345- for _ in range(abs(delta)):
346- timeline_header = self._get_timeline_header()
347-
348- main_view.swipe_view(direction, timeline_header)
349- # prevent timing issues with swiping
350- pathview_base.moving.wait_for(False)
351-
352- def get_days_of_week(self):
353- # sort based on text value of the day
354- days = sorted(self._get_date_label_headers(),
355- key=lambda label: label.text)
356- days = [int(item.text) for item in days]
357-
358- # resort so beginning of next month comes after the end
359- # need to support overlapping months 28,30,31 -> 1
360- sorteddays = []
361- for day in days:
362- inserted = 0
363- for index, sortday in enumerate(sorteddays):
364- if day - sorteddays[index] == 1:
365- sorteddays.insert(index + 1, day)
366- inserted = 1
367- break
368- if inserted == 0:
369- sorteddays.insert(0, day)
370- return sorteddays
371-
372- @autopilot.logging.log_action(logger.info)
373- def get_current_headerdatecomponent(self, now):
374- today = datetime.date(now.year, now.month, now.day)
375- header_date_components = self.select_many('HeaderDateComponent')
376- for header in header_date_components:
377- header_date = datetime.date(header.date.datetime.year,
378- header.date.datetime.month,
379- header.date.datetime.day)
380- if header_date == today:
381- return header
382-
383-
384-class MonthView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
385-
386- """Autopilot helper for the Month View page."""
387-
388- def get_current_month(self):
389- return self.select_single('MonthComponent', isCurrentItem=True)
390-
391- @autopilot.logging.log_action(logger.info)
392- def get_current_month_name(self):
393- month = self.get_current_month()
394- return month.currentMonth.datetime.strftime("%B")
395-
396- @autopilot.logging.log_action(logger.info)
397- def get_current_selected_day(self):
398- today_days = self.select_many(
399- 'MonthComponentDateDelegate', isToday=True)
400- for item in today_days:
401- if item.isCurrentMonth:
402- return item
403-
404- @autopilot.logging.log_action(logger.info)
405- def get_day_label(self, day):
406- days_row = self.select_single(
407- 'QQuickRow', objectName='dayLabelRow0')
408- return days_row.select_single(
409- 'Label', objectName='weekDay{}'.format(day))
410-
411-
412 class DayView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
413
414 """Autopilot helper for the Day View page."""
415@@ -784,17 +438,6 @@
416 return self.get_root_instance().wait_select_single(
417 EventDetails, objectName='eventDetails')
418
419-
420-# override toolkit helper to
421-# workaround bug https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1343916
422-class QQuickFlickable(ubuntuuitoolkit.QQuickFlickable):
423-
424- def _slow_drag(self, start_x, stop_x, start_y, stop_y):
425- rate = (self.flickDeceleration + 250) / 350
426- self.pointing_device.drag(start_x, start_y, stop_x, stop_y, rate=rate)
427- self.pointing_device.click()
428-
429-
430 class NewEvent(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
431
432 """Autopilot helper for the New Event page."""
433@@ -881,7 +524,7 @@
434 raise CalendarException('No guest found with name %s' % guest)
435
436 def _select_calendar(self, calendar):
437- self._get_calendar().select_option('Label', text=calendar)
438+ self._get_calendar().select_option('UCLabel', text=calendar)
439
440 def _get_calendar(self):
441 return self.wait_select_single(ubuntuuitoolkit.OptionSelector,
442@@ -957,6 +600,26 @@
443 """Autopilot helper for the NewEventEntryField component."""
444
445
446+#for https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1552773
447+class OptionSelector(ubuntuuitoolkit.OptionSelector):
448+ """OptionSelector Autopilot custom proxy object"""
449+
450+ def get_selected_text(self):
451+ """gets the text of the currently selected item"""
452+ option_selector_delegate = self.select_single(
453+ 'OptionSelectorDelegate', focus='True')
454+ current_label = option_selector_delegate.select_single(
455+ 'UCLabel', visible='True')
456+ return current_label.text
457+
458+ def get_current_label(self):
459+ """gets the text of the currently selected item"""
460+ option_selector_delegate = self.select_single(
461+ 'OptionSelectorDelegate', focus='True')
462+ current_label = option_selector_delegate.select_single(
463+ 'UCLabel', visible='True')
464+ return current_label
465+
466 class EventDetails(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
467
468 """Autopilot helper for the Event Details page."""
469
470=== removed file 'tests/autopilot/calendar_app/tests/test_custom_proxy_objects.py'
471--- tests/autopilot/calendar_app/tests/test_custom_proxy_objects.py 2014-09-04 21:31:50 +0000
472+++ tests/autopilot/calendar_app/tests/test_custom_proxy_objects.py 1970-01-01 00:00:00 +0000
473@@ -1,30 +0,0 @@
474-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
475-#
476-# Copyright (C) 2014 Canonical Ltd
477-#
478-# This program is free software: you can redistribute it and/or modify
479-# it under the terms of the GNU General Public License version 3 as
480-# published by the Free Software Foundation.
481-#
482-# This program is distributed in the hope that it will be useful,
483-# but WITHOUT ANY WARRANTY; without even the implied warranty of
484-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
485-# GNU General Public License for more details.
486-#
487-# You should have received a copy of the GNU General Public License
488-# along with this program. If not, see <http://www.gnu.org/licenses/>.
489-
490-from calendar_app import data, tests
491-
492-
493-class NewEventFormTestCase(tests.CalendarAppTestCaseWithVcard):
494-
495- def test_fill_form(self):
496- """Test that the form can be filled with event information."""
497- test_event = data.Event.make_unique(unique_id='test uuid')
498-
499- new_event_page = self.app.main_view.go_to_new_event()
500- new_event_page._fill_form(test_event)
501-
502- form_values = new_event_page._get_form_values()
503- self.assertEqual(test_event, form_values)
504
505=== removed file 'tests/autopilot/calendar_app/tests/test_data.py'
506--- tests/autopilot/calendar_app/tests/test_data.py 2015-06-01 13:15:10 +0000
507+++ tests/autopilot/calendar_app/tests/test_data.py 1970-01-01 00:00:00 +0000
508@@ -1,31 +0,0 @@
509-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
510-#
511-# Copyright (C) 2014 Canonical Ltd
512-#
513-# This program is free software: you can redistribute it and/or modify
514-# it under the terms of the GNU General Public License version 3 as
515-# published by the Free Software Foundation.
516-#
517-# This program is distributed in the hope that it will be useful,
518-# but WITHOUT ANY WARRANTY; without even the implied warranty of
519-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
520-# GNU General Public License for more details.
521-#
522-# You should have received a copy of the GNU General Public License
523-# along with this program. If not, see <http://www.gnu.org/licenses/>.
524-
525-import testtools
526-
527-from calendar_app import data
528-
529-
530-class EventTestCase(testtools.TestCase):
531-
532- def test_make_unique_event_must_return_event_with_unique_id(self):
533- event = data.Event.make_unique(unique_id='test uuid')
534-
535- self.assertEqual(event.calendar, 'Personal')
536- self.assertEqual(event.name, 'Test ev test uuid')
537- self.assertEqual(event.description, 'Test desc test uuid.')
538- self.assertEqual(event.location, 'Test loc test uuid')
539- self.assertEqual(event.guests, ['UX User'])
540
541=== removed file 'tests/autopilot/calendar_app/tests/test_dayview.py'
542--- tests/autopilot/calendar_app/tests/test_dayview.py 2015-05-21 19:32:31 +0000
543+++ tests/autopilot/calendar_app/tests/test_dayview.py 1970-01-01 00:00:00 +0000
544@@ -1,120 +0,0 @@
545-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
546-#
547-# Copyright (C) 2013, 2014 Canonical Ltd
548-#
549-# This program is free software: you can redistribute it and/or modify
550-# it under the terms of the GNU General Public License version 3 as
551-# published by the Free Software Foundation.
552-#
553-# This program is distributed in the hope that it will be useful,
554-# but WITHOUT ANY WARRANTY; without even the implied warranty of
555-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
556-# GNU General Public License for more details.
557-#
558-# You should have received a copy of the GNU General Public License
559-# along with this program. If not, see <http://www.gnu.org/licenses/>.
560-
561-"""
562-Calendar app autopilot tests for the day view.
563-"""
564-
565-import datetime
566-import calendar
567-import logging
568-
569-# from __future__ import range
570-# (python3's range, is same as python2's xrange)
571-import sys
572-if sys.version_info < (3,):
573- range = xrange
574-
575-from autopilot.matchers import Eventually
576-from testtools.matchers import Equals, NotEquals
577-
578-from calendar_app.tests import CalendarAppTestCase
579-from datetime import date
580-
581-logger = logging.getLogger(__name__)
582-
583-
584-class TestDayView(CalendarAppTestCase):
585-
586- def setUp(self):
587- super(TestDayView, self).setUp()
588- self.day_view = self.app.main_view.go_to_day_view()
589-
590- def test_default_view(self):
591- """By default, the day view shows the current month year and
592- today's date.
593- The day should be scrolled to the current time
594- """
595-
596- now = datetime.datetime.now()
597- today = date(now.year, now.month, now.day)
598- day_view_currentDay = self.day_view.currentDay
599-
600- day_view_currentDay_date = \
601- date(day_view_currentDay.year,
602- day_view_currentDay.month,
603- day_view_currentDay.day)
604-
605- expected_month_name_year = now.strftime("%B %Y")
606-
607- # Checking today's date is correct
608- self.assertEquals(day_view_currentDay_date, today)
609-
610- # Checking month and year in header are correct
611- self.assertEquals(
612- self.app.main_view.get_month_year(self.day_view),
613- expected_month_name_year)
614-
615- # Checking day label and day of week label are correct
616- self.assertEquals(
617- self.day_view.get_daylabel(today).text,
618- calendar.day_abbr[now.weekday()])
619- self.assertEquals(
620- self.day_view.get_datelabel(today).text, str(now.day))
621-
622- # Check day is scrolled to the current time
623- self.assertEquals(self.day_view.get_scrollHour(), now.hour)
624-
625- def test_show_next_days(self):
626- """It must be possible to show next days by swiping the view."""
627- self._change_days(1)
628-
629- def test_show_previous_days(self):
630- """It must be possible to show previous days by swiping the view."""
631- self._change_days(-1)
632-
633- def test_today_button(self):
634- now = datetime.datetime.now()
635- today = date(now.year, now.month, now.day)
636- self._change_days(1)
637- self.app.main_view.press_header_todaybutton()
638- self.day_view.check_loading_spinnger()
639-
640- current_day = self.day_view.get_active_timelinebasecomponent().startDay
641- new_today = date(current_day.year, current_day.month, current_day.day)
642-
643- self.assertEquals(today, new_today)
644-
645- def _change_days(self, direction):
646- firstday = self.day_view.currentDay.datetime
647-
648- for i in range(1, 5):
649- # prevent timing issues with swiping
650- old_day = self.day_view.currentDay.datetime
651- self.app.main_view.swipe_view(direction, self.day_view)
652- self.assertThat(lambda: self.day_view.currentDay.datetime,
653- Eventually(NotEquals(old_day)))
654-
655- current_day = self.day_view.currentDay.datetime
656-
657- expected_day = (firstday + datetime.timedelta(
658- days=(i * direction)))
659-
660- self.assertThat(self._strip_time(current_day),
661- Equals(self._strip_time(expected_day)))
662-
663- def _strip_time(self, date):
664- return date.replace(hour=0, minute=0, second=0, microsecond=0)
665
666=== modified file 'tests/autopilot/calendar_app/tests/test_management.py'
667--- tests/autopilot/calendar_app/tests/test_management.py 2015-04-17 19:49:43 +0000
668+++ tests/autopilot/calendar_app/tests/test_management.py 2016-03-04 19:54:53 +0000
669@@ -29,22 +29,6 @@
670
671 class TestManagement(CalendarAppTestCaseWithVcard):
672
673- def test_change_calendar_color(self):
674- """ Test changing calendar color """
675- calendar_choice_popup = \
676- self.app.main_view.go_to_calendar_choice_popup()
677- original_calendar_color = \
678- calendar_choice_popup.get_calendar_color()
679- calendar_choice_popup.open_color_picker_dialog()
680- colorPickerDialog = self.app.main_view.get_color_picker_dialog()
681- colorPickerDialog.change_calendar_color("color6")
682-
683- final_calendar_color = \
684- calendar_choice_popup.get_calendar_color()
685-
686- self.assertThat(
687- original_calendar_color, NotEquals(final_calendar_color))
688-
689 def test_unselect_calendar(self):
690 """ Test unselecting calendar
691
692@@ -76,7 +60,7 @@
693 def _event_exists(self, event_name):
694 try:
695 day_view = self.app.main_view.go_to_day_view()
696- day_view.get_event(event_name, True)
697+ day_view.get_event(event_name, False)
698 except Exception:
699 return False
700 return True
701
702=== removed file 'tests/autopilot/calendar_app/tests/test_monthview.py'
703--- tests/autopilot/calendar_app/tests/test_monthview.py 2015-05-21 20:01:24 +0000
704+++ tests/autopilot/calendar_app/tests/test_monthview.py 1970-01-01 00:00:00 +0000
705@@ -1,147 +0,0 @@
706-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
707-#
708-# Copyright (C) 2013, 2014 Canonical Ltd
709-#
710-# This program is free software: you can redistribute it and/or modify
711-# it under the terms of the GNU General Public License version 3 as
712-# published by the Free Software Foundation.
713-#
714-# This program is distributed in the hope that it will be useful,
715-# but WITHOUT ANY WARRANTY; without even the implied warranty of
716-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
717-# GNU General Public License for more details.
718-#
719-# You should have received a copy of the GNU General Public License
720-# along with this program. If not, see <http://www.gnu.org/licenses/>.
721-
722-"""Calendar app autopilot tests."""
723-
724-from __future__ import absolute_import
725-
726-from autopilot.matchers import Eventually
727-from testtools.matchers import Equals, NotEquals
728-
729-import math
730-import calendar
731-
732-from calendar_app.tests import CalendarAppTestCase
733-
734-from datetime import datetime
735-from dateutil.relativedelta import relativedelta
736-
737-import logging
738-logger = logging.getLogger(__name__)
739-
740-
741-class TestMonthView(CalendarAppTestCase):
742-
743- def setUp(self):
744- super(TestMonthView, self).setUp()
745- self.month_view = self.app.main_view.go_to_month_view()
746-
747- def _change_month(self, delta):
748- month_view = self.app.main_view.get_month_view()
749- direction = int(math.copysign(1, delta))
750-
751- for _ in range(abs(delta)):
752- before = month_view.currentMonth.datetime
753-
754- # prevent timing issues with swiping
755- old_month = month_view.currentMonth.datetime
756-
757- self.app.main_view.swipe_view(direction, month_view)
758-
759- month_after = month_view.currentMonth.datetime
760-
761- self.assertThat(lambda: month_after,
762- Eventually(NotEquals(old_month)))
763-
764- after = before + relativedelta(months=direction)
765-
766- self.assertThat(lambda:
767- month_after.month,
768- Eventually(Equals(after.month)))
769- self.assertThat(lambda:
770- month_after.year,
771- Eventually(Equals(after.year)))
772-
773- def _assert_today(self):
774- today = datetime.now()
775- local = self.month_view.currentMonth.datetime
776- converted_local = self.app.main_view.to_local_date(local)
777- logger.debug(local)
778- logger.debug(converted_local)
779- logger.debug(today)
780-
781- self.assertThat(lambda: local.day,
782- Eventually(Equals(today.day)))
783- self.assertThat(lambda: local.month,
784- Eventually(Equals(today.month)))
785- self.assertThat(lambda: local.year,
786- Eventually(Equals(today.year)))
787-
788- def _go_to_today(self, delta):
789- self._change_month(delta)
790- header = self.app.main_view.get_header()
791- header.click_action_button('todaybutton')
792- self._assert_today()
793-
794- def test_monthview_go_to_today_next_month(self):
795- self._go_to_today(1)
796-
797- def test_monthview_go_to_today_prev_month(self):
798- self._go_to_today(-1)
799-
800- def test_monthview_go_to_today_next_year(self):
801- self._go_to_today(12)
802-
803- def test_monthview_go_to_today_prev_year(self):
804- self._go_to_today(-12)
805-
806- def test_current_day_month_and_year_is_selected(self):
807- """
808- By default, the month view shows the current day, month and year.
809- """
810- now = datetime.now()
811- expected_month_name_year = now.strftime("%B %Y")
812-
813- self.assertThat(self.app.main_view.get_month_year(self.month_view),
814- Equals(expected_month_name_year))
815-
816- expected_day = str(int(now.strftime("%d")))
817- selected_day = self.month_view.get_current_selected_day()
818-
819- self.assertEquals(
820- selected_day.select_single('Label').text, expected_day)
821-
822- def test_days_of_week_are_correct(self):
823- """
824- Verify that days of week are correct for the locale
825- """
826- first_week_day = calendar.day_abbr[calendar.firstweekday()]
827- day_0_label = self.month_view.get_day_label(0).day
828- day_1_label = self.month_view.get_day_label(1).day
829- day_2_label = self.month_view.get_day_label(2).day
830- day_3_label = self.month_view.get_day_label(3).day
831- day_4_label = self.month_view.get_day_label(4).day
832- day_5_label = self.month_view.get_day_label(5).day
833- day_6_label = self.month_view.get_day_label(6).day
834-
835- self.assertEquals(day_0_label, first_week_day)
836-
837- self.assertEquals(calendar.day_abbr[calendar.MONDAY], day_0_label)
838- self.assertEquals(calendar.day_abbr[calendar.TUESDAY], day_1_label)
839- self.assertEquals(calendar.day_abbr[calendar.WEDNESDAY], day_2_label)
840- self.assertEquals(calendar.day_abbr[calendar.THURSDAY], day_3_label)
841- self.assertEquals(calendar.day_abbr[calendar.FRIDAY], day_4_label)
842- self.assertEquals(calendar.day_abbr[calendar.SATURDAY], day_5_label)
843- self.assertEquals(calendar.day_abbr[calendar.SUNDAY], day_6_label)
844-
845- def test_today_button(self):
846- """ Verify that today button takes to today in month view """
847- self._go_to_today(1)
848-
849- header = self.app.main_view.get_header()
850- header.click_action_button('todaybutton')
851-
852- self._assert_today()
853
854=== modified file 'tests/autopilot/calendar_app/tests/test_new_event.py'
855--- tests/autopilot/calendar_app/tests/test_new_event.py 2015-05-09 02:20:34 +0000
856+++ tests/autopilot/calendar_app/tests/test_new_event.py 2016-03-04 19:54:53 +0000
857@@ -35,9 +35,6 @@
858 # TODO add tests for events in the future and in the past, all day event,
859 # event with recurrence and event with reminders.
860 # also add tests for saving to different calendars
861- # We currently can't change the date of the new event because of bug
862- # http://pad.lv/1328600 on Autopilot.
863- # --elopio - 2014-06-26
864
865 def _try_delete_event(self, event_name):
866 try:
867@@ -86,39 +83,6 @@
868 now.day, now.hour, 0)
869 return start_date + datetime.timedelta(hours=1)
870
871- def test_new_event_must_start_with_default_values(self):
872- """Test adding a new event default values
873-
874- Start Date: today Start Time: next half hour increment
875- End Date: today End Time: 1 hour after start time
876- Calendar: Personal
877- All Day Event: unchecked
878- Event Name: blank, selected
879- Description: blank
880- Location: none
881- Guests: none
882- This happens: Once
883- Remind me: On Event
884- """
885-
886- new_event_page = self.app.main_view.go_to_new_event()
887- self.assertThat(new_event_page.get_calendar_name(), Equals('Personal'))
888- self.assertThat(new_event_page.get_event_name(), Equals(''))
889- self.assertThat(new_event_page.get_description_text(), Equals(''))
890- self.assertThat(new_event_page.get_location_name(), Equals(''))
891- self.assertThat(new_event_page.get_is_all_day_event(), Equals(False))
892- self.assertThat(new_event_page.has_guests(), Equals(False))
893- self.assertThat(new_event_page.get_this_happens(), Equals('Once'))
894- self.assertThat(new_event_page.get_reminder(), Equals('15 minutes'))
895-
896- expected_start_date = self._expected_start_date()
897- expected_end_date = expected_start_date + datetime.timedelta(hours=1)
898-
899- self.assertThat(new_event_page.get_start_date(),
900- Equals(expected_start_date))
901- self.assertThat(new_event_page.get_end_date(),
902- Equals(expected_end_date))
903-
904 def test_add_new_event_with_default_values(self):
905 """Test adding a new event with the default values.
906
907
908=== removed file 'tests/autopilot/calendar_app/tests/test_weekview.py'
909--- tests/autopilot/calendar_app/tests/test_weekview.py 2015-06-01 09:15:23 +0000
910+++ tests/autopilot/calendar_app/tests/test_weekview.py 1970-01-01 00:00:00 +0000
911@@ -1,177 +0,0 @@
912-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
913-#
914-# Copyright (C) 2013, 2014 Canonical Ltd
915-#
916-# This program is free software: you can redistribute it and/or modify
917-# it under the terms of the GNU General Public License version 3 as
918-# published by the Free Software Foundation.
919-#
920-# This program is distributed in the hope that it will be useful,
921-# but WITHOUT ANY WARRANTY; without even the implied warranty of
922-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
923-# GNU General Public License for more details.
924-#
925-# You should have received a copy of the GNU General Public License
926-# along with this program. If not, see <http://www.gnu.org/licenses/>.
927-
928-"""
929-Calendar app autopilot tests for the week view.
930-"""
931-
932-# from __future__ import range
933-# (python3's range, is same as python2's xrange)
934-import sys
935-if sys.version_info < (3,):
936- range = xrange
937-
938-import datetime
939-from datetime import timedelta
940-from autopilot.matchers import Eventually
941-from testtools.matchers import Equals, NotEquals
942-from random import randint, randrange
943-
944-from calendar_app.tests import CalendarAppTestCase
945-import logging
946-
947-logger = logging.getLogger(__name__)
948-
949-
950-class TestWeekView(CalendarAppTestCase):
951-
952- def setUp(self):
953- super(TestWeekView, self).setUp()
954- self.week_view = self.app.main_view.go_to_week_view()
955-
956- def _assert_week_delta(self, original_week, delta):
957- current_week = self.week_view.get_current_weeknumber()
958- expected_week = original_week + delta
959-
960- if expected_week < 0:
961- expected_week += 53
962- elif expected_week > 52:
963- expected_week -= 53
964-
965- self.assertEquals(current_week, expected_week)
966-
967- def test_default_view(self):
968- """By default, the week view shows the current week.
969- It also displays the current year and month"""
970-
971- now = datetime.datetime.now()
972- expected_month_name_year = now.strftime("%B %Y")
973- self.assertThat(self.app.main_view.get_month_year(self.week_view),
974- Equals(expected_month_name_year))
975-
976- # check current day is highlighted
977- header_date = self.week_view.get_current_headerdatecomponent(now)
978- self.assertEquals(header_date.dayColor[0], 221)
979- self.assertEquals(header_date.dayColor[1], 72)
980- self.assertEquals(header_date.dayColor[2], 20)
981- self.assertEquals(header_date.dayColor[3], 255)
982-
983- def test_scroll_week_must_scroll_weekdays(self):
984- """Scrolling inside the timeline should scroll the weekdays"""
985- before_days = self.week_view.get_days_of_week()
986-
987- direction = 1
988- no_of_swipes = 3
989- for x in range(no_of_swipes):
990- self.app.main_view.swipe_view(direction, self.week_view)
991-
992- after_days = self.week_view.get_days_of_week()
993-
994- self.assertThat(before_days[0], NotEquals(after_days[0]))
995- self.assertThat(before_days[1], NotEquals(after_days[1]))
996- self.assertThat(before_days[2], NotEquals(after_days[2]))
997- self.assertThat(before_days[3], NotEquals(after_days[3]))
998- self.assertThat(before_days[4], NotEquals(after_days[4]))
999- self.assertThat(before_days[5], NotEquals(after_days[5]))
1000- self.assertThat(before_days[6], NotEquals(after_days[6]))
1001-
1002- def test_change_week_across_months(self):
1003- """Changing week across months should update the month"""
1004- header = self.app.main_view.get_header()
1005- before_month = self.app.main_view.get_month_year(header)
1006- self.week_view.change_week(6)
1007-
1008- after_month = self.app.main_view.get_month_year(header)
1009-
1010- self.assertThat(before_month, NotEquals(after_month))
1011-
1012- def test_change_week_across_year(self):
1013- """Changing week across years should update the year"""
1014- header = self.app.main_view.get_header()
1015- month_year_label = self.app.main_view.get_month_year(header)
1016- before_year = month_year_label[-4:]
1017-
1018- current_week = self.week_view.get_current_weeknumber()
1019- direction = 1
1020- no_of_swipes = ((55 - current_week) * 3) # 3 swipes to change week
1021- for x in range(1, no_of_swipes):
1022- self.app.main_view.swipe_view(direction, self.week_view)
1023-
1024- month_year_label = self.app.main_view.get_month_year(header)
1025- after_year = month_year_label[-4:]
1026-
1027- self.assertThat(before_year, NotEquals(after_year))
1028-
1029- def test_month_to_week(self):
1030- """Changing from a month to weekview should
1031- start weekview on the first day of the week"""
1032- self.app.main_view.go_to_month_view()
1033- self.app.main_view.go_to_week_view()
1034-
1035- cal_week_firstday_ts = self.app.main_view.get_week_view().firstDay
1036- cal_week_firstday = datetime.date(cal_week_firstday_ts.datetime.year,
1037- cal_week_firstday_ts.datetime.month,
1038- cal_week_firstday_ts.datetime.day)
1039-
1040- now = datetime.datetime.now()
1041- delta = datetime.datetime.weekday(now)
1042- first_dow = now - timedelta(delta)
1043- expected_first_dow = datetime.date(first_dow.year, first_dow.month,
1044- first_dow.day)
1045-
1046- self.assertEquals(cal_week_firstday, expected_first_dow)
1047-
1048- def test_day_to_week(self):
1049- """Changing from a day to weekview should
1050- start weekview on the same week as the day"""
1051- day_view = self.app.main_view.go_to_day_view()
1052- day_week_no = day_view.get_weeknumber()
1053- week_view = self.app.main_view.go_to_week_view()
1054- week_week_no = week_view.get_current_weeknumber()
1055-
1056- self.assertEquals(day_week_no, week_week_no)
1057-
1058- def test_change_week(self):
1059- """It must be possible to change weeks by swiping the timeline"""
1060- weeks = randint(1, 6)
1061- direction = randrange(-1, 1, 2)
1062- delta = weeks * direction
1063- original_week = self.week_view.get_current_weeknumber()
1064-
1065- self.week_view.change_week(delta)
1066- self._assert_week_delta(original_week, delta)
1067-
1068- def test_selecting_a_day_switches_to_day_view(self):
1069- """It must be possible to show a single day by clicking on it."""
1070- today = datetime.datetime.now()
1071- day_to_select = self.week_view.get_current_headerdatecomponent(today)
1072-
1073- expected_day = day_to_select.date.day
1074- expected_month = day_to_select.date.month
1075- expected_year = day_to_select.date.year
1076-
1077- self.app.pointing_device.click_object(day_to_select)
1078-
1079- # Check that the view changed from 'Week' to 'Day'
1080- day_view = self.app.main_view.get_day_view()
1081- self.assertThat(day_view.visible, Eventually(Equals(True)))
1082-
1083- # Check that the 'Day' view is on the correct/selected day.
1084- day = self.app.main_view.get_day_view().get_selected_day().startDay
1085-
1086- self.assertThat(expected_day, Equals(day.day))
1087- self.assertThat(expected_month, Equals(day.month))
1088- self.assertThat(expected_year, Equals(day.year))
1089
1090=== removed file 'tests/autopilot/calendar_app/tests/test_yearview.py'
1091--- tests/autopilot/calendar_app/tests/test_yearview.py 2015-04-06 17:07:11 +0000
1092+++ tests/autopilot/calendar_app/tests/test_yearview.py 1970-01-01 00:00:00 +0000
1093@@ -1,106 +0,0 @@
1094-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1095-#
1096-# Copyright (C) 2013, 2014 Canonical Ltd
1097-#
1098-# This program is free software: you can redistribute it and/or modify
1099-# it under the terms of the GNU General Public License version 3 as
1100-# published by the Free Software Foundation.
1101-#
1102-# This program is distributed in the hope that it will be useful,
1103-# but WITHOUT ANY WARRANTY; without even the implied warranty of
1104-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1105-# GNU General Public License for more details.
1106-#
1107-# You should have received a copy of the GNU General Public License
1108-# along with this program. If not, see <http://www.gnu.org/licenses/>.
1109-
1110-"""
1111-Calendar app autopilot tests for the year view.
1112-"""
1113-
1114-# from __future__ import range
1115-# (python3's range, is same as python2's xrange)
1116-import sys
1117-if sys.version_info < (3,):
1118- range = xrange
1119-
1120-import datetime
1121-from autopilot.matchers import Eventually
1122-from testtools.matchers import Equals
1123-
1124-from calendar_app.tests import CalendarAppTestCase
1125-
1126-
1127-class TestYearView(CalendarAppTestCase):
1128-
1129- def setUp(self):
1130- super(TestYearView, self).setUp()
1131- self.year_view = self.app.main_view.go_to_year_view()
1132-
1133- def _get_year_grid(self):
1134- return self.year_view.wait_select_single("QQuickGridView",
1135- isCurrentItem=True)
1136-
1137- def _change_year(self, direction, how_many=5):
1138- current_year = self.year_view.currentYear
1139-
1140- for i in range(1, how_many):
1141- self.app.main_view.swipe_view(direction, self.year_view)
1142-
1143- self.assertThat(
1144- lambda: self.year_view.currentYear,
1145- Eventually(Equals(current_year + (i * direction))))
1146-
1147- def test_default_view(self):
1148- """The current year should be the default shown
1149- and the current month should be visible. In addition
1150- the current day should be selected"""
1151- date = datetime.datetime.now()
1152- self.assertEqual(self.year_view.currentYear, date.year)
1153- self.assertEqual(
1154- self.year_view.get_selected_month().currentMonth.datetime.month,
1155- date.month)
1156- self.assertEqual(self.year_view.get_selected_day().date, date.day)
1157-
1158- def test_selecting_a_month_switch_to_month_view(self):
1159- """It must be possible to select a month and open the month view."""
1160-
1161- # click the select month
1162- month = self.year_view.get_selected_month()
1163- expected_year = self.year_view.currentYear
1164- expected_month = month.currentMonth.datetime.month
1165- expected_month_name = month.select_single('Label',
1166- objectName='monthLabel').text
1167-
1168- self.app.pointing_device.click_object(month)
1169-
1170- # confirm month transition
1171- month_view = self.app.main_view.get_month_view()
1172- self.assertThat(month_view.visible, Eventually(Equals(True)))
1173-
1174- self.assertEquals(month_view.currentMonth.datetime.year,
1175- expected_year)
1176-
1177- self.assertEquals(month_view.currentMonth.datetime.month,
1178- expected_month)
1179-
1180- self.assertEquals(month_view.get_current_month_name(),
1181- expected_month_name)
1182-
1183- def test_show_next_years(self):
1184- """It must be possible to show next years by swiping the view."""
1185- self._change_year(1)
1186-
1187- def test_show_previous_years(self):
1188- """It must be possible to show previous years by swiping the view."""
1189- self._change_year(-1)
1190-
1191- def test_today_button(self):
1192- """ Verify that today button takes to today in month view """
1193- date = datetime.datetime.now()
1194- self._change_year(1)
1195-
1196- header = self.app.main_view.get_header()
1197- header.click_action_button('todaybutton')
1198-
1199- self.assertEqual(self.year_view.get_selected_day().date, date.day)

Subscribers

People subscribed via source and target branches

to status/vote changes: