ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #00864
[Merge] lp:~carla-sella/ubuntu-calendar-app/dayview-test-default-view into lp:ubuntu-calendar-app
Carla Sella has proposed merging lp:~carla-sella/ubuntu-calendar-app/dayview-test-default-view into lp:ubuntu-calendar-app.
Commit message:
Autopilot test for Calendar app
Requested reviews:
Nicholas Skaggs (nskaggs)
Related bugs:
Bug #1426063 in Ubuntu Calendar App: "Autopilot Test: test_dayview testsuite needs updated"
https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1426063
For more details, see:
https://code.launchpad.net/~carla-sella/ubuntu-calendar-app/dayview-test-default-view/+merge/253760
Dayview: test default view.
--
Your team Ubuntu Calendar Developers is subscribed to branch lp:ubuntu-calendar-app.
=== modified file 'HeaderDateComponent.qml'
--- HeaderDateComponent.qml 2014-11-04 18:32:16 +0000
+++ HeaderDateComponent.qml 2015-03-21 16:19:29 +0000
@@ -39,6 +39,7 @@
Column {
id: dateContainer
+ objectName: "dateContainer"
width: dayLabel.paintedWidth
spacing: units.gu(0.2)
=== modified file 'tests/autopilot/calendar_app/__init__.py'
--- tests/autopilot/calendar_app/__init__.py 2015-03-07 10:14:46 +0000
+++ tests/autopilot/calendar_app/__init__.py 2015-03-21 16:19:29 +0000
@@ -28,6 +28,7 @@
from testtools.matchers import GreaterThan
from calendar_app import data
+from datetime import date
logger = logging.getLogger(__name__)
@@ -583,27 +584,36 @@
return event_details_page.edit()
@autopilot.logging.log_action(logger.info)
- def get_day_header(self, day=None):
+ def get_day_header(self, day):
"""Return the dayheader for a given day. If no day is given,
return the current day.
- :param day: A datetime object matching the header
+ :param day: day in date(year, month, day) format
:return: The day header object
"""
if day:
headers = self.select_many('TimeLineHeaderComponent')
for header in headers:
- if header.startDay.datetime == day:
- day_header = header
- break
+ header_date = date(header.startDay.datetime.year,
+ header.startDay.datetime.month,
+ header.startDay.datetime.day)
+ if header_date == day:
+ return header
+
else:
- # just grab the current day
- day_header = self.wait_select_single(
- 'TimeLineHeaderComponent', isCurrentItem=True)
-
- if not(day_header):
raise CalendarException('Day Header not found for %s' % day)
- return day_header
+
+ @autopilot.logging.log_action(logger.info)
+ def get_daylabel(self, today):
+ current_day_header = self.get_day_header(today)
+ return current_day_header.wait_select_single(
+ 'Label', objectName='dayLabel')
+
+ @autopilot.logging.log_action(logger.info)
+ def get_datelabel(self, today):
+ current_day_header = self.get_day_header(today)
+ return current_day_header.wait_select_single(
+ 'Label', objectName='dateLabel')
class AgendaView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
=== modified file 'tests/autopilot/calendar_app/tests/test_dayview.py'
--- tests/autopilot/calendar_app/tests/test_dayview.py 2014-10-08 00:44:20 +0000
+++ tests/autopilot/calendar_app/tests/test_dayview.py 2015-03-21 16:19:29 +0000
@@ -19,6 +19,7 @@
"""
import datetime
+import calendar
# from __future__ import range
# (python3's range, is same as python2's xrange)
@@ -30,6 +31,7 @@
from testtools.matchers import Equals, NotEquals
from calendar_app.tests import CalendarAppTestCase
+from datetime import date
class TestDayView(CalendarAppTestCase):
@@ -38,15 +40,33 @@
super(TestDayView, self).setUp()
self.day_view = self.app.main_view.go_to_day_view()
- def test_current_month_and_year_is_selected(self):
- """By default, the day view shows the current month and year."""
+ 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)
+
+ self.assertEquals(day_view_currentDay_date, today)
expected_month_name_year = now.strftime("%B %Y")
- self.assertThat(self.app.main_view.get_month_year(self.day_view),
- Equals(expected_month_name_year))
+ self.assertEquals(
+ self.app.main_view.get_month_year(self.day_view),
+ expected_month_name_year)
+
+ 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))
def test_show_next_days(self):
"""It must be possible to show next days by swiping the view."""
Follow ups