Merge lp:~elopio/u1-test-utils/qa_anchors into lp:u1-test-utils

Proposed by Leo Arias
Status: Merged
Approved by: Natalia Bidart
Approved revision: 77
Merged at revision: 75
Proposed branch: lp:~elopio/u1-test-utils/qa_anchors
Merge into: lp:u1-test-utils
Diff against target: 141 lines (+19/-27)
2 files modified
u1testutils/sso/sst/__init__.py (+2/-5)
u1testutils/sso/sst/pages.py (+17/-22)
To merge this branch: bzr merge lp:~elopio/u1-test-utils/qa_anchors
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Review via email: mp+166635@code.launchpad.net

Commit message

Updated all the SSO pages to use the QA anchors.

Description of the change

Now we use a special QA anchor on the html tag of the pages to identify them. It's no longer needed to assert for their title and headings.

This branch requires https://code.launchpad.net/~elopio/canonical-identity-provider/qa_anchors/+merge/166636

To post a comment you must log in.
lp:~elopio/u1-test-utils/qa_anchors updated
76. By Leo Arias

Allow to open the login page.

77. By Leo Arias

Now we don't need the user name to instantiate pages.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'u1testutils/sso/sst/__init__.py'
--- u1testutils/sso/sst/__init__.py 2013-05-03 16:17:38 +0000
+++ u1testutils/sso/sst/__init__.py 2013-05-31 04:30:38 +0000
@@ -99,7 +99,7 @@
99 site_not_recognized.yes_sign_me_in()99 site_not_recognized.yes_sign_me_in()
100100
101101
102def log_out(user_name):102def log_out():
103 """Log out from the Ubuntu Single Sign On site.103 """Log out from the Ubuntu Single Sign On site.
104104
105 The browser must be on the Single Sign On site, and the user must have the105 The browser must be on the Single Sign On site, and the user must have the
@@ -108,9 +108,6 @@
108 If the log out succeeds, the browser will be on the Ubuntu Single Sign On108 If the log out succeeds, the browser will be on the Ubuntu Single Sign On
109 logout page.109 logout page.
110110
111 Keyword arguments:
112 user_name -- The name of the logged in user.
113
114 """111 """
115 your_account = pages.YourAccount(user_name)112 your_account = pages.YourAccount()
116 return your_account.subheader.log_out()113 return your_account.subheader.log_out()
117114
=== modified file 'u1testutils/sso/sst/pages.py'
--- u1testutils/sso/sst/pages.py 2013-05-23 15:05:28 +0000
+++ u1testutils/sso/sst/pages.py 2013-05-31 04:30:38 +0000
@@ -32,12 +32,20 @@
3232
33 """33 """
3434
35 title = 'Log in'
36 url_path = '(/|/\+login)'35 url_path = '(/|/\+login)'
37 is_url_path_regex = True36 is_url_path_regex = True
38 headings1 = ['Ubuntu Single Sign On']37 qa_anchor = 'login'
39 headings2 = ['Log in to Ubuntu Single Sign On', 'Are you new?']38
40 qa_anchor = 'ubuntu_login_title'39 @log_action(logging.info)
40 def _open_page(self):
41 """Open the page.
42
43 This overwrites the method from the base Page class in order to choose
44 one of the possible URL paths to open the page.
45
46 """
47 sst.actions.go_to('/+login')
48 return self
4149
42 @log_action(logging.info)50 @log_action(logging.info)
43 def log_in_to_site_recognized(self, user=None):51 def log_in_to_site_recognized(self, user=None):
@@ -103,8 +111,6 @@
103111
104 url_path = '/.*/\+decide'112 url_path = '/.*/\+decide'
105 is_url_path_regex = True113 is_url_path_regex = True
106 headings2 = ['Log in', 'Are you new?']
107 qa_anchor = 'ubuntu_login_title'
108114
109 @log_action(logging.info)115 @log_action(logging.info)
110 def go_to_create_new_account(self):116 def go_to_create_new_account(self):
@@ -156,9 +162,7 @@
156162
157 """163 """
158164
159 title = 'Create account'
160 url_path = '/+new_account'165 url_path = '/+new_account'
161 headings1 = ['Ubuntu Single Sign On', 'Create an account']
162 qa_anchor = 'new_account'166 qa_anchor = 'new_account'
163167
164 @log_action(logging.info)168 @log_action(logging.info)
@@ -209,10 +213,7 @@
209213
210 """214 """
211215
212 title = 'Account creation mail sent'
213 url_path = '/+new_account'216 url_path = '/+new_account'
214 headings1 = ['Account creation mail sent']
215 headings2 = ["Haven't received it?"]
216 qa_anchor = 'new_account'217 qa_anchor = 'new_account'
217218
218 @log_action(logging.info)219 @log_action(logging.info)
@@ -287,9 +288,9 @@
287288
288 """289 """
289290
290 title = "Complete email address validation"
291 url_path = '/token/.+/\+newemail/.+@.+'291 url_path = '/token/.+/\+newemail/.+@.+'
292 is_url_path_regex = True292 is_url_path_regex = True
293 qa_anchor = 'confirm_email'
293294
294 def __init__(self, open_page=False):295 def __init__(self, open_page=False):
295 super(CompleteEmailValidation, self).__init__(open_page)296 super(CompleteEmailValidation, self).__init__(open_page)
@@ -306,13 +307,11 @@
306 @log_action(logging.info)307 @log_action(logging.info)
307 def confirm(self):308 def confirm(self):
308 self._click_continue_button()309 self._click_continue_button()
309 user_name = self.subheader.get_user_name()310 return YourAccount()
310 return YourAccount(user_name)
311311
312 @log_action(logging.info)312 @log_action(logging.info)
313 def cancel(self):313 def cancel(self):
314 user_name = self.subheader.get_user_name()314 return YourAccount()
315 return YourAccount(user_name)
316315
317316
318class SiteNotRecognized(u1testutils.sst.Page):317class SiteNotRecognized(u1testutils.sst.Page):
@@ -324,9 +323,9 @@
324323
325 """324 """
326325
327 title = '^Authenticate to .+'
328 url_path = '/.+/\+decide'326 url_path = '/.+/\+decide'
329 is_url_path_regex = True327 is_url_path_regex = True
328 qa_anchor = 'decide'
330329
331 def assert_title(self):330 def assert_title(self):
332 """Assert that the page is open.331 """Assert that the page is open.
@@ -376,19 +375,15 @@
376375
377 """376 """
378377
379 title = "{0}'s details"
380 url_path = '/'378 url_path = '/'
381 qa_anchor = 'edit_account'379 qa_anchor = 'edit_account'
382380
383 def __init__(self, user_name, open_page=False):381 def __init__(self, open_page=False):
384 self.title = self.title.format(user_name)
385 super(YourAccount, self).__init__(open_page)382 super(YourAccount, self).__init__(open_page)
386383
387384
388class YouHaveBeenLoggedOut(PageWithAnonymousSubheader):385class YouHaveBeenLoggedOut(PageWithAnonymousSubheader):
389 """Your account page of the Ubuntu Single Sign On website."""386 """Your account page of the Ubuntu Single Sign On website."""
390387
391 title = 'You have been logged out'
392 url_path = '/+logout'388 url_path = '/+logout'
393 headings1 = ['Ubuntu Single Sign On', 'You have been logged out']
394 qa_anchor = 'logout'389 qa_anchor = 'logout'

Subscribers

People subscribed via source and target branches

to all changes: