← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~nskaggs/ubuntu-calendar-app/reduce-ap-tests into lp:ubuntu-calendar-app

 

Nicholas Skaggs has proposed merging lp:~nskaggs/ubuntu-calendar-app/reduce-ap-tests into lp:ubuntu-calendar-app.

Commit message:
Remove all the AP tests that involve views, these can be test using qml tests.
Reduce unneeded helpers
Workaround toolkit AP helper bug

Requested reviews:
  Ubuntu Calendar Developers (ubuntu-calendar-dev)

For more details, see:
https://code.launchpad.net/~nskaggs/ubuntu-calendar-app/reduce-ap-tests/+merge/287972

Remove all the AP tests that involve views, these can be test using qml tests.
Reduce unneeded helpers
Workaround toolkit AP helper bug
-- 
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~nskaggs/ubuntu-calendar-app/reduce-ap-tests into lp:ubuntu-calendar-app.
=== modified file 'tests/autopilot/calendar_app/__init__.py'
--- tests/autopilot/calendar_app/__init__.py	2016-02-01 19:48:19 +0000
+++ tests/autopilot/calendar_app/__init__.py	2016-03-03 17:10:48 +0000
@@ -70,55 +70,13 @@
 
         # click on tab action
         tab_button = self.wait_select_single(objectName='tab_%s_button'%tabName)
-        self.pointing_device.click_object(tab_button)   
+        self.pointing_device.click_object(tab_button)
 
     @autopilot.logging.log_action(logger.info)
     def click_action_button(self, action):
         current_tab = self.select_single('Tab', visible=True)
         button = current_tab.wait_select_single(objectName='%s_button'%action)
-        self.pointing_device.click_object(button)   
-
-    @autopilot.logging.log_action(logger.info)
-    def go_to_month_view(self):
-        """Open the month view.
-
-        :return: The Month View page.
-
-        """
-        month_tab = self.select_single('Tab', objectName='monthTab')
-        if not month_tab.visible:
-            self.switch_to_tab('monthTab')
-        else:
-            logger.debug('The month View page is already opened.')
-        return self.get_month_view(month_tab)
-
-    @autopilot.logging.log_action(logger.info)
-    def go_to_week_view(self):
-        """Open the week view.
-
-        :return: The Week View page.
-
-        """
-        week_tab = self.select_single('Tab', objectName='weekTab')
-        if not week_tab.visible:
-            self.switch_to_tab('weekTab')
-        else:
-            logger.debug('The week View page is already opened.')
-        return self.get_week_view(week_tab)
-
-    @autopilot.logging.log_action(logger.info)
-    def go_to_year_view(self):
-        """Open the year view.
-
-        :return: The Year View page.
-
-        """
-        year_tab = self.select_single('Tab', objectName='yearTab')
-        if not year_tab.visible:
-            self.switch_to_tab('yearTab')
-        else:
-            logger.debug('The Year View page is already opened.')
-        return self.get_year_view(year_tab)
+        self.pointing_device.click_object(button)
 
     @autopilot.logging.log_action(logger.info)
     def go_to_day_view(self):
@@ -169,121 +127,26 @@
         return self.wait_select_single(
             CalendarChoicePopup, objectName="calendarchoicepopup")
 
-    def set_picker(self, field, mode, value):
-        # open picker
-        self.pointing_device.click_object(field)
-        # valid options are date or time; assume date if invalid/no option
-        if mode == 'time':
-            mode_value = 'Hours|Minutes'
-        else:
-            mode_value = 'Years|Months|Days'
-        picker = self.wait_select_single(
-            ubuntuuitoolkit.pickers.DatePicker, mode=mode_value, visible=True)
-        if mode_value == 'Hours|Minutes':
-            picker.pick_time(value)
-        else:
-            picker.pick_date(value)
-        # close picker
-        self.pointing_device.click_object(field)
-
-    def get_event_view(self, parent_object=None):
-        if parent_object is None:
-            parent_object = self
-        return parent_object.wait_select_single("EventView")
-
     def get_event_details(self, parent_object=None):
         if parent_object is None:
             parent_object = self
         return parent_object.wait_select_single(EventDetails,
                                                 objectName='eventDetails')
-
-    def get_month_view(self, parent_object=None):
-        if parent_object is None:
-            parent_object = self
-        return parent_object.wait_select_single(MonthView,
-                                                objectName='monthViewPage')
-
-    def get_year_view(self, parent_object=None):
-        if parent_object is None:
-            parent_object = self
-        return parent_object.wait_select_single(YearView,
-                                                objectName='yearViewPage')
-
     def get_day_view(self, parent_object=None):
         if parent_object is None:
             parent_object = self
         return parent_object.wait_select_single(DayView,
                                                 objectName='dayViewPage')
 
-    def get_week_view(self, parent_object=None):
-        if parent_object is None:
-            parent_object = self
-        return parent_object.wait_select_single(WeekView,
-                                                objectName='weekViewPage')
-
     def get_agenda_view(self, parent_object=None):
         if parent_object is None:
             parent_object = self
         return parent_object.wait_select_single(AgendaView,
                                                 objectName='AgendaView')
 
-    def get_label_with_text(self, text, root=None):
-        if root is None:
-            root = self
-        labels = root.select_many("Label", text=text)
-        if (len(labels) > 0):
-            return labels[0]
-        else:
-            return None
-
-    def get_month_year(self, component):
-        return self.wait_select_single(
-            "Label", objectName="monthYearLabel").text
-
-    def get_year(self, component):
-        return int(component.wait_select_single(
-            "Label", objectName="yearLabel").text)
-
-    def get_month_name(self, component):
-        return component.wait_select_single(
-            "Label", objectName="monthLabel").text
-
-    def safe_swipe_view(self, direction, view, date):
-        """
-        direction: direction to swipe
-        view: the view you are swiping against
-        date: a function object of the view
-        """
-        timeout = 0
-        before = date
-        # try up to 3 times to swipe
-        while timeout < 3 and date == before:
-            self._swipe(direction, view)
-            # check for up to 3 seconds after swipe for view
-            # to have changed before trying again
-            for x in range(0, 3):
-                if date != before:
-                    break
-                sleep(1)
-            timeout += 1
-
-    def swipe_view(self, direction, view, x_pad=0.08):
-        """Swipe the given view to left or right.
-
-        Args:
-            direction: if 1 it swipes from right to left, if -1 from
-                left right.
-
-        """
-
-        start = (-direction * x_pad) % 1
-        stop = (direction * x_pad) % 1
-
-        y_line = view.globalRect[1] + view.globalRect[3] / 2
-        x_start = view.globalRect[0] + view.globalRect[2] * start
-        x_stop = view.globalRect[0] + view.globalRect[2] * stop
-
-        self.pointing_device.drag(x_start, y_line, x_stop, y_line)
+    @autopilot.logging.log_action(logger.info)
+    def press_header_custombackbutton(self):
+        self.click_custom_back_button()
 
     def swipe_view_vertical(self, direction, view, y_pad=0.08):
         """Swipe the given view to up or down.
@@ -302,215 +165,6 @@
         self.pointing_device.drag(x_line, y_start, x_line, y_stop)
         sleep(1)
 
-    def to_local_date(self, date):
-        utc = date.replace(tzinfo=tz.tzutc())
-        local = utc.astimezone(tz.tzlocal())
-        return local
-
-    def press_header_todaybutton(self):
-        self.click_action_button('todaybutton')
-
-    @autopilot.logging.log_action(logger.info)
-    def get_color_picker_dialog(self):
-        return self.wait_select_single(
-            "ColorPickerDialog", objectName="colorPickerDialog")
-
-    @autopilot.logging.log_action(logger.info)
-    def press_header_custombackbutton(self):
-        self.click_custom_back_button()
-
-
-class YearView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
-
-    """Autopilot helper for the Year View page."""
-
-    def get_selected_day(self):
-        """Return the selected day.
-
-        :returns: A today calendar object
-
-        """
-        month = self.get_selected_month()
-        try:
-            today = month.select_single(
-                'MonthComponentDateDelegate',
-                isCurrentMonth=True, isToday=True)
-        except exceptions.StateNotFoundError:
-            raise CalendarException('No day is selected on the visible year.')
-        else:
-            return today
-
-    def get_selected_month(self):
-        """Return the selected month.
-
-        :returns: A month calendar object
-
-        """
-        current_year_grid = self._get_current_year_grid()
-        return self._get_month_component(current_year_grid,
-                                         current_year_grid.scrollMonth)
-
-    def get_day(self, monthNumber, dayNumber):
-        """Return the day object.
-        :param monthNumber the numeric month to get
-        :param dayNumber the numeric day to get
-        :returns: A month calendar object
-
-        """
-        month = self.get_month(monthNumber)
-
-        try:
-            day = month.select_single('MonthComponentDateDelegate',
-                                      date=dayNumber)
-        except exceptions.StateNotFoundError:
-            raise CalendarException('%s not found in %s' % (
-                dayNumber, monthNumber))
-        else:
-            return day
-
-    def get_month(self, monthNumber):
-        """Return the month object.
-        :param monthNumber the numeric month to get
-        :returns: A month calendar object
-
-        """
-        current_year_grid = self._get_current_year_grid()
-        # the monthcomponents start at zero, thus subtract 1 to get month
-        return self._find_month_component(current_year_grid, monthNumber - 1)
-
-    def _get_current_year_grid(self):
-        path_view_base = self.select_single(
-            'PathViewBase', objectName='yearPathView')
-        return path_view_base.select_single(
-            "YearViewDelegate", isCurrentItem=True)
-
-    def _find_month_component(self, grid, index):
-        try:
-            month = self._get_month_component(grid, index)
-        except exceptions.StateNotFoundError:
-            month = self._swipe_to_find_month_component(grid, index)
-        if month is None:
-            raise CalendarException('Month {} not found.'.format(index))
-        else:
-            return month
-
-    def _get_month_component(self, grid, index):
-        return grid.select_single(
-            'MonthComponent',
-            objectName='monthComponent{}'.format(index))
-
-    def _swipe_to_find_month_component(self, grid, index):
-        month = None
-        grid.swipe_to_top()
-        while not grid.atYEnd:
-            try:
-                month = self._get_month_component(grid, index)
-            except exceptions.StateNotFoundError:
-                # FIXME do not call the private _get_containers.
-                # Reported as bug http://pad.lv/1365674
-                # --elopio - 2014-09-04
-                grid.swipe_to_show_more_below(grid._get_containers())
-            else:
-                break
-        return month
-
-
-class WeekView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
-
-    """Autopilot helper for the Week View page."""
-
-    def get_current_weeknumber(self):
-        return self._get_timeline_base().weekNumber
-
-    def _get_timeline_base(self):
-        return self.select_single("TimeLineBaseComponent", isActive=True)
-
-    def _get_timeline_header(self):
-        return self._get_timeline_base().select_single(objectName="viewHeader")
-
-    def _get_date_label_headers(self):
-        return self._get_timeline_header().select_many("Label",
-                                                       objectName="dateLabel")
-
-    def _get_pathview_base(self):
-        # return self.select_single('PathViewBase',
-        #                           objectname='weekviewpathbase')
-        # why do you hate me autopilot? ^^
-        return self.select_single('PathViewBase')
-
-    def change_week(self, delta):
-        direction = int(math.copysign(1, delta))
-        main_view = self.get_root_instance().select_single(MainView)
-
-        pathview_base = self._get_pathview_base()
-
-        for _ in range(abs(delta)):
-            timeline_header = self._get_timeline_header()
-
-            main_view.swipe_view(direction, timeline_header)
-            # prevent timing issues with swiping
-            pathview_base.moving.wait_for(False)
-
-    def get_days_of_week(self):
-        # sort based on text value of the day
-        days = sorted(self._get_date_label_headers(),
-                      key=lambda label: label.text)
-        days = [int(item.text) for item in days]
-
-        # resort so beginning of next month comes after the end
-        # need to support overlapping months 28,30,31 -> 1
-        sorteddays = []
-        for day in days:
-            inserted = 0
-            for index, sortday in enumerate(sorteddays):
-                if day - sorteddays[index] == 1:
-                    sorteddays.insert(index + 1, day)
-                    inserted = 1
-                    break
-            if inserted == 0:
-                sorteddays.insert(0, day)
-        return sorteddays
-
-    @autopilot.logging.log_action(logger.info)
-    def get_current_headerdatecomponent(self, now):
-        today = datetime.date(now.year, now.month, now.day)
-        header_date_components = self.select_many('HeaderDateComponent')
-        for header in header_date_components:
-            header_date = datetime.date(header.date.datetime.year,
-                                        header.date.datetime.month,
-                                        header.date.datetime.day)
-            if header_date == today:
-                return header
-
-
-class MonthView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
-
-    """Autopilot helper for the Month View page."""
-
-    def get_current_month(self):
-        return self.select_single('MonthComponent', isCurrentItem=True)
-
-    @autopilot.logging.log_action(logger.info)
-    def get_current_month_name(self):
-        month = self.get_current_month()
-        return month.currentMonth.datetime.strftime("%B")
-
-    @autopilot.logging.log_action(logger.info)
-    def get_current_selected_day(self):
-        today_days = self.select_many(
-            'MonthComponentDateDelegate', isToday=True)
-        for item in today_days:
-            if item.isCurrentMonth:
-                return item
-
-    @autopilot.logging.log_action(logger.info)
-    def get_day_label(self, day):
-        days_row = self.select_single(
-            'QQuickRow', objectName='dayLabelRow0')
-        return days_row.select_single(
-            'Label', objectName='weekDay{}'.format(day))
-
-
 class DayView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
 
     """Autopilot helper for the Day View page."""
@@ -784,17 +438,6 @@
         return self.get_root_instance().wait_select_single(
             EventDetails, objectName='eventDetails')
 
-
-# override toolkit helper to
-# workaround bug https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1343916
-class QQuickFlickable(ubuntuuitoolkit.QQuickFlickable):
-
-    def _slow_drag(self, start_x, stop_x, start_y, stop_y):
-        rate = (self.flickDeceleration + 250) / 350
-        self.pointing_device.drag(start_x, start_y, stop_x, stop_y, rate=rate)
-        self.pointing_device.click()
-
-
 class NewEvent(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
 
     """Autopilot helper for the New Event page."""
@@ -881,7 +524,7 @@
                 raise CalendarException('No guest found with name %s' % guest)
 
     def _select_calendar(self, calendar):
-        self._get_calendar().select_option('Label', text=calendar)
+        self._get_calendar().select_option('UCLabel', text=calendar)
 
     def _get_calendar(self):
         return self.wait_select_single(ubuntuuitoolkit.OptionSelector,
@@ -957,6 +600,26 @@
     """Autopilot helper for the NewEventEntryField component."""
 
 
+#for https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1552773
+class OptionSelector(ubuntuuitoolkit.OptionSelector):
+    """OptionSelector Autopilot custom proxy object"""
+
+    def get_selected_text(self):
+        """gets the text of the currently selected item"""
+        option_selector_delegate = self.select_single(
+            'OptionSelectorDelegate', focus='True')
+        current_label = option_selector_delegate.select_single(
+            'UCLabel', visible='True')
+        return current_label.text
+
+    def get_current_label(self):
+        """gets the text of the currently selected item"""
+        option_selector_delegate = self.select_single(
+            'OptionSelectorDelegate', focus='True')
+        current_label = option_selector_delegate.select_single(
+            'UCLabel', visible='True')
+        return current_label
+
 class EventDetails(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
 
     """Autopilot helper for the Event Details page."""

=== removed file 'tests/autopilot/calendar_app/tests/test_custom_proxy_objects.py'
--- tests/autopilot/calendar_app/tests/test_custom_proxy_objects.py	2014-09-04 21:31:50 +0000
+++ tests/autopilot/calendar_app/tests/test_custom_proxy_objects.py	1970-01-01 00:00:00 +0000
@@ -1,30 +0,0 @@
-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
-#
-# Copyright (C) 2014 Canonical Ltd
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 3 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from calendar_app import data, tests
-
-
-class NewEventFormTestCase(tests.CalendarAppTestCaseWithVcard):
-
-    def test_fill_form(self):
-        """Test that the form can be filled with event information."""
-        test_event = data.Event.make_unique(unique_id='test uuid')
-
-        new_event_page = self.app.main_view.go_to_new_event()
-        new_event_page._fill_form(test_event)
-
-        form_values = new_event_page._get_form_values()
-        self.assertEqual(test_event, form_values)

=== removed file 'tests/autopilot/calendar_app/tests/test_data.py'
--- tests/autopilot/calendar_app/tests/test_data.py	2015-06-01 13:15:10 +0000
+++ tests/autopilot/calendar_app/tests/test_data.py	1970-01-01 00:00:00 +0000
@@ -1,31 +0,0 @@
-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
-#
-# Copyright (C) 2014 Canonical Ltd
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 3 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import testtools
-
-from calendar_app import data
-
-
-class EventTestCase(testtools.TestCase):
-
-    def test_make_unique_event_must_return_event_with_unique_id(self):
-        event = data.Event.make_unique(unique_id='test uuid')
-
-        self.assertEqual(event.calendar, 'Personal')
-        self.assertEqual(event.name, 'Test ev test uuid')
-        self.assertEqual(event.description, 'Test desc test uuid.')
-        self.assertEqual(event.location, 'Test loc test uuid')
-        self.assertEqual(event.guests, ['UX User'])

=== removed file 'tests/autopilot/calendar_app/tests/test_dayview.py'
--- tests/autopilot/calendar_app/tests/test_dayview.py	2015-05-21 19:32:31 +0000
+++ tests/autopilot/calendar_app/tests/test_dayview.py	1970-01-01 00:00:00 +0000
@@ -1,120 +0,0 @@
-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
-#
-# Copyright (C) 2013, 2014 Canonical Ltd
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 3 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-"""
-Calendar app autopilot tests for the day view.
-"""
-
-import datetime
-import calendar
-import logging
-
-# from __future__ import range
-# (python3's range, is same as python2's xrange)
-import sys
-if sys.version_info < (3,):
-    range = xrange
-
-from autopilot.matchers import Eventually
-from testtools.matchers import Equals, NotEquals
-
-from calendar_app.tests import CalendarAppTestCase
-from datetime import date
-
-logger = logging.getLogger(__name__)
-
-
-class TestDayView(CalendarAppTestCase):
-
-    def setUp(self):
-        super(TestDayView, self).setUp()
-        self.day_view = self.app.main_view.go_to_day_view()
-
-    def test_default_view(self):
-        """By default, the day view shows the current month year and
-           today's date.
-           The day should be scrolled to the current time
-        """
-
-        now = datetime.datetime.now()
-        today = date(now.year, now.month, now.day)
-        day_view_currentDay = self.day_view.currentDay
-
-        day_view_currentDay_date = \
-            date(day_view_currentDay.year,
-                 day_view_currentDay.month,
-                 day_view_currentDay.day)
-
-        expected_month_name_year = now.strftime("%B %Y")
-
-        # Checking today's date is correct
-        self.assertEquals(day_view_currentDay_date, today)
-
-        # Checking month and year in header are correct
-        self.assertEquals(
-            self.app.main_view.get_month_year(self.day_view),
-            expected_month_name_year)
-
-        # Checking day label and day of week label are correct
-        self.assertEquals(
-            self.day_view.get_daylabel(today).text,
-            calendar.day_abbr[now.weekday()])
-        self.assertEquals(
-            self.day_view.get_datelabel(today).text, str(now.day))
-
-        # Check  day is scrolled to the current time
-        self.assertEquals(self.day_view.get_scrollHour(), now.hour)
-
-    def test_show_next_days(self):
-        """It must be possible to show next days by swiping the view."""
-        self._change_days(1)
-
-    def test_show_previous_days(self):
-        """It must be possible to show previous days by swiping the view."""
-        self._change_days(-1)
-
-    def test_today_button(self):
-        now = datetime.datetime.now()
-        today = date(now.year, now.month, now.day)
-        self._change_days(1)
-        self.app.main_view.press_header_todaybutton()
-        self.day_view.check_loading_spinnger()
-
-        current_day = self.day_view.get_active_timelinebasecomponent().startDay
-        new_today = date(current_day.year, current_day.month, current_day.day)
-
-        self.assertEquals(today, new_today)
-
-    def _change_days(self, direction):
-        firstday = self.day_view.currentDay.datetime
-
-        for i in range(1, 5):
-            # prevent timing issues with swiping
-            old_day = self.day_view.currentDay.datetime
-            self.app.main_view.swipe_view(direction, self.day_view)
-            self.assertThat(lambda: self.day_view.currentDay.datetime,
-                            Eventually(NotEquals(old_day)))
-
-            current_day = self.day_view.currentDay.datetime
-
-            expected_day = (firstday + datetime.timedelta(
-                days=(i * direction)))
-
-            self.assertThat(self._strip_time(current_day),
-                            Equals(self._strip_time(expected_day)))
-
-    def _strip_time(self, date):
-        return date.replace(hour=0, minute=0, second=0, microsecond=0)

=== modified file 'tests/autopilot/calendar_app/tests/test_management.py'
--- tests/autopilot/calendar_app/tests/test_management.py	2015-04-17 19:49:43 +0000
+++ tests/autopilot/calendar_app/tests/test_management.py	2016-03-03 17:10:48 +0000
@@ -29,22 +29,6 @@
 
 class TestManagement(CalendarAppTestCaseWithVcard):
 
-    def test_change_calendar_color(self):
-        """ Test changing calendar color   """
-        calendar_choice_popup = \
-            self.app.main_view.go_to_calendar_choice_popup()
-        original_calendar_color = \
-            calendar_choice_popup.get_calendar_color()
-        calendar_choice_popup.open_color_picker_dialog()
-        colorPickerDialog = self.app.main_view.get_color_picker_dialog()
-        colorPickerDialog.change_calendar_color("color6")
-
-        final_calendar_color = \
-            calendar_choice_popup.get_calendar_color()
-
-        self.assertThat(
-            original_calendar_color, NotEquals(final_calendar_color))
-
     def test_unselect_calendar(self):
         """ Test unselecting calendar
 
@@ -76,7 +60,7 @@
     def _event_exists(self, event_name):
         try:
             day_view = self.app.main_view.go_to_day_view()
-            day_view.get_event(event_name, True)
+            day_view.get_event(event_name, False)
         except Exception:
             return False
         return True

=== removed file 'tests/autopilot/calendar_app/tests/test_monthview.py'
--- tests/autopilot/calendar_app/tests/test_monthview.py	2015-05-21 20:01:24 +0000
+++ tests/autopilot/calendar_app/tests/test_monthview.py	1970-01-01 00:00:00 +0000
@@ -1,147 +0,0 @@
-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
-#
-# Copyright (C) 2013, 2014 Canonical Ltd
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 3 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-"""Calendar app autopilot tests."""
-
-from __future__ import absolute_import
-
-from autopilot.matchers import Eventually
-from testtools.matchers import Equals, NotEquals
-
-import math
-import calendar
-
-from calendar_app.tests import CalendarAppTestCase
-
-from datetime import datetime
-from dateutil.relativedelta import relativedelta
-
-import logging
-logger = logging.getLogger(__name__)
-
-
-class TestMonthView(CalendarAppTestCase):
-
-    def setUp(self):
-        super(TestMonthView, self).setUp()
-        self.month_view = self.app.main_view.go_to_month_view()
-
-    def _change_month(self, delta):
-        month_view = self.app.main_view.get_month_view()
-        direction = int(math.copysign(1, delta))
-
-        for _ in range(abs(delta)):
-            before = month_view.currentMonth.datetime
-
-            # prevent timing issues with swiping
-            old_month = month_view.currentMonth.datetime
-
-            self.app.main_view.swipe_view(direction, month_view)
-
-            month_after = month_view.currentMonth.datetime
-
-            self.assertThat(lambda: month_after,
-                            Eventually(NotEquals(old_month)))
-
-            after = before + relativedelta(months=direction)
-
-            self.assertThat(lambda:
-                            month_after.month,
-                            Eventually(Equals(after.month)))
-            self.assertThat(lambda:
-                            month_after.year,
-                            Eventually(Equals(after.year)))
-
-    def _assert_today(self):
-        today = datetime.now()
-        local = self.month_view.currentMonth.datetime
-        converted_local = self.app.main_view.to_local_date(local)
-        logger.debug(local)
-        logger.debug(converted_local)
-        logger.debug(today)
-
-        self.assertThat(lambda: local.day,
-                        Eventually(Equals(today.day)))
-        self.assertThat(lambda: local.month,
-                        Eventually(Equals(today.month)))
-        self.assertThat(lambda: local.year,
-                        Eventually(Equals(today.year)))
-
-    def _go_to_today(self, delta):
-        self._change_month(delta)
-        header = self.app.main_view.get_header()
-        header.click_action_button('todaybutton')
-        self._assert_today()
-
-    def test_monthview_go_to_today_next_month(self):
-        self._go_to_today(1)
-
-    def test_monthview_go_to_today_prev_month(self):
-        self._go_to_today(-1)
-
-    def test_monthview_go_to_today_next_year(self):
-        self._go_to_today(12)
-
-    def test_monthview_go_to_today_prev_year(self):
-        self._go_to_today(-12)
-
-    def test_current_day_month_and_year_is_selected(self):
-        """
-        By default, the month view shows the current day, month and year.
-        """
-        now = datetime.now()
-        expected_month_name_year = now.strftime("%B %Y")
-
-        self.assertThat(self.app.main_view.get_month_year(self.month_view),
-                        Equals(expected_month_name_year))
-
-        expected_day = str(int(now.strftime("%d")))
-        selected_day = self.month_view.get_current_selected_day()
-
-        self.assertEquals(
-            selected_day.select_single('Label').text, expected_day)
-
-    def test_days_of_week_are_correct(self):
-        """
-        Verify that days of week are correct for the locale
-        """
-        first_week_day = calendar.day_abbr[calendar.firstweekday()]
-        day_0_label = self.month_view.get_day_label(0).day
-        day_1_label = self.month_view.get_day_label(1).day
-        day_2_label = self.month_view.get_day_label(2).day
-        day_3_label = self.month_view.get_day_label(3).day
-        day_4_label = self.month_view.get_day_label(4).day
-        day_5_label = self.month_view.get_day_label(5).day
-        day_6_label = self.month_view.get_day_label(6).day
-
-        self.assertEquals(day_0_label, first_week_day)
-
-        self.assertEquals(calendar.day_abbr[calendar.MONDAY], day_0_label)
-        self.assertEquals(calendar.day_abbr[calendar.TUESDAY], day_1_label)
-        self.assertEquals(calendar.day_abbr[calendar.WEDNESDAY], day_2_label)
-        self.assertEquals(calendar.day_abbr[calendar.THURSDAY], day_3_label)
-        self.assertEquals(calendar.day_abbr[calendar.FRIDAY], day_4_label)
-        self.assertEquals(calendar.day_abbr[calendar.SATURDAY], day_5_label)
-        self.assertEquals(calendar.day_abbr[calendar.SUNDAY], day_6_label)
-
-    def test_today_button(self):
-        """ Verify that today button takes to today in month view """
-        self._go_to_today(1)
-
-        header = self.app.main_view.get_header()
-        header.click_action_button('todaybutton')
-
-        self._assert_today()

=== modified file 'tests/autopilot/calendar_app/tests/test_new_event.py'
--- tests/autopilot/calendar_app/tests/test_new_event.py	2015-05-09 02:20:34 +0000
+++ tests/autopilot/calendar_app/tests/test_new_event.py	2016-03-03 17:10:48 +0000
@@ -35,9 +35,6 @@
     # TODO add tests for events in the future and in the past, all day event,
     # event with recurrence and event with reminders.
     # also add tests for saving to different calendars
-    # We currently can't change the date of the new event because of bug
-    # http://pad.lv/1328600 on Autopilot.
-    # --elopio - 2014-06-26
 
     def _try_delete_event(self, event_name):
         try:
@@ -86,39 +83,6 @@
                                            now.day, now.hour, 0)
             return start_date + datetime.timedelta(hours=1)
 
-    def test_new_event_must_start_with_default_values(self):
-        """Test adding a new event default values
-
-           Start Date: today Start Time: next half hour increment
-           End Date: today End Time: 1 hour after start time
-           Calendar: Personal
-           All Day Event: unchecked
-           Event Name: blank, selected
-           Description: blank
-           Location: none
-           Guests: none
-           This happens: Once
-           Remind me: On Event
-        """
-
-        new_event_page = self.app.main_view.go_to_new_event()
-        self.assertThat(new_event_page.get_calendar_name(), Equals('Personal'))
-        self.assertThat(new_event_page.get_event_name(), Equals(''))
-        self.assertThat(new_event_page.get_description_text(), Equals(''))
-        self.assertThat(new_event_page.get_location_name(), Equals(''))
-        self.assertThat(new_event_page.get_is_all_day_event(), Equals(False))
-        self.assertThat(new_event_page.has_guests(), Equals(False))
-        self.assertThat(new_event_page.get_this_happens(), Equals('Once'))
-        self.assertThat(new_event_page.get_reminder(), Equals('15 minutes'))
-
-        expected_start_date = self._expected_start_date()
-        expected_end_date = expected_start_date + datetime.timedelta(hours=1)
-
-        self.assertThat(new_event_page.get_start_date(),
-                        Equals(expected_start_date))
-        self.assertThat(new_event_page.get_end_date(),
-                        Equals(expected_end_date))
-
     def test_add_new_event_with_default_values(self):
         """Test adding a new event with the default values.
 

=== removed file 'tests/autopilot/calendar_app/tests/test_weekview.py'
--- tests/autopilot/calendar_app/tests/test_weekview.py	2015-06-01 09:15:23 +0000
+++ tests/autopilot/calendar_app/tests/test_weekview.py	1970-01-01 00:00:00 +0000
@@ -1,177 +0,0 @@
-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
-#
-# Copyright (C) 2013, 2014 Canonical Ltd
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 3 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-"""
-Calendar app autopilot tests for the week view.
-"""
-
-# from __future__ import range
-# (python3's range, is same as python2's xrange)
-import sys
-if sys.version_info < (3,):
-    range = xrange
-
-import datetime
-from datetime import timedelta
-from autopilot.matchers import Eventually
-from testtools.matchers import Equals, NotEquals
-from random import randint, randrange
-
-from calendar_app.tests import CalendarAppTestCase
-import logging
-
-logger = logging.getLogger(__name__)
-
-
-class TestWeekView(CalendarAppTestCase):
-
-    def setUp(self):
-        super(TestWeekView, self).setUp()
-        self.week_view = self.app.main_view.go_to_week_view()
-
-    def _assert_week_delta(self, original_week, delta):
-        current_week = self.week_view.get_current_weeknumber()
-        expected_week = original_week + delta
-
-        if expected_week < 0:
-            expected_week += 53
-        elif expected_week > 52:
-            expected_week -= 53
-
-        self.assertEquals(current_week, expected_week)
-
-    def test_default_view(self):
-        """By default, the week view shows the current week.
-        It also displays the current year and month"""
-
-        now = datetime.datetime.now()
-        expected_month_name_year = now.strftime("%B %Y")
-        self.assertThat(self.app.main_view.get_month_year(self.week_view),
-                        Equals(expected_month_name_year))
-
-        # check current day is highlighted
-        header_date = self.week_view.get_current_headerdatecomponent(now)
-        self.assertEquals(header_date.dayColor[0], 221)
-        self.assertEquals(header_date.dayColor[1], 72)
-        self.assertEquals(header_date.dayColor[2], 20)
-        self.assertEquals(header_date.dayColor[3], 255)
-
-    def test_scroll_week_must_scroll_weekdays(self):
-        """Scrolling inside the timeline should scroll the weekdays"""
-        before_days = self.week_view.get_days_of_week()
-
-        direction = 1
-        no_of_swipes = 3
-        for x in range(no_of_swipes):
-            self.app.main_view.swipe_view(direction, self.week_view)
-
-        after_days = self.week_view.get_days_of_week()
-
-        self.assertThat(before_days[0], NotEquals(after_days[0]))
-        self.assertThat(before_days[1], NotEquals(after_days[1]))
-        self.assertThat(before_days[2], NotEquals(after_days[2]))
-        self.assertThat(before_days[3], NotEquals(after_days[3]))
-        self.assertThat(before_days[4], NotEquals(after_days[4]))
-        self.assertThat(before_days[5], NotEquals(after_days[5]))
-        self.assertThat(before_days[6], NotEquals(after_days[6]))
-
-    def test_change_week_across_months(self):
-        """Changing week across months should update the month"""
-        header = self.app.main_view.get_header()
-        before_month = self.app.main_view.get_month_year(header)
-        self.week_view.change_week(6)
-
-        after_month = self.app.main_view.get_month_year(header)
-
-        self.assertThat(before_month, NotEquals(after_month))
-
-    def test_change_week_across_year(self):
-        """Changing week across years should update the year"""
-        header = self.app.main_view.get_header()
-        month_year_label = self.app.main_view.get_month_year(header)
-        before_year = month_year_label[-4:]
-
-        current_week = self.week_view.get_current_weeknumber()
-        direction = 1
-        no_of_swipes = ((55 - current_week) * 3)  # 3 swipes to change week
-        for x in range(1, no_of_swipes):
-            self.app.main_view.swipe_view(direction, self.week_view)
-
-        month_year_label = self.app.main_view.get_month_year(header)
-        after_year = month_year_label[-4:]
-
-        self.assertThat(before_year, NotEquals(after_year))
-
-    def test_month_to_week(self):
-        """Changing from a month to weekview should
-         start weekview on the first day of the week"""
-        self.app.main_view.go_to_month_view()
-        self.app.main_view.go_to_week_view()
-
-        cal_week_firstday_ts = self.app.main_view.get_week_view().firstDay
-        cal_week_firstday = datetime.date(cal_week_firstday_ts.datetime.year,
-                                          cal_week_firstday_ts.datetime.month,
-                                          cal_week_firstday_ts.datetime.day)
-
-        now = datetime.datetime.now()
-        delta = datetime.datetime.weekday(now)
-        first_dow = now - timedelta(delta)
-        expected_first_dow = datetime.date(first_dow.year, first_dow.month,
-                                           first_dow.day)
-
-        self.assertEquals(cal_week_firstday, expected_first_dow)
-
-    def test_day_to_week(self):
-        """Changing from a day to weekview should
-           start weekview on the same week as the day"""
-        day_view = self.app.main_view.go_to_day_view()
-        day_week_no = day_view.get_weeknumber()
-        week_view = self.app.main_view.go_to_week_view()
-        week_week_no = week_view.get_current_weeknumber()
-
-        self.assertEquals(day_week_no, week_week_no)
-
-    def test_change_week(self):
-        """It must be possible to change weeks by swiping the timeline"""
-        weeks = randint(1, 6)
-        direction = randrange(-1, 1, 2)
-        delta = weeks * direction
-        original_week = self.week_view.get_current_weeknumber()
-
-        self.week_view.change_week(delta)
-        self._assert_week_delta(original_week, delta)
-
-    def test_selecting_a_day_switches_to_day_view(self):
-        """It must be possible to show a single day by clicking on it."""
-        today = datetime.datetime.now()
-        day_to_select = self.week_view.get_current_headerdatecomponent(today)
-
-        expected_day = day_to_select.date.day
-        expected_month = day_to_select.date.month
-        expected_year = day_to_select.date.year
-
-        self.app.pointing_device.click_object(day_to_select)
-
-        # Check that the view changed from 'Week' to 'Day'
-        day_view = self.app.main_view.get_day_view()
-        self.assertThat(day_view.visible, Eventually(Equals(True)))
-
-        # Check that the 'Day' view is on the correct/selected day.
-        day = self.app.main_view.get_day_view().get_selected_day().startDay
-
-        self.assertThat(expected_day, Equals(day.day))
-        self.assertThat(expected_month, Equals(day.month))
-        self.assertThat(expected_year, Equals(day.year))

=== removed file 'tests/autopilot/calendar_app/tests/test_yearview.py'
--- tests/autopilot/calendar_app/tests/test_yearview.py	2015-04-06 17:07:11 +0000
+++ tests/autopilot/calendar_app/tests/test_yearview.py	1970-01-01 00:00:00 +0000
@@ -1,106 +0,0 @@
-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
-#
-# Copyright (C) 2013, 2014 Canonical Ltd
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 3 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-"""
-Calendar app autopilot tests for the year view.
-"""
-
-# from __future__ import range
-# (python3's range, is same as python2's xrange)
-import sys
-if sys.version_info < (3,):
-    range = xrange
-
-import datetime
-from autopilot.matchers import Eventually
-from testtools.matchers import Equals
-
-from calendar_app.tests import CalendarAppTestCase
-
-
-class TestYearView(CalendarAppTestCase):
-
-    def setUp(self):
-        super(TestYearView, self).setUp()
-        self.year_view = self.app.main_view.go_to_year_view()
-
-    def _get_year_grid(self):
-        return self.year_view.wait_select_single("QQuickGridView",
-                                                 isCurrentItem=True)
-
-    def _change_year(self, direction, how_many=5):
-        current_year = self.year_view.currentYear
-
-        for i in range(1, how_many):
-            self.app.main_view.swipe_view(direction, self.year_view)
-
-            self.assertThat(
-                lambda: self.year_view.currentYear,
-                Eventually(Equals(current_year + (i * direction))))
-
-    def test_default_view(self):
-        """The current year should be the default shown
-        and the current month should be visible. In addition
-        the current day should be selected"""
-        date = datetime.datetime.now()
-        self.assertEqual(self.year_view.currentYear, date.year)
-        self.assertEqual(
-            self.year_view.get_selected_month().currentMonth.datetime.month,
-            date.month)
-        self.assertEqual(self.year_view.get_selected_day().date, date.day)
-
-    def test_selecting_a_month_switch_to_month_view(self):
-        """It must be possible to select a month and open the month view."""
-
-        # click the select month
-        month = self.year_view.get_selected_month()
-        expected_year = self.year_view.currentYear
-        expected_month = month.currentMonth.datetime.month
-        expected_month_name = month.select_single('Label',
-                                                  objectName='monthLabel').text
-
-        self.app.pointing_device.click_object(month)
-
-        # confirm month transition
-        month_view = self.app.main_view.get_month_view()
-        self.assertThat(month_view.visible, Eventually(Equals(True)))
-
-        self.assertEquals(month_view.currentMonth.datetime.year,
-                          expected_year)
-
-        self.assertEquals(month_view.currentMonth.datetime.month,
-                          expected_month)
-
-        self.assertEquals(month_view.get_current_month_name(),
-                          expected_month_name)
-
-    def test_show_next_years(self):
-        """It must be possible to show next years by swiping the view."""
-        self._change_year(1)
-
-    def test_show_previous_years(self):
-        """It must be possible to show previous years by swiping the view."""
-        self._change_year(-1)
-
-    def test_today_button(self):
-        """ Verify that today button takes to today in month view """
-        date = datetime.datetime.now()
-        self._change_year(1)
-
-        header = self.app.main_view.get_header()
-        header.click_action_button('todaybutton')
-
-        self.assertEqual(self.year_view.get_selected_day().date, date.day)


Follow ups