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
=== modified file 'tests/autopilot/calendar_app/tests/test_weekview.py'
--- tests/autopilot/calendar_app/tests/test_weekview.py 2013-10-28 21:08:48 +0000
+++ tests/autopilot/calendar_app/tests/test_weekview.py 2013-11-04 22:14:24 +0000
@@ -9,7 +9,6 @@
9Calendar app autopilot tests for the week view.9Calendar app autopilot tests for the week view.
10"""10"""
1111
12import calendar
13import datetime12import datetime
1413
15from autopilot.matchers import Eventually14from autopilot.matchers import Eventually
@@ -49,15 +48,11 @@
4948
50 now = datetime.datetime.now()49 now = datetime.datetime.now()
51 days = self.get_days_of_week()50 days = self.get_days_of_week()
52 monday = (now - datetime.timedelta(days=now.weekday())).day51 monday = (now - datetime.timedelta(days=now.weekday()))
53 current_month_days = calendar.monthrange(now.year, now.month)[1]
5452
55 for i in xrange(7):53 for i in xrange(7):
56 current_day = int(days[i].text)54 current_day = int(days[i].text)
57 expected_day = (monday + i) % current_month_days55 expected_day = (monday + datetime.timedelta(days=i)).day
58
59 if (monday + i) == current_month_days:
60 expected_day = current_month_days
6156
62 self.assertThat(current_day, Equals(expected_day))57 self.assertThat(current_day, Equals(expected_day))
6358
6459
=== modified file 'tests/autopilot/calendar_app/tests/test_yearview.py'
--- tests/autopilot/calendar_app/tests/test_yearview.py 2013-10-28 21:08:48 +0000
+++ tests/autopilot/calendar_app/tests/test_yearview.py 2013-11-04 22:14:24 +0000
@@ -31,7 +31,10 @@
31 def test_selecting_a_month_switch_to_month_view(self):31 def test_selecting_a_month_switch_to_month_view(self):
32 """It must be possible to select a month and open the month view."""32 """It must be possible to select a month and open the month view."""
3333
34 months = self.months_from_selected_year()34 # TODO: the component indexed at 1 is the one currently displayed,
35 # investigate a way to validate this assumption visually.
36 year_grid = self.year_view.select_many("QQuickGridView")[1]
37 months = year_grid.select_many("MonthComponent")
35 self.assert_current_year_is_default_one(months[0])38 self.assert_current_year_is_default_one(months[0])
3639
37 february = months[1]40 february = months[1]
@@ -56,19 +59,22 @@
56 def test_current_day_is_selected(self):59 def test_current_day_is_selected(self):
57 """The current day must be selected."""60 """The current day must be selected."""
5861
59 months = self.months_from_selected_year()62 current_month = self.current_month()
60 current_month = months[datetime.now().month - 1]
61 month_grid = current_month.select_single(objectName="monthGrid")63 month_grid = current_month.select_single(objectName="monthGrid")
6264
63 current_day_label = month_grid.select_single(65 # there could actually be two labels with
66 # the current day: one is the current day of the current month,
67 # the other one is the current day of the previous or next month. Both
68 # shouldn't have the standard white color.
69 current_day_labels = month_grid.select_many(
64 "Label", text=str(datetime.now().day))70 "Label", text=str(datetime.now().day))
6571
66 # probably better to check the surrounding UbuntuShape object,72 # probably better to check the surrounding UbuntuShape object,
67 # upgrade when python-autopilot 1.4 will be available (get_parent).73 # upgrade when python-autopilot 1.4 will be available (get_parent).
68 color = current_day_label.color74 for current_day_label in current_day_labels:
69 label_color = (color[0], color[1], color[2], color[3])75 color = current_day_label.color
7076 label_color = (color[0], color[1], color[2], color[3])
71 self.assertThat(label_color, NotEquals((255, 255, 255, 255)))77 self.assertThat(label_color, NotEquals((255, 255, 255, 255)))
7278
73 def test_show_next_years(self):79 def test_show_next_years(self):
74 """It must be possible to show next years by swiping the view."""80 """It must be possible to show next years by swiping the view."""
@@ -93,9 +99,33 @@
93 self.assertThat(self.main_view.get_year(month_component),99 self.assertThat(self.main_view.get_year(month_component),
94 Equals(datetime.now().year))100 Equals(datetime.now().year))
95101
96 def months_from_selected_year(self):102 def current_month(self):
97 # TODO: the component indexed at 1 is the one currently displayed,103 now = datetime.now()
98 # investigate a way to validate this assumption visually.104 current_month_name = now.strftime("%B")
105
106 # for months after June, we must scroll down the page to have
107 # the month components loaded in the view.
108 if now.month > 6:
109 self.drag_page_up()
99110
100 year_grid = self.year_view.select_many("QQuickGridView")[1]111 year_grid = self.year_view.select_many("QQuickGridView")[1]
101 return year_grid.select_many("MonthComponent")112 months = year_grid.select_many("MonthComponent")
113
114 for month in months:
115 current_month_label = month.select_single(
116 "Label", objectName="monthLabel")
117
118 if current_month_name == current_month_label.text:
119 return month
120
121 return None
122
123 def drag_page_up(self):
124 x_line = (self.year_view.globalRect[0] +
125 self.year_view.globalRect[2] / 2)
126
127 y_stop = self.year_view.globalRect[1]
128 y_start = self.year_view.globalRect[3]
129
130 self.pointing_device.drag(x_line, y_start, x_line, y_stop)
131 self.pointing_device.drag(x_line, y_start, x_line, y_stop)

Subscribers

People subscribed via source and target branches

to status/vote changes: