OLD | NEW |
---|---|
(Empty) | |
1 # -*- coding: utf-8 -*- | |
2 | |
3 import sys | |
4 | |
5 from environment import Environment | |
6 | |
7 | |
8 """ Tests setup. """ | |
9 | |
10 | |
11 environment = Environment("websites.xml") | |
vabr (Chromium)
2014/05/08 13:53:45
This should be part of the
if __name__ == "__main_
rchtara
2014/05/14 11:58:04
Done.
| |
12 | |
13 | |
14 """ Working tests. """ | |
15 | |
16 | |
17 amazon = environment.AddWebsite("amazon") | |
vabr (Chromium)
2014/05/08 13:53:45
Could the whole addition of tests be a function?
I
rchtara
2014/05/14 11:58:04
Done.
| |
18 | |
19 amazon.AddLoginAction( | |
20 "goto", | |
21 "https://www.amazon.com/ap/signin?_" | |
22 "encoding=UTF8&openid.assoc_handle=usflex&openid.claimed_id=http%3A%2F%2Fsp" | |
23 "ecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F" | |
24 "%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_s" | |
25 "etup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=h" | |
26 "ttp%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_aut" | |
27 "h_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.com%2Fgp%2Fyourstore%2Fh" | |
28 "ome%3Fie%3DUTF8%26ref_%3Dgno_signin") | |
29 amazon.AddLoginAction("fillusername", "[name='email']") | |
30 amazon.AddLoginAction("fillpassword", "[name='password']") | |
31 amazon.AddLoginAction("submit", "[name='password']") | |
32 amazon.AddLoginAction("wait", 2) | |
33 | |
34 amazon.AddLogoutAction("hover", "#nav-signin-title") | |
35 amazon.AddLogoutAction("wait", 1) | |
36 amazon.AddLogoutAction("click", "#nav-item-signout") | |
37 | |
38 | |
39 ask = environment.AddWebsite("ask") | |
40 | |
41 ask.AddLoginAction( | |
42 "goto", "http://www.ask.com/answers/browse?qsrc=321&q=&o=0&l=dir#") | |
43 ask.AddLoginAction("click", "#a16CnbSignInText") | |
44 ask.AddLoginAction("fillusername", "[name='username']") | |
45 ask.AddLoginAction("fillpassword", "[name='password']") | |
46 ask.AddLoginAction("click", ".signin_show.signin_submit") | |
47 ask.AddLoginAction("wait", 2) | |
48 | |
49 ask.AddLogoutAction("click", "#a16CnbSignInText") | |
50 | |
51 | |
52 espn = environment.AddWebsite("espn") | |
53 | |
54 espn.AddLoginAction( | |
55 "goto", | |
56 "https://r.espn.go.com/members/v3_1/login?affiliateName=espn&appRedirect=" | |
57 "http%3A%2F%2Fespn.go.com%2F&parentLocation=http%3A%2F%2Fespn.go.com%2F&" | |
58 "password=dN_xw0GVUbgx935g3OU51&username=jkszbfkizhsefb789y4fui%40s" | |
vabr (Chromium)
2014/05/08 13:53:45
This URL still contains the username.
Please scrub
rchtara
2014/05/14 11:58:04
Done.
| |
59 "pamgoes.in®istrationFormId=espn&language=en&resize=true") | |
60 espn.AddLoginAction("fillusername", "#username") | |
61 espn.AddLoginAction("fillpassword", "#password") | |
62 espn.AddLoginAction("submit", "#password") | |
63 | |
64 | |
65 espn.AddLogoutAction("wait", 2) | |
66 espn.AddLogoutAction("click", "#signin .small") | |
67 | |
68 | |
69 facebook = environment.AddWebsite("facebook") | |
70 | |
71 facebook.AddLoginAction("goto", "https://www.facebook.com") | |
72 facebook.AddLoginAction("fillusername", "[name='email']") | |
73 facebook.AddLoginAction("fillpassword", "[name='pass']") | |
74 facebook.AddLoginAction("submit", "[name='pass']") | |
75 | |
76 facebook.AddLogoutAction("wait", 1) | |
77 facebook.AddLogoutAction("click", "#userNavigationLabel") | |
78 facebook.AddLogoutAction("wait", 1) | |
79 facebook.AddLogoutAction("click", "#logout_form [type='submit']") | |
80 | |
81 | |
82 google = environment.AddWebsite("google") | |
83 | |
84 google.AddLoginAction( | |
85 "goto", | |
86 "https://accounts.google.com/ServiceLogin?sacu=1&continue=" | |
87 "https%3A%2F%2Faccounts.google.com%2FManageAccount&hl=en") | |
88 google.AddLoginAction("fillusername", "#Email") | |
89 google.AddLoginAction("fillpassword", "#Passwd") | |
90 google.AddLoginAction("submit", "#Passwd") | |
91 | |
92 google.AddLogoutAction("wait", 1) | |
93 google.AddLogoutAction("click", ".gb_V.gbii") | |
94 google.AddLogoutAction("wait", 1) | |
95 google.AddLogoutAction("click", "#gb_71") | |
96 google.AddLogoutAction( | |
97 "goto", | |
98 "https://accounts.google.com/ServiceLogin?sacu=1&continue=" | |
99 "https%3A%2F%2Faccounts.google.com%2FManageAccount&hl=en") | |
100 | |
101 | |
102 mailru = environment.AddWebsite("mailru") | |
103 | |
104 mailru.AddLoginAction("goto", "https://ww.mail.ru") | |
vabr (Chromium)
2014/05/08 13:53:45
ww.mail.ru ?
Why not just mail.ru ?
rchtara
2014/05/14 11:58:04
Done.
| |
105 mailru.AddLoginAction("fillusername", "#mailbox__login") | |
106 mailru.AddLoginAction("fillpassword", "#mailbox__password") | |
107 mailru.AddLoginAction("submit", "#mailbox__password") | |
108 | |
109 mailru.AddLogoutAction("click", "#PH_logoutLink") | |
110 | |
111 | |
112 nytimes = environment.AddWebsite("nytimes") | |
113 | |
114 nytimes.AddLoginAction("goto", "https://myaccount.nytimes.com/auth/login") | |
115 nytimes.AddLoginAction("fillusername", "#userid") | |
116 nytimes.AddLoginAction("fillpassword", "#password") | |
117 nytimes.AddLoginAction("submit", "#password") | |
118 | |
119 nytimes.AddLogoutAction("goto", "https://myaccount.nytimes.com/gst/signout") | |
120 | |
121 | |
122 pinterest = environment.AddWebsite("pinterest") | |
123 | |
124 pinterest.AddLoginAction("goto", "https://www.pinterest.com/login/") | |
125 pinterest.AddLoginAction("fillusername", "[name='username_or_email']") | |
126 pinterest.AddLoginAction("fillpassword", "[name='password']") | |
127 pinterest.AddLoginAction("submit", "[name='password']") | |
128 | |
129 pinterest.AddLogoutAction("goto", "https://www.pinterest.com/logout/") | |
130 | |
131 | |
132 reddit = environment.AddWebsite("reddit", username_not_auto=True) | |
133 | |
134 reddit.AddLoginAction("goto", "http://www.reddit.com") | |
135 reddit.AddLoginAction("click", ".user .login-required") | |
136 reddit.AddLoginAction("fillusername", "#user_login") | |
137 reddit.AddLoginAction("fillpassword", "#passwd_login") | |
138 reddit.AddLoginAction("wait", 2) | |
139 reddit.AddLoginAction("submit", "#passwd_login") | |
140 | |
141 reddit.AddLogoutAction("click", "form[action='http://www.reddit.com/logout'] a") | |
142 | |
143 | |
144 tumblr = environment.AddWebsite("tumbler", username_not_auto=True) | |
145 | |
146 tumblr.AddLoginAction("goto", "https://www.tumblr.com/login") | |
147 tumblr.AddLoginAction("fillusername", "#signup_email") | |
148 tumblr.AddLoginAction("fillpassword", "#signup_password") | |
149 tumblr.AddLoginAction("submit", "#signup_password") | |
150 | |
151 tumblr.AddLogoutAction("goto", "http://www.tumblr.com/logout") | |
152 | |
153 | |
154 wikipedia = environment.AddWebsite("wikipedia", username_not_auto=True) | |
155 | |
156 wikipedia.AddLoginAction( | |
157 "goto", "https://en.wikipedia.org/w/index.php?title=Special:UserLogin") | |
158 wikipedia.AddLoginAction("fillusername", "#wpName1") | |
159 wikipedia.AddLoginAction("fillpassword", "#wpPassword1") | |
160 wikipedia.AddLoginAction("submit", "#wpPassword1") | |
161 | |
162 wikipedia.AddLogoutAction( | |
163 "goto", "https://en.wikipedia.org/w/index.php?title=Special:UserLogout") | |
164 | |
165 | |
166 yandex = environment.AddWebsite("yandex") | |
167 | |
168 yandex.AddLoginAction("goto", "https://mail.yandex.com") | |
169 yandex.AddLoginAction("fillusername", "#b-mail-domik-username11") | |
170 yandex.AddLoginAction("fillpassword", "#b-mail-domik-password11") | |
171 yandex.AddLoginAction("click", ".b-mail-button__button") | |
172 | |
173 yandex.AddLogoutAction("click", ".header-user-pic.b-mail-dropdown__handle") | |
174 yandex.AddLogoutAction("click", | |
175 u".b-mail-dropdown__item__contentn.Выход.daria-action") | |
176 | |
177 | |
178 """ Tests that can cause a crash (the cause of the crash is not related to the | |
vabr (Chromium)
2014/05/08 13:53:45
For all crashing tests, please add a bugreport for
rchtara
2014/05/14 11:58:04
I think that the chrome version we use to run the
| |
179 password manager). """ | |
180 | |
181 | |
182 baidu = environment.AddWebsite("baidu") | |
183 | |
184 baidu.AddLoginAction("goto", "http://www.baidu.com/") | |
185 baidu.AddLoginAction("click", "[name='tj_login']") | |
186 baidu.AddLoginAction("wait", 5) | |
187 baidu.AddLoginAction("fillusername", "[name='userName']") | |
188 baidu.AddLoginAction("fillpassword", "[name='password']") | |
189 baidu.AddLoginAction("submit", "[name='password']") | |
190 | |
191 baidu.AddLogoutAction("wait", 1) | |
192 baidu.AddLogoutAction( | |
193 "goto", "https://passport.baidu.com/?logout&u=http://www.baidu.com") | |
194 | |
195 | |
196 ebay = environment.AddWebsite("ebay") | |
197 | |
198 ebay.AddLoginAction("goto", "https://signin.ebay.com/ws/eBayISAPI.dll?SellItem") | |
199 ebay.AddLoginAction("fillusername", "[name='userid']") | |
200 ebay.AddLoginAction("fillpassword", "[name='pass']") | |
201 ebay.AddLoginAction("submit", "[name='pass']") | |
202 | |
203 ebay.AddLogoutAction("wait", 1) | |
204 ebay.AddLogoutAction("click", "#gh-ug") | |
205 ebay.AddLogoutAction("wait", 1) | |
206 ebay.AddLogoutAction("click", "#gh-uo") | |
207 | |
208 | |
209 linkedin = environment.AddWebsite("linkedin") | |
210 | |
211 linkedin.AddLoginAction("goto", "https://www.linkedin.com") | |
212 linkedin.AddLoginAction("fillusername", "#session_key-login") | |
213 linkedin.AddLoginAction("fillpassword", "#session_password-login") | |
214 linkedin.AddLoginAction("submit", "#session_password-login") | |
215 | |
216 linkedin.AddLogoutAction("wait", 1) | |
217 linkedin.AddLogoutAction("hover", ".account-toggle") | |
218 linkedin.AddLogoutAction("wait", 1) | |
219 linkedin.AddLogoutAction("click", ".account-settings .act-set-action") | |
220 | |
221 | |
222 yahoo = environment.AddWebsite("yahoo", username_not_auto=True) | |
223 | |
224 yahoo.AddLoginAction("goto", "https://login.yahoo.com") | |
225 yahoo.AddLoginAction("optinalfillusername", "#username") | |
226 yahoo.AddLoginAction("fillpassword", "#passwd") | |
227 yahoo.AddLoginAction("submit", "#passwd") | |
228 | |
229 yahoo.AddLogoutAction("wait", 5) | |
230 yahoo.AddLogoutAction("hover", ".tab.tab-user>.mod.view_default") | |
231 yahoo.AddLogoutAction("wait", 1) | |
232 yahoo.AddLogoutAction("click", "[data-pos='4'] .lbl.y-link-1") | |
233 | |
234 | |
235 """ Failing tests. """ | |
236 | |
237 # crbug.com/368690 | |
238 cnn = environment.AddWebsite("cnn") | |
239 | |
240 cnn.AddLoginAction("goto", "http://www.cnn.com") | |
241 cnn.AddLoginAction("wait", 5) | |
242 | |
243 cnn.AddLoginAction("click", "#hdr-auth .no-border.no-pad-right a") | |
244 | |
245 cnn.AddLoginAction("click", ".cnnOvrlyBtn.cnnBtnLogIn") | |
246 cnn.AddLoginAction("fillusername", "#cnnOverlayEmail1l") | |
247 cnn.AddLoginAction("fillpassword", "#cnnOverlayPwd") | |
248 cnn.AddLoginAction("click", ".cnnOvrlyBtn.cnnBtnLogIn") | |
249 cnn.AddLoginAction("wait", 5) | |
250 | |
251 cnn.AddLogoutAction("wait", 4) | |
252 cnn.AddLogoutAction("click", "#hdr-auth .no-border.no-pad-right") | |
253 | |
254 | |
255 # crbug.com/367768 | |
256 live = environment.AddWebsite("live", username_not_auto=True) | |
257 | |
258 live.AddLoginAction("goto", "https://www.live.com") | |
259 live.AddLoginAction("fillusername", "[name='login']") | |
260 live.AddLoginAction("fillpassword", "[name='passwd']") | |
261 live.AddLoginAction("submit", "[name='passwd']") | |
262 | |
263 live.AddLogoutAction("wait", 1) | |
264 live.AddLogoutAction("click", "#c_meun") | |
265 live.AddLogoutAction("wait", 1) | |
266 live.AddLogoutAction("click", "#c_signout") | |
267 | |
268 | |
269 # crbug.com/368690 | |
270 one63 = environment.AddWebsite("163") | |
271 | |
272 one63.AddLoginAction("goto", "http://www.163.com") | |
273 one63.AddLoginAction("hover", "#js_N_navHighlight") | |
274 one63.AddLoginAction("wait", 1) | |
275 one63.AddLoginAction("fillusername", "#js_loginframe_username") | |
276 one63.AddLoginAction("fillpassword", | |
277 ".ntes-loginframe-label-ipt[type='password']") | |
278 one63.AddLoginAction("click", ".ntes-loginframe-btn") | |
279 | |
280 | |
281 one63.AddLogoutAction("wait", 4) | |
282 one63.AddLogoutAction("click", "#js_N_navLogout") | |
283 | |
284 | |
285 # crbug.com/368690 | |
286 vube = environment.AddWebsite("vube") | |
287 | |
288 vube.AddLoginAction("goto", "https://vube.com") | |
289 vube.AddLoginAction("click", "[vube-login='']") | |
290 vube.AddLoginAction("wait", 2) | |
291 vube.AddLoginAction("fillusername", "[ng-model='login.user']") | |
292 vube.AddLoginAction("fillpassword", "[ng-model='login.pass']") | |
293 | |
294 vube.AddLoginAction("click", "[ng-click='login()']") | |
295 vube.AddLoginAction("wait", 3) | |
296 | |
297 vube.AddLogoutAction("wait", 1) | |
298 vube.AddLogoutAction("click", "[ng-click='user.logout()']") | |
299 | |
300 | |
301 """ Tests shutdown. """ | |
vabr (Chromium)
2014/05/08 13:53:45
I don't understand what is meant here.
rchtara
2014/05/14 11:58:04
Done.
| |
302 | |
303 working = ["amazon", "ask", "espn", "facebook", "google", "mailru", "nytimes", | |
304 "pinterest", "reddit", "tumbler", "wikipedia", "yandex"] | |
305 | |
306 args = sys.argv[1:] | |
vabr (Chromium)
2014/05/08 13:53:45
Please enclose the code here in a
if __name__ == "
rchtara
2014/05/14 11:58:04
Done.
| |
307 | |
308 if len(args) == 0: | |
vabr (Chromium)
2014/05/08 13:53:45
Please also consider printing a brief help on argu
rchtara
2014/05/14 11:58:04
Done.
| |
309 environment.Test(working) | |
310 elif "--all" in args: | |
311 environment.AllTests() | |
312 else: | |
313 environment.Test(args) | |
314 | |
315 | |
316 environment.Quit() | |
OLD | NEW |