Merge lp:~nskaggs/ubuntu-rssreader-app/expand-setup into lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk

Proposed by Nicholas Skaggs
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 62
Merged at revision: 59
Proposed branch: lp:~nskaggs/ubuntu-rssreader-app/expand-setup
Merge into: lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk
Diff against target: 161 lines (+66/-5)
4 files modified
tests/autopilot/ubuntu_rssreader_app/emulators.py (+9/-0)
tests/autopilot/ubuntu_rssreader_app/tests/__init__.py (+33/-1)
tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py (+22/-4)
ubuntu-rssreader-app.qml (+2/-0)
To merge this branch: bzr merge lp:~nskaggs/ubuntu-rssreader-app/expand-setup
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Nicholas Skaggs (community) Approve
Review via email: mp+183912@code.launchpad.net

Commit message

expand test setup so a clean db is used, and the refresh dialog is expired before beginning a test

Description of the change

This enhances the autopilot tests to make them run more robustly by using a fresh database before each test, as well as adding an assert to wait for the the refresh dialog to disappear before starting a test.

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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (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) :
review: Approve
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) :
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/emulators.py'
--- tests/autopilot/ubuntu_rssreader_app/emulators.py 2013-08-13 20:21:58 +0000
+++ tests/autopilot/ubuntu_rssreader_app/emulators.py 2013-09-05 05:27:18 +0000
@@ -127,3 +127,12 @@
127127
128 def get_add_a_topic(self):128 def get_add_a_topic(self):
129 return self.select_single("QQuickItem", objectName = "addTopic")129 return self.select_single("QQuickItem", objectName = "addTopic")
130
131 def get_refresh_feed_dialog(self):
132 return self.select_single("Dialog", objectName = "refreshWaitDialog")
133
134 def get_refresh_dialog_cancel_button(self):
135 return self.select_single("Button", objectName = "refreshCancel")
136
137 def get_network_activity(self):
138 return self.select_single("ActivityIndicator", running = "True")
130139
=== modified file 'tests/autopilot/ubuntu_rssreader_app/tests/__init__.py'
--- tests/autopilot/ubuntu_rssreader_app/tests/__init__.py 2013-08-13 02:52:16 +0000
+++ tests/autopilot/ubuntu_rssreader_app/tests/__init__.py 2013-09-05 05:27:18 +0000
@@ -21,12 +21,13 @@
2121
22import os.path22import os.path
23import os23import os
24import shutil
2425
25from autopilot.input import Mouse, Touch, Pointer26from autopilot.input import Mouse, Touch, Pointer
26from autopilot.platform import model27from autopilot.platform import model
27from autopilot.testcase import AutopilotTestCase28from autopilot.testcase import AutopilotTestCase
28from autopilot.matchers import Eventually29from autopilot.matchers import Eventually
29from testtools.matchers import GreaterThan30from testtools.matchers import GreaterThan, Equals
3031
31from ubuntuuitoolkit import emulators as toolkit_emulators32from ubuntuuitoolkit import emulators as toolkit_emulators
32from ubuntu_rssreader_app import emulators33from ubuntu_rssreader_app import emulators
@@ -43,10 +44,16 @@
43 scenarios = [('with touch', dict(input_device_class=Touch))]44 scenarios = [('with touch', dict(input_device_class=Touch))]
4445
45 local_location = "../../ubuntu-rssreader-app.qml"46 local_location = "../../ubuntu-rssreader-app.qml"
47 sqlite_dir = os.path.expanduser(
48 "~/.local/share/Qt Project/QtQmlViewer/QML/OfflineStorage/Databases")
49 backup_dir = sqlite_dir + ".backup"
4650
47 def setUp(self):51 def setUp(self):
48 self.pointing_device = Pointer(self.input_device_class.create())52 self.pointing_device = Pointer(self.input_device_class.create())
49 super(RssReaderAppTestCase, self).setUp()53 super(RssReaderAppTestCase, self).setUp()
54 self.temp_move_sqlite_db()
55 self.addCleanup(self.restore_sqlite_db)
56
50 if os.path.exists(self.local_location):57 if os.path.exists(self.local_location):
51 self.launch_test_local()58 self.launch_test_local()
52 else:59 else:
@@ -68,6 +75,31 @@
68 app_type='qt',75 app_type='qt',
69 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)76 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
7077
78 def temp_move_sqlite_db(self):
79 if os.path.exists(self.sqlite_dir):
80 shutil.move(self.sqlite_dir, self.backup_dir)
81 self.assertThat(
82 lambda: os.path.exists(self.backup_dir),
83 Eventually(Equals(True)))
84
85 def restore_sqlite_db(self):
86 if os.path.exists(self.backup_dir) and os.path.exists(self.sqlite_dir):
87 shutil.rmtree(self.sqlite_dir)
88 self.assertThat(
89 lambda: os.path.exists(self.sqlite_dir),
90 Eventually(Equals(False)))
91 shutil.move(self.backup_dir, self.sqlite_dir)
92 self.assertTrue(
93 lambda: os.path.exists(self.sqlite_dir),
94 Eventually(Equals(True)))
95 elif os.path.exists(self.backup_dir):
96 shutil.move(self.backup_dir, self.sqlite_dir)
97 self.assertTrue(
98 lambda: os.path.exists(self.sqlite_dir),
99 Eventually(Equals(True)))
100 else:
101 pass
102
71 @property103 @property
72 def main_view(self):104 def main_view(self):
73 return self.app.select_single(emulators.MainView)105 return self.app.select_single(emulators.MainView)
74106
=== modified file 'tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py'
--- tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 2013-08-30 14:58:01 +0000
+++ tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 2013-09-05 05:27:18 +0000
@@ -26,6 +26,11 @@
26 super(TestMainWindow, self).setUp()26 super(TestMainWindow, self).setUp()
27 self.assertThat(self.main_view.visible, Eventually(Equals(True)))27 self.assertThat(self.main_view.visible, Eventually(Equals(True)))
2828
29 #wait for any updates to finish before beginning tests
30 self.assertThat(self.main_view.get_network_activity, Eventually(Not(Is(None))))
31 self.assertThat(self.main_view.get_network_activity, Eventually(Is(None)))
32
33
29 def _add_feed_and_topic(self):34 def _add_feed_and_topic(self):
30 """test add feed and topic"""35 """test add feed and topic"""
31 #open toolbar36 #open toolbar
@@ -65,15 +70,28 @@
65 self.assertThat(chossetopicpage, Eventually(Equals(True)))70 self.assertThat(chossetopicpage, Eventually(Equals(True)))
6671
67 #add a new topic72 #add a new topic
68 self._input_new_topic("CanonicalTopic")73 topicName = "CanonicalTopic"
74 self._input_new_topic(topicName)
6975
70 #select canonical topic76 #select canonical topic
71 self.assertThat(self.main_view.get_canonical_topic_labelvisual, Eventually(Not(Is(None))))77 self.assertThat(self.main_view.get_canonical_topic_labelvisual, Eventually(Not(Is(None))))
78
79 #make sure topic is selected
80 timeout = 0
72 canonicalTopic = self.main_view.get_canonical_topic_labelvisual()81 canonicalTopic = self.main_view.get_canonical_topic_labelvisual()
73 self.pointing_device.click_object(canonicalTopic)82 self.pointing_device.click_object(canonicalTopic)
7483
75 #just for timing purposes84 #loop to ensure we clicked the topic
76 self.assertThat(canonicalTopic.text, Eventually(Equals("CanonicalTopic")))85 #while canonicalTopic.Text != topicName and timeout < 10:
86 while not self.main_view.get_network_activity and timeout < 10:
87 canonicalTopic = self.main_view.get_canonical_topic_labelvisual()
88 self.pointing_device.click_object(canonicalTopic)
89 sleep(1)
90 timeout += 1
91
92 #wait for any updates to finish
93 #self.assertThat(self.main_view.get_network_activity, Eventually(Not(Is(None))))
94 self.assertThat(self.main_view.get_network_activity, Eventually(Is(None)))
7795
78 def _remove_feed(self):96 def _remove_feed(self):
79 #open toolbar97 #open toolbar
@@ -197,7 +215,7 @@
197 #remove added Canonical topic215 #remove added Canonical topic
198 #12 Aug 2013, removing topic broken for now216 #12 Aug 2013, removing topic broken for now
199 #test commented until fixed, see https://bugs.launchpad.net/ubuntu-rssreader-app/+bug/1211631217 #test commented until fixed, see https://bugs.launchpad.net/ubuntu-rssreader-app/+bug/1211631
200 ## self._remove_topic()218 #self._remove_topic()
201219
202 #remove added Canonical feed220 #remove added Canonical feed
203 self._remove_feed()221 self._remove_feed()
204222
=== modified file 'ubuntu-rssreader-app.qml'
--- ubuntu-rssreader-app.qml 2013-09-01 21:45:40 +0000
+++ ubuntu-rssreader-app.qml 2013-09-05 05:27:18 +0000
@@ -273,6 +273,7 @@
273273
274 Dialog {274 Dialog {
275 id: refreshWaitDialog275 id: refreshWaitDialog
276 objectName: refreshWaitDialog
276277
277 title: i18n.tr("Checking for new articles")278 title: i18n.tr("Checking for new articles")
278279
@@ -282,6 +283,7 @@
282283
283 Button {284 Button {
284 text: i18n.tr("Cancel")285 text: i18n.tr("Cancel")
286 objectName: refreshCancel
285 color: UbuntuColors.orange287 color: UbuntuColors.orange
286 onClicked: {288 onClicked: {
287 xmlnetwork.cancelDownload()289 xmlnetwork.cancelDownload()

Subscribers

People subscribed via source and target branches