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
=== modified file 'tests/autopilot/ubuntu_rssreader_app/tests/__init__.py'
--- tests/autopilot/ubuntu_rssreader_app/tests/__init__.py 2013-09-26 08:44:17 +0000
+++ tests/autopilot/ubuntu_rssreader_app/tests/__init__.py 2013-09-27 16:22:38 +0000
@@ -44,6 +44,8 @@
44 scenarios = [('with touch', dict(input_device_class=Touch))]44 scenarios = [('with touch', dict(input_device_class=Touch))]
4545
46 local_location = "../../rssreader-app.qml"46 local_location = "../../rssreader-app.qml"
47 installed_location = "/usr/share/rssreader-app/rssreader-app.qml"
48
47 sqlite_dir = os.path.expanduser(49 sqlite_dir = os.path.expanduser(
48 "~/.local/share/Qt Project/QtQmlViewer/QML/OfflineStorage/Databases")50 "~/.local/share/Qt Project/QtQmlViewer/QML/OfflineStorage/Databases")
49 backup_dir = sqlite_dir + ".backup"51 backup_dir = sqlite_dir + ".backup"
@@ -62,8 +64,10 @@
6264
63 if os.path.exists(self.local_location):65 if os.path.exists(self.local_location):
64 self.launch_test_local()66 self.launch_test_local()
65 else:67 elif os.path.exists(self.installed_location):
66 self.launch_test_installed()68 self.launch_test_installed()
69 else:
70 self.launch_test_click()
6771
68 def launch_test_local(self):72 def launch_test_local(self):
69 self.app = self.launch_test_application(73 self.app = self.launch_test_application(
@@ -75,11 +79,13 @@
75 def launch_test_installed(self):79 def launch_test_installed(self):
76 self.app = self.launch_test_application(80 self.app = self.launch_test_application(
77 "qmlscene",81 "qmlscene",
78 "/usr/share/rssreader-app/rssreader-app.qml",82 self.installed_location,
79 "--desktop_file_hint=/usr/share/applications/"83 "--desktop_file_hint=/usr/share/applications/"
80 "rssreader-app.desktop",84 "rssreader-app.desktop",
81 app_type='qt',85 app_type='qt',
82 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)86 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
87 def launch_test_click(self):
88 self.app = self.launch_click_package("com.ubuntu.rssreader-app", emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
8389
84 def temp_move_sqlite_db(self):90 def temp_move_sqlite_db(self):
85 if os.path.exists(self.backup_dir):91 if os.path.exists(self.backup_dir):
8692
=== modified file 'tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py'
--- tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 2013-09-11 18:43:33 +0000
+++ tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 2013-09-27 16:22:38 +0000
@@ -17,11 +17,15 @@
1717
18from autopilot.introspection.dbus import StateNotFoundError18from autopilot.introspection.dbus import StateNotFoundError
19from ubuntu_rssreader_app.tests import RssReaderAppTestCase19from ubuntu_rssreader_app.tests import RssReaderAppTestCase
20import logging
2021
21from time import sleep22from time import sleep
2223
23class TestMainWindow(RssReaderAppTestCase):24class TestMainWindow(RssReaderAppTestCase):
2425
26 global logger
27 logger = logging.getLogger(__name__)
28
25 def setUp(self):29 def setUp(self):
26 super(TestMainWindow, self).setUp()30 super(TestMainWindow, self).setUp()
2731
@@ -33,142 +37,142 @@
3337
34 def _add_feed_and_topic(self, feed, topicName):38 def _add_feed_and_topic(self, feed, topicName):
35 """test add feed and topic"""39 """test add feed and topic"""
36 print "starting test add feed and topic"40 logger.debug("starting test add feed and topic")
37 #open toolbar41 #open toolbar
38 print "opening toolbar"42 logger.debug("opening toolbar")
39 toolbar = self.main_view.open_toolbar()43 toolbar = self.main_view.open_toolbar()
4044
41 #click on add reads toolbar button45 #click on add reads toolbar button
42 print "clicking addreadsbutton"46 logger.debug("clicking addreadsbutton")
43 toolbar.click_button("addreadsbutton")47 toolbar.click_button("addreadsbutton")
4448
45 #click on add feeds popover action49 #click on add feeds popover action
46 print "clicking + Add feeds"50 logger.debug("clicking + Add feeds")
47 addReadsPopover = self.main_view.get_action_popover()51 addReadsPopover = self.main_view.get_action_popover()
48 self.main_view.run_action(addReadsPopover, "+ Add feeds")52 self.main_view.run_action(addReadsPopover, "+ Add feeds")
4953
50 #verify Append Feed page is open54 #verify Append Feed page is open
51 print "asserting append page"55 logger.debug("asserting append page")
52 appendpage = lambda: self.main_view.get_append_page().visible56 appendpage = lambda: self.main_view.get_append_page().visible
53 self.assertThat(appendpage, Eventually(Equals(True)))57 self.assertThat(appendpage, Eventually(Equals(True)))
5458
55 #type feed in input field59 #type feed in input field
56 print "inputting feed"60 logger.debug("inputting feed")
57 self._input_new_feed(feed)61 self._input_new_feed(feed)
5862
59 #click on checkbox to confirm feed63 #click on checkbox to confirm feed
60 print "asserting checkbox"64 logger.debug("asserting checkbox")
61 self.assertThat(self.main_view.get_append_page_feed, Eventually(Not(Is(None))))65 self.assertThat(self.main_view.get_append_page_feed, Eventually(Not(Is(None))))
62 print "grabbing checkbox"66 logger.debug("grabbing checkbox")
63 checkboxBtn = self.main_view.get_append_page_feed()67 checkboxBtn = self.main_view.get_append_page_feed()
64 print "clicking checkbox"68 logger.debug("clicking checkbox")
65 self.pointing_device.click_object(checkboxBtn)69 self.pointing_device.click_object(checkboxBtn)
66 print "asserting checkbox checked"70 logger.debug("asserting checkbox checked")
67 self.assertThat(checkboxBtn.checked, Eventually(Equals(True)))71 self.assertThat(checkboxBtn.checked, Eventually(Equals(True)))
6872
69 #click on Next button73 #click on Next button
70 print "asserting next"74 logger.debug("asserting next")
71 self.assertThat(self.main_view.get_next_button, Eventually(Not(Is(None))))75 self.assertThat(self.main_view.get_next_button, Eventually(Not(Is(None))))
72 print "grabbing next"76 logger.debug("grabbing next")
73 nextButton = self.main_view.get_next_button()77 nextButton = self.main_view.get_next_button()
74 print "clicking next"78 logger.debug("clicking next")
75 self.pointing_device.click_object(nextButton)79 self.pointing_device.click_object(nextButton)
7680
77 #verify choose topic page has opened81 #verify choose topic page has opened
78 print "asserting choose topic page"82 logger.debug("asserting choose topic page")
79 chossetopicpage = lambda: self.main_view.get_topics_page().visible83 chossetopicpage = lambda: self.main_view.get_topics_page().visible
80 self.assertThat(chossetopicpage, Eventually(Equals(True)))84 self.assertThat(chossetopicpage, Eventually(Equals(True)))
8185
82 #get current topics86 #get current topics
83 print "grabbing topics"87 logger.debug("grabbing topics")
84 topics = self.main_view.get_choose_topics_items()88 topics = self.main_view.get_choose_topics_items()
85 numTopics = len(topics)89 numTopics = len(topics)
86 print "found " + str(numTopics) + " topics"90 logger.debug("found " + str(numTopics) + " topics")
87 for topic in topics:91 for topic in topics:
88 print "Topic: " + str(topic.text)92 logger.debug("Topic: " + str(topic.text))
8993
90 #add a new topic94 #add a new topic
91 print "input topic"95 logger.debug("input topic")
92 self._input_new_topic(topicName)96 self._input_new_topic(topicName)
9397
94 #A new topic is now automatically selected as the topic98 #A new topic is now automatically selected as the topic
95 #select new topic99 #select new topic
96 #print "assert new topic"100 #logger.debug("assert new topic")
97 #newNumTopics = len(self.main_view.get_choose_topics_items)101 #newNumTopics = len(self.main_view.get_choose_topics_items)
98 #self.assertThat(newNumTopics, Eventually(Equals(numTopics + 1)))102 #self.assertThat(newNumTopics, Eventually(Equals(numTopics + 1)))
99 #print "grab new topic"103 #logger.debug("grab new topic")
100 #topics = self.main_view.get_choose_topics_items()104 #topics = self.main_view.get_choose_topics_items()
101 #numTopics = len(topics)105 #numTopics = len(topics)
102 #print "found " + str(numTopics) + " topics"106 #logger.debug("found " + str(numTopics) + " topics")
103 #for topic in topics:107 #for topic in topics:
104 # print "Topic: " + str(topic.text)108 # logger.debug("Topic: ") + str(topic.text)
105 #newTopic = self.main_view.get_choose_topics_items()[-1]109 #newTopic = self.main_view.get_choose_topics_items()[-1]
106 #newTopic = topics[-1]110 #newTopic = topics[-1]
107 #print "click new topic, " + str(newTopic.text)111 #logger.debug("click new topic, ") + str(newTopic.text)
108 #self.pointing_device.click_object(newTopic)112 #self.pointing_device.click_object(newTopic)
109 #print "topic clicked"113 #logger.debug("topic clicked")
110114
111 #wait for any updates to finish before beginning tests115 #wait for any updates to finish before beginning tests
112 #this transition currently locks the device https://bugs.launchpad.net/ubuntu-rssreader-app/+bug/1221893116 #this transition currently locks the device https://bugs.launchpad.net/ubuntu-rssreader-app/+bug/1221893
113 #print "check for network updates"117 #logger.debug("check for network updates")
114 #self.assertThat(self.main_view.get_network_activity, Eventually(Not(Is(None))))118 #self.assertThat(self.main_view.get_network_activity, Eventually(Not(Is(None))))
115 #print "assert no network updates"119 #logger.debug("assert no network updates")
116 #self.assertThat(self.main_view.get_network_activity, Eventually(Is(None)))120 #self.assertThat(self.main_view.get_network_activity, Eventually(Is(None)))
117 #print "assert we're back on main view"121 #logger.debug("assert we're back on main view")
118 #self.assertThat(self.main_view.visible, Eventually(Equals(True)))122 #self.assertThat(self.main_view.visible, Eventually(Equals(True)))
119 #print "finished with add_feed_topic"123 #logger.debug("finished with add_feed_topic")
120124
121 def _remove_feed(self, feedName, topicName):125 def _remove_feed(self, feedName, topicName):
122 print "removing feed"126 logger.debug("removing feed")
123 #open toolbar127 #open toolbar
124 print "opening toolbar"128 logger.debug("opening toolbar")
125 toolbar = self.main_view.open_toolbar()129 toolbar = self.main_view.open_toolbar()
126130
127 #click on back toolbar Button131 #click on back toolbar Button
128 print "clicking edit topics"132 logger.debug("clicking edit topics")
129 toolbar.click_button("edittopicsbutton")133 toolbar.click_button("edittopicsbutton")
130134
131 #verify we are on the Management page135 #verify we are on the Management page
132 print "assert feedlist page"136 logger.debug("assert feedlist page")
133 feedlistpage = lambda: self.main_view.get_feed_management_page().visible137 feedlistpage = lambda: self.main_view.get_feed_management_page().visible
134 self.assertThat(feedlistpage, Eventually(Equals(True)))138 self.assertThat(feedlistpage, Eventually(Equals(True)))
135139
136 #select topic140 #select topic
137 print "grabbing topic"141 logger.debug("grabbing topic")
138 self._get_topic(topicName)142 self._get_topic(topicName)
139143
140 #select feed144 #select feed
141 print "assert feed"145 logger.debug("assert feed")
142 self.assertThat(lambda: self.main_view.get_feedlist_feed(feedName), Eventually(Not(Is(None))))146 self.assertThat(lambda: self.main_view.get_feedlist_feed(feedName), Eventually(Not(Is(None))))
143 print "grabbing feed"147 logger.debug("grabbing feed")
144 feed = self.main_view.get_feedlist_feed(feedName)148 feed = self.main_view.get_feedlist_feed(feedName)
145 print "clicking feed"149 logger.debug("clicking feed")
146 self.pointing_device.click_object(feed)150 self.pointing_device.click_object(feed)
147151
148 #verify we are on the Edit Feed page152 #verify we are on the Edit Feed page
149 print "assert editfeedpage"153 logger.debug("assert editfeedpage")
150 editFeedPage = self.main_view.get_edit_feed_page()154 editFeedPage = self.main_view.get_edit_feed_page()
151 self.assertThat(editFeedPage.visible, Eventually(Equals(True)))155 self.assertThat(editFeedPage.visible, Eventually(Equals(True)))
152156
153 #press delete button157 #press delete button
154 print "assert delete button"158 logger.debug("assert delete button")
155 self.assertThat(self.main_view.get_delete_button, Eventually(Not(Is(None))))159 self.assertThat(self.main_view.get_delete_button, Eventually(Not(Is(None))))
156 print "grab delete button"160 logger.debug("grab delete button")
157 deleteButton = self.main_view.get_delete_button()161 deleteButton = self.main_view.get_delete_button()
158 print "click delete button"162 logger.debug("click delete button")
159 self.pointing_device.click_object(deleteButton)163 self.pointing_device.click_object(deleteButton)
160164
161 #verify we are on the Management page165 #verify we are on the Management page
162 print "assert feedlistpage"166 logger.debug("assert feedlistpage")
163 feedlistpage = lambda: self.main_view.get_feed_management_page().visible167 feedlistpage = lambda: self.main_view.get_feed_management_page().visible
164 self.assertThat(feedlistpage, Eventually(Equals(True)))168 self.assertThat(feedlistpage, Eventually(Equals(True)))
165169
166 #check topic170 #check topic
167 print "assert topic remains"171 logger.debug("assert topic remains")
168 self.assertThat(lambda: self.main_view.get_feedlist_topic(topicName), Eventually(Not(Is(None))))172 self.assertThat(lambda: self.main_view.get_feedlist_topic(topicName), Eventually(Not(Is(None))))
169173
170 #check feed has been removed174 #check feed has been removed
171 print "assert removed feed"175 logger.debug("assert removed feed")
172 self.assertThat(lambda: self.main_view.get_feedlist_feed(feedName), Eventually(Equals(None)))176 self.assertThat(lambda: self.main_view.get_feedlist_feed(feedName), Eventually(Equals(None)))
173177
174 def _remove_topic(self, topicName):178 def _remove_topic(self, topicName):
@@ -231,15 +235,15 @@
231 return inputField235 return inputField
232236
233 def _get_topic(self, topicName, timeout = 10):237 def _get_topic(self, topicName, timeout = 10):
234 print "_get_topic: assert topics"238 logger.debug("_get_topic: assert topics")
235 self.assertThat(lambda: self.main_view.get_feedlist_topic(topicName), Eventually(Not(Is(None))))239 self.assertThat(lambda: self.main_view.get_feedlist_topic(topicName), Eventually(Not(Is(None))))
236 print "_get_topic: grab topic"240 logger.debug("_get_topic: grab topic")
237 topic = self.main_view.get_feedlist_topic(topicName)241 topic = self.main_view.get_feedlist_topic(topicName)
238 print "_get_topic: click topic"242 logger.debug("_get_topic: click topic")
239243
240 poll = 0244 poll = 0
241 while topic.isExpended == False and poll < timeout:245 while topic.isExpended == False and poll < timeout:
242 print "_get_topic: loop click topic"246 logger.debug("_get_topic: loop click topic")
243 self.pointing_device.click_object(topic)247 self.pointing_device.click_object(topic)
244 sleep(1)248 sleep(1)
245 poll += 1249 poll += 1
@@ -257,7 +261,7 @@
257 self._add_feed_and_topic(feed, topicName)261 self._add_feed_and_topic(feed, topicName)
258262
259 #remove added feed263 #remove added feed
260 print "starting remove feed"264 logger.debug("starting remove feed")
261 #12 sept 2013,265 #12 sept 2013,
262 #this transition currently locks the device https://bugs.launchpad.net/ubuntu-rssreader-app/+bug/1221893266 #this transition currently locks the device https://bugs.launchpad.net/ubuntu-rssreader-app/+bug/1221893
263 #self._remove_feed(feedName, topicName)267 #self._remove_feed(feedName, topicName)

Subscribers

People subscribed via source and target branches