Merge lp:~carla-sella/ubuntu-rssreader-app/fix-test_view_feeds into lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk

Proposed by Carla Sella
Status: Merged
Merged at revision: 141
Proposed branch: lp:~carla-sella/ubuntu-rssreader-app/fix-test_view_feeds
Merge into: lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk
Diff against target: 190 lines (+41/-24)
2 files modified
tests/autopilot/ubuntu_rssreader_app/emulators.py (+6/-6)
tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py (+35/-18)
To merge this branch: bzr merge lp:~carla-sella/ubuntu-rssreader-app/fix-test_view_feeds
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Ubuntu Shorts Developers Pending
Review via email: mp+194754@code.launchpad.net

Commit message

autopilot test for ubuntu-rssreader-app

Description of the change

Fixed test_view_feeds.
Tested also on my device and it works.

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)
151. By Carla Sella <email address hidden>

Fixed all ubuntu-rssreade-app tests on desktop.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntu_rssreader_app/emulators.py'
2--- tests/autopilot/ubuntu_rssreader_app/emulators.py 2013-11-05 02:57:36 +0000
3+++ tests/autopilot/ubuntu_rssreader_app/emulators.py 2013-11-11 21:38:17 +0000
4@@ -38,7 +38,7 @@
5 return self.select_many("ActionSelectionPopover")[0]
6
7 def get_network_activity(self):
8- return self.select_single("ActivityIndicator", running="True")
9+ return self.wait.select_single("ActivityIndicator", running="True")
10
11 #### choose topics page objects
12
13@@ -64,7 +64,7 @@
14 return self.wait_select_single("TopicComponent", topicName=name)
15
16 def get_feedlist_feed(self, feed):
17- return self.select_single("FeedComponent", text=feed)
18+ return self.wait_select_single("FeedComponent", text=feed)
19
20 def get_add_a_topic(self):
21 return self.select_single("QQuickItem", objectName="addTopic")
22@@ -105,6 +105,10 @@
23 return self.wait_select_single(
24 "RssFeedPage", objectName="rssfeedpage")
25
26+ def get_shorts_tab(self):
27+ return self.wait_select_single(
28+ "ShortsTab", objectName="Tab0")
29+
30 def get_topics(self):
31 return self.select_single("QQuickListView", objectName="topiclist")
32
33@@ -143,10 +147,6 @@
34 def get_editfeed_done_button(self):
35 return self.wait_select_single("Button", objectName="doneButton")
36
37- def get_activityIndicator(self):
38- return self.wait_select_single(
39- "ActivityIndicator", objectName="activityindicator")
40-
41 def get_topic_tab(self, topic):
42 return self.wait_select_single("TopicTab", title=topic)
43
44
45=== modified file 'tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py'
46--- tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 2013-11-05 23:54:44 +0000
47+++ tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 2013-11-11 21:38:17 +0000
48@@ -28,7 +28,7 @@
49
50 #wait for any updates to finish before beginning tests
51 try:
52- self.main_view.get_activityIndicator().running.wait_for(False)
53+ self.main_view.get_network_activity().running.wait_for(False)
54 except:
55 self.assertThat(
56 self.main_view.get_topics_page, Eventually(NotEquals(None)))
57@@ -39,7 +39,6 @@
58
59 self.assertThat(self.main_view.get_topics_page,
60 Eventually(NotEquals(None)))
61-
62 #open toolbar
63 logger.debug("opening toolbar")
64 toolbar = self.main_view.open_toolbar()
65@@ -114,16 +113,13 @@
66 feedlistpage = self.main_view.get_feed_management_page()
67 self.assertThat(feedlistpage.visible, Eventually(Equals(True)))
68
69- #select topic
70- logger.debug("grabbing topic")
71- self._get_topic(topicName)
72-
73 ##select feed
74 logger.debug("assert feed")
75- self.assertThat(lambda: self.main_view.get_feedlist_feed(feedName),
76- Eventually(Not(Is(None))))
77+ self.assertThat(self.main_view.get_feedlist_feed(feedName).text,
78+ Equals(feedName))
79 logger.debug("grabbing feed")
80 feed = self.main_view.get_feedlist_feed(feedName)
81+ feedLabel = feed.select_single('Label', text = feedName)
82
83 self.assertThat(self.main_view.get_feed_management_page,
84 Eventually(NotEquals(None)))
85@@ -131,7 +127,7 @@
86 #swipe to delete feed
87 startX = int(feedlistpage.x + feedlistpage.width * 0.30)
88 stopX = int(feedlistpage.x + feedlistpage.width)
89- lineY = feed.globalRect[1]
90+ lineY = int(feedLabel.globalRect[1])
91
92 #swipe to remove the feed
93 self.pointing_device.move(startX, lineY)
94@@ -183,6 +179,7 @@
95
96 #select topic
97 topic = self._get_topic(topicName)
98+ topicLabel = topic.select_single("Label", text=topicName)
99
100 topicmanagementpage = self.main_view.get_feed_management_page()
101 self.assertThat(self.main_view.get_feed_management_page,
102@@ -191,7 +188,7 @@
103 #swipe to delete topic
104 startX = int(topicmanagementpage.x + topicmanagementpage.width * 0.30)
105 stopX = int(topicmanagementpage.x + topicmanagementpage.width)
106- lineY = topic.globalRect[1]
107+ lineY = topicLabel.globalRect[1]
108
109 #swipe to remove the topic
110 self.pointing_device.move(startX, lineY)
111@@ -207,9 +204,13 @@
112 self.assertThat(self.main_view.get_feed_management_page().objectName,
113 Eventually(Equals("topicmanagement")))
114
115- #check that it is gone
116- topic = self.main_view.get_feedlist_topic(topicName)
117- self.assertThat(topic, NotEquals(topicName))
118+ #check topic has been removed
119+ logger.debug("assert removed topic")
120+ try:
121+ self.assertThat(self._get_topic(topicName), Eventually(Equals(None)))
122+ except:
123+ print('Topic removed.')
124+
125
126 def _input_new_feed(self, rssFeed):
127 inputField = self.main_view.get_append_feed_input_box()
128@@ -236,7 +237,7 @@
129 def _get_topic(self, topicName, timeout=10):
130 logger.debug("_get_topic: assert topics")
131 self.assertThat(lambda: self.main_view.get_feedlist_topic(topicName),
132- Eventually(Not(Is(None))))
133+ Eventually(Not(Is([]))))
134 logger.debug("_get_topic: grab topic")
135 topic = self.main_view.get_feedlist_topic(topicName)
136 logger.debug("_get_topic: click topic")
137@@ -258,6 +259,15 @@
138 feedName = "Canonical"
139 topicName = "CanonicalTopic"
140
141+ #just for timing issues
142+ self.assertThat(self.main_view.get_shorts_tab(),
143+ NotEquals(None))
144+ self.assertThat(self.main_view.get_shorts_tab().objectName,
145+ Eventually(Equals("Tab0")))
146+ self.assertThat(self.main_view.get_shorts_tab().visible,
147+ Eventually(Equals(True)))
148+
149+ #add feed and topic
150 self._add_feed_and_topic(feed, topicName)
151
152 #remove added feed
153@@ -275,6 +285,14 @@
154 feedName = "Canonical"
155 topicName = "CanonicalTopic"
156
157+ #just for timing issues
158+ self.assertThat(self.main_view.get_shorts_tab(),
159+ NotEquals(None))
160+ self.assertThat(self.main_view.get_shorts_tab().objectName,
161+ Eventually(Equals("Tab0")))
162+ self.assertThat(self.main_view.get_shorts_tab().visible,
163+ Eventually(Equals(True)))
164+
165 #add topic and feed
166 self._add_feed_and_topic(feed, topicName)
167
168@@ -290,11 +308,10 @@
169
170 #wait for any updates to finish before continuing tests
171 try:
172- self.main_view.get_activityIndicator().running.wait_for(False)
173+ self.main_view.get_network_activity().running.wait_for(False)
174 except:
175 self.assertThat(
176- lambda: self.main_view.get_topic_tab(topicName),
177- Eventually(NotEquals(None)))
178+ self.main_view.get_topic_tab(topicName), Not(Is([])))
179
180 #open toolbar
181 toolbar = self.main_view.open_toolbar()
182@@ -308,7 +325,7 @@
183
184 #select feed
185 editFeed = self.main_view.get_feed_in_feedlist(topicName, feedName)
186- self.assertThat(editFeed, NotEquals(None))
187+ self.assertThat(editFeed, Not(Is([])))
188 self.pointing_device.click_object(editFeed)
189
190 #verify we are on RSS feed page

Subscribers

People subscribed via source and target branches