Merge lp:~nskaggs/ubuntu-rssreader-app/fix-my-horrible-prints into lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk

Proposed by Nicholas Skaggs
Status: Merged
Approved by: Joey Chan
Approved revision: 75
Merged at revision: 77
Proposed branch: lp:~nskaggs/ubuntu-rssreader-app/fix-my-horrible-prints
Merge into: lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk
Diff against target: 274 lines (+60/-50)
2 files modified
tests/autopilot/ubuntu_rssreader_app/tests/__init__.py (+8/-2)
tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py (+52/-48)
To merge this branch: bzr merge lp:~nskaggs/ubuntu-rssreader-app/fix-my-horrible-prints
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Shorts Developers Pending
Review via email: mp+188079@code.launchpad.net

Commit message

Add support for testing via click packages

Description of the change

Add support for testing via click packages
fix my horrible print statements

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)
75. By Nicholas Skaggs

fix logger issues

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (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/tests/__init__.py'
2--- tests/autopilot/ubuntu_rssreader_app/tests/__init__.py 2013-09-26 08:44:17 +0000
3+++ tests/autopilot/ubuntu_rssreader_app/tests/__init__.py 2013-09-27 16:22:38 +0000
4@@ -44,6 +44,8 @@
5 scenarios = [('with touch', dict(input_device_class=Touch))]
6
7 local_location = "../../rssreader-app.qml"
8+ installed_location = "/usr/share/rssreader-app/rssreader-app.qml"
9+
10 sqlite_dir = os.path.expanduser(
11 "~/.local/share/Qt Project/QtQmlViewer/QML/OfflineStorage/Databases")
12 backup_dir = sqlite_dir + ".backup"
13@@ -62,8 +64,10 @@
14
15 if os.path.exists(self.local_location):
16 self.launch_test_local()
17- else:
18+ elif os.path.exists(self.installed_location):
19 self.launch_test_installed()
20+ else:
21+ self.launch_test_click()
22
23 def launch_test_local(self):
24 self.app = self.launch_test_application(
25@@ -75,11 +79,13 @@
26 def launch_test_installed(self):
27 self.app = self.launch_test_application(
28 "qmlscene",
29- "/usr/share/rssreader-app/rssreader-app.qml",
30+ self.installed_location,
31 "--desktop_file_hint=/usr/share/applications/"
32 "rssreader-app.desktop",
33 app_type='qt',
34 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
35+ def launch_test_click(self):
36+ self.app = self.launch_click_package("com.ubuntu.rssreader-app", emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
37
38 def temp_move_sqlite_db(self):
39 if os.path.exists(self.backup_dir):
40
41=== modified file 'tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py'
42--- tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 2013-09-11 18:43:33 +0000
43+++ tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 2013-09-27 16:22:38 +0000
44@@ -17,11 +17,15 @@
45
46 from autopilot.introspection.dbus import StateNotFoundError
47 from ubuntu_rssreader_app.tests import RssReaderAppTestCase
48+import logging
49
50 from time import sleep
51
52 class TestMainWindow(RssReaderAppTestCase):
53
54+ global logger
55+ logger = logging.getLogger(__name__)
56+
57 def setUp(self):
58 super(TestMainWindow, self).setUp()
59
60@@ -33,142 +37,142 @@
61
62 def _add_feed_and_topic(self, feed, topicName):
63 """test add feed and topic"""
64- print "starting test add feed and topic"
65+ logger.debug("starting test add feed and topic")
66 #open toolbar
67- print "opening toolbar"
68+ logger.debug("opening toolbar")
69 toolbar = self.main_view.open_toolbar()
70
71 #click on add reads toolbar button
72- print "clicking addreadsbutton"
73+ logger.debug("clicking addreadsbutton")
74 toolbar.click_button("addreadsbutton")
75
76 #click on add feeds popover action
77- print "clicking + Add feeds"
78+ logger.debug("clicking + Add feeds")
79 addReadsPopover = self.main_view.get_action_popover()
80 self.main_view.run_action(addReadsPopover, "+ Add feeds")
81
82 #verify Append Feed page is open
83- print "asserting append page"
84+ logger.debug("asserting append page")
85 appendpage = lambda: self.main_view.get_append_page().visible
86 self.assertThat(appendpage, Eventually(Equals(True)))
87
88 #type feed in input field
89- print "inputting feed"
90+ logger.debug("inputting feed")
91 self._input_new_feed(feed)
92
93 #click on checkbox to confirm feed
94- print "asserting checkbox"
95+ logger.debug("asserting checkbox")
96 self.assertThat(self.main_view.get_append_page_feed, Eventually(Not(Is(None))))
97- print "grabbing checkbox"
98+ logger.debug("grabbing checkbox")
99 checkboxBtn = self.main_view.get_append_page_feed()
100- print "clicking checkbox"
101+ logger.debug("clicking checkbox")
102 self.pointing_device.click_object(checkboxBtn)
103- print "asserting checkbox checked"
104+ logger.debug("asserting checkbox checked")
105 self.assertThat(checkboxBtn.checked, Eventually(Equals(True)))
106
107 #click on Next button
108- print "asserting next"
109+ logger.debug("asserting next")
110 self.assertThat(self.main_view.get_next_button, Eventually(Not(Is(None))))
111- print "grabbing next"
112+ logger.debug("grabbing next")
113 nextButton = self.main_view.get_next_button()
114- print "clicking next"
115+ logger.debug("clicking next")
116 self.pointing_device.click_object(nextButton)
117
118 #verify choose topic page has opened
119- print "asserting choose topic page"
120+ logger.debug("asserting choose topic page")
121 chossetopicpage = lambda: self.main_view.get_topics_page().visible
122 self.assertThat(chossetopicpage, Eventually(Equals(True)))
123
124 #get current topics
125- print "grabbing topics"
126+ logger.debug("grabbing topics")
127 topics = self.main_view.get_choose_topics_items()
128 numTopics = len(topics)
129- print "found " + str(numTopics) + " topics"
130+ logger.debug("found " + str(numTopics) + " topics")
131 for topic in topics:
132- print "Topic: " + str(topic.text)
133+ logger.debug("Topic: " + str(topic.text))
134
135 #add a new topic
136- print "input topic"
137+ logger.debug("input topic")
138 self._input_new_topic(topicName)
139
140 #A new topic is now automatically selected as the topic
141 #select new topic
142- #print "assert new topic"
143+ #logger.debug("assert new topic")
144 #newNumTopics = len(self.main_view.get_choose_topics_items)
145 #self.assertThat(newNumTopics, Eventually(Equals(numTopics + 1)))
146- #print "grab new topic"
147+ #logger.debug("grab new topic")
148 #topics = self.main_view.get_choose_topics_items()
149 #numTopics = len(topics)
150- #print "found " + str(numTopics) + " topics"
151+ #logger.debug("found " + str(numTopics) + " topics")
152 #for topic in topics:
153- # print "Topic: " + str(topic.text)
154+ # logger.debug("Topic: ") + str(topic.text)
155 #newTopic = self.main_view.get_choose_topics_items()[-1]
156 #newTopic = topics[-1]
157- #print "click new topic, " + str(newTopic.text)
158+ #logger.debug("click new topic, ") + str(newTopic.text)
159 #self.pointing_device.click_object(newTopic)
160- #print "topic clicked"
161+ #logger.debug("topic clicked")
162
163 #wait for any updates to finish before beginning tests
164 #this transition currently locks the device https://bugs.launchpad.net/ubuntu-rssreader-app/+bug/1221893
165- #print "check for network updates"
166+ #logger.debug("check for network updates")
167 #self.assertThat(self.main_view.get_network_activity, Eventually(Not(Is(None))))
168- #print "assert no network updates"
169+ #logger.debug("assert no network updates")
170 #self.assertThat(self.main_view.get_network_activity, Eventually(Is(None)))
171- #print "assert we're back on main view"
172+ #logger.debug("assert we're back on main view")
173 #self.assertThat(self.main_view.visible, Eventually(Equals(True)))
174- #print "finished with add_feed_topic"
175+ #logger.debug("finished with add_feed_topic")
176
177 def _remove_feed(self, feedName, topicName):
178- print "removing feed"
179+ logger.debug("removing feed")
180 #open toolbar
181- print "opening toolbar"
182+ logger.debug("opening toolbar")
183 toolbar = self.main_view.open_toolbar()
184
185 #click on back toolbar Button
186- print "clicking edit topics"
187+ logger.debug("clicking edit topics")
188 toolbar.click_button("edittopicsbutton")
189
190 #verify we are on the Management page
191- print "assert feedlist page"
192+ logger.debug("assert feedlist page")
193 feedlistpage = lambda: self.main_view.get_feed_management_page().visible
194 self.assertThat(feedlistpage, Eventually(Equals(True)))
195
196 #select topic
197- print "grabbing topic"
198+ logger.debug("grabbing topic")
199 self._get_topic(topicName)
200
201 #select feed
202- print "assert feed"
203+ logger.debug("assert feed")
204 self.assertThat(lambda: self.main_view.get_feedlist_feed(feedName), Eventually(Not(Is(None))))
205- print "grabbing feed"
206+ logger.debug("grabbing feed")
207 feed = self.main_view.get_feedlist_feed(feedName)
208- print "clicking feed"
209+ logger.debug("clicking feed")
210 self.pointing_device.click_object(feed)
211
212 #verify we are on the Edit Feed page
213- print "assert editfeedpage"
214+ logger.debug("assert editfeedpage")
215 editFeedPage = self.main_view.get_edit_feed_page()
216 self.assertThat(editFeedPage.visible, Eventually(Equals(True)))
217
218 #press delete button
219- print "assert delete button"
220+ logger.debug("assert delete button")
221 self.assertThat(self.main_view.get_delete_button, Eventually(Not(Is(None))))
222- print "grab delete button"
223+ logger.debug("grab delete button")
224 deleteButton = self.main_view.get_delete_button()
225- print "click delete button"
226+ logger.debug("click delete button")
227 self.pointing_device.click_object(deleteButton)
228
229 #verify we are on the Management page
230- print "assert feedlistpage"
231+ logger.debug("assert feedlistpage")
232 feedlistpage = lambda: self.main_view.get_feed_management_page().visible
233 self.assertThat(feedlistpage, Eventually(Equals(True)))
234
235 #check topic
236- print "assert topic remains"
237+ logger.debug("assert topic remains")
238 self.assertThat(lambda: self.main_view.get_feedlist_topic(topicName), Eventually(Not(Is(None))))
239
240 #check feed has been removed
241- print "assert removed feed"
242+ logger.debug("assert removed feed")
243 self.assertThat(lambda: self.main_view.get_feedlist_feed(feedName), Eventually(Equals(None)))
244
245 def _remove_topic(self, topicName):
246@@ -231,15 +235,15 @@
247 return inputField
248
249 def _get_topic(self, topicName, timeout = 10):
250- print "_get_topic: assert topics"
251+ logger.debug("_get_topic: assert topics")
252 self.assertThat(lambda: self.main_view.get_feedlist_topic(topicName), Eventually(Not(Is(None))))
253- print "_get_topic: grab topic"
254+ logger.debug("_get_topic: grab topic")
255 topic = self.main_view.get_feedlist_topic(topicName)
256- print "_get_topic: click topic"
257+ logger.debug("_get_topic: click topic")
258
259 poll = 0
260 while topic.isExpended == False and poll < timeout:
261- print "_get_topic: loop click topic"
262+ logger.debug("_get_topic: loop click topic")
263 self.pointing_device.click_object(topic)
264 sleep(1)
265 poll += 1
266@@ -257,7 +261,7 @@
267 self._add_feed_and_topic(feed, topicName)
268
269 #remove added feed
270- print "starting remove feed"
271+ logger.debug("starting remove feed")
272 #12 sept 2013,
273 #this transition currently locks the device https://bugs.launchpad.net/ubuntu-rssreader-app/+bug/1221893
274 #self._remove_feed(feedName, topicName)

Subscribers

People subscribed via source and target branches