Merge lp://qastaging/~carla-sella/ubuntu-calendar-app/dayview-test-default-view into lp://qastaging/ubuntu-calendar-app

Proposed by Carla Sella
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 610
Merged at revision: 624
Proposed branch: lp://qastaging/~carla-sella/ubuntu-calendar-app/dayview-test-default-view
Merge into: lp://qastaging/ubuntu-calendar-app
Diff against target: 216 lines (+120/-17)
3 files modified
HeaderDateComponent.qml (+1/-0)
tests/autopilot/calendar_app/__init__.py (+72/-13)
tests/autopilot/calendar_app/tests/test_dayview.py (+47/-4)
To merge this branch: bzr merge lp://qastaging/~carla-sella/ubuntu-calendar-app/dayview-test-default-view
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Nicholas Skaggs Pending
Review via email: mp+253760@code.qastaging.launchpad.net

Commit message

Autopilot test for Calendar app

Description of the change

Dayview: test default view.

To post a comment you must log in.
Revision history for this message
Carla Sella (carla-sella) wrote :

Still need to verify that the day should be scrolled to the current time.

Revision history for this message
Carla Sella (carla-sella) wrote :

Should be ok now.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
608. By Carla Sella

Fixed identation errror.

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
Carla Sella (carla-sella) wrote :

Reported bug #1435542 as in Italy Sunday is the first day of the week and yesterday, 22nd March the week number was 12 and not 11, so this test failed, but should not have:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/calendar_app/tests/test_dayview.py", line 77, in test_default_view
    self.day_view.get_weeknumer(today).text, 'W' + now.strftime("%U"))
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 338, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 423, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: 'W11' != 'W12'

Revision history for this message
Carla Sella (carla-sella) wrote :

I found out why the test is failing only on Sundays.
If you look at the screenshot:

https://dl.dropboxusercontent.com/u/10083981/Ubuntu%20phone/Calendar.png

You can see how the days in Calendar app are displayed, Sunday is together with Saturday and Friday on the same page where there is the W13 week number label, but friday and saturday are W13 while sunday is W14.
That means that, for instance sunday 5 april is displayed on W13 but is
W14 instead.
So the test fails if you are testing on sunday 5 april because I am checking day label and day of week label are correct, the label is correct for two day but not for the third only in pages displaying Friday, Saturday and Sunday together.

So the question is: what should I do if the day I am testing on is a Sunday, this test will always fail on Sundays as Sundays are already on a next week number-

I can verify that if the day I am testing on is a Sunday I have to subtact 1 to week number, but not sure this is what you want me to do.

Carla

609. By Carla Sella

Added test_today_button.

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
Kunal Parmar (pkunal-parmar) wrote :

> I found out why the test is failing only on Sundays.
> If you look at the screenshot:
>
> https://dl.dropboxusercontent.com/u/10083981/Ubuntu%20phone/Calendar.png
>
> You can see how the days in Calendar app are displayed, Sunday is together
> with Saturday and Friday on the same page where there is the W13 week number
> label, but friday and saturday are W13 while sunday is W14.
> That means that, for instance sunday 5 april is displayed on W13 but is
> W14 instead.
> So the test fails if you are testing on sunday 5 april because I am checking
> day label and day of week label are correct, the label is correct for two day
> but not for the third only in pages displaying Friday, Saturday and Sunday
> together.
>
> So the question is: what should I do if the day I am testing on is a Sunday,
> this test will always fail on Sundays as Sundays are already on a next week
> number-
>
> I can verify that if the day I am testing on is a Sunday I have to subtact 1
> to week number, but not sure this is what you want me to do.
>
> Carla

Hello Carla,

There seem some issue with logic how we calculate week numer from date.

Date.prototype.weekNumber = function() {
    var date = this.weekStart(1).addDays(3) // Thursday midnight

This is function used, in dateext.js, and looks like week's start day here is hard coded.
I gave you a branch where I resolved this issue, that patch calculate week number by taking in account what is week start day.

Please check with that branch as well.

Revision history for this message
Carla Sella (carla-sella) wrote :

Hello Kunal,
I merged your branch into mine. It works if I run this test on a Sunday (for instance Sun 5th April), but fails if I run it on the 31st of March for instance, I get this errror:

Traceback (most recent call last):
  File "/home/letozaf/autopilot-tests/dayview-test-default-view/tests/autopilot/calendar_app/tests/test_dayview.py", line 77, in test_default_view
    self.day_view.get_weeknumer(today).text, 'W' + now.strftime("%U"))
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 338, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 423, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: 'W14' != 'W13'

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

> Hello Kunal,
> I merged your branch into mine. It works if I run this test on a Sunday (for
> instance Sun 5th April), but fails if I run it on the 31st of March for
> instance, I get this errror:
>
> Traceback (most recent call last):
> File "/home/letozaf/autopilot-tests/dayview-test-default-
> view/tests/autopilot/calendar_app/tests/test_dayview.py", line 77, in
> test_default_view
> self.day_view.get_weeknumer(today).text, 'W' + now.strftime("%U"))
> File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 338, in
> assertEqual
> self.assertThat(observed, matcher, message)
> File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 423, in
> assertThat
> raise mismatch_error
> testtools.matchers._impl.MismatchError: 'W14' != 'W13'

Hello Carla,

I read python strftime doc. As per it, week start from 00 and end at 53. As per our implementation it start from 1 and end at 54.

Also we need to check what is locale set as per that we should use %U or %W.
I referred this link https://docs.python.org/2/library/time.html

610. By Carla Sella

Fixed cheching week number.

Revision history for this message
Carla Sella (carla-sella) wrote :

To me looks like using %W instead of %U fixes the issue, but I am not sure. Maybe someone can double check ?

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 :

%W can work, so long as we assume a Monday as first day of the week locale.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: