Merge lp:~elopio/ubuntu-rssreader-app/autopilot-1.4 into lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk

Proposed by Leo Arias
Status: Superseded
Proposed branch: lp:~elopio/ubuntu-rssreader-app/autopilot-1.4
Merge into: lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk
Diff against target: 185 lines (+27/-45)
4 files modified
listview/ListModePage.qml (+1/-0)
tests/autopilot/ubuntu_rssreader_app/emulators.py (+12/-36)
tests/autopilot/ubuntu_rssreader_app/tests/__init__.py (+7/-3)
tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py (+7/-6)
To merge this branch: bzr merge lp:~elopio/ubuntu-rssreader-app/autopilot-1.4
Reviewer Review Type Date Requested Status
Chris Gagnon (community) Needs Fixing
Thomi Richards (community) Approve
Ubuntu Shorts Developers Pending
Review via email: mp+193355@code.launchpad.net

This proposal has been superseded by a proposal from 2013-11-05.

Commit message

Update tests for autopilot 1.4

Description of the change

Tests are failing because of bug https://bugs.launchpad.net/ubuntu-rssreader-app/+bug/1246501
They fail with autopilot 1.3 and 1.4.

To post a comment you must log in.
Revision history for this message
Joey Chan (qqworini) wrote :

So... do I need to fix bug #1246501 first or approve this first ?

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

First fix the bug, please. This branch can't land until the Jenkins runners are using autopilot 1.4.

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

LGTM. Do not approve until AP 1.4 lands.

review: Approve
131. By Leo Arias

Merged with trunk.

132. By Leo Arias

Use the qmlscene launch command from the toolkit.

133. By Leo Arias

Merged with precondition branch.

Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

161 + self.assertThat(
162 + self.main_view.get_feedlist_topic(topicName), Not(Is(None)))

This will never return none, a dbus.StateNotFound error will be raised first.

review: Needs Fixing
134. By Leo Arias

The method will never return None.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'listview/ListModePage.qml'
--- listview/ListModePage.qml 2013-10-30 20:05:10 +0000
+++ listview/ListModePage.qml 2013-11-05 03:02:07 +0000
@@ -149,6 +149,7 @@
149149
150 Label {150 Label {
151 id: labelFeedname151 id: labelFeedname
152 objectName: "labelFeedname"
152153
153 text: model.feed_name154 text: model.feed_name
154 fontSize: "x-small"155 fontSize: "x-small"
155156
=== modified file 'tests/autopilot/ubuntu_rssreader_app/emulators.py'
--- tests/autopilot/ubuntu_rssreader_app/emulators.py 2013-10-10 16:52:39 +0000
+++ tests/autopilot/ubuntu_rssreader_app/emulators.py 2013-11-05 03:02:07 +0000
@@ -33,30 +33,6 @@
33 requested = action33 requested = action
34 self.pointing_device.click_object(requested)34 self.pointing_device.click_object(requested)
3535
36 def select_single_retry(self, object_type, **kwargs):
37 """Returns the item that is searched for with app.select_single
38 In case of the item was not found (not created yet) a second attempt is
39 taken 1 second later."""
40 item = self.select_single(object_type, **kwargs)
41 tries = 10
42 while item is None and tries > 0:
43 sleep(self.retry_delay)
44 item = self.select_single(object_type, **kwargs)
45 tries = tries - 1
46 return item
47
48 def select_many_retry(self, object_type, **kwargs):
49 """Returns the item that is searched for with app.select_many
50 In case of no item was not found (not created yet) a second attempt is
51 taken 1 second later"""
52 items = self.select_many(object_type, **kwargs)
53 tries = 10
54 while len(items) < 1 and tries > 0:
55 sleep(self.retry_delay)
56 items = self.select_many(object_type, **kwargs)
57 tries = tries - 1
58 return items
59
60 def get_action_popover(self):36 def get_action_popover(self):
61 # Returns all instances, but with current one as first index37 # Returns all instances, but with current one as first index
62 return self.select_many("ActionSelectionPopover")[0]38 return self.select_many("ActionSelectionPopover")[0]
@@ -85,7 +61,7 @@
8561
86 #### feed list page objects62 #### feed list page objects
87 def get_feedlist_topic(self, name):63 def get_feedlist_topic(self, name):
88 return self.select_single_retry("TopicComponent", topicName=name)64 return self.wait_select_single("TopicComponent", topicName=name)
8965
90 def get_feedlist_feed(self, feed):66 def get_feedlist_feed(self, feed):
91 return self.select_single("FeedComponent", text=feed)67 return self.select_single("FeedComponent", text=feed)
@@ -107,7 +83,7 @@
107 objectName="choosetopicpage")83 objectName="choosetopicpage")
10884
109 def get_feedlist_page(self):85 def get_feedlist_page(self):
110 return self.select_single_retry("FeedListPage",86 return self.wait_select_single("FeedListPage",
111 objectName="feedlistpage")87 objectName="feedlistpage")
11288
113 def get_articlelist_page(self):89 def get_articlelist_page(self):
@@ -115,7 +91,7 @@
115 objectName="articlelistpage")91 objectName="articlelistpage")
11692
117 def get_feed_management_page(self):93 def get_feed_management_page(self):
118 return self.select_single_retry("TopicManagement",94 return self.wait_select_single("TopicManagement",
119 objectName="topicmanagement")95 objectName="topicmanagement")
12096
121 def get_edit_feed_page(self):97 def get_edit_feed_page(self):
@@ -126,7 +102,7 @@
126 return self.select_single("ManageTopicsPage")102 return self.select_single("ManageTopicsPage")
127103
128 def get_rss_feed_page(self):104 def get_rss_feed_page(self):
129 return self.select_single_retry(105 return self.wait_select_single(
130 "RssFeedPage", objectName="rssfeedpage")106 "RssFeedPage", objectName="rssfeedpage")
131107
132 def get_topics(self):108 def get_topics(self):
@@ -165,25 +141,25 @@
165 return self.select_single("ActionItem", text="Back")141 return self.select_single("ActionItem", text="Back")
166142
167 def get_editfeed_done_button(self):143 def get_editfeed_done_button(self):
168 return self.select_single_retry("Button", objectName="doneButton")144 return self.wait_select_single("Button", objectName="doneButton")
169145
170 def get_activityIndicator(self):146 def get_activityIndicator(self):
171 return self.select_single_retry(147 return self.wait_select_single(
172 "ActivityIndicator", objectName="activityindicator")148 "ActivityIndicator", objectName="activityindicator")
173149
174 def get_topic_tab(self, topic):150 def get_topic_tab(self, topic):
175 return self.select_single_retry("TopicTab", title=topic)151 return self.wait_select_single("TopicTab", title=topic)
176152
177 def get_feed_in_feedlist(self, topic, feed):153 def get_feed_in_feedlist(self, topic, feed):
178 tab = self.get_topic_tab(topic)154 tab = self.get_topic_tab(topic)
179 itemList = tab.select_many("Subtitled", objectName="feedlistitems")155 itemList = tab.select_many("UbuntuShape", objectName="feedlistitems")
180 for item in itemList:156 for item in itemList:
181 splititem = item.subText.split(",")157 label = item.select_single("Label", objectName="labelFeedname")
182 if splititem[1] == " " + feed:158 if label.text == feed:
183 return item159 return item
184160
185 def get_editfeed_topic_valueselector(self):161 def get_editfeed_topic_valueselector(self):
186 return self.select_single_retry(162 return self.wait_select_single(
187 "ValueSelector", objectName="valueselector")163 "ValueSelector", objectName="valueselector")
188164
189 def get_editfeed_valueselector_value(self, name):165 def get_editfeed_valueselector_value(self, name):
190166
=== modified file 'tests/autopilot/ubuntu_rssreader_app/tests/__init__.py'
--- tests/autopilot/ubuntu_rssreader_app/tests/__init__.py 2013-10-07 12:49:31 +0000
+++ tests/autopilot/ubuntu_rssreader_app/tests/__init__.py 2013-11-05 03:02:07 +0000
@@ -28,7 +28,11 @@
28from autopilot.platform import model28from autopilot.platform import model
29from autopilot.testcase import AutopilotTestCase29from autopilot.testcase import AutopilotTestCase
3030
31from ubuntuuitoolkit import emulators as toolkit_emulators31from ubuntuuitoolkit import (
32 base,
33 emulators as toolkit_emulators
34)
35
32from ubuntu_rssreader_app import emulators36from ubuntu_rssreader_app import emulators
3337
34logger = logging.getLogger(__name__)38logger = logging.getLogger(__name__)
@@ -74,14 +78,14 @@
7478
75 def launch_test_local(self):79 def launch_test_local(self):
76 self.app = self.launch_test_application(80 self.app = self.launch_test_application(
77 "qmlscene",81 base.get_qmlscene_launch_command(),
78 self.local_location,82 self.local_location,
79 app_type='qt',83 app_type='qt',
80 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)84 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
8185
82 def launch_test_installed(self):86 def launch_test_installed(self):
83 self.app = self.launch_test_application(87 self.app = self.launch_test_application(
84 "qmlscene",88 base.get_qmlscene_launch_command(),
85 self.installed_location,89 self.installed_location,
86 "--desktop_file_hint=/usr/share/applications/"90 "--desktop_file_hint=/usr/share/applications/"
87 "rssreader-app.desktop",91 "rssreader-app.desktop",
8892
=== modified file 'tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py'
--- tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 2013-10-10 18:12:28 +0000
+++ tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 2013-11-05 03:02:07 +0000
@@ -145,13 +145,14 @@
145145
146 #check topic146 #check topic
147 logger.debug("assert topic remains")147 logger.debug("assert topic remains")
148 self.assertThat(lambda: self.main_view.get_feedlist_topic(topicName),148 self.assertThat(
149 Eventually(Not(Is(None))))149 self.main_view.get_feedlist_topic(topicName), Not(Is(None)))
150150
151 #check feed has been removed151 #check feed has been removed
152 logger.debug("assert removed feed")152 logger.debug("assert removed feed")
153 self.assertThat(lambda: self.main_view.get_feedlist_feed(feedName),153 self.assertThat(
154 Eventually(Equals(None)))154 lambda: self.main_view.select_many('FeedComponent', text=feedName),
155 Eventually(Equals([])))
155156
156 def _remove_topic(self, topicName):157 def _remove_topic(self, topicName):
157 self.assertThat(self.main_view.get_topics_page,158 self.assertThat(self.main_view.get_topics_page,
@@ -360,9 +361,9 @@
360361
361 #click on news topic362 #click on news topic
362 topicValueselectorValue = self.main_view. \363 topicValueselectorValue = self.main_view. \
363 get_editfeed_valueselector_value("news")364 get_editfeed_valueselector_value("Ubuntu")
364 self.pointing_device.click_object(topicValueselectorValue)365 self.pointing_device.click_object(topicValueselectorValue)
365366
366 #verify topic has changed367 #verify topic has changed
367 self.assertThat(topicValueselectorValue.text,368 self.assertThat(topicValueselectorValue.text,
368 Eventually(Equals("news")))369 Eventually(Equals("Ubuntu")))

Subscribers

People subscribed via source and target branches