Merge lp:~elopio/unity-scope-click/split_scope into lp:unity-scope-click/devel

Proposed by Leo Arias
Status: Merged
Approved by: dobey
Approved revision: 307
Merged at revision: 318
Proposed branch: lp:~elopio/unity-scope-click/split_scope
Merge into: lp:unity-scope-click/devel
Diff against target: 634 lines (+366/-124)
3 files modified
autopilot/unityclickscope/__init__.py (+128/-0)
autopilot/unityclickscope/fake_servers.py (+156/-50)
autopilot/unityclickscope/test_click_scope.py (+82/-74)
To merge this branch: bzr merge lp:~elopio/unity-scope-click/split_scope
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
dobey (community) Approve
Review via email: mp+224926@code.launchpad.net

Commit message

Updated the autopilot tests to use the split scopes.
Updated the tests to use dobey's application.
Moved all the helpers to the unityclickscope namespace, so they can be reused by UX tests.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'autopilot/unityclickscope/__init__.py'
2--- autopilot/unityclickscope/__init__.py 2013-12-28 02:13:26 +0000
3+++ autopilot/unityclickscope/__init__.py 2014-07-07 21:14:23 +0000
4@@ -0,0 +1,128 @@
5+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
6+#
7+# Copyright (C) 2013, 2014 Canonical Ltd.
8+#
9+# This program is free software; you can redistribute it and/or modify
10+# it under the terms of the GNU General Public License version 3, as published
11+# by the Free Software Foundation.
12+#
13+# This program is distributed in the hope that it will be useful,
14+# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+# GNU General Public License for more details.
17+#
18+# You should have received a copy of the GNU General Public License
19+# along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
21+import logging
22+
23+import autopilot.logging
24+import ubuntuuitoolkit
25+from autopilot.introspection import dbus as autopilot_dbus
26+from testtools.matchers import Equals, MatchesAny
27+from unity8.shell.emulators import dash
28+
29+
30+logger = logging.getLogger(__name__)
31+
32+
33+class GenericScopeView(dash.DashApps):
34+
35+ """Autopilot helper for the generic scope view of the store."""
36+
37+ # XXX We need to set an objectName to this scope, so we can put a different
38+ # name to this custom proxy object class. --elopio - 2014-06-28
39+
40+ def enter_search_query(self, query):
41+ # TODO once http://pad.lv/1335551 is fixed, we can use the search
42+ # helpers from unity. --elopio - 2014-06-28
43+ search_text_field = self._get_search_text_field()
44+ search_text_field.write(query)
45+ search_text_field.state.wait_for('idle')
46+
47+ def _get_search_text_field(self):
48+ page_header = self._get_scope_item_header()
49+ search_container = page_header.select_single(
50+ 'QQuickItem', objectName='searchContainer')
51+ search_container.state.wait_for(
52+ MatchesAny(Equals('narrowActive'), Equals('active')))
53+ return search_container.select_single(ubuntuuitoolkit.TextField)
54+
55+ def _get_scope_item_header(self):
56+ return self._get_scope_item().select_single(
57+ 'PageHeader', objectName='')
58+
59+ def _get_scope_item(self):
60+ return self.get_root_instance().select_single('ScopeItem')
61+
62+ @autopilot.logging.log_action(logger.info)
63+ def open_preview(self, category, app_name):
64+ """Open the preview of an application.
65+
66+ :parameter category: The name of the category where the application is.
67+ :parameter app_name: The name of the application.
68+ :return: The opened preview.
69+
70+ """
71+ category_element = self._get_category_element(category)
72+ icon = category_element.select_single('AbstractButton', title=app_name)
73+ self.pointing_device.click_object(icon)
74+ # TODO assign an object name to this preview list view.
75+ # --elopio - 2014-06-29
76+ preview_list = self._get_scope_item().wait_select_single(
77+ 'PreviewListView', objectName='')
78+ preview_list.x.wait_for(0)
79+ return preview_list.select_single(
80+ Preview, objectName='preview{}'.format(preview_list.currentIndex))
81+
82+
83+class DashApps(dash.DashApps):
84+
85+ """Autopilot helper for the applicatios scope."""
86+
87+ @autopilot.logging.log_action(logger.info)
88+ def go_to_store(self):
89+ """Open the applications store.
90+
91+ :return: The store Scope View.
92+
93+ """
94+ # TODO call click_scope_item once the fix for bug http://pad.lv/1335548
95+ # lands. --elopio - 2014-06-28
96+ category_element = self._get_category_element('store')
97+ icon = category_element.select_single(
98+ 'AbstractButton', title='Ubuntu Store')
99+ self.pointing_device.click_object(icon)
100+ scope_item = self.get_root_instance().select_single('ScopeItem')
101+ scope_item.x.wait_for(0)
102+ return scope_item.select_single(GenericScopeView)
103+
104+
105+class Preview(dash.Preview):
106+
107+ """Autopilot helper for the application preview."""
108+
109+ def get_details(self):
110+ """Return the details of the application whose preview is open."""
111+ header_widget = self.select_single('PreviewWidget', objectName='hdr')
112+ title_label = header_widget.select_single(
113+ 'Label', objectName='titleLabel')
114+ subtitle_label = header_widget.select_single(
115+ 'Label', objectName='subtitleLabel')
116+ return dict(
117+ title=title_label.text, subtitle=subtitle_label.text)
118+
119+ def install(self):
120+ parent = self.get_parent()
121+ install_button = self.select_single(
122+ 'PreviewActionButton', objectName='buttoninstall_click')
123+ self.pointing_device.click_object(install_button)
124+ self.implicitHeight.wait_for(0)
125+ parent.ready.wait_for(True)
126+
127+ def is_progress_bar_visible(self):
128+ try:
129+ self.select_single('ProgressBar', objectName='progressBar')
130+ return True
131+ except autopilot_dbus.StateNotFoundError:
132+ return False
133
134=== modified file 'autopilot/unityclickscope/fake_servers.py'
135--- autopilot/unityclickscope/fake_servers.py 2014-05-16 13:09:36 +0000
136+++ autopilot/unityclickscope/fake_servers.py 2014-07-07 21:14:23 +0000
137@@ -17,10 +17,16 @@
138 import copy
139 import http.server
140 import json
141+import logging
142 import os
143 import tempfile
144 import urllib.parse
145
146+import autopilot.logging
147+
148+
149+logger = logging.getLogger(__name__)
150+
151
152 class BaseFakeHTTPRequestHandler(http.server.BaseHTTPRequestHandler):
153
154@@ -55,71 +61,167 @@
155 class FakeSearchRequestHandler(BaseFakeHTTPRequestHandler):
156
157 _SEARCH_PATH = '/api/v1/search'
158- _FAKE_SEARCH_RESPONSE_DICT = [
159- {
160- 'resource_url': 'https://TODO/api/v1/package/com.ubuntu.shorts',
161- 'icon_url': '{U1_SEARCH_BASE_URL}extra/shorts.png',
162- 'price': 0.0,
163- 'name': 'com.ubuntu.shorts',
164- 'title': 'Shorts'
165+ _FAKE_DELTA_RESULTS = {
166+ "publisher": "Rodney Dawes",
167+ "_links": {
168+ "self": {
169+ "href": (
170+ "{U1_SEARCH_BASE_URL}api/v1/"
171+ "package/com.ubuntu.developer.dobey.delta-web")
172+ }
173+ },
174+ "architecture": ["all"],
175+ "title": "Delta",
176+ "icon_url": "http://TODO/delta-web.png",
177+ "price": 0.0,
178+ "name": "com.ubuntu.developer.dobey.delta-web"
179+ }
180+ _FAKE_SEARCH_RESPONSE_DICT = {
181+ "_embedded": {
182+ "clickindex:package": [_FAKE_DELTA_RESULTS]
183+ },
184+ }
185+ _FAKE_DELTA_DETAILS_DICT = {
186+ "website": "",
187+ "description": (
188+ "A simple web app for Delta.\n"
189+ "Check in, view flight schedules, and book flights, on the Delta "
190+ "mobile web site."),
191+ "price": 0.0,
192+ "date_published": "2014-05-03T15:30:16.431511Z",
193+ "framework": ["ubuntu-sdk-14.04-qml-dev1"],
194+ "terms_of_service": "",
195+ "prices": {"USD": 0.0},
196+ "screenshot_url": "http://TODO/delta-web-checkin.png",
197+ "category": "Utility",
198+ "publisher": "Rodney Dawes",
199+ "name": "com.ubuntu.developer.dobey.delta-web",
200+ "license": "GNU GPL v3",
201+ "title": "Delta",
202+ "support_url": "https://launchpad.net/~dobey",
203+ "icon_url": "http://TODO/delta-web.png",
204+ "changelog": "",
205+ "binary_filesize": 23728,
206+ "download_url": (
207+ '{DOWNLOAD_BASE_URL}download/delta-dummy.click'),
208+ "click_version": "0.1",
209+ "developer_name": "Rodney Dawes",
210+ "version": "1.0.1",
211+ "company_name": "",
212+ "keywords": [
213+ "delta",
214+ "airlines",
215+ "flight",
216+ "status",
217+ "schedules"
218+ ],
219+ "department": ["Accessories"],
220+ "screenshot_urls": [
221+ "http://TODO/delta-web-checkin.png",
222+ "https://TODO/delta-web-main.png"
223+ ],
224+ "architecture": ["all"]
225+ }
226+ _FAKE_DETAILS = {
227+ 'com.ubuntu.developer.dobey.delta-web': _FAKE_DELTA_DETAILS_DICT
228+ }
229+ _FAKE_INDEX = {
230+ "_embedded": {
231+ "clickindex:department": [
232+ {
233+ "has_children": False,
234+ "_links": {
235+ "self": {
236+ "href": (
237+ "{U1_SEARCH_BASE_URL}api/v1/departments/"
238+ "accessories")
239+ }
240+ },
241+ "name": "Accessories",
242+ "slug": "accesories"
243+ },
244+ ],
245+ "clickindex:highlight": [
246+ {
247+ "_embedded": {
248+ "clickindex:package": [_FAKE_DELTA_RESULTS],
249+ },
250+ "_links": {
251+ "self": {
252+ "href": (
253+ "{U1_SEARCH_BASE_URL}api/v1/highlights/"
254+ "travel-apps")
255+ }
256+ },
257+ "name": "Travel apps",
258+ "slug": "travel-apps"
259+ },
260+ ],
261+ },
262+ '_links': {
263+ 'clickindex:department': {
264+ 'href': "{U1_SEARCH_BASE_URL}api/v1/departments/{slug}",
265+ 'templated': True,
266+ 'title': 'Department'
267+ },
268+ 'clickindex:departments': {
269+ 'href': "{U1_SEARCH_BASE_URL}api/v1/departments",
270+ 'title': 'Departments'
271+ },
272+ 'clickindex:highlight': {
273+ 'href': '{U1_SEARCH_BASE_URL}api/v1/highlights/{slug}',
274+ 'templated': True,
275+ 'title': 'Highlight'
276+ },
277+ 'clickindex:highlights': {
278+ 'href': '{U1_SEARCH_BASE_URL}api/v1/highlights',
279+ 'title': 'Highlights'
280+ },
281+ 'clickindex:package': {
282+ 'href': '{U1_SEARCH_BASE_URL}api/v1/package/{name}',
283+ 'templated': True,
284+ 'title': 'Package'
285+ },
286+ 'curies': [
287+ {
288+ 'href': '{U1_SEARCH_BASE_URL}docs/v1/relations.html{#rel}',
289+ 'name': 'clickindex',
290+ 'templated': True
291+ }
292+ ],
293+ 'search': {
294+ 'href': '{U1_SEARCH_BASE_URL}api/v1/search{?q}',
295+ 'templated': True,
296+ 'title': 'Search'
297+ },
298+ 'self': {
299+ 'href': '{U1_SEARCH_BASE_URL}api/v1'
300+ }
301 }
302- ]
303- _FAKE_SHORTS_DETAILS_DICT = {
304- 'website': 'https://launchpad.net/ubuntu-rssreader-app',
305- 'description': (
306- 'Shorts is an rssreader application\n'
307- 'Shorts is an rss reader application that allows you to easily '
308- 'search for new feeds.'),
309- 'price': 0.0,
310- 'framework': ["ubuntu-sdk-13.10"],
311- 'terms_of_service': '',
312- 'prices': {'USD': 0.0},
313- 'screenshot_url': 'https://TODO/shorts0.png',
314- 'date_published': '2013-10-16T15:58:52.469000',
315- 'publisher': 'Ubuntu Click Loader',
316- 'name': 'com.ubuntu.shorts',
317- 'license': 'GNU GPL v3',
318- 'changelog': 'Test fixes',
319- 'support_url': 'mailto:ubuntu-touch-coreapps@lists.launchpad.net',
320- 'icon_url': 'https://TODO/shorts.png',
321- 'title': 'Shorts',
322- 'binary_filesize': 164944,
323- 'download_url': (
324- '{DOWNLOAD_BASE_URL}download/shorts-dummy.click'),
325- 'click_version': '0.1',
326- 'developer_name': 'Ubuntu Click Loader',
327- 'version': '0.2.152',
328- 'company_name': '',
329- 'keywords': ['shorts', 'rss', 'news'],
330- 'screenshot_urls': [
331- 'https://TODO/shorts0.png',
332- 'https://TODO/shorts1.png'
333- ],
334- 'architecture': ['all']
335- }
336- _FAKE_DETAILS = {
337- 'com.ubuntu.shorts': _FAKE_SHORTS_DETAILS_DICT
338 }
339
340 def do_GET(self):
341 parsed_path = urllib.parse.urlparse(self.path)
342 if parsed_path.path.startswith(self._SEARCH_PATH):
343- self.send_json_reply(200, self._get_fake_search_response())
344+ self.send_search_results()
345 elif parsed_path.path.startswith('/extra/'):
346 self.send_file(parsed_path.path[1:])
347 elif parsed_path.path.startswith('/api/v1/package/'):
348 package = parsed_path.path[16:]
349 self.send_package_details(package)
350+ elif parsed_path.path.startswith('/api/v1'):
351+ self.send_index()
352 else:
353+ logger.error(
354+ 'Not implemented path in fake server: {}'.format(self.path))
355 raise NotImplementedError(self.path)
356
357- def _get_fake_search_response(self):
358- fake_search_response = copy.deepcopy(self._FAKE_SEARCH_RESPONSE_DICT)
359- for result in fake_search_response:
360- result['icon_url'] = result['icon_url'].format(
361- U1_SEARCH_BASE_URL=os.environ.get('U1_SEARCH_BASE_URL'))
362- return json.dumps(fake_search_response)
363+ @autopilot.logging.log_action(logger.debug)
364+ def send_search_results(self):
365+ results = json.dumps(self._FAKE_SEARCH_RESPONSE_DICT)
366+ self.send_json_reply(200, results)
367
368+ @autopilot.logging.log_action(logger.debug)
369 def send_package_details(self, package):
370 details = copy.deepcopy(self._FAKE_DETAILS.get(package, None))
371 if details is not None:
372@@ -130,6 +232,10 @@
373 else:
374 raise NotImplementedError(package)
375
376+ @autopilot.logging.log_action(logger.debug)
377+ def send_index(self):
378+ self.send_json_reply(200, json.dumps(self._FAKE_INDEX))
379+
380
381 class FakeDownloadServer(http.server.HTTPServer, object):
382
383
384=== modified file 'autopilot/unityclickscope/test_click_scope.py'
385--- autopilot/unityclickscope/test_click_scope.py 2014-05-26 08:06:08 +0000
386+++ autopilot/unityclickscope/test_click_scope.py 2014-07-07 21:14:23 +0000
387@@ -21,14 +21,12 @@
388
389 import dbusmock
390 import fixtures
391-from autopilot.introspection import dbus as autopilot_dbus
392 from autopilot.matchers import Eventually
393 from testtools.matchers import Equals
394 from unity8 import process_helpers
395 from unity8.shell import tests as unity_tests
396-from unity8.shell.emulators import dash
397-
398-
399+
400+import unityclickscope
401 from unityclickscope import credentials, fake_services, fixture_setup
402
403
404@@ -53,11 +51,14 @@
405
406 # We use fake servers by default because the current Jenkins
407 # configuration does not let us override the variables.
408- if os.environ.get('U1_SEARCH_BASE_URL', 'fake') == 'fake':
409- self._use_fake_server()
410 if os.environ.get('DOWNLOAD_BASE_URL', 'fake') == 'fake':
411 self._use_fake_download_server()
412 self._use_fake_download_service()
413+ if os.environ.get('U1_SEARCH_BASE_URL', 'fake') == 'fake':
414+ self._use_fake_server()
415+
416+ self.useFixture(fixtures.EnvironmentVariable('U1_DEBUG', newvalue='1'))
417+ self._restart_scopes()
418
419 unity_proxy = self.launch_unity()
420 process_helpers.unlock_unity(unity_proxy)
421@@ -69,7 +70,6 @@
422 self.useFixture(fake_search_server)
423 self.useFixture(fixtures.EnvironmentVariable(
424 'U1_SEARCH_BASE_URL', newvalue=fake_search_server.url))
425- self._restart_scope()
426
427 def _use_fake_download_server(self):
428 fake_download_server = fixture_setup.FakeDownloadServerRunning()
429@@ -106,43 +106,78 @@
430 dbus_mock.terminate()
431 dbus_mock.wait()
432
433- def _restart_scope(self):
434+ def _restart_scopes(self):
435 logging.info('Restarting click scope.')
436+ scope_runner_path = self._get_scoperunner_path()
437+ apps_scope_ini_path, store_scope_ini_path = self._get_scopes_ini_path()
438+
439 os.system('pkill -f -9 clickscope.ini')
440- os.system(
441- "dpkg-architecture -c "
442- "'{scoperunner} \"\" {clickscope}' &".format(
443- scoperunner=self._get_scoperunner_path(),
444- clickscope=self._get_scope_ini_path()))
445+ os.system('pkill -f -9 clickstore.ini')
446+
447+ os.system('{scoperunner} "" {appsscope} &'.format(
448+ scoperunner=scope_runner_path,
449+ appsscope=apps_scope_ini_path))
450+
451+ os.system('{scoperunner} "" {storescope} &'.format(
452+ scoperunner=scope_runner_path,
453+ storescope=store_scope_ini_path))
454
455 def _get_scoperunner_path(self):
456 return os.path.join(
457 self._get_installed_unity_scopes_lib_dir(), 'scoperunner')
458
459 def _get_installed_unity_scopes_lib_dir(self):
460- return os.path.join('/usr/lib/$DEB_HOST_MULTIARCH/', 'unity-scopes')
461+ arch = subprocess.check_output(
462+ ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"],
463+ universal_newlines=True).strip()
464+ return os.path.join('/usr/lib/{}/'.format(arch), 'unity-scopes')
465
466- def _get_scope_ini_path(self):
467+ def _get_scopes_ini_path(self):
468 build_dir = os.environ.get('BUILD_DIR', None)
469 if build_dir is not None:
470- return self._get_built_scope_ini_path(build_dir)
471+ return self._get_built_scopes_ini_path(build_dir)
472 else:
473- return os.path.join(
474- self._get_installed_unity_scopes_lib_dir(),
475- 'clickscope', 'clickscope.ini')
476+ app_scope_ini_path = os.path.join(
477+ self._get_installed_unity_scopes_lib_dir(),
478+ 'clickapps', 'clickscope.ini')
479+ store_scope_ini_path = os.path.join(
480+ self._get_installed_unity_scopes_lib_dir(),
481+ 'clickstore', 'com.canonical.scopes.clickstore.ini')
482+ return app_scope_ini_path, store_scope_ini_path
483
484- def _get_built_scope_ini_path(self, build_dir):
485+ def _get_built_scopes_ini_path(self, build_dir):
486 # The ini and the so files need to be on the same directory.
487 # We copy them to a temp directory.
488 temp_dir_fixture = fixtures.TempDir()
489 self.useFixture(temp_dir_fixture)
490- shutil.copy(
491- os.path.join(build_dir, 'data', 'clickscope.ini'),
492- temp_dir_fixture.path)
493- shutil.copy(
494- os.path.join(build_dir, 'scope', 'click', 'libclickscope.so'),
495- temp_dir_fixture.path)
496- return os.path.join(temp_dir_fixture.path, 'clickscope.ini')
497+
498+ built_apps_scope_ini = os.path.join(
499+ build_dir, 'data', 'clickscope.ini')
500+ temp_apps_scope_dir = os.path.join(temp_dir_fixture.path, 'clickapps')
501+ os.mkdir(temp_apps_scope_dir)
502+ shutil.copy(built_apps_scope_ini, temp_apps_scope_dir)
503+
504+ built_apps_scope = os.path.join(
505+ build_dir, 'scope', 'clickapps', 'scope.so')
506+ shutil.copy(built_apps_scope, temp_apps_scope_dir)
507+
508+ built_store_scope_ini = os.path.join(
509+ build_dir, 'data', 'com.canonical.scopes.clickstore.ini')
510+ temp_store_scope_dir = os.path.join(
511+ temp_dir_fixture.path, 'clickstore')
512+ os.mkdir(temp_store_scope_dir)
513+ shutil.copy(built_store_scope_ini, temp_store_scope_dir)
514+
515+ built_store_scope = os.path.join(
516+ build_dir, 'scope', 'clickstore',
517+ 'com.canonical.scopes.clickstore.so')
518+ shutil.copy(built_store_scope, temp_store_scope_dir)
519+
520+ app_scope_ini_path = os.path.join(
521+ temp_apps_scope_dir, 'clickscope.ini')
522+ store_scope_ini_path = os.path.join(
523+ temp_store_scope_dir, 'com.canonical.scopes.clickstore.ini')
524+ return app_scope_ini_path, store_scope_ini_path
525
526 def _unlock_screen(self):
527 self.main_window.get_greeter().swipe()
528@@ -155,8 +190,8 @@
529 def search(self, query):
530 search_indicator = self._proxy.select_single(
531 'SearchIndicator', objectName='search')
532- self.touch.tap_object(search_indicator)
533- self.dash.enter_search_query(query)
534+ search_indicator.pointing_device.click_object(search_indicator)
535+ self.scope.enter_search_query(query)
536
537 def open_app_preview(self, category, name):
538 self.search(name)
539@@ -172,40 +207,46 @@
540 self.assertThat(scope.isCurrent, Equals(True))
541
542
543-class TestCaseWithClickScopeOpen(BaseClickScopeTestCase):
544+class BaseTestCaseWithStoreScopeOpen(BaseClickScopeTestCase):
545
546 def setUp(self):
547- super(TestCaseWithClickScopeOpen, self).setUp()
548- self.scope = self.open_scope()
549+ super(BaseTestCaseWithStoreScopeOpen, self).setUp()
550+ app_scope = self.open_scope()
551+ self.scope = app_scope.go_to_store()
552+
553+
554+class TestCaseWithStoreScopeOpen(BaseTestCaseWithStoreScopeOpen):
555
556 def test_search_available_app(self):
557- self.search('Shorts')
558+ self.search('Delta')
559 applications = self.scope.get_applications('appstore')
560- self.assertThat(applications[0], Equals('Shorts'))
561+ self.assertThat(applications[0], Equals('Delta'))
562
563 def test_open_app_preview(self):
564 expected_details = dict(
565- title='Shorts', subtitle='Ubuntu Click Loader')
566- preview = self.open_app_preview('appstore', 'Shorts')
567+ title='Delta', subtitle='Rodney Dawes')
568+ preview = self.open_app_preview('appstore', 'Delta')
569 details = preview.get_details()
570 self.assertEqual(details, expected_details)
571
572 def test_install_without_credentials(self):
573- preview = self.open_app_preview('appstore', 'Shorts')
574+ preview = self.open_app_preview('appstore', 'Delta')
575 preview.install()
576- error = self.dash.wait_select_single(Preview)
577+ error = self.dash.wait_select_single(unityclickscope.Preview)
578
579 details = error.get_details()
580 self.assertEqual('Login Error', details.get('title'))
581
582
583-class ClickScopeTestCaseWithCredentials(BaseClickScopeTestCase):
584+class ClickScopeTestCaseWithCredentials(BaseTestCaseWithStoreScopeOpen):
585
586 def setUp(self):
587+ self.skipTest(
588+ 'We cannot add credentials yet because the keyring dialog will be '
589+ 'opened prompting for a password. http://pad.lv/1338714')
590 self.add_u1_credentials()
591 super(ClickScopeTestCaseWithCredentials, self).setUp()
592- self.scope = self.open_scope()
593- self.preview = self.open_app_preview('appstore', 'Shorts')
594+ self.preview = self.open_app_preview('appstore', 'Delta')
595
596 def add_u1_credentials(self):
597 account_manager = credentials.AccountManager()
598@@ -224,36 +265,3 @@
599 self.preview.install()
600 self.assertThat(
601 self.preview.is_progress_bar_visible, Eventually(Equals(True)))
602-
603-
604-class DashApps(dash.DashApps):
605- """Autopilot emulator for the applicatios scope."""
606-
607-
608-class Preview(dash.Preview):
609- """Autopilot emulator for the application preview."""
610-
611- def get_details(self):
612- """Return the details of the application whose preview is open."""
613- header_widget = self.select_single('PreviewWidget', objectName='hdr')
614- title_label = header_widget.select_single(
615- 'Label', objectName='titleLabel')
616- subtitle_label = header_widget.select_single(
617- 'Label', objectName='subtitleLabel')
618- return dict(
619- title=title_label.text, subtitle=subtitle_label.text)
620-
621- def install(self):
622- parent = self.get_parent()
623- install_button = self.select_single(
624- 'PreviewActionButton', objectName='buttoninstall_click')
625- self.pointing_device.click_object(install_button)
626- self.implicitHeight.wait_for(0)
627- parent.ready.wait_for(True)
628-
629- def is_progress_bar_visible(self):
630- try:
631- self.select_single('ProgressBar', objectName='progressBar')
632- return True
633- except autopilot_dbus.StateNotFoundError:
634- return False

Subscribers

People subscribed via source and target branches

to all changes: