Merge lp:~ubuntu-calendar-dev/ubuntu-calendar-app/add-tests-for-future-and-past-events into lp:ubuntu-calendar-app

Proposed by Jason
Status: Work in progress
Proposed branch: lp:~ubuntu-calendar-dev/ubuntu-calendar-app/add-tests-for-future-and-past-events
Merge into: lp:ubuntu-calendar-app
Diff against target: 55 lines (+36/-3)
1 file modified
tests/autopilot/calendar_app/tests/test_new_event.py (+36/-3)
To merge this branch: bzr merge lp:~ubuntu-calendar-dev/ubuntu-calendar-app/add-tests-for-future-and-past-events
Reviewer Review Type Date Requested Status
Mihir Soni Needs Information
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Review via email: mp+232150@code.launchpad.net

Commit message

Add tests for creating past and future events.

Description of the change

The changes in this branch add two autopilot tests to test adding events on dates in the past, and events in the future. Each test follows the following pattern:

1) Go to the DayView
2) Go forward* a day.
3) Add an event and assert that the add succeeded.
4) Go backward* a day, and then return to the day containing the added event.
5) Assert that the added event is still present. (This is mainly just a sanity check)

*The description shown is for adding future events. For the test responsible for exercising past-events, replace each occurrence of "forward" with "backward" and each occurrence of "backward" with "forward".

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)
Revision history for this message
Jason (gerlowskija) wrote :

My guess is that this failure is unrelated to this change...mainly because this change only includes autopilot changes, and these changes only touch new tests (i.e. this change doesn't alter any helper functions/methods used by existing tests).

Revision history for this message
Jason (gerlowskija) wrote :

When I reproduce the failure locally, I see an additional error message that doesn't appear in the Jenkins logs: "Tips on minimizing the occurrence of this failureare available here: http://developer.ubuntu.com/api/devel/ubuntu-14.10/python/autopilot/faq/troubleshooting.html" This site covers common causes of autopilot-test flakiness.

Revision history for this message
Mihir Soni (mihirsoni) wrote :

Hi Thanks for the MR.

But as per discussion , we have to create multiple scenarios for the change date.

Like , year, day, and month as we have to test that thoroughly.

Scenario examples :

http://unity.ubuntu.com/autopilot/tutorial/good_tests.html#scenarios

Also , we need to change this as we changing UI , so it will be minor change as we are not testing recurrence and reminders

review: Needs Fixing
Revision history for this message
Jason (gerlowskija) wrote :

Ok, makes sense. I'll take a look at the examples you linked to.

My revised plan is to test adding events on:
1) a past/future day
2) a past/future week
3) a past/future month
4) a past/future year.

If this misses any cases that were suggested in the previous discussion you alluded to, please let me know.

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

Keep in mind using the datepicker requires https://code.launchpad.net/bugs/1328600 to be fixed. I've been trying to get an MP merged into autopilot for some time, but it's still hung up. Hopefully this will be merged very soon.

Revision history for this message
Mihir Soni (mihirsoni) wrote :

Json , any progress on this ?

review: Needs Information
Revision history for this message
Jason (gerlowskija) wrote :

Hey Mihir,

I haven't really started work on a new branch for this. My understanding was that it was blocked on the bug that nskaggs mentioned in his comment above (https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1328600). Looking at that, it looks to me like the this is still blocked, though maybe I'm misreading the 'status' of the bug.

Nicholas mentioned the blocker on 8/29/2014, and I don't see any other changes on the bug since then, so I think that this is still blocked. I'll talk to Nicholas at the start of next week and see if I can lend a hand in getting the blocker resolved.

Revision history for this message
Mihir Soni (mihirsoni) wrote :

Hi ,

Thanks for information. As per the bug description, it says it has problem with larger timestamp(to specific in year 2038). So to kick start we can start working on this and make sure we don't exceed that.

Once Nicholas is done with that fix , we can always do merge.

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

For now, I would develop using the workaround.

Inside the qml for datepickers, add a min and max:

maximum: {
var d = new Date()
d.setFullYear('2030')
return d
}
minimum: {
var d = new Date()
d.setFullYear('1990')
return d
}

Unmerged revisions

417. By Jason

Remove extra line to fix flake8 error.

416. By Jason

Add tests for creating events in the future and past.

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_new_event.py'
2--- tests/autopilot/calendar_app/tests/test_new_event.py 2014-08-23 02:31:49 +0000
3+++ tests/autopilot/calendar_app/tests/test_new_event.py 2014-08-26 01:08:48 +0000
4@@ -43,9 +43,8 @@
5 self.useFixture(contacts_backend)
6 super(NewEventTestCase, self).setUp()
7
8- # TODO add tests for events in the future and in the past, all day event,
9- # event with recurrence and event with reminders.
10- # also add tests for saving to different calendars
11+ # TODO add tests for all day event, event with recurrence and event.
12+ # with reminders. Also add tests for saving to different calendars.
13 # We currently can't change the date of the new event because of bug
14 # http://pad.lv/1328600 on Autopilot.
15 # --elopio - 2014-06-26
16@@ -90,6 +89,40 @@
17 return False
18 return True
19
20+ def test_add_new_future_event(self):
21+ day_view = self.main_view.go_to_day_view()
22+
23+ self.main_view.swipe_view(1, day_view)
24+
25+ initial_num_events = len(day_view.get_events())
26+ self._add_event()
27+ expected_num_events = initial_num_events + 1
28+
29+ # Leave the day, and return to check that the event
30+ # still exists on the future date
31+ self.main_view.swipe_view(-1, day_view)
32+ self.main_view.swipe_view(1, day_view)
33+
34+ self.assertThat(lambda: len(day_view.get_events()),
35+ Eventually(Equals(expected_num_events)))
36+
37+ def test_add_new_past_event(self):
38+ day_view = self.main_view.go_to_day_view()
39+
40+ self.main_view.swipe_view(-1, day_view)
41+
42+ initial_num_events = len(day_view.get_events())
43+ self._add_event()
44+ expected_num_events = initial_num_events + 1
45+
46+ # Leave the day, and return to check that the event
47+ # still exists on the future date
48+ self.main_view.swipe_view(1, day_view)
49+ self.main_view.swipe_view(-1, day_view)
50+
51+ self.assertThat(lambda: len(day_view.get_events()),
52+ Eventually(Equals(expected_num_events)))
53+
54 def test_add_new_event_with_default_values(self):
55 """Test adding a new event with the default values.
56

Subscribers

People subscribed via source and target branches

to status/vote changes: