OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Automated tests for many websites""" | 6 """Automated tests for many websites""" |
7 | 7 |
8 import argparse | 8 import argparse |
9 import logging | 9 import logging |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 self.GoTo("https://www.facebook.com") | 33 self.GoTo("https://www.facebook.com") |
34 self.FillUsernameInto("[name='email']") | 34 self.FillUsernameInto("[name='email']") |
35 self.FillPasswordInto("[name='pass']") | 35 self.FillPasswordInto("[name='pass']") |
36 self.Submit("[name='pass']") | 36 self.Submit("[name='pass']") |
37 | 37 |
38 | 38 |
39 class Google(WebsiteTest): | 39 class Google(WebsiteTest): |
40 | 40 |
41 def Login(self): | 41 def Login(self): |
42 self.GoTo("https://accounts.google.com/ServiceLogin?sacu=1&continue=") | 42 self.GoTo("https://accounts.google.com/ServiceLogin?sacu=1&continue=") |
43 self.WaitUntilDisplayed("#Email") | |
44 self.FillUsernameInto("#Email") | 43 self.FillUsernameInto("#Email") |
45 self.FillPasswordInto("#Passwd") | 44 self.FillPasswordInto("#Passwd") |
46 self.Submit("#Passwd") | 45 self.Submit("#Passwd") |
47 | 46 |
48 | 47 |
49 class Linkedin(WebsiteTest): | 48 class Linkedin(WebsiteTest): |
50 | 49 |
51 def Login(self): | 50 def Login(self): |
52 self.GoTo("https://www.linkedin.com") | 51 self.GoTo("https://www.linkedin.com") |
53 self.FillUsernameInto("#session_key-login") | 52 self.FillUsernameInto("#session_key-login") |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 self.GoTo("https://www.tumblr.com/login") | 98 self.GoTo("https://www.tumblr.com/login") |
100 self.FillUsernameInto("#signup_email") | 99 self.FillUsernameInto("#signup_email") |
101 self.FillPasswordInto("#signup_password") | 100 self.FillPasswordInto("#signup_password") |
102 self.Submit("#signup_password") | 101 self.Submit("#signup_password") |
103 | 102 |
104 | 103 |
105 class Twitter(WebsiteTest): | 104 class Twitter(WebsiteTest): |
106 | 105 |
107 def Login(self): | 106 def Login(self): |
108 self.GoTo("https:///twitter.com") | 107 self.GoTo("https:///twitter.com") |
109 self.WaitUntilDisplayed("#signin-email") | |
110 self.FillUsernameInto("#signin-email") | 108 self.FillUsernameInto("#signin-email") |
111 self.FillPasswordInto("#signin-password") | 109 self.FillPasswordInto("#signin-password") |
112 self.Submit("#signin-password") | 110 self.Submit("#signin-password") |
113 | 111 |
114 | 112 |
115 class Wikipedia(WebsiteTest): | 113 class Wikipedia(WebsiteTest): |
116 | 114 |
117 def Login(self): | 115 def Login(self): |
118 self.GoTo("https://en.wikipedia.org/w/index.php?title=Special:UserLogin") | 116 self.GoTo("https://en.wikipedia.org/w/index.php?title=Special:UserLogin") |
119 self.FillUsernameInto("#wpName1") | 117 self.FillUsernameInto("#wpName1") |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 self.FillUsernameInto("[name='username']") | 164 self.FillUsernameInto("[name='username']") |
167 self.FillPasswordInto("[name='password']") | 165 self.FillPasswordInto("[name='password']") |
168 self.Click(".signin_show.signin_submit") | 166 self.Click(".signin_show.signin_submit") |
169 | 167 |
170 | 168 |
171 # Password not saved. | 169 # Password not saved. |
172 class Baidu(WebsiteTest): | 170 class Baidu(WebsiteTest): |
173 | 171 |
174 def Login(self): | 172 def Login(self): |
175 self.GoTo("https://passport.baidu.com") | 173 self.GoTo("https://passport.baidu.com") |
176 self.WaitUntilDisplayed("[name='userName']") | |
177 self.FillUsernameInto("[name='userName']") | 174 self.FillUsernameInto("[name='userName']") |
178 self.FillPasswordInto("[name='password']") | 175 self.FillPasswordInto("[name='password']") |
179 self.Submit("[name='password']") | 176 self.Submit("[name='password']") |
180 | 177 |
181 | 178 |
182 # http://crbug.com/368690 | 179 # http://crbug.com/368690 |
183 class Cnn(WebsiteTest): | 180 class Cnn(WebsiteTest): |
184 | 181 |
185 def Login(self): | 182 def Login(self): |
186 self.GoTo("http://www.cnn.com") | 183 self.GoTo("http://www.cnn.com") |
187 self.Wait(5) | 184 self.Wait(5) |
188 while not self.IsDisplayed(".cnnOvrlyBtn.cnnBtnLogIn"): | 185 while not self.IsDisplayed(".cnnOvrlyBtn.cnnBtnLogIn"): |
189 self.ClickIfClickable("#hdr-auth .no-border.no-pad-right a") | 186 self.ClickIfClickable("#hdr-auth .no-border.no-pad-right a") |
190 self.Wait(1) | 187 self.Wait(1) |
191 | 188 |
192 self.Click(".cnnOvrlyBtn.cnnBtnLogIn") | 189 self.Click(".cnnOvrlyBtn.cnnBtnLogIn") |
193 self.FillUsernameInto("#cnnOverlayEmail1l") | 190 self.FillUsernameInto("#cnnOverlayEmail1l") |
194 self.FillPasswordInto("#cnnOverlayPwd") | 191 self.FillPasswordInto("#cnnOverlayPwd") |
195 self.Click(".cnnOvrlyBtn.cnnBtnLogIn") | 192 self.Click(".cnnOvrlyBtn.cnnBtnLogIn") |
196 self.Click(".cnnOvrlyBtn.cnnBtnLogIn") | 193 self.Click(".cnnOvrlyBtn.cnnBtnLogIn") |
197 self.Wait(5) | 194 self.Wait(5) |
198 | 195 |
199 | 196 |
200 # http://crbug.com/368690 | 197 # http://crbug.com/368690 |
201 class Ebay(WebsiteTest): | 198 class Ebay(WebsiteTest): |
202 | 199 |
203 def Login(self): | 200 def Login(self): |
204 self.GoTo("https://signin.ebay.com/") | 201 self.GoTo("https://signin.ebay.com/") |
205 self.WaitUntilDisplayed("[name='userid']") | |
206 self.FillUsernameInto("[name='userid']") | 202 self.FillUsernameInto("[name='userid']") |
207 self.FillPasswordInto("[name='pass']") | 203 self.FillPasswordInto("[name='pass']") |
208 self.Submit("[name='pass']") | 204 self.Submit("[name='pass']") |
209 | 205 |
210 | 206 |
211 # Iframe, password saved but not autofileld. | 207 # Iframe, password saved but not autofileld. |
212 class Espn(WebsiteTest): | 208 class Espn(WebsiteTest): |
213 | 209 |
214 def Login(self): | 210 def Login(self): |
215 self.GoTo("http://espn.go.com/") | 211 self.GoTo("http://espn.go.com/") |
216 while not self.IsDisplayed("#cboxLoadedContent iframe"): | 212 while not self.IsDisplayed("#cboxLoadedContent iframe"): |
217 self.Click("#signin .cbOverlay") | 213 self.Click("#signin .cbOverlay") |
218 self.Wait(1) | 214 self.Wait(1) |
219 frame = self.driver.find_element_by_css_selector("#cboxLoadedContent " | 215 frame = self.driver.find_element_by_css_selector("#cboxLoadedContent " |
220 "iframe") | 216 "iframe") |
221 self.driver.switch_to_frame(frame) | 217 self.driver.switch_to_frame(frame) |
222 self.WaitUntilDisplayed("#username") | |
223 self.FillUsernameInto("#username") | 218 self.FillUsernameInto("#username") |
224 self.FillPasswordInto("#password") | 219 self.FillPasswordInto("#password") |
225 while self.IsDisplayed("#password"): | 220 while self.IsDisplayed("#password"): |
226 self.ClickIfClickable("#submitBtn") | 221 self.ClickIfClickable("#submitBtn") |
227 self.Wait(1) | 222 self.Wait(1) |
228 | 223 |
229 | 224 |
230 # http://crbug.com/367768 | 225 # http://crbug.com/367768 |
231 class Live(WebsiteTest): | 226 class Live(WebsiteTest): |
232 | 227 |
233 def Login(self): | 228 def Login(self): |
234 self.GoTo("https://login.live.com") | 229 self.GoTo("https://login.live.com") |
235 self.WaitUntilDisplayed("[name='login']") | |
236 self.FillUsernameInto("[name='login']") | 230 self.FillUsernameInto("[name='login']") |
237 self.FillPasswordInto("[name='passwd']") | 231 self.FillPasswordInto("[name='passwd']") |
238 self.Submit("[name='passwd']") | 232 self.Submit("[name='passwd']") |
239 | 233 |
240 | 234 |
241 # http://crbug.com/368690 | 235 # http://crbug.com/368690 |
242 class One63(WebsiteTest): | 236 class One63(WebsiteTest): |
243 | 237 |
244 def Login(self): | 238 def Login(self): |
245 self.GoTo("http://www.163.com") | 239 self.GoTo("http://www.163.com") |
246 self.WaitUntilDisplayed("#js_N_navHighlight") | |
247 self.HoverOver("#js_N_navHighlight") | 240 self.HoverOver("#js_N_navHighlight") |
248 self.WaitUntilDisplayed("#js_loginframe_username") | |
249 self.FillUsernameInto("#js_loginframe_username") | 241 self.FillUsernameInto("#js_loginframe_username") |
250 self.FillPasswordInto(".ntes-loginframe-label-ipt[type='password']") | 242 self.FillPasswordInto(".ntes-loginframe-label-ipt[type='password']") |
251 self.Click(".ntes-loginframe-btn") | 243 self.Click(".ntes-loginframe-btn") |
252 | 244 |
253 | 245 |
254 # http://crbug.com/368690 | 246 # http://crbug.com/368690 |
255 class Vube(WebsiteTest): | 247 class Vube(WebsiteTest): |
256 | 248 |
257 def Login(self): | 249 def Login(self): |
258 self.GoTo("https://vube.com") | 250 self.GoTo("https://vube.com") |
259 self.WaitUntilDisplayed("[vube-login='']") | |
260 self.Click("[vube-login='']") | 251 self.Click("[vube-login='']") |
261 self.WaitUntilDisplayed("[ng-model='login.user']") | |
262 self.FillUsernameInto("[ng-model='login.user']") | 252 self.FillUsernameInto("[ng-model='login.user']") |
263 self.FillPasswordInto("[ng-model='login.pass']") | 253 self.FillPasswordInto("[ng-model='login.pass']") |
264 while (self.IsDisplayed("[ng-model='login.pass']") | 254 while (self.IsDisplayed("[ng-model='login.pass']") |
265 and not self.IsDisplayed(".prompt.alert")): | 255 and not self.IsDisplayed(".prompt.alert")): |
266 self.ClickIfClickable("[ng-click='login()']") | 256 self.ClickIfClickable("[ng-click='login()']") |
267 self.Wait(1) | 257 self.Wait(1) |
268 | 258 |
269 | 259 |
270 def Tests(environment): | 260 def Tests(environment): |
271 | 261 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 args.profile_path[0], | 480 args.profile_path[0], |
491 passwords_path, | 481 passwords_path, |
492 True, | 482 True, |
493 numeric_level, | 483 numeric_level, |
494 args.log_screen, | 484 args.log_screen, |
495 log_file, | 485 log_file, |
496 tested_websites, | 486 tested_websites, |
497 args.tests) | 487 args.tests) |
498 | 488 |
499 saveResults(tests_results, save_path) | 489 saveResults(tests_results, save_path) |
OLD | NEW |