Merge lp:~mardy/signon-ui/functional-tests into lp:signon-ui

Proposed by Alberto Mardegan
Status: Merged
Approved by: Víctor R. Ruiz
Approved revision: 75
Merged at revision: 73
Proposed branch: lp:~mardy/signon-ui/functional-tests
Merge into: lp:signon-ui
Diff against target: 646 lines (+254/-314)
11 files modified
.bzrignore (+2/-1)
tests/functional/.config/signon-ui/webkit-options.d/localhost.conf (+0/-4)
tests/functional/dialog.rb (+0/-135)
tests/functional/functional.pro (+0/-3)
tests/functional/reauthenticator.py (+246/-0)
tests/functional/run-with-signon-ui.sh (+1/-1)
tests/functional/server.rb (+0/-53)
tests/functional/signon-ui.sh (+1/-1)
tests/functional/tests.sh (+1/-9)
tests/functional/webpage.rb (+0/-105)
tests/tests.pro (+3/-2)
To merge this branch: bzr merge lp:~mardy/signon-ui/functional-tests
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Víctor R. Ruiz (community) Approve
David King (community) Approve
Review via email: mp+134460@code.launchpad.net

Description of the change

Tests: add functional test for the reauthenticator

Simulate signond to check signon-ui reauthentication.

Remove the testability functional tests, which have been disabled for some time
already.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Víctor R. Ruiz (vrruiz) wrote :

Project ERROR: Package libproxy-1.0 not found

Revision history for this message
David King (amigadave) wrote :

> Project ERROR: Package libproxy-1.0 not found

The packaging branch being used is out-of-date, and does not include the dependency for the libproxy development package, so just the library is installed.

It builds and checks fine here.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Víctor R. Ruiz (vrruiz) wrote :

Packaging branch fixed.

review: Approve
Revision history for this message
Alberto Mardegan (mardy) wrote :

Victor, should we wait for Jenkins to re-test this MR, or should I just set its state to "approved"?

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) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Víctor R. Ruiz (vrruiz) wrote :

Please, deactivate non-unit tests by default, or anything that requires X.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

you can also try to run xfvb

Revision history for this message
Alberto Mardegan (mardy) wrote :

This merge request is just about new functional tests. :-)

They are not run if the DISPLAY variable is unset:
http://bazaar.launchpad.net/~mardy/signon-ui/functional-tests/view/head:/tests/functional/tests.sh

So, if for some reason X applications don't work in jenkins, just unset the DISPLAY variable.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

I think the functional tests without high requirement on the environment (like only X), should be run in jenkins (and so, when building the package). The X server can be mocked by xfvb as mentionned quite easily ;)

Revision history for this message
Víctor R. Ruiz (vrruiz) wrote :

The rules are simple: continuous integration just run unit (small) tests. Medium and big tests are run periodically (e.g. daily) but not as part of CI. So, please, deactivate them by default. I will create another job to run those.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Víctor R. Ruiz (vrruiz) wrote :

Looks good!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2012-10-26 13:44:23 +0000
3+++ .bzrignore 2012-11-19 12:23:22 +0000
4@@ -21,4 +21,5 @@
5 src/webcredentials_adaptor.*
6 tests/unit/signon-ui-unittest
7 tests/.config/Trolltech.conf
8-tests/functional/.config/Trolltech.conf
9+tests/functional/.cache/
10+tests/functional/.config/
11
12=== removed directory 'tests/functional/.config'
13=== removed directory 'tests/functional/.config/signon-ui'
14=== removed directory 'tests/functional/.config/signon-ui/webkit-options.d'
15=== removed file 'tests/functional/.config/signon-ui/webkit-options.d/localhost.conf'
16--- tests/functional/.config/signon-ui/webkit-options.d/localhost.conf 2012-02-20 12:26:19 +0000
17+++ tests/functional/.config/signon-ui/webkit-options.d/localhost.conf 1970-01-01 00:00:00 +0000
18@@ -1,4 +0,0 @@
19-UsernameField = input[name="username"]
20-PasswordField = input[name="password"]
21-LoginButton = input[type="submit"]
22-
23
24=== removed file 'tests/functional/dialog.rb'
25--- tests/functional/dialog.rb 2012-04-04 12:22:47 +0000
26+++ tests/functional/dialog.rb 1970-01-01 00:00:00 +0000
27@@ -1,135 +0,0 @@
28-#!/usr/bin/env ruby
29-
30-require 'tdriver'
31-require 'test/unit'
32-require 'dbus'
33-include TDriverVerify
34-
35-class TestDialog < Test::Unit::TestCase
36- # Run before each test case begins
37- def setup
38- @sut = TDriver.connect_sut(:Id => 'sut_qt')
39- @app = @sut.application(:name => "signon-ui")
40- @bus = DBus::SessionBus.instance
41- service = @bus.service("com.nokia.singlesignonui")
42- object = service.object("/SignonUi")
43- object.introspect
44- @proxy = object["com.nokia.singlesignonui"]
45- end
46-
47- # Run after each test case completes
48- def teardown
49- end
50-
51- # Test cases:
52-
53- def test_startup
54- # Make sure signon-ui doesn't pop-up unrequested dialogs
55- verify_not(3, "Unrequested dialog appeared!") {
56- @app.SignOnUi__Dialog()
57- }
58- end
59-
60- def test_query_username
61- # Prepare a request
62- parameters = {}
63- parameters['QueryUserName'] = true
64- parameters['QueryMessage'] = "The field should get filled automatically"
65- parameters['Title'] = "Enter your username"
66- expected_username = "The User Name"
67- loop = DBus::Main.new
68- loop << @bus
69- @proxy.queryDialog(parameters) do |msg, resp|
70- verify_equal(expected_username) { resp['UserName'] }
71- loop.quit
72- end
73-
74- # The UI should have appeared now; check its contents
75- @app.force_refresh()
76- verify() { @app.QLabel(:name => "Message") }
77- verify() { @app.SignOnUi__Dialog(:name => 'LoginDialog') }
78- verify_equal("true") { @app.QLabel(:name => 'Message')['enabled'] }
79- verify_equal("The field should get filled automatically") {
80- @app.QLabel(:name => 'Message')['text']
81- }
82-
83- # Fill the username and click the button
84- @app.QLineEdit['text'] = expected_username
85- @app.QPushButton(:default => true).tap
86- loop.run
87- verify_not(3, "Dialog still open") {
88- @app.SignOnUi__Dialog()
89- }
90- end
91-
92- def test_query_password
93- # Prepare a request
94- parameters = {}
95- parameters['UserName'] = "Average Joe"
96- parameters['QueryPassword'] = true
97- parameters['QueryMessage'] = "Joe, please enter your password!"
98- parameters['Title'] = "Password needed"
99- expected_password = "Yes, I'll do that"
100- loop = DBus::Main.new
101- loop << @bus
102- @proxy.queryDialog(parameters) do |msg, resp|
103- verify_equal(expected_password) { resp['Secret'] }
104- loop.quit
105- end
106-
107- # The UI should have appeared now; check its contents
108- @app.force_refresh()
109- verify() { @app.SignOnUi__Dialog(:name => 'LoginDialog') }
110- verify_equal("false") {
111- @app.QLineEdit(:name => 'UsernameField')['enabled']
112- }
113- verify_equal("true") {
114- @app.QLineEdit(:name => 'PasswordField')['enabled']
115- }
116- verify_equal("Average Joe") {
117- @app.QLineEdit(:name => 'UsernameField')['text']
118- }
119-
120- # Fill the password and click the button
121- @app.QLineEdit(:name => 'PasswordField')['text'] = expected_password
122- @app.QPushButton(:default => true).tap
123- loop.run
124- verify_not(3, "Dialog still open") {
125- @app.SignOnUi__Dialog()
126- }
127- end
128-
129- def test_captcha
130- # Prepare a request
131- parameters = {}
132- parameters['UserName'] = "Average Joe"
133- parameters['QueryPassword'] = true
134- parameters['Title'] = "Password needed"
135- parameters['CaptchaUrl'] = "123.png"
136- expected_password = "pwd"
137- expected_captcha_text = "123"
138- loop = DBus::Main.new
139- loop << @bus
140- @proxy.queryDialog(parameters) do |msg, resp|
141- puts "Response: #{resp}"
142- verify_equal(expected_password) { resp['Secret'] }
143- verify_equal(expected_captcha_text) { resp['CaptchaResponse'] }
144- loop.quit
145- end
146-
147- # The UI should have appeared now; check its contents
148- @app.force_refresh()
149- verify() { @app.SignOnUi__Dialog(:name => 'LoginDialog') }
150- verify() { @app.QLineEdit(:name => 'CaptchaField') }
151-
152- # Fill the password, the captcha solution and click the button
153- @app.QLineEdit(:name => 'PasswordField')['text'] = expected_password
154- @app.QLineEdit(:name => 'CaptchaField')['text'] = expected_captcha_text
155- @app.QPushButton(:default => true).tap
156- loop.run
157- verify_not(3, "Dialog still open") {
158- @app.SignOnUi__Dialog()
159- }
160- end
161-
162-end
163
164=== modified file 'tests/functional/functional.pro'
165--- tests/functional/functional.pro 2012-03-02 15:07:05 +0000
166+++ tests/functional/functional.pro 2012-11-19 12:23:22 +0000
167@@ -6,6 +6,3 @@
168
169 check.commands = "BUILDDIR=$$TOP_BUILD_DIR SRCDIR=$$TOP_SRC_DIR $$TOP_SRC_DIR/tests/functional/tests.sh"
170 QMAKE_EXTRA_TARGETS += check
171-
172-DISTFILES += \
173- .config/signon-ui/webkit-options.d/localhost.conf
174
175=== added file 'tests/functional/reauthenticator.py'
176--- tests/functional/reauthenticator.py 1970-01-01 00:00:00 +0000
177+++ tests/functional/reauthenticator.py 2012-11-19 12:23:22 +0000
178@@ -0,0 +1,246 @@
179+#! /usr/bin/python3
180+
181+import unittest
182+import logging
183+import sys
184+import dbus, dbus.service
185+from dbus.mainloop.glib import DBusGMainLoop
186+
187+from gi.repository import Accounts
188+from gi.repository import GLib
189+from gi.repository import GObject
190+
191+SIGNOND_BUS_NAME = 'com.google.code.AccountsSSO.SingleSignOn'
192+AUTH_SERVICE_IFACE = SIGNOND_BUS_NAME + '.AuthService'
193+AUTH_SESSION_IFACE = SIGNOND_BUS_NAME + '.AuthSession'
194+
195+class MockAuthSession(dbus.service.Object):
196+ last_session = 0
197+ def __init__(self, connection, identity, method):
198+ self.identity = identity
199+ self.method = method
200+ MockAuthSession.last_session += 1
201+ path = '/session/{}'.format(MockAuthSession.last_session)
202+ super().__init__(connection, path)
203+
204+ @dbus.service.method(dbus_interface=AUTH_SESSION_IFACE,
205+ in_signature='a{sv}s', out_signature='a{sv}')
206+ def process(self, session_data, mechanism):
207+ # Store the session data and mechanism, so that later they can be
208+ # verified by the test functions
209+ self.session_data = session_data
210+ self.mechanism = mechanism
211+ # signon-ui does not care what dictionary is returned, as long as it's
212+ # not an error; so let's just return the same dictionary
213+ return session_data
214+
215+
216+class MockSignond(dbus.service.Object):
217+ def __init__(self, bus_name):
218+ super().__init__(bus_name, '/com/google/code/AccountsSSO/SingleSignOn')
219+ self.sessions = {}
220+
221+ @dbus.service.method(dbus_interface=AUTH_SERVICE_IFACE,
222+ in_signature='u', out_signature='oa{sv}')
223+ def getIdentity(self, identity):
224+ return ('/identity/{}'.format(identity), {})
225+
226+ @dbus.service.method(dbus_interface=AUTH_SERVICE_IFACE,
227+ in_signature='us', out_signature='s')
228+ def getAuthSessionObjectPath(self, identity, method):
229+ session = MockAuthSession(self.connection, identity, method)
230+ self.sessions[session._object_path] = session
231+ return session._object_path
232+
233+class AuthenticatorTests(unittest.TestCase):
234+ credentials_id = 45000
235+
236+ @classmethod
237+ def setUpClass(cls):
238+ manager = Accounts.Manager()
239+ account = manager.create_account("any provider")
240+ account.set_enabled(True)
241+
242+ v_credentials_id = GObject.Value()
243+ v_credentials_id.init(GObject.TYPE_UINT)
244+ v_credentials_id.set_uint(AuthenticatorTests.credentials_id)
245+ account.set_value('CredentialsId', v_credentials_id)
246+
247+ account.store_blocking()
248+ AuthenticatorTests.account_id = account.id
249+
250+ # Get a proxy for signon-ui
251+ bus = dbus.SessionBus()
252+ signon_ui_proxy = bus.get_object('com.nokia.singlesignonui',
253+ '/SignonUi')
254+ signon_ui = dbus.Interface(signon_ui_proxy,
255+ 'com.nokia.singlesignonui')
256+ webcredentials_proxy = bus.get_object('com.canonical.indicators.webcredentials',
257+ '/com/canonical/indicators/webcredentials')
258+ webcredentials = dbus.Interface(webcredentials_proxy,
259+ 'com.canonical.indicators.webcredentials')
260+ AuthenticatorTests.signon_ui = signon_ui
261+ AuthenticatorTests.webcredentials = webcredentials
262+
263+ signond_bus_name = dbus.service.BusName(SIGNOND_BUS_NAME,
264+ bus=dbus.SessionBus())
265+ AuthenticatorTests.signond_bus_name = signond_bus_name
266+
267+ def setUp(self):
268+ self.test_failed = False
269+ self.signond = MockSignond(AuthenticatorTests.signond_bus_name)
270+ self.loop = GLib.MainLoop()
271+
272+ def tearDown(self):
273+ self.signond.remove_from_connection()
274+ self.signond = None
275+ self.loop = None
276+
277+ def failed_test(self, e):
278+ print(e)
279+ self.test_failed = True
280+ self.loop.quit()
281+
282+ def test01_single_failure(self):
283+ log = logging.getLogger('AuthenticatorTests')
284+ self.method = 'TheMethod'
285+ self.mechanism = 'TheMechanism'
286+ client_data = dbus.Dictionary({
287+ 'OneKey': 'OneValue',
288+ 'AnotherKey': 'AnotherValue'
289+ }, signature='sv')
290+
291+ params = {
292+ 'OpenUrl': 'https://localhost/dontopen',
293+ 'Identity': self.credentials_id,
294+ 'Method': self.method,
295+ 'Mechanism': self.mechanism,
296+ 'ClientData': client_data,
297+ }
298+
299+ reply = AuthenticatorTests.signon_ui.queryDialog(params)
300+ log.debug('Got reply: %s' % (reply,))
301+ self.assertIn('QueryErrorCode', reply)
302+ self.assertEqual(reply['QueryErrorCode'], 10)
303+
304+ def reauthenticate_cb(success):
305+ try:
306+ self.assertTrue(success)
307+ except:
308+ self.test_failed = True
309+ self.loop.quit()
310+
311+ extra_data = dbus.Dictionary({
312+ 'ExtraKey': 'ExtraValue',
313+ }, signature='sv')
314+ log.debug('Account id: ', self.account_id)
315+ AuthenticatorTests.webcredentials.ReauthenticateAccount(self.account_id, extra_data,
316+ reply_handler=reauthenticate_cb,
317+ error_handler=self.failed_test)
318+ self.loop.run()
319+ self.assertFalse(self.test_failed)
320+
321+ # Now verify that the authentication data is consistent
322+ self.assertEqual(len(self.signond.sessions), 1)
323+ session = list(self.signond.sessions.values())[0]
324+ self.assertEqual(session.method, self.method)
325+ self.assertEqual(session.mechanism, self.mechanism)
326+ full_data = client_data.copy()
327+ full_data.update(extra_data)
328+ self.assertEqual(session.session_data, full_data)
329+
330+ AuthenticatorTests.webcredentials.ReauthenticateAccount(self.account_id, extra_data,
331+ reply_handler=reauthenticate_cb,
332+ error_handler=self.failed_test)
333+ self.loop.run()
334+
335+ def test02_many_failures(self):
336+ log = logging.getLogger('AuthenticatorTests')
337+ num_sessions = 8
338+ sessions = {}
339+
340+ def query_dialog_cb(reply):
341+ log.debug('Got reply: %s (count = %s)' % (reply, query_dialog_cb.call_count))
342+ try:
343+ self.assertIn('QueryErrorCode', reply)
344+ self.assertEqual(reply['QueryErrorCode'], 10)
345+ except:
346+ self.test_failed = True
347+ query_dialog_cb.call_count += 1
348+ if query_dialog_cb.call_count == num_sessions:
349+ self.loop.quit()
350+ query_dialog_cb.call_count = 0
351+
352+ for i in range(num_sessions):
353+ client_data = dbus.Dictionary({
354+ 'OneKey': 'OneValue',
355+ 'AnotherKey': i
356+ }, signature='sv')
357+
358+ params = {
359+ 'OpenUrl': 'https://localhost/dontopen',
360+ 'Identity': self.credentials_id,
361+ 'Method': 'method{}'.format(int(i / 2)),
362+ 'Mechanism': 'mechanism{}'.format(int(i / 3)),
363+ 'ClientData': client_data,
364+ }
365+
366+ reply = AuthenticatorTests.signon_ui.queryDialog(params,
367+ reply_handler=query_dialog_cb,
368+ error_handler=self.failed_test)
369+ sessions[i] = params
370+
371+ self.loop.run()
372+ self.assertFalse(self.test_failed)
373+
374+
375+ def reauthenticate_cb(success):
376+ log.debug('reauthenticate_cb: {}'.format(success))
377+ try:
378+ self.assertTrue(success)
379+ except:
380+ self.test_failed = True
381+ self.loop.quit()
382+
383+ extra_data = dbus.Dictionary({
384+ 'ExtraKey': 'ExtraValue',
385+ }, signature='sv')
386+ AuthenticatorTests.webcredentials.ReauthenticateAccount(self.account_id, extra_data,
387+ reply_handler=reauthenticate_cb,
388+ error_handler=self.failed_test)
389+ self.loop.run()
390+ self.assertFalse(self.test_failed)
391+
392+ # Now verify that the authentication data is consistent
393+ self.assertEqual(len(self.signond.sessions), num_sessions)
394+ actual_sessions = []
395+ for session in self.signond.sessions.values():
396+ s = {
397+ 'Method': session.method,
398+ 'Mechanism': session.mechanism,
399+ 'SessionData': session.session_data
400+ }
401+ actual_sessions.append(s)
402+
403+ for session in sessions.values():
404+ full_data = session['ClientData'].copy()
405+ full_data.update(extra_data)
406+ s = {
407+ 'Method': session['Method'],
408+ 'Mechanism': session['Mechanism'],
409+ 'SessionData': full_data
410+ }
411+ found = False
412+ for actual in actual_sessions:
413+ if s == actual:
414+ found = True
415+ break
416+
417+ self.assertTrue(found)
418+
419+
420+if __name__ == '__main__':
421+ DBusGMainLoop(set_as_default=True)
422+ logging.basicConfig(stream=sys.stderr)
423+ logging.getLogger('AuthenticatorTests').setLevel(logging.DEBUG)
424+ unittest.main(failfast=True, buffer=False, verbosity=2)
425
426=== modified file 'tests/functional/run-with-signon-ui.sh'
427--- tests/functional/run-with-signon-ui.sh 2012-04-03 13:21:55 +0000
428+++ tests/functional/run-with-signon-ui.sh 2012-11-19 12:23:22 +0000
429@@ -2,7 +2,7 @@
430
431 set -e
432
433-qttasserver &
434+export ACCOUNTS="/tmp"
435
436 # start a local signon-ui
437 dbus-test-runner -m 180 \
438
439=== removed file 'tests/functional/server.rb'
440--- tests/functional/server.rb 2012-04-04 12:21:33 +0000
441+++ tests/functional/server.rb 1970-01-01 00:00:00 +0000
442@@ -1,53 +0,0 @@
443-#!/usr/bin/env ruby
444-
445-require 'webrick'
446-
447-class Simple < WEBrick::HTTPServlet::AbstractServlet
448-
449- def do_GET(request, response)
450- status, content_type, body = print_login_form(request)
451- response.status = status
452- response['Content-Type'] = content_type
453- response.body = body
454- end
455-
456- def print_login_form(request)
457- body = '
458-<html><head><title>Login here</title></head>
459-<body>
460-<form method="POST" action="/login.html">
461- Username: <input type="text" name="username" size="15" /><br />
462- Password: <input type="password" name="password" size="15" /><br />
463- <p><input type="submit" value="Login" /></p>
464-</form>
465-</body>
466-</html>
467-'
468- return 200, "text/html", body
469- end
470-
471- def do_POST(request, response)
472- username = request.query['username']
473- password = request.query['password']
474- if username.empty? or password.empty?
475- puts "Missing data"
476- status, content_type, body = print_login_form(request)
477- response.status = status
478- response['Content-Type'] = content_type
479- response.body = body
480- return
481- end
482-
483- response.status = 301
484- response['Location'] = "/logged\##{username}#{password}"
485- end
486-end
487-
488-if $0 == __FILE__ then
489- server = WEBrick::HTTPServer.new(:Port => 8000)
490- server.mount "/", Simple
491- trap "INT" do server.shutdown end
492- trap "TERM" do server.shutdown end
493- server.start
494-end
495-
496
497=== modified file 'tests/functional/signon-ui.sh'
498--- tests/functional/signon-ui.sh 2012-04-03 13:21:55 +0000
499+++ tests/functional/signon-ui.sh 2012-11-19 12:23:22 +0000
500@@ -3,4 +3,4 @@
501 set -e
502
503 export SSOUI_LOGGING_LEVEL=2
504-${SSOUI_WRAPPER} ${BUILDDIR}/src/signon-ui -testability
505+${SSOUI_WRAPPER} ${BUILDDIR}/src/signon-ui
506
507=== modified file 'tests/functional/tests.sh'
508--- tests/functional/tests.sh 2012-04-03 13:21:55 +0000
509+++ tests/functional/tests.sh 2012-11-19 12:23:22 +0000
510@@ -10,12 +10,4 @@
511 export SSOUI_DAEMON_TIMEOUT=10
512
513 "$SRCDIR/tests/functional/run-with-signon-ui.sh" \
514- ./dialog.rb
515-
516-# Web tests
517-./server.rb &
518-SERVER_PID="$!"
519-"$SRCDIR/tests/functional/run-with-signon-ui.sh" \
520- ./webpage.rb
521-kill "$SERVER_PID"
522-
523+ ./reauthenticator.py
524
525=== removed file 'tests/functional/webpage.rb'
526--- tests/functional/webpage.rb 2012-05-31 08:21:16 +0000
527+++ tests/functional/webpage.rb 1970-01-01 00:00:00 +0000
528@@ -1,105 +0,0 @@
529-#!/usr/bin/env ruby
530-
531-require 'tdriver'
532-require 'test/unit'
533-require 'dbus'
534-include TDriverVerify
535-
536-class TestDialog < Test::Unit::TestCase
537- # Run before each test case begins
538- def setup
539- @sut = TDriver.connect_sut(:Id => 'sut_qt')
540- @app = @sut.application(:name => "signon-ui")
541- @bus = DBus::SessionBus.instance
542- service = @bus.service("com.nokia.singlesignonui")
543- object = service.object("/SignonUi")
544- object.introspect
545- @proxy = object["com.nokia.singlesignonui"]
546- end
547-
548- # Run after each test case completes
549- def teardown
550- end
551-
552- # Test cases:
553-
554- def test_login
555- # Prepare a request
556- parameters = {}
557- parameters['OpenUrl'] = 'http://localhost:8000/'
558- parameters['FinalUrl'] = 'http://localhost:8000/logged'
559- parameters['UserName'] = 'user'
560- loop = DBus::Main.new
561- loop << @bus
562- @proxy.queryDialog(parameters) do |msg, resp|
563- verify_equal('http://localhost:8000/login.html') {
564- resp['UrlResponse']
565- }
566- loop.quit
567- end
568-
569- @app.force_refresh()
570- verify(3) { @app.SignOnUi__Dialog() }
571- # Currently, it's not possible to interact with QWebView from tdriver:
572- # https://projects.developer.nokia.com/Testabilitydriver/ticket/36
573- #
574- # So, we just close the window
575- @app.press_key(:qt_kEscape)
576- loop.run
577- end
578-
579- def test_autologin
580- # Prepare a request
581- parameters = {}
582- parameters['OpenUrl'] = 'http://localhost:8000/'
583- parameters['FinalUrl'] = 'http://localhost:8000/logged'
584- parameters['UserName'] = 'user'
585- parameters['Secret'] = 'pwd'
586- loop = DBus::Main.new
587- loop << @bus
588- @proxy.queryDialog(parameters) do |msg, resp|
589- verify_equal('http://localhost:8000/logged#userpwd') {
590- resp['UrlResponse']
591- }
592- loop.quit
593- end
594-
595- # The UI should not appear in this test
596- @app.force_refresh()
597- verify_not(2, "Unrequested dialog appeared!") {
598- @app.SignOnUi__Dialog()
599- }
600- loop.run
601- end
602-
603- def test_cookies
604- # Prepare a request
605- cookies = {}
606- cookies['Primo'] = 'primo biscottino'
607- cookies['Secondo'] = 'secondo biscottino'
608- client_data = {}
609- client_data['Cookies'] = cookies
610- parameters = {}
611- parameters['OpenUrl'] = 'http://localhost:8000/'
612- parameters['FinalUrl'] = 'http://localhost:8000/logged'
613- parameters['UserName'] = 'user'
614- parameters['Secret'] = 'pwd'
615- parameters['ClientData'] = client_data
616- loop = DBus::Main.new
617- loop << @bus
618- @proxy.queryDialog(parameters) do |msg, resp|
619- verify_equal('http://localhost:8000/logged#userpwd') {
620- resp['UrlResponse']
621- }
622- loop.quit
623- end
624-
625- # The UI should not appear in this test
626- @app.force_refresh()
627- verify_not(2, "Unrequested dialog appeared!") {
628- @app.SignOnUi__Dialog()
629- }
630- loop.run
631- end
632-
633-end
634
635=== modified file 'tests/tests.pro'
636--- tests/tests.pro 2012-08-31 11:42:07 +0000
637+++ tests/tests.pro 2012-11-19 12:23:22 +0000
638@@ -3,5 +3,6 @@
639 SUBDIRS = \
640 unit
641
642-# Functional tests are disabled, because of some tdriver/ruby issues
643-# SUBDIRS += functional
644+CONFIG(medium-tests) {
645+ SUBDIRS += functional
646+}

Subscribers

People subscribed via source and target branches

to all changes: