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
1=== modified file 'u1testutils/sso/sst/__init__.py'
2--- u1testutils/sso/sst/__init__.py 2013-05-03 16:17:38 +0000
3+++ u1testutils/sso/sst/__init__.py 2013-05-31 04:30:38 +0000
4@@ -99,7 +99,7 @@
5 site_not_recognized.yes_sign_me_in()
6
7
8-def log_out(user_name):
9+def log_out():
10 """Log out from the Ubuntu Single Sign On site.
11
12 The browser must be on the Single Sign On site, and the user must have the
13@@ -108,9 +108,6 @@
14 If the log out succeeds, the browser will be on the Ubuntu Single Sign On
15 logout page.
16
17- Keyword arguments:
18- user_name -- The name of the logged in user.
19-
20 """
21- your_account = pages.YourAccount(user_name)
22+ your_account = pages.YourAccount()
23 return your_account.subheader.log_out()
24
25=== modified file 'u1testutils/sso/sst/pages.py'
26--- u1testutils/sso/sst/pages.py 2013-05-23 15:05:28 +0000
27+++ u1testutils/sso/sst/pages.py 2013-05-31 04:30:38 +0000
28@@ -32,12 +32,20 @@
29
30 """
31
32- title = 'Log in'
33 url_path = '(/|/\+login)'
34 is_url_path_regex = True
35- headings1 = ['Ubuntu Single Sign On']
36- headings2 = ['Log in to Ubuntu Single Sign On', 'Are you new?']
37- qa_anchor = 'ubuntu_login_title'
38+ qa_anchor = 'login'
39+
40+ @log_action(logging.info)
41+ def _open_page(self):
42+ """Open the page.
43+
44+ This overwrites the method from the base Page class in order to choose
45+ one of the possible URL paths to open the page.
46+
47+ """
48+ sst.actions.go_to('/+login')
49+ return self
50
51 @log_action(logging.info)
52 def log_in_to_site_recognized(self, user=None):
53@@ -103,8 +111,6 @@
54
55 url_path = '/.*/\+decide'
56 is_url_path_regex = True
57- headings2 = ['Log in', 'Are you new?']
58- qa_anchor = 'ubuntu_login_title'
59
60 @log_action(logging.info)
61 def go_to_create_new_account(self):
62@@ -156,9 +162,7 @@
63
64 """
65
66- title = 'Create account'
67 url_path = '/+new_account'
68- headings1 = ['Ubuntu Single Sign On', 'Create an account']
69 qa_anchor = 'new_account'
70
71 @log_action(logging.info)
72@@ -209,10 +213,7 @@
73
74 """
75
76- title = 'Account creation mail sent'
77 url_path = '/+new_account'
78- headings1 = ['Account creation mail sent']
79- headings2 = ["Haven't received it?"]
80 qa_anchor = 'new_account'
81
82 @log_action(logging.info)
83@@ -287,9 +288,9 @@
84
85 """
86
87- title = "Complete email address validation"
88 url_path = '/token/.+/\+newemail/.+@.+'
89 is_url_path_regex = True
90+ qa_anchor = 'confirm_email'
91
92 def __init__(self, open_page=False):
93 super(CompleteEmailValidation, self).__init__(open_page)
94@@ -306,13 +307,11 @@
95 @log_action(logging.info)
96 def confirm(self):
97 self._click_continue_button()
98- user_name = self.subheader.get_user_name()
99- return YourAccount(user_name)
100+ return YourAccount()
101
102 @log_action(logging.info)
103 def cancel(self):
104- user_name = self.subheader.get_user_name()
105- return YourAccount(user_name)
106+ return YourAccount()
107
108
109 class SiteNotRecognized(u1testutils.sst.Page):
110@@ -324,9 +323,9 @@
111
112 """
113
114- title = '^Authenticate to .+'
115 url_path = '/.+/\+decide'
116 is_url_path_regex = True
117+ qa_anchor = 'decide'
118
119 def assert_title(self):
120 """Assert that the page is open.
121@@ -376,19 +375,15 @@
122
123 """
124
125- title = "{0}'s details"
126 url_path = '/'
127 qa_anchor = 'edit_account'
128
129- def __init__(self, user_name, open_page=False):
130- self.title = self.title.format(user_name)
131+ def __init__(self, open_page=False):
132 super(YourAccount, self).__init__(open_page)
133
134
135 class YouHaveBeenLoggedOut(PageWithAnonymousSubheader):
136 """Your account page of the Ubuntu Single Sign On website."""
137
138- title = 'You have been logged out'
139 url_path = '/+logout'
140- headings1 = ['Ubuntu Single Sign On', 'You have been logged out']
141 qa_anchor = 'logout'

Subscribers

People subscribed via source and target branches

to all changes: