| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 | 29 |
| 30 class Facebook(WebsiteTest): | 30 class Facebook(WebsiteTest): |
| 31 | 31 |
| 32 def Login(self): | 32 def Login(self): |
| 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 def Logout(self): | |
| 39 self.WaitUntilDisplayed("#userNavigationLabel") | |
| 40 self.Click("#userNavigationLabel") | |
| 41 self.WaitUntilDisplayed("#logout_form [type='submit']") | |
| 42 self.Click("#logout_form [type='submit']") | |
| 43 | |
| 44 | 38 |
| 45 class Google(WebsiteTest): | 39 class Google(WebsiteTest): |
| 46 | 40 |
| 47 def Login(self): | 41 def Login(self): |
| 48 self.GoTo("https://accounts.google.com/ServiceLogin?sacu=1&continue=") | 42 self.GoTo("https://accounts.google.com/ServiceLogin?sacu=1&continue=") |
| 49 self.FillUsernameInto("#Email") | 43 self.FillUsernameInto("#Email") |
| 50 self.FillPasswordInto("#Passwd") | 44 self.FillPasswordInto("#Passwd") |
| 51 self.Submit("#Passwd") | 45 self.Submit("#Passwd") |
| 52 | 46 |
| 53 def Logout(self): | |
| 54 self.GoTo("https://accounts.google.com/Logout") | |
| 55 | |
| 56 | 47 |
| 57 class Linkedin(WebsiteTest): | 48 class Linkedin(WebsiteTest): |
| 58 | 49 |
| 59 def Login(self): | 50 def Login(self): |
| 60 self.GoTo("https://www.linkedin.com") | 51 self.GoTo("https://www.linkedin.com") |
| 61 self.FillUsernameInto("#session_key-login") | 52 self.FillUsernameInto("#session_key-login") |
| 62 self.FillPasswordInto("#session_password-login") | 53 self.FillPasswordInto("#session_password-login") |
| 63 self.Submit("#session_password-login") | 54 self.Submit("#session_password-login") |
| 64 | 55 |
| 65 def Logout(self): | |
| 66 self.WaitUntilDisplayed(".account-toggle") | |
| 67 self.HoverOver(".account-toggle") | |
| 68 self.WaitUntilDisplayed(".account-settings .act-set-action") | |
| 69 self.Click(".account-settings .act-set-action") | |
| 70 | |
| 71 | 56 |
| 72 class Mailru(WebsiteTest): | 57 class Mailru(WebsiteTest): |
| 73 | 58 |
| 74 def Login(self): | 59 def Login(self): |
| 75 self.GoTo("https://mail.ru") | 60 self.GoTo("https://mail.ru") |
| 76 self.FillUsernameInto("#mailbox__login") | 61 self.FillUsernameInto("#mailbox__login") |
| 77 self.FillPasswordInto("#mailbox__password") | 62 self.FillPasswordInto("#mailbox__password") |
| 78 self.Submit("#mailbox__password") | 63 self.Submit("#mailbox__password") |
| 79 | 64 |
| 80 def Logout(self): | |
| 81 self.Click("#PH_logoutLink") | |
| 82 | |
| 83 | 65 |
| 84 class Nytimes(WebsiteTest): | 66 class Nytimes(WebsiteTest): |
| 85 | 67 |
| 86 def Login(self): | 68 def Login(self): |
| 87 self.GoTo("https://myaccount.nytimes.com/auth/login") | 69 self.GoTo("https://myaccount.nytimes.com/auth/login") |
| 88 self.FillUsernameInto("#userid") | 70 self.FillUsernameInto("#userid") |
| 89 self.FillPasswordInto("#password") | 71 self.FillPasswordInto("#password") |
| 90 self.Submit("#password") | 72 self.Submit("#password") |
| 91 | 73 |
| 92 def Logout(self): | |
| 93 self.GoTo("https://myaccount.nytimes.com/gst/signout") | |
| 94 | |
| 95 | 74 |
| 96 class Pinterest(WebsiteTest): | 75 class Pinterest(WebsiteTest): |
| 97 | 76 |
| 98 def Login(self): | 77 def Login(self): |
| 99 self.GoTo("https://www.pinterest.com/login/") | 78 self.GoTo("https://www.pinterest.com/login/") |
| 100 self.FillUsernameInto("[name='username_or_email']") | 79 self.FillUsernameInto("[name='username_or_email']") |
| 101 self.FillPasswordInto("[name='password']") | 80 self.FillPasswordInto("[name='password']") |
| 102 self.Submit("[name='password']") | 81 self.Submit("[name='password']") |
| 103 | 82 |
| 104 def Logout(self): | |
| 105 self.GoTo("https://www.pinterest.com/logout/") | |
| 106 | |
| 107 | 83 |
| 108 class Reddit(WebsiteTest): | 84 class Reddit(WebsiteTest): |
| 109 | 85 |
| 110 def Login(self): | 86 def Login(self): |
| 111 self.GoTo("http://www.reddit.com") | 87 self.GoTo("http://www.reddit.com") |
| 112 self.Click(".user .login-required") | 88 self.Click(".user .login-required") |
| 113 self.FillUsernameInto("#user_login") | 89 self.FillUsernameInto("#user_login") |
| 114 self.FillPasswordInto("#passwd_login") | 90 self.FillPasswordInto("#passwd_login") |
| 115 self.Wait(2) | 91 self.Wait(2) |
| 116 self.Submit("#passwd_login") | 92 self.Submit("#passwd_login") |
| 117 | 93 |
| 118 def Logout(self): | |
| 119 self.Click("form[action='http://www.reddit.com/logout'] a") | |
| 120 | |
| 121 | 94 |
| 122 class Tumblr(WebsiteTest): | 95 class Tumblr(WebsiteTest): |
| 123 | 96 |
| 124 def Login(self): | 97 def Login(self): |
| 125 self.GoTo("https://www.tumblr.com/login") | 98 self.GoTo("https://www.tumblr.com/login") |
| 126 self.FillUsernameInto("#signup_email") | 99 self.FillUsernameInto("#signup_email") |
| 127 self.FillPasswordInto("#signup_password") | 100 self.FillPasswordInto("#signup_password") |
| 128 self.Submit("#signup_password") | 101 self.Submit("#signup_password") |
| 129 | 102 |
| 130 def Logout(self): | |
| 131 self.GoTo("https://www.tumblr.com/logout") | |
| 132 | |
| 133 | 103 |
| 134 class Wikipedia(WebsiteTest): | 104 class Wikipedia(WebsiteTest): |
| 135 | 105 |
| 136 def Login(self): | 106 def Login(self): |
| 137 self.GoTo("https://en.wikipedia.org/w/index.php?title=Special:UserLogin") | 107 self.GoTo("https://en.wikipedia.org/w/index.php?title=Special:UserLogin") |
| 138 self.FillUsernameInto("#wpName1") | 108 self.FillUsernameInto("#wpName1") |
| 139 self.FillPasswordInto("#wpPassword1") | 109 self.FillPasswordInto("#wpPassword1") |
| 140 self.Submit("#wpPassword1") | 110 self.Submit("#wpPassword1") |
| 141 | 111 |
| 142 def Logout(self): | |
| 143 self.GoTo("https://en.wikipedia.org/w/index.php?title=Special:UserLogout") | |
| 144 | |
| 145 | 112 |
| 146 class Yandex(WebsiteTest): | 113 class Yandex(WebsiteTest): |
| 147 | 114 |
| 148 def Login(self): | 115 def Login(self): |
| 149 self.GoTo("https://mail.yandex.com") | 116 self.GoTo("https://mail.yandex.com") |
| 150 self.FillUsernameInto("#b-mail-domik-username11") | 117 self.FillUsernameInto("#b-mail-domik-username11") |
| 151 self.FillPasswordInto("#b-mail-domik-password11") | 118 self.FillPasswordInto("#b-mail-domik-password11") |
| 152 self.Click(".b-mail-button__button") | 119 self.Click(".b-mail-button__button") |
| 153 | 120 |
| 154 def Logout(self): | |
| 155 while not self.IsDisplayed(".b-mail-dropdown__item__content" | |
| 156 u".Выход.daria-action"): | |
| 157 self.ClickIfClickable(".header-user-pic.b-mail-dropdown__handle") | |
| 158 self.Wait(1) | |
| 159 self.Click(u".b-mail-dropdown__item__content.Выход.daria-action") | |
| 160 | |
| 161 | 121 |
| 162 # Disabled tests. | 122 # Disabled tests. |
| 163 | 123 |
| 164 | 124 |
| 165 # Bug not reproducible without test. | 125 # Bug not reproducible without test. |
| 166 class Amazon(WebsiteTest): | 126 class Amazon(WebsiteTest): |
| 167 | 127 |
| 168 def Login(self): | 128 def Login(self): |
| 169 self.GoTo( | 129 self.GoTo( |
| 170 "https://www.amazon.com/ap/signin?openid.assoc_handle=usflex" | 130 "https://www.amazon.com/ap/signin?openid.assoc_handle=usflex" |
| 171 "&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net" | 131 "&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net" |
| 172 "%2Fauth%2F2.0") | 132 "%2Fauth%2F2.0") |
| 173 self.FillUsernameInto("[name='email']") | 133 self.FillUsernameInto("[name='email']") |
| 174 self.FillPasswordInto("[name='password']") | 134 self.FillPasswordInto("[name='password']") |
| 175 self.Submit("[name='password']") | 135 self.Submit("[name='password']") |
| 176 | 136 |
| 177 def Logout(self): | |
| 178 while not self.IsDisplayed("#nav-item-signout"): | |
| 179 self.Wait(1) | |
| 180 self.HoverOver("#nav-signin-title") | |
| 181 self.Click("#nav-item-signout") | |
| 182 | |
| 183 | 137 |
| 184 # Password not saved. | 138 # Password not saved. |
| 185 class Ask(WebsiteTest): | 139 class Ask(WebsiteTest): |
| 186 | 140 |
| 187 def Login(self): | 141 def Login(self): |
| 188 self.GoTo("http://www.ask.com/answers/browse?qsrc=321&q=&o=0&l=dir#") | 142 self.GoTo("http://www.ask.com/answers/browse?qsrc=321&q=&o=0&l=dir#") |
| 189 while not self.IsDisplayed("[name='username']"): | 143 while not self.IsDisplayed("[name='username']"): |
| 190 self.Click("#a16CnbSignInText") | 144 self.Click("#a16CnbSignInText") |
| 191 self.Wait(1) | 145 self.Wait(1) |
| 192 self.FillUsernameInto("[name='username']") | 146 self.FillUsernameInto("[name='username']") |
| 193 self.FillPasswordInto("[name='password']") | 147 self.FillPasswordInto("[name='password']") |
| 194 self.Click(".signin_show.signin_submit") | 148 self.Click(".signin_show.signin_submit") |
| 195 | 149 |
| 196 def Logout(self): | |
| 197 self.WaitUntilDisplayed("#a16CnbSignInText") | |
| 198 self.Click("#a16CnbSignInText") | |
| 199 | |
| 200 | 150 |
| 201 # Password not saved. | 151 # Password not saved. |
| 202 class Baidu(WebsiteTest): | 152 class Baidu(WebsiteTest): |
| 203 | 153 |
| 204 def Login(self): | 154 def Login(self): |
| 205 self.GoTo("http://www.baidu.com/") | 155 self.GoTo("http://www.baidu.com/") |
| 206 self.Click("[name='tj_login']") | 156 self.Click("[name='tj_login']") |
| 207 self.WaitUntilDisplayed("[name='userName']") | 157 self.WaitUntilDisplayed("[name='userName']") |
| 208 self.FillUsernameInto("[name='userName']") | 158 self.FillUsernameInto("[name='userName']") |
| 209 self.FillPasswordInto("[name='password']") | 159 self.FillPasswordInto("[name='password']") |
| 210 self.Submit("[name='password']") | 160 self.Submit("[name='password']") |
| 211 | 161 |
| 212 def Logout(self): | |
| 213 self.Wait(1) | |
| 214 self.GoTo("https://passport.baidu.com/?logout&u=http://www.baidu.com") | |
| 215 | |
| 216 | 162 |
| 217 # http://crbug.com/368690 | 163 # http://crbug.com/368690 |
| 218 class Cnn(WebsiteTest): | 164 class Cnn(WebsiteTest): |
| 219 | 165 |
| 220 def Login(self): | 166 def Login(self): |
| 221 self.GoTo("http://www.cnn.com") | 167 self.GoTo("http://www.cnn.com") |
| 222 self.Wait(5) | 168 self.Wait(5) |
| 223 while not self.IsDisplayed(".cnnOvrlyBtn.cnnBtnLogIn"): | 169 while not self.IsDisplayed(".cnnOvrlyBtn.cnnBtnLogIn"): |
| 224 self.ClickIfClickable("#hdr-auth .no-border.no-pad-right a") | 170 self.ClickIfClickable("#hdr-auth .no-border.no-pad-right a") |
| 225 self.Wait(1) | 171 self.Wait(1) |
| 226 | 172 |
| 227 self.Click(".cnnOvrlyBtn.cnnBtnLogIn") | 173 self.Click(".cnnOvrlyBtn.cnnBtnLogIn") |
| 228 self.FillUsernameInto("#cnnOverlayEmail1l") | 174 self.FillUsernameInto("#cnnOverlayEmail1l") |
| 229 self.FillPasswordInto("#cnnOverlayPwd") | 175 self.FillPasswordInto("#cnnOverlayPwd") |
| 230 self.Click(".cnnOvrlyBtn.cnnBtnLogIn") | 176 self.Click(".cnnOvrlyBtn.cnnBtnLogIn") |
| 231 self.Click(".cnnOvrlyBtn.cnnBtnLogIn") | 177 self.Click(".cnnOvrlyBtn.cnnBtnLogIn") |
| 232 self.Wait(5) | 178 self.Wait(5) |
| 233 | 179 |
| 234 def Logout(self): | |
| 235 self.Wait(4) | |
| 236 self.Click("#hdr-auth .no-border.no-pad-right") | |
| 237 | |
| 238 | 180 |
| 239 # http://crbug.com/368690 | 181 # http://crbug.com/368690 |
| 240 class Ebay(WebsiteTest): | 182 class Ebay(WebsiteTest): |
| 241 | 183 |
| 242 def Login(self): | 184 def Login(self): |
| 243 self.GoTo("https://signin.ebay.com/") | 185 self.GoTo("https://signin.ebay.com/") |
| 244 self.FillUsernameInto("[name='userid']") | 186 self.FillUsernameInto("[name='userid']") |
| 245 self.FillPasswordInto("[name='pass']") | 187 self.FillPasswordInto("[name='pass']") |
| 246 self.Submit("[name='pass']") | 188 self.Submit("[name='pass']") |
| 247 | 189 |
| 248 def Logout(self): | |
| 249 self.WaitUntilDisplayed("#gh-ug") | |
| 250 self.Click("#gh-ug") | |
| 251 self.WaitUntilDisplayed("#gh-uo") | |
| 252 self.Click("#gh-uo") | |
| 253 | |
| 254 | 190 |
| 255 # Iframe, password saved but not autofileld. | 191 # Iframe, password saved but not autofileld. |
| 256 class Espn(WebsiteTest): | 192 class Espn(WebsiteTest): |
| 257 | 193 |
| 258 def Login(self): | 194 def Login(self): |
| 259 self.GoTo("http://espn.go.com/") | 195 self.GoTo("http://espn.go.com/") |
| 260 while not self.IsDisplayed("#cboxLoadedContent iframe"): | 196 while not self.IsDisplayed("#cboxLoadedContent iframe"): |
| 261 self.Click("#signin .cbOverlay") | 197 self.Click("#signin .cbOverlay") |
| 262 self.Wait(1) | 198 self.Wait(1) |
| 263 frame = self.driver.find_element_by_css_selector("#cboxLoadedContent " | 199 frame = self.driver.find_element_by_css_selector("#cboxLoadedContent " |
| 264 "iframe") | 200 "iframe") |
| 265 self.driver.switch_to_frame(frame) | 201 self.driver.switch_to_frame(frame) |
| 266 self.WaitUntilDisplayed("#username") | 202 self.WaitUntilDisplayed("#username") |
| 267 self.FillUsernameInto("#username") | 203 self.FillUsernameInto("#username") |
| 268 self.FillPasswordInto("#password") | 204 self.FillPasswordInto("#password") |
| 269 while self.IsDisplayed("#password"): | 205 while self.IsDisplayed("#password"): |
| 270 self.ClickIfClickable("#submitBtn") | 206 self.ClickIfClickable("#submitBtn") |
| 271 self.Wait(1) | 207 self.Wait(1) |
| 272 | 208 |
| 273 def Logout(self): | |
| 274 self.WaitUntilDisplayed("#signin .small") | |
| 275 self.Click("#signin .small") | |
| 276 | |
| 277 | 209 |
| 278 # http://crbug.com/367768 | 210 # http://crbug.com/367768 |
| 279 class Live(WebsiteTest): | 211 class Live(WebsiteTest): |
| 280 | 212 |
| 281 def Login(self): | 213 def Login(self): |
| 282 self.GoTo("https://www.live.com") | 214 self.GoTo("https://www.live.com") |
| 283 self.FillUsernameInto("[name='login']") | 215 self.FillUsernameInto("[name='login']") |
| 284 self.FillPasswordInto("[name='passwd']") | 216 self.FillPasswordInto("[name='passwd']") |
| 285 self.Submit("[name='passwd']") | 217 self.Submit("[name='passwd']") |
| 286 | 218 |
| 287 def Logout(self): | |
| 288 self.WaitUntilDisplayed("#c_meun") | |
| 289 self.Click("#c_meun") | |
| 290 self.WaitUntilDisplayed("#c_signout") | |
| 291 self.Click("#c_signout") | |
| 292 | |
| 293 | 219 |
| 294 # http://crbug.com/368690 | 220 # http://crbug.com/368690 |
| 295 class One63(WebsiteTest): | 221 class One63(WebsiteTest): |
| 296 | 222 |
| 297 def Login(self): | 223 def Login(self): |
| 298 self.GoTo("http://www.163.com") | 224 self.GoTo("http://www.163.com") |
| 299 self.HoverOver("#js_N_navHighlight") | 225 self.HoverOver("#js_N_navHighlight") |
| 300 self.WaitUntilDisplayed("#js_loginframe_username") | 226 self.WaitUntilDisplayed("#js_loginframe_username") |
| 301 self.FillUsernameInto("#js_loginframe_username") | 227 self.FillUsernameInto("#js_loginframe_username") |
| 302 self.FillPasswordInto(".ntes-loginframe-label-ipt[type='password']") | 228 self.FillPasswordInto(".ntes-loginframe-label-ipt[type='password']") |
| 303 self.Click(".ntes-loginframe-btn") | 229 self.Click(".ntes-loginframe-btn") |
| 304 | 230 |
| 305 def Logout(self): | |
| 306 self.WaitUntilDisplayed("#js_N_navLogout") | |
| 307 self.Click("#js_N_navLogout") | |
| 308 | |
| 309 | 231 |
| 310 # http://crbug.com/368690 | 232 # http://crbug.com/368690 |
| 311 class Vube(WebsiteTest): | 233 class Vube(WebsiteTest): |
| 312 | 234 |
| 313 def Login(self): | 235 def Login(self): |
| 314 self.GoTo("https://vube.com") | 236 self.GoTo("https://vube.com") |
| 315 self.Click("[vube-login='']") | 237 self.Click("[vube-login='']") |
| 316 self.WaitUntilDisplayed("[ng-model='login.user']") | 238 self.WaitUntilDisplayed("[ng-model='login.user']") |
| 317 self.FillUsernameInto("[ng-model='login.user']") | 239 self.FillUsernameInto("[ng-model='login.user']") |
| 318 self.FillPasswordInto("[ng-model='login.pass']") | 240 self.FillPasswordInto("[ng-model='login.pass']") |
| 319 while (self.IsDisplayed("[ng-model='login.pass']") | 241 while (self.IsDisplayed("[ng-model='login.pass']") |
| 320 and not self.IsDisplayed(".prompt.alert")): | 242 and not self.IsDisplayed(".prompt.alert")): |
| 321 self.ClickIfClickable("[ng-click='login()']") | 243 self.ClickIfClickable("[ng-click='login()']") |
| 322 self.Wait(1) | 244 self.Wait(1) |
| 323 | 245 |
| 324 def Logout(self): | |
| 325 self.WaitUntilDisplayed("[ng-click='user.logout()']") | |
| 326 self.Click("[ng-click='user.logout()']") | |
| 327 | |
| 328 | 246 |
| 329 # Tests that can cause a crash. | 247 # Tests that can cause a crash. |
| 330 | 248 |
| 331 | 249 |
| 332 class Yahoo(WebsiteTest): | 250 class Yahoo(WebsiteTest): |
| 333 | 251 |
| 334 def Login(self): | 252 def Login(self): |
| 335 self.GoTo("https://login.yahoo.com") | 253 self.GoTo("https://login.yahoo.com") |
| 336 self.FillUsernameInto("#username") | 254 self.FillUsernameInto("#username") |
| 337 self.FillPasswordInto("#passwd") | 255 self.FillPasswordInto("#passwd") |
| 338 self.Submit("#passwd") | 256 self.Submit("#passwd") |
| 339 | 257 |
| 340 def Logout(self): | |
| 341 self.WaitUntilDisplayed(".tab.tab-user>.mod.view_default") | |
| 342 self.HoverOver(".tab.tab-user>.mod.view_default") | |
| 343 self.WaitUntilDisplayed("[data-pos='4'] .lbl.y-link-1") | |
| 344 self.Click("[data-pos='4'] .lbl.y-link-1") | |
| 345 | |
| 346 | 258 |
| 347 def Tests(environment): | 259 def Tests(environment): |
| 348 | 260 |
| 349 | 261 |
| 350 # Working tests. | 262 # Working tests. |
| 351 | 263 |
| 352 | 264 |
| 353 environment.AddWebsiteTest(Facebook("facebook")) | 265 environment.AddWebsiteTest(Facebook("facebook")) |
| 354 | 266 |
| 355 environment.AddWebsiteTest(Google("google")) | 267 environment.AddWebsiteTest(Google("google")) |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 args.profile_path[0], | 481 args.profile_path[0], |
| 570 passwords_path, | 482 passwords_path, |
| 571 True, | 483 True, |
| 572 numeric_level, | 484 numeric_level, |
| 573 args.log_screen, | 485 args.log_screen, |
| 574 log_file, | 486 log_file, |
| 575 tested_websites, | 487 tested_websites, |
| 576 args.tests) | 488 args.tests) |
| 577 | 489 |
| 578 saveResults(tests_results, save_path) | 490 saveResults(tests_results, save_path) |
| OLD | NEW |