Merge lp:~carla-sella/reminders-app/download-list-of-notebooks-and-notes into lp:reminders-app

Proposed by Carla Sella
Status: Work in progress
Proposed branch: lp:~carla-sella/reminders-app/download-list-of-notebooks-and-notes
Merge into: lp:reminders-app
Prerequisite: lp:~elopio/reminders-app/evernote-sdk
Diff against target: 88 lines (+47/-1)
3 files modified
src/app/qml/ui/NotebooksPage.qml (+1/-1)
tests/autopilot/reminders/__init__.py (+34/-0)
tests/autopilot/reminders/tests/test_reminders.py (+12/-0)
To merge this branch: bzr merge lp:~carla-sella/reminders-app/download-list-of-notebooks-and-notes
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Leo Arias (community) code review Needs Fixing
Michael Zanetti Pending
Nicholas Skaggs Pending
Review via email: mp+219757@code.launchpad.net

This proposal supersedes a proposal from 2014-05-05.

Commit message

New refactored tests for reminders-app: test_download_list_of_notebooks and test_download_list_of_notes.

Description of the change

New refactored tests for reminders-app: test_download_list_of_notebooks and test_download_list_of_notes.

To post a comment you must log in.
Revision history for this message
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal

8 + objectName: "NotebookspageListview"

please keep the casing conventions e.g. "notebeeoksPageListView". Ideally you keep the objectName the same as the id. So "notebooksListView" in this case.

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

You'll be happy to note Leo's branch is solving the account issue, so I trust these tests will just work after it merges. https://code.launchpad.net/~elopio/reminders-app/test_with_account/+merge/217171

Revision history for this message
Carla Sella (carla-sella) wrote : Posted in a previous version of this proposal

Cool, can't wait!

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

Carla, Leo's branch has now merged. Check out and ensure there's not pep8 or pyflakes errors and rebase to trunk :-)

Revision history for this message
Leo Arias (elopio) wrote : Posted in a previous version of this proposal

51 +class Page(toolkit_emulators.MainView):

On QML the page doesn't extend the MainView, so on our helper it shouldn't either. This will make all of the methods of the main view available to the page, and many of them will fail.

+ def get_notebookpage(self):
35 + def get_notespage(self):
38 + def get_notestab_activityindicator(self):

On of the important parts of the page object is that we shouldn't expose the app internals to the tests. So any time you have a public method that returns an autopilot introspection object with select single("Something") it breaks that principle.

Instead, you should check what your test requires, and make a method for that. for example:

def get_number_of_notebooks()

But the biggest problem of this branch is that here we are not controlling the account so the test is not independent. To achive isolation on this test we need to add a notebook and a note to the evernote account, and then check that it is displayed on the application. For that, we need https://github.com/evernote/evernote-sdk-python
I've requested dpm to get somebody to package it and add it to Ubuntu.

review: Needs Fixing
Revision history for this message
Carla Sella (carla-sella) wrote : Posted in a previous version of this proposal

Ok so I will wait for you guys to package evernote-sdk-python and add it to Ubuntu.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote : Posted in a previous version of this proposal

Daniel packaged it, and it's in the core apps ppa. You should be able to move forward and depend on it.

Revision history for this message
Leo Arias (elopio) wrote : Posted in a previous version of this proposal

Carla, we can pair program on a hangout to get your branch merged with mine, and then use the sdk to add notes and notebooks. Ping me.

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 :

Rebuilding

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 :

Leo's branch has landed now, this should be possible to land. Also ensure you run pyflakes and pep8 on the branch so it will pass the jenkins checks.

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
Leo Arias (elopio) wrote :

22 + def get_notebookpage(self):
25 + def get_notespage(self):
28 + def get_notestab_activityindicator(self):

Following the page object pattern [1], these internals of the page should be private.

36 + def _check_activity_indicator(self):

You don't actually need this method. You can do self.app.main_view._get_activity_indicator().running.wait_for(False)

def goto_NotesTab(self)

Please rename to go_to_notes ^

notespage.get_notespageListview().count

please wrap this ^ in a method called get_number_of_notes or get_notes_count.

Thanks again Carla!

[1] http://developer.ubuntu.com/apps/platform/guides/acceptance-testing-using-the-page-object-model/

review: Needs Fixing (code review)
120. By Carla Sella

Merged trunk.

121. By Carla Sella

Fixed tests as Elopio asked.

122. By Carla Sella

Merged.

123. By Carla Sella

Cancel blank line in NotebooksPage.qml.

124. By Carla Sella

Canceled import ExpectedException.

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

Fixed error in test_download_list_of_notes.

126. By Carla Sella

Merged.

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

Tests fail : http://paste.ubuntu.com/7538726/.
Do not understand why.

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 :

Carla, whew traveling plus being sick I've not gotten around to looking what's up with this. Sorry about that. So, it appears jenkins gives some valid reasons for the test failures. Have a look.

As far as your failures, is the app launching? It seems like it's having trouble launching from what I can gleam from the log at least.

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

I cannot properly test the tests I wrote as reminders app launches, but the "no account dialog" does not close and the test fails.
I think it's an introspection error:

21:42:55.103 WARNING _object_registry:158 - Generating introspection instance for type 'b'Dialog'' based on generic class.
21:42:55.110 DEBUG utilities:47 - Possible backends: X11
21:42:58.266 ERROR proxies:410 - Introspect error on :1.116:/com/canonical/Autopilot/Introspection: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Message did not receive a reply (timeout by message bus)
21:42:58.266 DEBUG proxies:413 - Executing introspect queue due to error
21:42:58.267 DEBUG utilities:165 - 'GetState Query(b'/comubuntureminders/QQuickView/MainView/Dialog[id=5]')' took 1.282S
21:42:58.365 INFO _launcher:539 - waiting for process to exit.

The test fails on line 69, in setUp no_account_dialog.wait_until_destroyed() so I suppose the evernote account has been created, but it could also be that the creation of ervernote account fails.

127. By Carla Sella

Fixed minor errors.

Revision history for this message
Leo Arias (elopio) wrote :

Sorry Carla. I'm still on the sprint and I haven't checked in with you. The tests will fail if you have already an evernote account. We should link this with the home patching that balloons is pushing.
And just before my branch got merged, I was seeing strange errors, but couldn't take a deeper look. I hope next week will be easier to get a better look at this.

I see errors on the jenkins results like:
../../../../lib/SignOn/connection-manager.cpp 106 setupSocketConnection p2p error: QDBusError("org.freedesktop.DBus.Error.FileNotFound", "Failed to connect to socket /tmp/runtime-ubuntu/signond/socket: No such file or directory") 1

I don't remember seeing them before.

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 :

Hello elopio, I have deleted my evernote account from account settings.
Do not know if after removing it from account settings some configuration files might remain and cause this problem.

Revision history for this message
David Planella (dpm) wrote :

Nick, Leo, could you give a hand with this branch?

Unmerged revisions

127. By Carla Sella

Fixed minor errors.

126. By Carla Sella

Merged.

125. By Carla Sella

Fixed error in test_download_list_of_notes.

124. By Carla Sella

Canceled import ExpectedException.

123. By Carla Sella

Cancel blank line in NotebooksPage.qml.

122. By Carla Sella

Merged.

121. By Carla Sella

Fixed tests as Elopio asked.

120. By Carla Sella

Merged trunk.

119. By Carla Sella

Commit for checking errors.

118. By Carla Sella

Fixed tests to work with remindes testing account.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/qml/ui/NotebooksPage.qml'
2--- src/app/qml/ui/NotebooksPage.qml 2014-05-14 17:50:23 +0000
3+++ src/app/qml/ui/NotebooksPage.qml 2014-05-29 20:20:27 +0000
4@@ -148,7 +148,7 @@
5 visible: !notebooks.loading && notebooks.error
6 text: notebooks.error
7 }
8-
9+
10 }
11
12 Item {
13
14=== modified file 'tests/autopilot/reminders/__init__.py'
15--- tests/autopilot/reminders/__init__.py 2014-05-23 12:28:04 +0000
16+++ tests/autopilot/reminders/__init__.py 2014-05-29 20:20:27 +0000
17@@ -74,6 +74,21 @@
18 else:
19 return self._no_account_dialog
20
21+ def _get_notebookpage(self):
22+ return self.wait_select_single("NotebooksPage")
23+
24+ def _get_notespage(self):
25+ return self.wait_select_single("NotesPage")
26+
27+ def _get_notestab_activityindicator(self):
28+ return self.wait_select_single(
29+ "ActivityIndicator", objectName="notesTabActivityIndicator")
30+
31+ def goto_notes(self):
32+ self.main_view.switch_to_tab("NotesTab")
33+ self.app.main_view._get_notestab_activityindicator().\
34+ running.wait_for(False)
35+
36
37 class NoAccountDialog(toolkit_emulators.UbuntuUIToolkitEmulatorBase):
38 """Autopilot custom proxy object for the no account dialog."""
39@@ -161,6 +176,11 @@
40 ]
41 return notebooks
42
43+ def _get_number_of_notebooks(self):
44+ """Return the number of notebooks """
45+ notebookpage = self.app.main_view._get_notebookpage()
46+ notebookpage._get_notebookspageListview().count
47+
48
49 class NotebooksDelegate(toolkit_emulators.UbuntuUIToolkitEmulatorBase):
50 """Autopilot custom proxy object for the NotebooksDelegate."""
51@@ -185,3 +205,17 @@
52 """Return the number of notes in the Notebook."""
53 # The count is returned in paretheses, so we strip them.
54 return int(self._get_label_text('notebookNoteCountLabel').strip('()'))
55+
56+
57+class NotesPage(_Page):
58+ """Autopilot helper for the Notes page."""
59+
60+ def _get_notespageListview(self):
61+ """Get note page list view """
62+ return self.wait_select_single(
63+ "QQuickListView", objectName="notespageListview")
64+
65+ def _get_number_of_notes(self):
66+ """Return the number of notes """
67+ notespage = self.app.main_view._get_notespage()
68+ notespage._get_notespageListview().count
69
70=== modified file 'tests/autopilot/reminders/tests/test_reminders.py'
71--- tests/autopilot/reminders/tests/test_reminders.py 2014-05-15 07:02:41 +0000
72+++ tests/autopilot/reminders/tests/test_reminders.py 2014-05-29 20:20:27 +0000
73@@ -113,3 +113,15 @@
74
75 # An exception will be raised if the notebook is note found.
76 self.evernote_client.get_notebook_by_name(test_notebook_title)
77+
78+ def test_download_list_of_notebooks(self):
79+ """test to check whether downloading a list of Notebooks from
80+ Evernote is successful or not """
81+ self.app.main_view.switch_to_tab("NotebookTab")
82+ self.assertGreater(notebooks_page._get_number_of_notebooks(), 0)
83+
84+ def test_download_list_of_notes(self):
85+ """test to check whether downloading a list of Notes from Evernote is
86+ successful or not """
87+ self.app.goto_notes()
88+ self.assertGreater(self.app.NotebooksPage._get_number_of_notes(), 0)

Subscribers

People subscribed via source and target branches