Merge lp:~elopio/unity-scope-click/autopilot-open_preview into lp:unity-scope-click

Proposed by Leo Arias
Status: Merged
Approved by: Leo Arias
Approved revision: 110
Merged at revision: 108
Proposed branch: lp:~elopio/unity-scope-click/autopilot-open_preview
Merge into: lp:unity-scope-click
Diff against target: 117 lines (+79/-2)
2 files modified
src/tests/autopilot/unityclickscope/fake_servers.py (+43/-1)
src/tests/autopilot/unityclickscope/test_click_scope.py (+36/-1)
To merge this branch: bzr merge lp:~elopio/unity-scope-click/autopilot-open_preview
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Alejandro J. Cura (community) Approve
Review via email: mp+201797@code.launchpad.net

Commit message

Added the autopilot test to open a preview.

To post a comment you must log in.
Revision history for this message
Leo Arias (elopio) wrote :

Not yet ready. Marking as Needs review to see how jenkins tests fare.

Revision history for this message
Leo Arias (elopio) wrote :

sorry, wrong branch :)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:110
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~elopio/unity-scope-click/autopilot-open_preview/+merge/201797/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity-scope-click-ci/168/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-scope-click-trusty-amd64-ci/66
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-scope-click-trusty-armhf-ci/66

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity-scope-click-ci/168/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Looks good

review: Approve
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 'src/tests/autopilot/unityclickscope/fake_servers.py'
2--- src/tests/autopilot/unityclickscope/fake_servers.py 2014-01-14 00:57:43 +0000
3+++ src/tests/autopilot/unityclickscope/fake_servers.py 2014-01-15 15:15:46 +0000
4@@ -40,13 +40,48 @@
5 'title': 'Shorts'
6 }
7 ]
8+ _FAKE_SHORTS_DETAILS_DICT = {
9+ 'website': 'https://launchpad.net/ubuntu-rssreader-app',
10+ 'description':
11+ 'Shorts is an rssreader application\n'
12+ 'Shorts is an rss reader application that allows you to easily '
13+ 'search for new feeds.',
14+ 'price': 0.0,
15+ 'framework': ["ubuntu-sdk-13.10"],
16+ 'terms_of_service': '',
17+ 'prices': {'USD': 0.0},
18+ 'screenshot_url': 'https://TODO/shorts0.png',
19+ 'date_published': '2013-10-16T15:58:52.469000',
20+ 'publisher': 'Ubuntu Click Loader',
21+ 'name': 'com.ubuntu.shorts',
22+ 'license': 'GNU GPL v3',
23+ 'changelog': 'Test fixes',
24+ 'support_url': 'mailto:ubuntu-touch-coreapps@lists.launchpad.net',
25+ 'icon_url': 'https://TODO/shorts.png',
26+ 'title': 'Shorts',
27+ 'binary_filesize': 164944,
28+ 'download_url': 'https://TODO/com.ubuntu.shorts_0.2.152_all.click',
29+ 'click_version': '0.1',
30+ 'developer_name': 'Ubuntu Click Loader',
31+ 'version': '0.2.152',
32+ 'company_name': '',
33+ 'keywords': ['shorts', 'rss', 'news'],
34+ 'screenshot_urls': [
35+ 'https://TODO/shorts0.png',
36+ 'https://TODO/shorts1.png'
37+ ],
38+ 'architecture': ['all']
39+ }
40
41 def do_GET(self):
42 parsed_path = urlparse.urlparse(self.path)
43 if parsed_path.path.startswith(self._SEARCH_PATH):
44 self.send_json_reply(200, self._get_fake_search_response())
45- elif parsed_path.path.startswith("/extra/"):
46+ elif parsed_path.path.startswith('/extra/'):
47 self.send_file(parsed_path.path[1:])
48+ elif parsed_path.path.startswith('/api/v1/package/'):
49+ package = parsed_path.path[16:]
50+ self.send_package_details(package)
51 else:
52 raise NotImplementedError(self.path)
53
54@@ -70,3 +105,10 @@
55 self.send_header('Content-Length', str(len(data)))
56 self.end_headers()
57 self.wfile.write(data)
58+
59+ def send_package_details(self, package):
60+ if package == 'com.ubuntu.shorts':
61+ self.send_json_reply(
62+ 200, json.dumps(self._FAKE_SHORTS_DETAILS_DICT))
63+ else:
64+ raise NotImplementedError(package)
65
66=== modified file 'src/tests/autopilot/unityclickscope/test_click_scope.py'
67--- src/tests/autopilot/unityclickscope/test_click_scope.py 2014-01-14 00:57:43 +0000
68+++ src/tests/autopilot/unityclickscope/test_click_scope.py 2014-01-15 15:15:46 +0000
69@@ -20,8 +20,12 @@
70 import fixtures
71 from autopilot.matchers import Eventually
72 from testtools.matchers import Equals
73+from ubuntuuitoolkit import emulators as toolkit_emulators
74 from unity8 import process_helpers
75-from unity8.shell import tests as unity_tests
76+from unity8.shell import (
77+ emulators as unity_emulators,
78+ tests as unity_tests
79+)
80
81 from unityclickscope import fixture_setup
82
83@@ -100,3 +104,34 @@
84 search_box = self._proxy.select_single("SearchIndicator")
85 self.touch.tap_object(search_box)
86 self.keyboard.type(query)
87+
88+ def test_open_app_preview(self):
89+ expected_details = dict(
90+ title='Shorts', publisher='Ubuntu Click Loader')
91+ preview = self._open_app_preview('Shorts')
92+ details = preview.get_details()
93+ self.assertEqual(details, expected_details)
94+
95+ def _open_app_preview(self, name):
96+ self._search(name)
97+ icon = self.scope.wait_select_single('Tile', text=name)
98+ pointing_device = toolkit_emulators.get_pointing_device()
99+ pointing_device.click_object(icon)
100+ return self.dash.wait_select_single(AppPreview)
101+
102+
103+# TODO move this to unity. --elopio - 2014-1-14
104+class AppPreview(unity_emulators.UnityEmulatorBase):
105+ """Autopilot emulator for the application preview."""
106+
107+ def get_details(self):
108+ """Return the details of the application whose preview is open."""
109+ title = self.select_single('Label', objectName='titleLabel').text
110+ publisher = self.select_single(
111+ 'Label', objectName='subtitleLabel').text
112+ # The description label doesn't have an object name. Reported as bug
113+ # http://pad.lv/1269114 -- elopio - 2014-1-14
114+ # description = self.select_single(
115+ # 'Label', objectName='descriptionLabel').text
116+ # TODO check screenshots, icon, rating and reviews.
117+ return dict(title=title, publisher=publisher)

Subscribers

People subscribed via source and target branches

to all changes: