Merge lp:~diegosarmentero/pay-ui/initial-autopilot into lp:pay-ui
- initial-autopilot
- Merge into first-branch
Status: | Merged |
---|---|
Approved by: | Alejandro J. Cura |
Approved revision: | 39 |
Merged at revision: | 21 |
Proposed branch: | lp:~diegosarmentero/pay-ui/initial-autopilot |
Merge into: | lp:pay-ui |
Diff against target: |
496 lines (+398/-4) 9 files modified
HACKING (+36/-0) app/payui.qml (+1/-0) app/ui/DirectPurchase.qml (+3/-3) app/ui/ErrorDialog.qml (+2/-0) backend/modules/payui/network.cpp (+8/-1) tests/autopilot/pay_ui/tests/__init__.py (+78/-0) tests/autopilot/pay_ui/tests/mock_server.py (+188/-0) tests/autopilot/pay_ui/tests/test_pay_ui.py (+81/-0) tests/autopilot/run_autopilot (+1/-0) |
To merge this branch: | bzr merge lp:~diegosarmentero/pay-ui/initial-autopilot |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Alejandro J. Cura (community) | Approve | ||
Review via email: mp+229276@code.launchpad.net |
Commit message
- Adding initial autopilot tests
Description of the change
- 24. By Diego Sarmentero
-
commenting failing tests
- 25. By Diego Sarmentero
-
adding header to mock server
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:25
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 26. By Diego Sarmentero
-
working on autopilot tests
- 27. By Diego Sarmentero
-
uncomment code
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:27
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 28. By Diego Sarmentero
-
basic purchase working
- 29. By Diego Sarmentero
-
remove commented code
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:29
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 30. By Diego Sarmentero
-
adding storage cleaning
- 31. By Diego Sarmentero
-
using fixture for envvar
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:31
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 32. By Diego Sarmentero
-
adding view wallet test
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:32
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 33. By Diego Sarmentero
-
improves in fake server
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:33
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 34. By Diego Sarmentero
-
adding invalid password test case
Alejandro J. Cura (alecu) wrote : | # |
Please add a HACKING file with instructions on how to compile this project, and how to run the autopilot tests. eg: http://
Alejandro J. Cura (alecu) wrote : | # |
Btw, I tried it like shown below, and got all failures.
---
alecu@bollo:
Loading tests from: /home/alecu/
Tests running...
start
stop server
Shutting down
127.0.0.1 - - [06/Aug/2014 20:00:18] "GET /shutdown/ HTTP/1.1" 401 -
=======
ERROR: pay_ui.
-------
Empty attachments:
process-stdout (/usr/lib/
/var/log/syslog: {{{Aug 6 20:00:07 bollo kernel: [ 5460.985404] input: autopilot-finger as /devices/
process-return-code (/usr/lib/
process-stderr (/usr/lib/
Testability driver loaded. Wire protocol version is "1.4".
virtual void OnlineAccounts:
virtual void OnlineAccountsC
file://
}}}
test-log: {{{
20:00:07.338 INFO _launcher:373 - Attempting to launch application '/usr/lib/
20:00:07.343 INFO _launcher:431 - Launching process: ['/usr/
20:00:08.624 INFO _launcher:544 - waiting for process to exit.
20:00:08.625 INFO _launcher:567 - Killing process 11257
20:00:08.625 INFO _launcher:570 - Appears process has already exited.
}}}
Traceback (most recent call last):
File "/home/
super().setUp()
File "/home/
self.app = self.launch_
File "/home/
return self.launch_
File "/home/
emulator_
File "/usr/lib/
return launcher.
File "/usr/lib/
pid=process.pid
File "/usr/lib/
process
File "/usr/lib/
_raise...
- 35. By Diego Sarmentero
-
working on tests
- 36. By Diego Sarmentero
-
only success tests
- 37. By Diego Sarmentero
-
remove print
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:37
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 38. By Diego Sarmentero
-
adding hacking file
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:38
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alejandro J. Cura (alecu) : | # |
Alejandro J. Cura (alecu) wrote : | # |
Otherwise it looks good.
- 39. By Diego Sarmentero
-
fixing hacking file
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:38
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === added file 'HACKING' |
2 | --- HACKING 1970-01-01 00:00:00 +0000 |
3 | +++ HACKING 2014-08-19 14:55:31 +0000 |
4 | @@ -0,0 +1,36 @@ |
5 | +pay-ui hacking guide |
6 | +=============================== |
7 | + |
8 | +Getting pay-ui |
9 | +------------------------- |
10 | + |
11 | +To get the main branch of pay-ui: |
12 | + |
13 | + $ bzr branch lp:pay-ui |
14 | + |
15 | + |
16 | +Getting dependencies |
17 | +-------------------- |
18 | + |
19 | +To succesfully build pay-ui there are a few packages required: |
20 | + |
21 | + $ sudo apt-get install libubuntuoneauth-2.0-dev libqt5webkit5-qmlwebkitplugin |
22 | + |
23 | + |
24 | +Building pay-ui |
25 | +------------------ |
26 | + |
27 | +This app is built using cmake. Here's an example on how to build it: |
28 | + |
29 | + $ mkdir build |
30 | + $ cd build |
31 | + $ cmake .. |
32 | + $ make -j 8 |
33 | + |
34 | + |
35 | +Running the unit tests |
36 | +---------------------- |
37 | + |
38 | + $ cd tests/autopilot |
39 | + $ ./run_autopilot |
40 | + |
41 | |
42 | === modified file 'app/payui.qml' |
43 | --- app/payui.qml 2014-08-11 13:01:18 +0000 |
44 | +++ app/payui.qml 2014-08-19 14:55:31 +0000 |
45 | @@ -303,6 +303,7 @@ |
46 | } |
47 | |
48 | Button { |
49 | + objectName: "buttonCancelLoading" |
50 | text: i18n.tr("Cancel") |
51 | color: UbuntuColors.orange |
52 | onClicked: { |
53 | |
54 | === modified file 'app/ui/DirectPurchase.qml' |
55 | --- app/ui/DirectPurchase.qml 2014-08-11 13:01:18 +0000 |
56 | +++ app/ui/DirectPurchase.qml 2014-08-19 14:55:31 +0000 |
57 | @@ -164,7 +164,7 @@ |
58 | |
59 | Button { |
60 | id: cancelButton |
61 | - objectName: "cancelButton" |
62 | + objectName: "cancelButtonDirect" |
63 | text: i18n.tr("Cancel") |
64 | width: parent.buttonsWidth |
65 | color: "#797979" |
66 | @@ -173,7 +173,7 @@ |
67 | } |
68 | Button { |
69 | id: buyButton |
70 | - objectName: "buyButton" |
71 | + objectName: "buyButtonDirect" |
72 | text: i18n.tr("Buy Now") |
73 | color: UbuntuColors.orange |
74 | width: parent.buttonsWidth |
75 | @@ -188,7 +188,7 @@ |
76 | Label { |
77 | id: paymentTypeLabel |
78 | visible: (pageDirectPayment.hasPayments && passwordField.text.length > 7) ? true : false |
79 | - objectName: "paymentTypeLabel" |
80 | + objectName: "viewWalletLabel" |
81 | textFormat: Text.RichText |
82 | text: '<a href="#"><span style="color: #797979;">%1</span></a>'.arg(i18n.tr("View wallet")) |
83 | anchors { |
84 | |
85 | === modified file 'app/ui/ErrorDialog.qml' |
86 | --- app/ui/ErrorDialog.qml 2014-07-14 19:54:22 +0000 |
87 | +++ app/ui/ErrorDialog.qml 2014-08-19 14:55:31 +0000 |
88 | @@ -43,6 +43,7 @@ |
89 | |
90 | Button { |
91 | text: i18n.tr("Retry") |
92 | + objectName: "retryErrorButton" |
93 | color: UbuntuColors.orange |
94 | onClicked: { |
95 | dialogErrorItem.retry(); |
96 | @@ -52,6 +53,7 @@ |
97 | } |
98 | Button { |
99 | text: i18n.tr("Close") |
100 | + objectName: "closeErrorButton" |
101 | color: UbuntuColors.coolGrey |
102 | onClicked: { |
103 | dialogErrorItem.close(); |
104 | |
105 | === modified file 'backend/modules/payui/network.cpp' |
106 | --- backend/modules/payui/network.cpp 2014-08-01 13:59:30 +0000 |
107 | +++ backend/modules/payui/network.cpp 2014-08-19 14:55:31 +0000 |
108 | @@ -70,7 +70,14 @@ |
109 | |
110 | void Network::getCredentials() |
111 | { |
112 | - m_service.getCredentials(); |
113 | + QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); |
114 | + QString getcreds = environment.value("GET_CREDENTIALS", "1"); |
115 | + if (getcreds == "1") { |
116 | + m_service.getCredentials(); |
117 | + } else { |
118 | + Token token("tokenkey", "tokensecret", "consumerkey", "consumersecret"); |
119 | + handleCredentialsFound(token); |
120 | + } |
121 | } |
122 | |
123 | void Network::setCredentials(Token token) |
124 | |
125 | === added directory 'tests' |
126 | === added directory 'tests/autopilot' |
127 | === added directory 'tests/autopilot/pay_ui' |
128 | === added file 'tests/autopilot/pay_ui/__init__.py' |
129 | === added directory 'tests/autopilot/pay_ui/tests' |
130 | === added file 'tests/autopilot/pay_ui/tests/__init__.py' |
131 | --- tests/autopilot/pay_ui/tests/__init__.py 1970-01-01 00:00:00 +0000 |
132 | +++ tests/autopilot/pay_ui/tests/__init__.py 2014-08-19 14:55:31 +0000 |
133 | @@ -0,0 +1,78 @@ |
134 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
135 | +# |
136 | +# Copyright (C) 2014 Canonical Ltd. |
137 | +# |
138 | +# This program is free software; you can redistribute it and/or modify |
139 | +# it under the terms of the GNU General Public License version 3, as published |
140 | +# by the Free Software Foundation. |
141 | +# |
142 | +# This program is distributed in the hope that it will be useful, |
143 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
144 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
145 | +# GNU General Public License for more details. |
146 | +# |
147 | +# You should have received a copy of the GNU General Public License |
148 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
149 | + |
150 | +import os |
151 | +import tempfile |
152 | +import shutil |
153 | + |
154 | +import fixtures |
155 | +import ubuntuuitoolkit |
156 | +from autopilot import testcase |
157 | +from ubuntuuitoolkit import base |
158 | + |
159 | + |
160 | +class BasePayUITestCase(testcase.AutopilotTestCase): |
161 | + |
162 | + """Base Autopilot test case for the Pay UI project.""" |
163 | + |
164 | + def __init__(self, *args, **kwargs): |
165 | + super(BasePayUITestCase, self).__init__(*args, **kwargs) |
166 | + self.dirpath = None |
167 | + |
168 | + def setUp(self): |
169 | + super().setUp() |
170 | + build_dir = os.environ.get('BUILD_DIR', None) |
171 | + self.app = self.launch_application(build_dir) |
172 | + |
173 | + def create_config_dir(self): |
174 | + self.dirpath = tempfile.mkdtemp() |
175 | + self.useFixture(fixtures.EnvironmentVariable( |
176 | + 'XDG_DATA_HOME', self.dirpath)) |
177 | + |
178 | + def clean_config_dir(self): |
179 | + if self.dirpath: |
180 | + shutil.rmtree(self.dirpath) |
181 | + |
182 | + def launch_application(self, build_dir=None): |
183 | + if build_dir is None: |
184 | + self.launch_installed_app() |
185 | + else: |
186 | + return self.launch_built_application(build_dir) |
187 | + |
188 | + def launch_installed_app(self): |
189 | + raise NotImplementedError() |
190 | + |
191 | + def launch_built_application(self, build_dir): |
192 | + built_import_path = os.path.join(build_dir, 'backend') |
193 | + self.useFixture( |
194 | + fixtures.EnvironmentVariable( |
195 | + 'QML2_IMPORT_PATH', newvalue=built_import_path)) |
196 | + # Shouldn't this be in the builddir too? |
197 | + main_qml_path = '../../app/payui.qml' |
198 | + desktop_file_path = os.path.join(build_dir, 'app', 'payui.desktop') |
199 | + app = self.launch_test_application( |
200 | + base.get_qmlscene_launch_command(), |
201 | + main_qml_path, |
202 | + '--desktop_file_hint={0}'.format(desktop_file_path), |
203 | + app_type='qt', |
204 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
205 | + |
206 | + return app |
207 | + |
208 | + @property |
209 | + def main_view(self): |
210 | + """Return main view""" |
211 | + return self.app.select_single(objectName='mainView') |
212 | |
213 | === added file 'tests/autopilot/pay_ui/tests/mock_server.py' |
214 | --- tests/autopilot/pay_ui/tests/mock_server.py 1970-01-01 00:00:00 +0000 |
215 | +++ tests/autopilot/pay_ui/tests/mock_server.py 2014-08-19 14:55:31 +0000 |
216 | @@ -0,0 +1,188 @@ |
217 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
218 | +# |
219 | +# Copyright (C) 2014 Canonical Ltd. |
220 | +# |
221 | +# This program is free software; you can redistribute it and/or modify |
222 | +# it under the terms of the GNU General Public License version 3, as published |
223 | +# by the Free Software Foundation. |
224 | +# |
225 | +# This program is distributed in the hope that it will be useful, |
226 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
227 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
228 | +# GNU General Public License for more details. |
229 | +# |
230 | +# You should have received a copy of the GNU General Public License |
231 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
232 | + |
233 | +import json |
234 | +import time |
235 | +import threading |
236 | +from http.server import BaseHTTPRequestHandler, HTTPServer |
237 | + |
238 | + |
239 | +KEEP_ALIVE = False |
240 | +DELAY_RESPONSE = 0 |
241 | + |
242 | + |
243 | +class MyHandler(BaseHTTPRequestHandler): |
244 | + |
245 | + def do_HEAD(self): |
246 | + self.send_response(200) |
247 | + self.send_header("X-Click-Token", "X-Click-Token") |
248 | + self.end_headers() |
249 | + |
250 | + def response_payment_types(self, fail=False): |
251 | + types = [ |
252 | + { |
253 | + "description": "PayPal", |
254 | + "id": "paypal", |
255 | + "preferred": False, |
256 | + "choices": [ |
257 | + { |
258 | + "currencies": [ |
259 | + "USD", |
260 | + "GBP", |
261 | + "EUR" |
262 | + ], |
263 | + "id": 532, |
264 | + "requires_interaction": False, |
265 | + "preferred": False, |
266 | + "description": ("PayPal Preapproved Payment " |
267 | + "(exp. 2014-04-12)") |
268 | + } |
269 | + ] |
270 | + }, |
271 | + { |
272 | + "description": "Credit or Debit Card", |
273 | + "id": "credit_card", |
274 | + "preferred": True, |
275 | + "choices": [ |
276 | + { |
277 | + "currencies": [ |
278 | + "USD" |
279 | + ], |
280 | + "id": 1767, |
281 | + "requires_interaction": False, |
282 | + "preferred": False, |
283 | + "description": ("**** **** **** 1111 " |
284 | + "(Visa, exp. 02/2015)") |
285 | + }, |
286 | + { |
287 | + "currencies": [ |
288 | + "USD" |
289 | + ], |
290 | + "id": 1726, |
291 | + "requires_interaction": False, |
292 | + "preferred": True, |
293 | + "description": ("**** **** **** 1111 " |
294 | + "(Visa, exp. 03/2015)") |
295 | + } |
296 | + ] |
297 | + } |
298 | + ] |
299 | + if fail: |
300 | + self.send_response(404) |
301 | + else: |
302 | + self.send_response(200) |
303 | + self.send_header("Content-type", "application/json") |
304 | + self.end_headers() |
305 | + self.wfile.write(bytes(json.dumps(types), 'UTF-8')) |
306 | + |
307 | + def response_buy_item(self, fail=False, interaction=False): |
308 | + state = "Complete" if not interaction else "InProgress" |
309 | + response = { |
310 | + "state": state, |
311 | + } |
312 | + if interaction: |
313 | + response["redirect_to"] = "http://redirect.url" |
314 | + if fail: |
315 | + response = {} |
316 | + self.send_response(200) |
317 | + self.send_header("Content-type", "application/json") |
318 | + self.end_headers() |
319 | + self.wfile.write(bytes(json.dumps(response), 'UTF-8')) |
320 | + |
321 | + def response_update_credentials(self, fail=False): |
322 | + response = { |
323 | + "token_key": "token_key", |
324 | + "token_secret": "token_secret", |
325 | + "consumer_key": "consumer_key", |
326 | + "consumer_secret": "consumer_secret", |
327 | + } |
328 | + if fail: |
329 | + self.send_response(404) |
330 | + else: |
331 | + self.send_response(200) |
332 | + self.send_header("Content-type", "application/json") |
333 | + self.end_headers() |
334 | + self.wfile.write(bytes(json.dumps(response), 'UTF-8')) |
335 | + |
336 | + def response_item_info(self, fail=False): |
337 | + response = { |
338 | + "title": "title", |
339 | + "publisher": "publisher", |
340 | + "price": 9.99, |
341 | + "icon_url": "icon_url", |
342 | + } |
343 | + if fail: |
344 | + self.send_response(404) |
345 | + else: |
346 | + self.send_response(200) |
347 | + self.send_header("Content-type", "application/json") |
348 | + self.end_headers() |
349 | + self.wfile.write(bytes(json.dumps(response), 'UTF-8')) |
350 | + |
351 | + def response_auth_error(self): |
352 | + self.send_response(401) |
353 | + self.send_header("Content-type", "application/json") |
354 | + self.end_headers() |
355 | + self.wfile.write(bytes(json.dumps(dict()), 'UTF-8')) |
356 | + |
357 | + def do_POST(self): |
358 | + """Respond to a POST request.""" |
359 | + #content = self.rfile.read(int(self.headers.get('content-length'))) |
360 | + #structure = json.loads(content.decode('utf-8')) |
361 | + self.do_GET() |
362 | + |
363 | + def do_GET(self): |
364 | + """Respond to a GET request.""" |
365 | + global DELAY_RESPONSE |
366 | + time.sleep(DELAY_RESPONSE) |
367 | + if self.path.find("paymentmethods/") != -1: |
368 | + fail = self.path.find("/fail/") != -1 |
369 | + self.response_payment_types(fail) |
370 | + elif self.path.find("purchases/") != -1: |
371 | + fail = self.path.find("/fail/") != -1 |
372 | + interaction = self.path.find("/interaction/") != -1 |
373 | + self.response_buy_item(fail=fail, interaction=interaction) |
374 | + elif self.path.find("creds/") != -1 or self.path.find("wallet/") != -1: |
375 | + fail = self.path.find("/fail/") != -1 |
376 | + self.response_update_credentials(fail) |
377 | + elif self.path.find("iteminfo/") != -1: |
378 | + fail = self.path.find("/fail/") != -1 |
379 | + self.response_item_info(fail) |
380 | + elif self.path.find("/authError/") != -1: |
381 | + self.response_auth_error() |
382 | + elif self.path.find("shutdown") != -1: |
383 | + print("Shutting down") |
384 | + global KEEP_ALIVE |
385 | + KEEP_ALIVE = False |
386 | + self.response_auth_error() |
387 | + |
388 | + |
389 | +def run_click_server(): |
390 | + global KEEP_ALIVE |
391 | + KEEP_ALIVE = True |
392 | + server_address = ('', 8088) |
393 | + httpd = HTTPServer(server_address, MyHandler) |
394 | + print('start') |
395 | + while KEEP_ALIVE: |
396 | + try: |
397 | + httpd.handle_request() |
398 | + except: |
399 | + print("Error in server, keep it alive.") |
400 | + |
401 | + |
402 | +def run_mocked_settings(): |
403 | + t = threading.Thread(target=run_click_server) |
404 | + t.start() |
405 | |
406 | === added file 'tests/autopilot/pay_ui/tests/test_pay_ui.py' |
407 | --- tests/autopilot/pay_ui/tests/test_pay_ui.py 1970-01-01 00:00:00 +0000 |
408 | +++ tests/autopilot/pay_ui/tests/test_pay_ui.py 2014-08-19 14:55:31 +0000 |
409 | @@ -0,0 +1,81 @@ |
410 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
411 | +# |
412 | +# Copyright (C) 2014 Canonical Ltd. |
413 | +# |
414 | +# This program is free software; you can redistribute it and/or modify |
415 | +# it under the terms of the GNU General Public License version 3, as published |
416 | +# by the Free Software Foundation. |
417 | +# |
418 | +# This program is distributed in the hope that it will be useful, |
419 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
420 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
421 | +# GNU General Public License for more details. |
422 | +# |
423 | +# You should have received a copy of the GNU General Public License |
424 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
425 | + |
426 | +import time |
427 | +import requests |
428 | + |
429 | +import fixtures |
430 | +import ubuntuuitoolkit |
431 | +from testtools.matchers import Equals, NotEquals |
432 | + |
433 | +from pay_ui import tests |
434 | +from pay_ui.tests import mock_server |
435 | + |
436 | + |
437 | +class PayUITestCase(tests.BasePayUITestCase): |
438 | + |
439 | + def __init__(self, *args, **kwargs): |
440 | + super(PayUITestCase, self).__init__(*args, **kwargs) |
441 | + self.useFixture(fixtures.EnvironmentVariable( |
442 | + 'ACCOUNT_CREDS_URL', 'http://localhost:8088/creds/')) |
443 | + self.useFixture(fixtures.EnvironmentVariable( |
444 | + 'PAY_BASE_URL', 'http://localhost:8088/')) |
445 | + self.useFixture(fixtures.EnvironmentVariable( |
446 | + 'URL_PACKAGE_INFO', 'http://localhost:8088/iteminfo/')) |
447 | + self.useFixture(fixtures.EnvironmentVariable( |
448 | + 'ADD_PAYMENT_URL', 'http://localhost:8088/add_payment/')) |
449 | + self.useFixture(fixtures.EnvironmentVariable('GET_CREDENTIALS', '0')) |
450 | + |
451 | + def setUp(self): |
452 | + if not mock_server.KEEP_ALIVE: |
453 | + mock_server.run_mocked_settings() |
454 | + self.clean_config_dir() |
455 | + self.create_config_dir() |
456 | + time.sleep(2) |
457 | + super().setUp() |
458 | + |
459 | + @classmethod |
460 | + def tearDownClass(cls): |
461 | + print("stop server") |
462 | + url = 'http://127.0.0.1:8088/shutdown/' |
463 | + requests.get(url) |
464 | + |
465 | + def test_ui_initialized(self): |
466 | + main = self.main_view |
467 | + self.assertThat(main, NotEquals(None)) |
468 | + |
469 | + def test_cancel_purchase(self): |
470 | + cancel_button_direct = self.main_view.select_single( |
471 | + objectName='cancelButtonDirect') |
472 | + self.assertThat(cancel_button_direct, NotEquals(None)) |
473 | + self.main_view.pointing_device.click_object(cancel_button_direct) |
474 | + |
475 | + def test_basic_purchase(self): |
476 | + password_field = self.main_view.select_single( |
477 | + ubuntuuitoolkit.TextField, objectName="passwordField") |
478 | + password_field.write("password123") |
479 | + buy_button_direct = self.main_view.select_single( |
480 | + objectName='buyButtonDirect') |
481 | + self.assertThat(buy_button_direct.enabled, Equals(True)) |
482 | + self.main_view.pointing_device.click_object(buy_button_direct) |
483 | + |
484 | + def test_view_wallet(self): |
485 | + password_field = self.main_view.select_single( |
486 | + ubuntuuitoolkit.TextField, objectName="passwordField") |
487 | + password_field.write("password123") |
488 | + wallet_label = self.main_view.select_single( |
489 | + objectName='viewWalletLabel') |
490 | + self.assertThat(wallet_label.visible, Equals(True)) |
491 | |
492 | === added file 'tests/autopilot/run_autopilot' |
493 | --- tests/autopilot/run_autopilot 1970-01-01 00:00:00 +0000 |
494 | +++ tests/autopilot/run_autopilot 2014-08-19 14:55:31 +0000 |
495 | @@ -0,0 +1,1 @@ |
496 | +BUILD_DIR=../../build autopilot3 run pay_ui |
PASSED: Continuous integration, rev:24 jenkins. qa.ubuntu. com/job/ pay-ui- ci/52/ jenkins. qa.ubuntu. com/job/ generic- click-builder- utopic- armhf/366 jenkins. qa.ubuntu. com/job/ pay-ui- utopic- amd64-ci/ 49 jenkins. qa.ubuntu. com/job/ pay-ui- utopic- armhf-ci/ 49 jenkins. qa.ubuntu. com/job/ pay-ui- utopic- armhf-ci/ 49/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ pay-ui- utopic- i386-ci/ 49
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/pay- ui-ci/52/ rebuild
http://