Merge lp:~carla-sella/ubuntu-rssreader-app/ubuntu-rssreader-add-remove-feed-topic into lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk
- ubuntu-rssreader-add-remove-feed-topic
- Merge into trunk
Proposed by
Carla Sella
Status: | Merged |
---|---|
Approved by: | Joey Chan |
Approved revision: | 29 |
Merged at revision: | 28 |
Proposed branch: | lp:~carla-sella/ubuntu-rssreader-app/ubuntu-rssreader-add-remove-feed-topic |
Merge into: | lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk |
Diff against target: |
635 lines (+292/-37) 9 files modified
feeds/AppendFeedPage.qml (+4/-0) feeds/ChooseTopicPage.qml (+1/-0) feeds/ManageFeedsPage.qml (+1/-0) feeds/ManageTopicsPage.qml (+5/-1) po/po.pro.user (+63/-0) tests/autopilot/ubuntu_rssreader_app/emulators/main_window.py (+47/-7) tests/autopilot/ubuntu_rssreader_app/emulators/ubuntusdk.py (+153/-0) tests/autopilot/ubuntu_rssreader_app/tests/__init__.py (+18/-3) tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py (+0/-26) |
To merge this branch: | bzr merge lp:~carla-sella/ubuntu-rssreader-app/ubuntu-rssreader-add-remove-feed-topic |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Ubuntu Shorts Developers | Pending | ||
Review via email:
|
Commit message
add/remove feed and topic
Description of the change
Completed the add/remove topic and feed autopilot test.
There are two sleeps that I could not find a way to get rid of, you can find them marked with #---> TODO fix this.
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
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
1 | === modified file 'feeds/AppendFeedPage.qml' |
2 | --- feeds/AppendFeedPage.qml 2013-07-28 15:39:48 +0000 |
3 | +++ feeds/AppendFeedPage.qml 2013-08-03 17:19:25 +0000 |
4 | @@ -48,6 +48,7 @@ |
5 | } |
6 | |
7 | Button { |
8 | + objectName: "nextButton" |
9 | id: nextBtn |
10 | anchors.verticalCenter: parent.verticalCenter |
11 | |
12 | @@ -152,6 +153,7 @@ |
13 | spacing: units.gu(2) |
14 | |
15 | TextField { |
16 | + objectName: "tfFeedUrl" |
17 | id: tfFeedUrl |
18 | |
19 | placeholderText: i18n.tr("Enter keywords or direct url") |
20 | @@ -198,9 +200,11 @@ |
21 | |
22 | delegate: ListItem.Standard { |
23 | text: model.title |
24 | + |
25 | control: CheckBox { |
26 | anchors.verticalCenter: parent.verticalCenter |
27 | |
28 | + objectName: "feedCheckbox" |
29 | onCheckedChanged: { |
30 | searchResultsModel.setProperty(index, "isSelected", checked) |
31 | if (checked) |
32 | |
33 | === modified file 'feeds/ChooseTopicPage.qml' |
34 | --- feeds/ChooseTopicPage.qml 2013-07-29 18:31:05 +0000 |
35 | +++ feeds/ChooseTopicPage.qml 2013-08-03 17:19:25 +0000 |
36 | @@ -68,6 +68,7 @@ |
37 | height: tfNewTopicName.height + units.gu(2) |
38 | |
39 | TextField { |
40 | + objectName: "New topic" |
41 | id: tfNewTopicName |
42 | |
43 | placeholderText: i18n.tr(" + New topic") |
44 | |
45 | === modified file 'feeds/ManageFeedsPage.qml' |
46 | --- feeds/ManageFeedsPage.qml 2013-07-25 19:49:25 +0000 |
47 | +++ feeds/ManageFeedsPage.qml 2013-08-03 17:19:25 +0000 |
48 | @@ -253,6 +253,7 @@ |
49 | } |
50 | |
51 | delegate: ListItem.Standard { |
52 | + objectName: "FeedListItem" |
53 | text: ((model.feedName == "") ? model.feedSource : model.feedName) |
54 | selected: model.isSelected |
55 | |
56 | |
57 | === modified file 'feeds/ManageTopicsPage.qml' |
58 | --- feeds/ManageTopicsPage.qml 2013-07-24 21:19:03 +0000 |
59 | +++ feeds/ManageTopicsPage.qml 2013-08-03 17:19:25 +0000 |
60 | @@ -40,26 +40,30 @@ |
61 | |
62 | ListView { |
63 | id: manageTopicsList |
64 | - |
65 | + objectName: "topiclist" |
66 | anchors.fill: parent |
67 | clip: true |
68 | model: manageTopicsListModel |
69 | |
70 | delegate: ListItem.Standard { |
71 | id: topicDelegate |
72 | + objectName: "topicDelegate" |
73 | text: model.tagName |
74 | removable: true |
75 | |
76 | Item { |
77 | id: removeTopicIndicator |
78 | + objectName: "topicItem" |
79 | //state: topicDelegate.swipingState === "" ? "hidden" : "visible" |
80 | anchors.fill: parent |
81 | Rectangle { |
82 | + objectName: "topicRect" |
83 | opacity: 0.8 |
84 | anchors.fill: parent |
85 | } |
86 | |
87 | Label { |
88 | + objectName: "topiclabel" |
89 | anchors.fill: parent |
90 | color: UbuntuColors.orange |
91 | anchors.margins: units.gu(4) |
92 | |
93 | === added file 'po/po.pro.user' |
94 | --- po/po.pro.user 1970-01-01 00:00:00 +0000 |
95 | +++ po/po.pro.user 2013-08-03 17:19:25 +0000 |
96 | @@ -0,0 +1,63 @@ |
97 | +<?xml version="1.0" encoding="UTF-8"?> |
98 | +<!DOCTYPE QtCreatorProject> |
99 | +<!-- Written by QtCreator 2.7.1, 2013-07-29T21:43:07. --> |
100 | +<qtcreator> |
101 | + <data> |
102 | + <variable>ProjectExplorer.Project.ActiveTarget</variable> |
103 | + <value type="int">-1</value> |
104 | + </data> |
105 | + <data> |
106 | + <variable>ProjectExplorer.Project.EditorSettings</variable> |
107 | + <valuemap type="QVariantMap"> |
108 | + <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
109 | + <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
110 | + <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
111 | + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
112 | + <value type="QByteArray" key="language">Cpp</value> |
113 | + <valuemap type="QVariantMap" key="value"> |
114 | + <value type="QString" key="CurrentPreferences">CppGlobal</value> |
115 | + </valuemap> |
116 | + </valuemap> |
117 | + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
118 | + <value type="QByteArray" key="language">QmlJS</value> |
119 | + <valuemap type="QVariantMap" key="value"> |
120 | + <value type="QString" key="CurrentPreferences">QmlJSGlobal</value> |
121 | + </valuemap> |
122 | + </valuemap> |
123 | + <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
124 | + <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
125 | + <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
126 | + <value type="int" key="EditorConfiguration.IndentSize">4</value> |
127 | + <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
128 | + <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
129 | + <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
130 | + <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
131 | + <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
132 | + <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
133 | + <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
134 | + <value type="int" key="EditorConfiguration.TabSize">8</value> |
135 | + <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
136 | + <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
137 | + <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
138 | + <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
139 | + <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
140 | + <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
141 | + </valuemap> |
142 | + </data> |
143 | + <data> |
144 | + <variable>ProjectExplorer.Project.PluginSettings</variable> |
145 | + <valuemap type="QVariantMap"/> |
146 | + </data> |
147 | + <data> |
148 | + <variable>ProjectExplorer.Project.TargetCount</variable> |
149 | + <value type="int">0</value> |
150 | + </data> |
151 | + <data> |
152 | + <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
153 | + <value type="QString">{e33c9772-4509-4210-9d1d-661ba661ef84}</value> |
154 | + </data> |
155 | + <data> |
156 | + <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
157 | + <value type="int">12</value> |
158 | + </data> |
159 | +</qtcreator> |
160 | |
161 | === modified file 'tests/autopilot/ubuntu_rssreader_app/emulators/main_window.py' |
162 | --- tests/autopilot/ubuntu_rssreader_app/emulators/main_window.py 2013-05-31 12:59:55 +0000 |
163 | +++ tests/autopilot/ubuntu_rssreader_app/emulators/main_window.py 2013-08-03 17:19:25 +0000 |
164 | @@ -5,7 +5,7 @@ |
165 | # under the terms of the GNU General Public License version 3, as published |
166 | # by the Free Software Foundation. |
167 | |
168 | -"""RSS Reader app autopilot emulators.""" |
169 | +"""Rss Reader app autopilot emulators.""" |
170 | |
171 | |
172 | class MainWindow(object): |
173 | @@ -16,9 +16,49 @@ |
174 | def __init__(self, app): |
175 | self.app = app |
176 | |
177 | - def get_qml_view(self): |
178 | - """Get the main QML view""" |
179 | - return self.app.select_single("QQuickView") |
180 | - |
181 | - def get_toolbar(self): |
182 | - return self.app.select_single("Toolbar") |
183 | + def get_action_popover(self): |
184 | + # Returns all instances, but with current one as first index |
185 | + return self.app.select_many("ActionSelectionPopover")[0] |
186 | + |
187 | + def get_append_feed_input_box(self): |
188 | + return self.app.select_single("TextField", objectName = "tfFeedUrl") |
189 | + |
190 | + def get_new_topic_input_box(self): |
191 | + return self.app.select_single("TextField", objectName = "New topic") |
192 | + |
193 | + def get_topics(self): |
194 | + return self.app.select_single('QQuickListView', objectName = 'topiclist') |
195 | + |
196 | + def get_manage_topics_page(self): |
197 | + return self.app.select_single('ManageTopicsPage') |
198 | + |
199 | + def get_canonical_topic(self): |
200 | + itemList = self.app.select_many('LabelVisual', text = 'CanonicalTopic') |
201 | + index = -1 |
202 | + for item in itemList: |
203 | + index += 1 |
204 | + if item.text == "CanonicalTopic": |
205 | + return itemList[index] |
206 | + |
207 | +## def get_canonical_feed_labelvisual(self): |
208 | +## return self.app.select_single('LabelVisual', text = 'Canonical') |
209 | + |
210 | + def get_canonical_feed_labelvisual(self): |
211 | + itemList = self.app.select_many('LabelVisual', text = 'Canonical') |
212 | + index = -1 |
213 | + for item in itemList: |
214 | + index += 1 |
215 | + if item.text == "Canonical": |
216 | + return itemList[index] |
217 | + |
218 | + |
219 | + def get_canonical_feed(self): |
220 | + itemList = self.app.select_many('Standard', objectName = 'FeedListItem') |
221 | + index = -1 |
222 | + for item in itemList: |
223 | + index += 1 |
224 | + if item.text == "Canonical": |
225 | + return itemList[index] |
226 | + |
227 | + def get_header(self): |
228 | + return self.app.select_many("Header") |
229 | |
230 | === added file 'tests/autopilot/ubuntu_rssreader_app/emulators/ubuntusdk.py' |
231 | --- tests/autopilot/ubuntu_rssreader_app/emulators/ubuntusdk.py 1970-01-01 00:00:00 +0000 |
232 | +++ tests/autopilot/ubuntu_rssreader_app/emulators/ubuntusdk.py 2013-08-03 17:19:25 +0000 |
233 | @@ -0,0 +1,153 @@ |
234 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
235 | +# |
236 | +# Copyright (C) 2013 Canonical Ltd |
237 | +# |
238 | +# This program is free software: you can redistribute it and/or modify |
239 | +# it under the terms of the GNU General Public License version 3 as |
240 | +# published by the Free Software Foundation. |
241 | +# |
242 | +# This program is distributed in the hope that it will be useful, |
243 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
244 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
245 | +# GNU General Public License for more details. |
246 | +# |
247 | +# You should have received a copy of the GNU General Public License |
248 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
249 | +# |
250 | +# Authored by: Nicholas Skaggs <nicholas.skaggs@canonical.com> |
251 | + |
252 | + |
253 | +class ubuntusdk(object): |
254 | + """An emulator class that makes it easy to interact with the ubuntu sdk |
255 | + applications.""" |
256 | + |
257 | + def __init__(self, autopilot, app): |
258 | + self.app = app |
259 | + self.autopilot = autopilot |
260 | + |
261 | + def get_qml_view(self): |
262 | + """Get the main QML view""" |
263 | + return self.app.select_single("QQuickView") |
264 | + |
265 | + def get_object(self, typeName, name): |
266 | + """Get a specific object""" |
267 | + return self.app.select_single(typeName, objectName=name) |
268 | + |
269 | + def get_objects(self, typeName, name): |
270 | + """Get more than one object""" |
271 | + return self.app.select_many(typeName, objectName=name) |
272 | + |
273 | + def switch_to_tab(self, tab): |
274 | + """Switch to the specified tab number""" |
275 | + tabs = self.get_tabs() |
276 | + currentTab = tabs.selectedTabIndex |
277 | + |
278 | + #perform operations until tab == currentTab |
279 | + while tab != currentTab: |
280 | + if tab > currentTab: |
281 | + self._previous_tab() |
282 | + if tab < currentTab: |
283 | + self._next_tab() |
284 | + currentTab = tabs.selectedTabIndex |
285 | + |
286 | + def toggle_toolbar(self): |
287 | + """Toggle the toolbar between revealed and hidden""" |
288 | + #check and see if the toolbar is open or not |
289 | + if self.get_toolbar().opened: |
290 | + self.hide_toolbar() |
291 | + else: |
292 | + self.open_toolbar() |
293 | + |
294 | + def get_toolbar(self): |
295 | + """Returns the toolbar in the main events view.""" |
296 | + return self.app.select_single("Toolbar") |
297 | + |
298 | + def get_toolbar_button(self, buttonLabel): |
299 | + """Returns the toolbar button at position index""" |
300 | + toolbar = self.get_toolbar() |
301 | + if not toolbar.opened: |
302 | + self.open_toolbar() |
303 | + row = toolbar.select_single("ToolbarItems") |
304 | + buttonList = row.select_many("ActionItem") |
305 | + for button in buttonList: |
306 | + if button.text == buttonLabel: |
307 | + return button |
308 | + |
309 | + def click_toolbar_button(self, buttonLabel): |
310 | + """Clicks the toolbar button with buttonLabel""" |
311 | + #The toolbar button is assumed to be the following format |
312 | + #ToolbarActions { |
313 | + # Action { |
314 | + # objectName: "name" |
315 | + # text: value |
316 | + button = self.get_toolbar_button(buttonLabel) |
317 | + self.autopilot.pointing_device.click_object(button) |
318 | + |
319 | + def open_toolbar(self): |
320 | + """Open the toolbar""" |
321 | + qmlView = self.get_qml_view() |
322 | + |
323 | + lineX = qmlView.x + qmlView.width * 0.50 |
324 | + startY = qmlView.y + qmlView.height - 1 |
325 | + stopY = qmlView.y + qmlView.height * 0.95 |
326 | + |
327 | + self.autopilot.pointing_device.drag(lineX, startY, lineX, stopY) |
328 | + |
329 | + def hide_toolbar(self): |
330 | + """Hide the toolbar""" |
331 | + qmlView = self.get_qml_view() |
332 | + |
333 | + lineX = qmlView.x + qmlView.width * 0.50 |
334 | + startY = qmlView.y + qmlView.height * 0.95 |
335 | + stopY = qmlView.y + qmlView.height - 1 |
336 | + |
337 | + self.autopilot.pointing_device.drag(lineX, startY, lineX, stopY) |
338 | + |
339 | + def set_popup_value(self, popover, button, value): |
340 | + """Changes the given popover selector to the request value |
341 | + At the moment this only works for values that are currently visible. To |
342 | + access the remaining items, a help method to drag and recheck is |
343 | + needed.""" |
344 | + #The popover is assumed to be the following format |
345 | + # Popover { |
346 | + # Column { |
347 | + # ListView { |
348 | + # delegate: Standard { |
349 | + # objectName: "name" |
350 | + # text: value |
351 | + |
352 | + self.autopilot.pointing_device.click_object(button) |
353 | + # we'll get all matching objects, incase the popover is reused between |
354 | + # buttons |
355 | + itemList = lambda: self.get_objects("Standard", popover) |
356 | + |
357 | + for item in itemList(): |
358 | + if item.get_properties()['text'] == value: |
359 | + self.autopilot.pointing_device.click_object(item) |
360 | + |
361 | + def get_tabs(self): |
362 | + """Return all tabs""" |
363 | + return self.get_object("Tabs", "rootTabs") |
364 | + |
365 | + def _previous_tab(self): |
366 | + """Switch to the previous tab""" |
367 | + qmlView = self.get_qml_view() |
368 | + |
369 | + startX = qmlView.x + qmlView.width * 0.35 |
370 | + stopX = qmlView.x + qmlView.width * 0.50 |
371 | + lineY = qmlView.y + qmlView.height * 0.05 |
372 | + |
373 | + self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY) |
374 | + self.autopilot.pointing_device.click() |
375 | + self.autopilot.pointing_device.click() |
376 | + |
377 | + def _next_tab(self): |
378 | + """Switch to the next tab""" |
379 | + qmlView = self.get_qml_view() |
380 | + |
381 | + startX = qmlView.x + qmlView.width * 0.50 |
382 | + stopX = qmlView.x + qmlView.width * 0.35 |
383 | + lineY = qmlView.y + qmlView.height * 0.05 |
384 | + |
385 | + self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY) |
386 | + self.autopilot.pointing_device.click() |
387 | |
388 | === modified file 'tests/autopilot/ubuntu_rssreader_app/tests/__init__.py' |
389 | --- tests/autopilot/ubuntu_rssreader_app/tests/__init__.py 2013-05-31 12:59:55 +0000 |
390 | +++ tests/autopilot/ubuntu_rssreader_app/tests/__init__.py 2013-08-03 17:19:25 +0000 |
391 | @@ -5,7 +5,7 @@ |
392 | # under the terms of the GNU General Public License version 3, as published |
393 | # by the Free Software Foundation. |
394 | |
395 | -"""RSSReader app autopilot tests.""" |
396 | +"""Rssreader app autopilot tests.""" |
397 | |
398 | import os.path |
399 | |
400 | @@ -13,13 +13,17 @@ |
401 | from autopilot.platform import model |
402 | from autopilot.testcase import AutopilotTestCase |
403 | |
404 | +from time import sleep |
405 | + |
406 | from ubuntu_rssreader_app.emulators.main_window import MainWindow |
407 | +from ubuntu_rssreader_app.emulators.ubuntusdk import ubuntusdk |
408 | + |
409 | |
410 | |
411 | class RssreaderTestCase(AutopilotTestCase): |
412 | |
413 | """A common test case class that provides several useful methods for |
414 | - rrsreader-app tests. |
415 | + rssreader-app tests. |
416 | |
417 | """ |
418 | if model() == 'Desktop': |
419 | @@ -47,9 +51,20 @@ |
420 | self.app = self.launch_test_application( |
421 | "qmlscene", |
422 | "/usr/share/ubuntu-rssreader-app/ubuntu-rssreader-app.qml", |
423 | - "--desktop_file_hint=/usr/share/applications/ubuntu-rssreader-app.desktop", |
424 | + "--desktop_file_hint=" |
425 | + "/usr/share/applications/ubuntu-rssreader-app.desktop", |
426 | app_type='qt') |
427 | |
428 | + def tap_item(self, item): |
429 | + self.pointing_device.move_to_object(item) |
430 | + self.pointing_device.press() |
431 | + sleep(1) |
432 | + self.pointing_device.release() |
433 | + |
434 | @property |
435 | def main_window(self): |
436 | return MainWindow(self.app) |
437 | + |
438 | + @property |
439 | + def ubuntusdk(self): |
440 | + return ubuntusdk(self, self.app) |
441 | |
442 | === added file 'tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py' |
443 | --- tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 1970-01-01 00:00:00 +0000 |
444 | +++ tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 2013-08-03 17:19:25 +0000 |
445 | @@ -0,0 +1,159 @@ |
446 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
447 | +# Copyright 2013 Canonical |
448 | +# |
449 | +# This program is free software: you can redistribute it and/or modify it |
450 | +# under the terms of the GNU General Public License version 3, as published |
451 | +# by the Free Software Foundation. |
452 | + |
453 | +"""RSS Reader app autopilot tests.""" |
454 | + |
455 | +from __future__ import absolute_import |
456 | + |
457 | +import tempfile |
458 | + |
459 | +import mock |
460 | +import os |
461 | +import os.path |
462 | +import shutil |
463 | + |
464 | +from autopilot.matchers import Eventually |
465 | +from testtools.matchers import Equals |
466 | +from testtools.matchers import NotEquals |
467 | + |
468 | +from autopilot.introspection.dbus import StateNotFoundError |
469 | +from ubuntu_rssreader_app.tests import RssreaderTestCase |
470 | + |
471 | +from time import sleep |
472 | + |
473 | +class TestMainWindow(RssreaderTestCase): |
474 | + |
475 | + def setUp(self): |
476 | + super(TestMainWindow, self).setUp() |
477 | + self.assertThat( |
478 | + self.ubuntusdk.get_qml_view().visible, Eventually(Equals(True))) |
479 | + |
480 | + |
481 | + def test_add_remove_feed_and_topic(self): |
482 | + #toggle toolbar |
483 | + self.ubuntusdk.toggle_toolbar() |
484 | + |
485 | + #click on add reads toolbar button |
486 | + self.ubuntusdk.click_toolbar_button('Add reads') |
487 | + |
488 | + #click on add feeds popover action |
489 | + addReadsPopover = self.main_window.get_action_popover() |
490 | + self._run_action(addReadsPopover, '+ Add feeds') |
491 | + |
492 | + #verify Append Feed page is open |
493 | + header = self.main_window.get_header()[0] |
494 | + self.assertThat(header.title, Eventually(Equals("Append feed"))) |
495 | + |
496 | + #type feed in input field |
497 | + new_Feed_Url = self.main_window.get_append_feed_input_box() |
498 | + self.assertThat(new_Feed_Url, NotEquals(None)) |
499 | + self.pointing_device.click_object(new_Feed_Url) |
500 | + self.keyboard.type("http://www.canonical.com/rss.xml") |
501 | + self.keyboard.type("\n") |
502 | + self.assertThat(new_Feed_Url.text, Eventually(Equals("http://www.canonical.com/rss.xml"))) |
503 | + #---> TODO fix this |
504 | + sleep(1) |
505 | + |
506 | + #check that feed is updated, not empty |
507 | + canonicalFeed = self.main_window.get_canonical_feed_labelvisual() |
508 | + self.assertThat(canonicalFeed.text, Eventually(Equals("Canonical"))) |
509 | + |
510 | + #click on checkbox to confirm feed |
511 | + checkboxBtn = self.ubuntusdk.get_object('CheckBox', "feedCheckbox") |
512 | + lambda: self.assertThat(checkboxBtn, Eventually(NotEquals(None))) |
513 | + self.pointing_device.click_object(checkboxBtn) |
514 | + self.assertThat(checkboxBtn.checked, Eventually(Equals(True))) |
515 | + |
516 | + #click on Next button |
517 | + nextButton = self.ubuntusdk.get_object("Button", "nextButton") |
518 | + lambda: self.assertThat(nextButton, Eventually(NotEquals(None))) |
519 | + self.pointing_device.click_object(nextButton) |
520 | + header = self.main_window.get_header()[0] |
521 | + self.assertThat(header.title, Eventually(Equals("Choose topic"))) |
522 | + |
523 | + #add a new topic |
524 | + new_Topic_Url = self.main_window.get_new_topic_input_box() |
525 | + self.assertThat(new_Topic_Url, NotEquals(None)) |
526 | + self.pointing_device.click_object(new_Topic_Url) |
527 | + self.keyboard.type("CanonicalTopic") |
528 | + self.keyboard.type("\n") |
529 | + |
530 | + #select canonical topic |
531 | + canonicalTopic = self.main_window.get_canonical_topic() |
532 | + self.assertThat(canonicalTopic, NotEquals(None)) |
533 | + self.pointing_device.click_object(canonicalTopic) |
534 | + |
535 | + #remove added Canonical topic |
536 | + self._remove_topic() |
537 | + |
538 | + #check that it's gone |
539 | + canonicalTopic = self.main_window.get_canonical_topic() |
540 | + #---> TODO fix this |
541 | + sleep(1) |
542 | + self.assertThat(canonicalTopic.text, NotEquals("CanonicalTopic")) |
543 | + |
544 | + #remove added Canonical feed |
545 | + self._remove_feed() |
546 | + |
547 | + def _remove_feed(self): |
548 | + #toggle toolbar |
549 | + self.ubuntusdk.toggle_toolbar() |
550 | + #click on back toolbar button |
551 | + header = self.main_window.get_header()[0] |
552 | + self.assertThat(header.title, Eventually(Equals("Topics"))) |
553 | + self.ubuntusdk.click_toolbar_button('Back') |
554 | + |
555 | + header = self.main_window.get_header()[0] |
556 | + self.assertThat(header.title, Eventually(Equals("Feeds"))) |
557 | + |
558 | + #select canonical feed |
559 | + canonicalFeed = self.main_window.get_canonical_feed() |
560 | + self.assertThat(canonicalFeed, NotEquals(None)) |
561 | + self.pointing_device.click_object(canonicalFeed, press_duration=2) |
562 | + |
563 | + #click on Remove popover action |
564 | + removeFeedPopover = self.main_window.get_action_popover() |
565 | + self._run_action(removeFeedPopover, 'Remove') |
566 | + |
567 | + def _remove_topic(self): |
568 | + #toggle toolbar |
569 | + self.ubuntusdk.toggle_toolbar() |
570 | + |
571 | + #click on edit topics toolbar button |
572 | + self.ubuntusdk.click_toolbar_button('Edit topics') |
573 | + header = self.main_window.get_header()[0] |
574 | + self.assertThat(header.title, Eventually(Equals("Feeds"))) |
575 | + |
576 | + self.ubuntusdk.click_toolbar_button('Topics') |
577 | + header = self.main_window.get_header()[0] |
578 | + self.assertThat(header.title, Eventually(Equals("Topics"))) |
579 | + |
580 | + #select and swipe canonical topic |
581 | + canonicalTopic = self.main_window.get_canonical_topic() |
582 | + self.assertThat(canonicalTopic, NotEquals(None)) |
583 | + |
584 | + qmlView = self.ubuntusdk.get_qml_view() |
585 | + topicsPage = self.main_window.get_manage_topics_page() |
586 | + |
587 | + #we have to consider the top tab offset, then create a swipe operation across the width of the page |
588 | + startX = int(topicsPage.x + topicsPage.width * 0.20) |
589 | + stopX = int(topicsPage.x + topicsPage.width * 0.80) |
590 | + tabHeightOffset = qmlView.height - topicsPage.height |
591 | + lineY = int(qmlView.y + canonicalTopic.y + tabHeightOffset) |
592 | + |
593 | + #swipe to remove the topic |
594 | + self.pointing_device.move(startX, lineY) |
595 | + self.pointing_device.drag(startX, lineY, stopX, lineY) |
596 | + |
597 | + def _run_action(self, popover, name): |
598 | + actions = popover.select_many('Empty') |
599 | + requested = None |
600 | + for action in actions: |
601 | + if action.text == name: |
602 | + requested = action |
603 | + self.pointing_device.click_object(requested) |
604 | + |
605 | |
606 | === removed file 'tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py' |
607 | --- tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 2013-07-22 18:24:27 +0000 |
608 | +++ tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 1970-01-01 00:00:00 +0000 |
609 | @@ -1,26 +0,0 @@ |
610 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
611 | -# Copyright 2013 Canonical |
612 | -# |
613 | -# This program is free software: you can redistribute it and/or modify it |
614 | -# under the terms of the GNU General Public License version 3, as published |
615 | -# by the Free Software Foundation. |
616 | - |
617 | -"""RSS Reader app autopilot tests.""" |
618 | - |
619 | -from __future__ import absolute_import |
620 | - |
621 | -from autopilot.matchers import Eventually |
622 | -from testtools.matchers import Equals |
623 | - |
624 | -from ubuntu_rssreader_app.tests import RssreaderTestCase |
625 | - |
626 | - |
627 | -class TestMainWindow(RssreaderTestCase): |
628 | - |
629 | - def setUp(self): |
630 | - super(TestMainWindow, self).setUp() |
631 | - self.assertThat( |
632 | - self.main_window.get_qml_view().visible, Eventually(Equals(True))) |
633 | - |
634 | - def tearDown(self): |
635 | - super(TestMainWindow, self).tearDown() |