Merge lp:~acerisara/ubuntu-calendar-app/failing-tests into lp:ubuntu-calendar-app

Proposed by Andrea Cerisara
Status: Merged
Merged at revision: 168
Proposed branch: lp:~acerisara/ubuntu-calendar-app/failing-tests
Merge into: lp:ubuntu-calendar-app
Diff against target: 113 lines (+44/-19)
2 files modified
tests/autopilot/calendar_app/tests/test_weekview.py (+2/-7)
tests/autopilot/calendar_app/tests/test_yearview.py (+42/-12)
To merge this branch: bzr merge lp:~acerisara/ubuntu-calendar-app/failing-tests
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Nicholas Skaggs (community) Needs Fixing
Review via email: mp+193706@code.launchpad.net

Commit message

Fixes failing autopilot tests.

Description of the change

Fixes failing autopilot tests:

1. test_weekview: simply old buggy code I forgot to change before sending the mp.
2. test_yearview: I need further investigation (at runtime we have just ten MonthComponent instances while we should have twelve), so I disabled the test for the time being.

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

Removed unused import.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Can you provide better reasoning for the @unit.skip? A bug report would be most useful, but otherwise something more than "too be fixed" :-)

review: Needs Fixing
Revision history for this message
Victor Thompson (vthompson) wrote :

It seems like all the MonthComponents aren't loaded into the GridView. It seems like a quick fix might be to get the test to scroll/flick to the bottom and then loop through the months array when the returned number of months is less than the datetime.now().month value.

167. By Andrea Cerisara

Fixes autopilot tests for the yearly view.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Andrea, if the month is before June everything works? Seems odd we only need to swipe if now.month > 6. I mean, if the month is before June, we we have to swipe down to get the months we need?

Revision history for this message
Andrea Cerisara (acerisara) wrote :

By default (when the view is open) we get the months till October, then we
have to swipe the page up to get the last two months. So to me, it could be
even more than June. If you have time please check this with the vis tool
so we could come up with a better implementation.

2013/11/5 Nicholas Skaggs <email address hidden>

> Andrea, if the month is before June everything works? Seems odd we only
> need to swipe if now.month > 6. I mean, if the month is before June, we we
> have to swipe down to get the months we need?
> --
>
> https://code.launchpad.net/~acerisara/ubuntu-calendar-app/failing-tests/+merge/193706
> You are the owner of lp:~acerisara/ubuntu-calendar-app/failing-tests.
>

--
** Think about the environment before printing

Revision history for this message
Andrea Cerisara (acerisara) wrote :

By default (when the view is open) we get months till October, then we have to swipe the page up to get the last two months. So to me, it could be even more than June. If you have time please check this with the vis tool so we could come up with a better implementation.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Time to take a look at this again now that ap 1.4 has landed :-)

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Ok, I think the logic for yearview is fine. However, this is currently failing for me on the desktop after I rebased with trunk. I'll try the phone in a second.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Mmm, indeed there are some issues with this, it's not getting the proper values.. For instance, get_days_of_week doesn't give the proper week dates for the view, and fails accordingly. Investigating why.

Revision history for this message
Nicholas Skaggs (nskaggs) :
review: Needs Fixing
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

FYI, I made the fix for the new event test in a different MP, so we can focus on the issues encountered by this one in this MP

https://code.launchpad.net/~nskaggs/ubuntu-calendar-app/fix-new-event-test/+merge/195421

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/calendar_app/tests/test_weekview.py'
2--- tests/autopilot/calendar_app/tests/test_weekview.py 2013-10-28 21:08:48 +0000
3+++ tests/autopilot/calendar_app/tests/test_weekview.py 2013-11-04 22:14:24 +0000
4@@ -9,7 +9,6 @@
5 Calendar app autopilot tests for the week view.
6 """
7
8-import calendar
9 import datetime
10
11 from autopilot.matchers import Eventually
12@@ -49,15 +48,11 @@
13
14 now = datetime.datetime.now()
15 days = self.get_days_of_week()
16- monday = (now - datetime.timedelta(days=now.weekday())).day
17- current_month_days = calendar.monthrange(now.year, now.month)[1]
18+ monday = (now - datetime.timedelta(days=now.weekday()))
19
20 for i in xrange(7):
21 current_day = int(days[i].text)
22- expected_day = (monday + i) % current_month_days
23-
24- if (monday + i) == current_month_days:
25- expected_day = current_month_days
26+ expected_day = (monday + datetime.timedelta(days=i)).day
27
28 self.assertThat(current_day, Equals(expected_day))
29
30
31=== modified file 'tests/autopilot/calendar_app/tests/test_yearview.py'
32--- tests/autopilot/calendar_app/tests/test_yearview.py 2013-10-28 21:08:48 +0000
33+++ tests/autopilot/calendar_app/tests/test_yearview.py 2013-11-04 22:14:24 +0000
34@@ -31,7 +31,10 @@
35 def test_selecting_a_month_switch_to_month_view(self):
36 """It must be possible to select a month and open the month view."""
37
38- months = self.months_from_selected_year()
39+ # TODO: the component indexed at 1 is the one currently displayed,
40+ # investigate a way to validate this assumption visually.
41+ year_grid = self.year_view.select_many("QQuickGridView")[1]
42+ months = year_grid.select_many("MonthComponent")
43 self.assert_current_year_is_default_one(months[0])
44
45 february = months[1]
46@@ -56,19 +59,22 @@
47 def test_current_day_is_selected(self):
48 """The current day must be selected."""
49
50- months = self.months_from_selected_year()
51- current_month = months[datetime.now().month - 1]
52+ current_month = self.current_month()
53 month_grid = current_month.select_single(objectName="monthGrid")
54
55- current_day_label = month_grid.select_single(
56+ # there could actually be two labels with
57+ # the current day: one is the current day of the current month,
58+ # the other one is the current day of the previous or next month. Both
59+ # shouldn't have the standard white color.
60+ current_day_labels = month_grid.select_many(
61 "Label", text=str(datetime.now().day))
62
63 # probably better to check the surrounding UbuntuShape object,
64 # upgrade when python-autopilot 1.4 will be available (get_parent).
65- color = current_day_label.color
66- label_color = (color[0], color[1], color[2], color[3])
67-
68- self.assertThat(label_color, NotEquals((255, 255, 255, 255)))
69+ for current_day_label in current_day_labels:
70+ color = current_day_label.color
71+ label_color = (color[0], color[1], color[2], color[3])
72+ self.assertThat(label_color, NotEquals((255, 255, 255, 255)))
73
74 def test_show_next_years(self):
75 """It must be possible to show next years by swiping the view."""
76@@ -93,9 +99,33 @@
77 self.assertThat(self.main_view.get_year(month_component),
78 Equals(datetime.now().year))
79
80- def months_from_selected_year(self):
81- # TODO: the component indexed at 1 is the one currently displayed,
82- # investigate a way to validate this assumption visually.
83+ def current_month(self):
84+ now = datetime.now()
85+ current_month_name = now.strftime("%B")
86+
87+ # for months after June, we must scroll down the page to have
88+ # the month components loaded in the view.
89+ if now.month > 6:
90+ self.drag_page_up()
91
92 year_grid = self.year_view.select_many("QQuickGridView")[1]
93- return year_grid.select_many("MonthComponent")
94+ months = year_grid.select_many("MonthComponent")
95+
96+ for month in months:
97+ current_month_label = month.select_single(
98+ "Label", objectName="monthLabel")
99+
100+ if current_month_name == current_month_label.text:
101+ return month
102+
103+ return None
104+
105+ def drag_page_up(self):
106+ x_line = (self.year_view.globalRect[0] +
107+ self.year_view.globalRect[2] / 2)
108+
109+ y_stop = self.year_view.globalRect[1]
110+ y_start = self.year_view.globalRect[3]
111+
112+ self.pointing_device.drag(x_line, y_start, x_line, y_stop)
113+ self.pointing_device.drag(x_line, y_start, x_line, y_stop)

Subscribers

People subscribed via source and target branches

to status/vote changes: