Merge lp:~carla-sella/ubuntu-rssreader-app/tests-refactoring into lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk

Proposed by Carla Sella
Status: Superseded
Proposed branch: lp:~carla-sella/ubuntu-rssreader-app/tests-refactoring
Merge into: lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk
Diff against target: 173 lines (+47/-75)
2 files modified
tests/autopilot/shorts_app/emulators.py (+15/-3)
tests/autopilot/shorts_app/tests/test_rssreader.py (+32/-72)
To merge this branch: bzr merge lp:~carla-sella/ubuntu-rssreader-app/tests-refactoring
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Leo Arias Pending
Nicholas Skaggs Pending
Review via email: mp+213335@code.launchpad.net

This proposal has been superseded by a proposal from 2014-04-01.

Commit message

refactored tests

Description of the change

I have an issue on getting the current tab (currentTab = tabs.get_current_tab()) :
Running test test_view_mode gives me this error: http://paste.ubuntu.com/7062392/.
But with autopilot vis I can see there is a tab with index 1 : http://ubuntuone.com/5BNa2F1hYxrgHJVfcbNcaz http://ubuntuone.com/0ob4TJNKhp4NA6VHqsvJJZ.

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
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, rebase your branch to trunk, I think that should solve this issue. If not, we should file a bug.

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

I get one failure

Traceback (most recent call last):
  File "/home/nskaggs/projects/ubuntutouch/merges/tests-refactoring/tests/autopilot/shorts_app/tests/test_rssreader.py", line 239, in test_remove_feed_and_topic
    self._remove_feed(test_feed_title, test_topic)
  File "/home/nskaggs/projects/ubuntutouch/merges/tests-refactoring/tests/autopilot/shorts_app/tests/test_rssreader.py", line 127, in _remove_feed
    Eventually(Equals([])))
  File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 406, in assertThat
    raise mismatch_error
MismatchError: After 10.0 seconds test failed: !=:
reference = []
actual = [<autopilot.introspection.dbus.FeedComponent object at 0x7ff0c6785f50>]

Ran 5 tests in 92.746s
FAILED (failures=1)

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

This is potentially a bug.

$ shorts-app
file:///usr/share/shorts-app/shorts-app.qml:351 Type SavedTab unavailable
file:///usr/share/shorts-app/SavedTab.qml:20 ListModePage is not a type

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

For the shorts-app error launching it in terminal I reported bug 1300969.

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

Nicholas, I branched rssreader-app from trunk and put my tests back in but I am having the same exact problem: "ToolkitEmulatorException: There is no tab with index 1."
The test giving me touble is the test_view_mode one, I forgot to comment the @unittest.skip("Can't get tabs'") line (line 244).

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

Unmerged revisions

188. By Carla Sella

Commented tests with problems.

187. By Carla Sella

Other fixes for refactoring of existing tests.

186. By Carla Sella

Started refactoring tests.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/shorts_app/emulators.py'
2--- tests/autopilot/shorts_app/emulators.py 2014-03-04 01:30:51 +0000
3+++ tests/autopilot/shorts_app/emulators.py 2014-03-28 20:47:58 +0000
4@@ -204,15 +204,27 @@
5 def get_topic_tab(self, topic):
6 return self.wait_select_single("TopicTab", title=topic)
7
8+ @autopilot_logging.log_action(logger.info)
9+ def get_tab_ListModePage(self):
10+ """Get topic tab GridModePage page """
11+ logger.debug("get_tab_ListModePage: get_tabs")
12+ tabs = self.get_tabs()
13+ logger.debug("get_tab_ListModePage: get_current_tab")
14+ currentTab = tabs.get_current_tab()
15+ logger.debug("get_tab_ListModePage: tab.visible.wait_for True")
16+ currentTab.visible.wait_for(True)
17+ return currentTab.wait_select_single("ListModePage")
18+
19+ @autopilot_logging.log_action(logger.info)
20 def get_feed_in_feedlist(self, topic, feed):
21- itemList = self.get_feedlist(topic)
22+ itemList = self._get_feedlist(topic)
23 for item in itemList:
24 label = item.select_single("Label", objectName="labelFeedname")
25 if label.text == feed:
26 return item
27
28- def get_feedlist(self, topic):
29- #tab = self.get_topic_tab(topic)
30+ def _get_feedlist(self, topic):
31+ logger.debug("_get_feedlist: select feedlistitems")
32 items = self.select_many("UbuntuShape", objectName="feedlistitems")
33 return items
34
35
36=== modified file 'tests/autopilot/shorts_app/tests/test_rssreader.py'
37--- tests/autopilot/shorts_app/tests/test_rssreader.py 2014-03-04 04:12:32 +0000
38+++ tests/autopilot/shorts_app/tests/test_rssreader.py 2014-03-28 20:47:58 +0000
39@@ -241,60 +241,39 @@
40 #remove added topic
41 self._remove_topic(test_topic)
42
43- @unittest.skip("Tab switching fails")
44- def test_view_mode_and_feed_item(self):
45- """test view modes and ensure feed items can be opened"""
46- test_feed_url = 'http://www.canonical.com/rss.xml'
47- test_feed_title = 'Insights'
48- test_topic = 'Test topic'
49-
50- self.add_feed_to_new_topic(test_feed_url, test_feed_title, test_topic)
51-
52- #verify we are on the editTopic Tab
53- editTab = self.main_view.get_topic_tab(test_topic)
54- self.assertThat(lambda: editTab.visible, Eventually(Equals(True)))
55-
56- #open toolbar
57+ @unittest.skip("Can't get tabs'")
58+ def test_view_mode(self):
59+ """test view modes (list mode and grid mode)"""
60+
61 toolbar = self.main_view.open_toolbar()
62-
63- #click on refresh toolbar button
64 toolbar.click_button("rsspagerefreshbutton")
65-
66- #wait for any updates to finish before continuing tests
67 self._wait_for_refresh()
68-
69- #open toolbar
70 toolbar = self.main_view.open_toolbar()
71-
72- #click on list view toolbar button
73 toolbar.click_button("changemodebutton")
74
75- #TODO FIX WHY THIS WON'T SWITCH TO THE PROPER TAB
76- #switch to the feed
77- #header = self.main_view.get_header()
78- #header.switch_to_next_tab()
79- #self.main_view.get_header().switch_to_next_tab()
80- #feedTab = self.main_view.get_topic_tab(topicName)
81- #self.pointing_device.click_object(feedTab)
82- #self.assertThat(lambda: feedTab.visible, Eventually(Equals(True)))
83-
84- #select feed entry
85- self.assertThat(lambda: self.main_view.get_feedlist(test_topic),
86- Eventually(Not(Is(None))))
87- editFeed = self.main_view.get_feedlist(test_topic)
88-
89- for item in editFeed:
90- label = item.select_single("Label", objectName="labelFeedname")
91- logger.debug("editFeed: " + str(label.text))
92-
93- #click on the first entry in the list
94- self.pointing_device.click_object(editFeed[0])
95-
96- #verify we are on RSS feed page
97- rssfeedpage = lambda: self.main_view.get_rss_feed_page().visible
98+ shortsListModePage = self.main_view.get_tab_ListModePage()
99+ self.assertThat(shortsListModePage.visible, Eventually(Equals(True)))
100+
101+ @unittest.skip("Can't get tabs'")
102+ def test_feed_item_ListModePage(self):
103+ """"ensure feed items can be opened"""
104+
105+ test_feed_url = 'http://www.canonical.com/rss.xml'
106+ test_feed_title = 'Insights'
107+ test_topic = 'Test topic'
108+
109+ self.add_feed_to_new_topic(test_feed_url, test_feed_title, test_topic)
110+
111+ if self.main_view.get_tab_ListModePage().visible is False:
112+ toolbar = self.main_view.open_toolbar()
113+ toolbar.click_button("changemodebutton")
114+
115+ feed = self.main_view.get_feed_in_feedlist(test_topic, test_feed_title)
116+ self.pointing_device.click_object(feed)
117+
118+ rssfeedpage = self.main_view.get_rss_feed_page().visible
119 self.assertThat(rssfeedpage, Eventually(Equals(True)))
120
121- @unittest.skip("Can't see or get dynamic tabs")
122 def test_edit_topic(self):
123 """test edit topic"""
124 test_feed_url = 'http://www.canonical.com/rss.xml'
125@@ -303,41 +282,22 @@
126
127 self.add_feed_to_new_topic(test_feed_url, test_feed_title, test_topic)
128
129- #verify we are on the topicName Tab
130- editTab = self.main_view.get_topic_tab(test_topic)
131- self.assertThat(editTab.visible, Eventually(Equals(True)))
132-
133- #open toolbar
134 toolbar = self.main_view.open_toolbar()
135-
136- #click on edit topics button
137 toolbar.click_button("edittopicsbutton")
138
139- # verify we are on topic management page
140- topicmanagementpage = self.main_view.get_feed_management_page()
141- self.assertThat(
142- topicmanagementpage.objectName,
143- Eventually(Equals("topicmanagement")))
144-
145- #verity Tab is expanded
146- editTopic = self.main_view.get_feedlist_topic(test_topic)
147- if editTopic.state != "expended":
148- self.pointing_device.click_object(editTopic)
149-
150- #select feed
151- editFeed = self.main_view.get_feedlist_feed(test_topic)
152- self.assertThat(editFeed, NotEquals(None))
153- self.pointing_device.click_object(editFeed)
154-
155- #verify we are on edit feed page
156+ feedListTopic = self.main_view.get_feedlist_topic(test_topic)
157+ if feedListTopic.state != "expended":
158+ self.pointing_device.click_object(feedListTopic)
159+
160+ feedListFeed = self.main_view.get_feedlist_feed(test_feed_title)
161+ self.pointing_device.click_object(feedListFeed)
162+
163 editfeedpage = self.main_view.get_edit_feed_page()
164 self.assertThat(editfeedpage.visible, Eventually(Equals(True)))
165
166- #change topic from dropdown
167 topicValueselector = self.main_view.get_editfeed_topic_valueselector()
168 self.pointing_device.click_object(topicValueselector)
169
170- #click on news topic
171 topicValueselectorValue = self.main_view. \
172 get_editfeed_valueselector_value("Ubuntu")
173 self.pointing_device.click_object(topicValueselectorValue)

Subscribers

People subscribed via source and target branches