| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 class Facebook(WebsiteTest): | 49 class Facebook(WebsiteTest): |
| 50 | 50 |
| 51 def Login(self): | 51 def Login(self): |
| 52 self.GoTo("https://www.facebook.com") | 52 self.GoTo("https://www.facebook.com") |
| 53 self.FillUsernameInto("[name='email']") | 53 self.FillUsernameInto("[name='email']") |
| 54 self.FillPasswordInto("[name='pass']") | 54 self.FillPasswordInto("[name='pass']") |
| 55 self.Submit("[name='pass']") | 55 self.Submit("[name='pass']") |
| 56 | 56 |
| 57 | 57 |
| 58 class Github(WebsiteTest): |
| 59 |
| 60 def Login(self): |
| 61 self.GoTo("https://github.com/login") |
| 62 self.FillUsernameInto("[name='login']") |
| 63 self.FillPasswordInto("[name='password']") |
| 64 self.Submit("[name='commit']") |
| 65 |
| 66 |
| 58 class Google(WebsiteTest): | 67 class Google(WebsiteTest): |
| 59 | 68 |
| 60 def Login(self): | 69 def Login(self): |
| 61 self.GoTo("https://accounts.google.com/ServiceLogin?sacu=1&continue=") | 70 self.GoTo("https://accounts.google.com/ServiceLogin?sacu=1&continue=") |
| 62 self.FillUsernameInto("#Email") | 71 self.FillUsernameInto("#Email") |
| 63 self.FillPasswordInto("#Passwd") | 72 self.FillPasswordInto("#Passwd") |
| 64 self.Submit("#Passwd") | 73 self.Submit("#Passwd") |
| 65 | 74 |
| 66 | 75 |
| 67 class Imgur(WebsiteTest): | 76 class Imgur(WebsiteTest): |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 def Login(self): | 218 def Login(self): |
| 210 self.GoTo("https://login.aliexpress.com/buyer.htm?return=http%3A%2F%2Fwww.al
iexpress.com%2F") | 219 self.GoTo("https://login.aliexpress.com/buyer.htm?return=http%3A%2F%2Fwww.al
iexpress.com%2F") |
| 211 self.WaitUntilDisplayed("iframe#alibaba-login-box") | 220 self.WaitUntilDisplayed("iframe#alibaba-login-box") |
| 212 frame = self.driver.find_element_by_css_selector("iframe#alibaba-login-box") | 221 frame = self.driver.find_element_by_css_selector("iframe#alibaba-login-box") |
| 213 self.driver.switch_to_frame(frame) | 222 self.driver.switch_to_frame(frame) |
| 214 self.FillUsernameInto("#fm-login-id") | 223 self.FillUsernameInto("#fm-login-id") |
| 215 self.FillPasswordInto("#fm-login-password") | 224 self.FillPasswordInto("#fm-login-password") |
| 216 self.Click("#fm-login-submit") | 225 self.Click("#fm-login-submit") |
| 217 | 226 |
| 218 | 227 |
| 228 # Fails to save password. |
| 229 class Adobe(WebsiteTest): |
| 230 |
| 231 def Login(self): |
| 232 self.GoTo("https://adobeid-na1.services.adobe.com/renga-idprovider/pages/l" |
| 233 "ogin?callback=https%3A%2F%2Fims-na1.adobelogin.com%2Fims%2Fadob" |
| 234 "eid%2Fadobedotcom2%2FAdobeID%2Ftoken%3Fredirect_uri%3Dhttps%253" |
| 235 "A%252F%252Fwww.adobe.com%252F%2523from_ims%253Dtrue%2526old_has" |
| 236 "h%253D%2526client_id%253Dadobedotcom2%2526scope%253Dcreative_cl" |
| 237 "oud%25252CAdobeID%25252Copenid%25252Cgnav%25252Cread_organizati" |
| 238 "ons%25252Cadditional_info.projectedProductContext%2526api%253Da" |
| 239 "uthorize&client_id=adobedotcom2&scope=creative_cloud%2CAdobeID%" |
| 240 "2Copenid%2Cgnav%2Cread_organizations%2Cadditional_info.projecte" |
| 241 "dProductContext&display=web_v2&denied_callback=https%3A%2F%2Fim" |
| 242 "s-na1.adobelogin.com%2Fims%2Fdenied%2Fadobedotcom2%3Fredirect_u" |
| 243 "ri%3Dhttps%253A%252F%252Fwww.adobe.com%252F%2523from_ims%253Dtr" |
| 244 "ue%2526old_hash%253D%2526client_id%253Dadobedotcom2%2526scope%2" |
| 245 "53Dcreative_cloud%25252CAdobeID%25252Copenid%25252Cgnav%25252Cr" |
| 246 "ead_organizations%25252Cadditional_info.projectedProductContext" |
| 247 "%2526api%253Dauthorize%26response_type%3Dtoken&relay=afebfef8-e" |
| 248 "2b3-4c0e-9c94-07baf205bae8&locale=en_US&flow_type=token&dc=fals" |
| 249 "e&client_redirect=https%3A%2F%2Fims-na1.adobelogin.com%2Fims%2F" |
| 250 "redirect%2Fadobedotcom2%3Fclient_redirect%3Dhttps%253A%252F%252" |
| 251 "Fwww.adobe.com%252F%2523from_ims%253Dtrue%2526old_hash%253D%252" |
| 252 "6client_id%253Dadobedotcom2%2526scope%253Dcreative_cloud%25252C" |
| 253 "AdobeID%25252Copenid%25252Cgnav%25252Cread_organizations%25252C" |
| 254 "additional_info.projectedProductContext%2526api%253Dauthorize&i" |
| 255 "dp_flow_type=login") |
| 256 self.FillUsernameInto("[name='username']") |
| 257 self.FillPasswordInto("[name='password']") |
| 258 self.Submit("#sign_in") |
| 259 |
| 260 |
| 219 # Bug not reproducible without test. | 261 # Bug not reproducible without test. |
| 220 class Amazon(WebsiteTest): | 262 class Amazon(WebsiteTest): |
| 221 | 263 |
| 222 def Login(self): | 264 def Login(self): |
| 223 self.GoTo( | 265 self.GoTo( |
| 224 "https://www.amazon.com/ap/signin?openid.assoc_handle=usflex" | 266 "https://www.amazon.com/ap/signin?openid.assoc_handle=usflex" |
| 225 "&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net" | 267 "&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net" |
| 226 "%2Fauth%2F2.0") | 268 "%2Fauth%2F2.0") |
| 227 self.FillUsernameInto("[name='email']") | 269 self.FillUsernameInto("[name='email']") |
| 228 self.FillPasswordInto("[name='password']") | 270 self.FillPasswordInto("[name='password']") |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 self.FillPasswordInto("#password") | 431 self.FillPasswordInto("#password") |
| 390 self.Click(".login input") | 432 self.Click(".login input") |
| 391 | 433 |
| 392 | 434 |
| 393 def Tests(environment, tests_to_run=None): | 435 def Tests(environment, tests_to_run=None): |
| 394 | 436 |
| 395 working_tests = { | 437 working_tests = { |
| 396 "alexa": Alexa("alexa"), | 438 "alexa": Alexa("alexa"), |
| 397 "dropbox": Dropbox("dropbox"), | 439 "dropbox": Dropbox("dropbox"), |
| 398 "facebook": Facebook("facebook"), | 440 "facebook": Facebook("facebook"), |
| 441 "github": Github("github"), |
| 399 "google": Google("google"), | 442 "google": Google("google"), |
| 400 "imgur": Imgur("imgur"), | 443 "imgur": Imgur("imgur"), |
| 401 "liveinternet": Liveinternet("liveinternet"), | 444 "liveinternet": Liveinternet("liveinternet"), |
| 402 "linkedin": Linkedin("linkedin"), | 445 "linkedin": Linkedin("linkedin"), |
| 403 "mailru": Mailru("mailru"), | 446 "mailru": Mailru("mailru"), |
| 404 "nytimes": Nytimes("nytimes"), | 447 "nytimes": Nytimes("nytimes"), |
| 405 "odnoklassniki": Odnoklassniki("odnoklassniki"), | 448 "odnoklassniki": Odnoklassniki("odnoklassniki"), |
| 406 "pinterest": Pinterest("pinterest"), | 449 "pinterest": Pinterest("pinterest"), |
| 407 "reddit": Reddit("reddit", username_not_auto=True), | 450 "reddit": Reddit("reddit", username_not_auto=True), |
| 408 "tumblr": Tumblr("tumblr", username_not_auto=True), | 451 "tumblr": Tumblr("tumblr", username_not_auto=True), |
| 409 "twitter": Twitter("twitter"), | 452 "twitter": Twitter("twitter"), |
| 410 "wikia": Wikia("wikia"), | 453 "wikia": Wikia("wikia"), |
| 411 "wikipedia": Wikipedia("wikipedia", username_not_auto=True), | 454 "wikipedia": Wikipedia("wikipedia", username_not_auto=True), |
| 412 "wordpress": Wordpress("wordpress"), | 455 "wordpress": Wordpress("wordpress"), |
| 413 "yahoo": Yahoo("yahoo", username_not_auto=True), | 456 "yahoo": Yahoo("yahoo", username_not_auto=True), |
| 414 "yandex": Yandex("yandex") | 457 "yandex": Yandex("yandex") |
| 415 } | 458 } |
| 416 | 459 |
| 417 disabled_tests = { | 460 disabled_tests = { |
| 461 "adobe": Adobe("adobe"), # Password saving not offered. |
| 418 "aliexpress": Aliexpress("aliexpress"), # Fails due to test framework issue. | 462 "aliexpress": Aliexpress("aliexpress"), # Fails due to test framework issue. |
| 419 "amazon": Amazon("amazon"), # Bug not reproducible without test. | 463 "amazon": Amazon("amazon"), # Bug not reproducible without test. |
| 420 "ask": Ask("ask"), # Password not saved. | 464 "ask": Ask("ask"), # Password not saved. |
| 421 "baidu": Baidu("baidu"), # Password not saved. | 465 "baidu": Baidu("baidu"), # Password not saved. |
| 422 "cnn": Cnn("cnn"), # http://crbug.com/368690 | 466 "cnn": Cnn("cnn"), # http://crbug.com/368690 |
| 423 "craigslist": Craigslist("craigslist"), # Too many failed logins per time. | 467 "craigslist": Craigslist("craigslist"), # Too many failed logins per time. |
| 424 "dailymotion": Dailymotion("dailymotion"), # Crashes. | 468 "dailymotion": Dailymotion("dailymotion"), # Crashes. |
| 425 "ebay": Ebay("ebay"), # http://crbug.com/368690 | 469 "ebay": Ebay("ebay"), # http://crbug.com/368690 |
| 426 "espn": Espn("espn"), # Iframe, password saved but not autofileld. | 470 "espn": Espn("espn"), # Iframe, password saved but not autofileld. |
| 427 "flipkart": Flipkart("flipkart"), # Fails due to test framework issue. | 471 "flipkart": Flipkart("flipkart"), # Fails due to test framework issue. |
| 428 "instagram": Instagram("instagram"), # Iframe, pw saved but not autofilled. | 472 "instagram": Instagram("instagram"), # Iframe, pw saved but not autofilled. |
| 429 "live": Live("live", username_not_auto=True), # http://crbug.com/367768 | 473 "live": Live("live", username_not_auto=True), # http://crbug.com/367768 |
| 430 "163": One63("163"), # http://crbug.com/368690 | 474 "163": One63("163"), # http://crbug.com/368690 |
| 431 "vube": Vube("vube"), # http://crbug.com/368690 | 475 "vube": Vube("vube"), # http://crbug.com/368690 |
| 432 "ziddu": Ziddu("ziddu"), #Password not saved | 476 "ziddu": Ziddu("ziddu"), # Password not saved. |
| 433 } | 477 } |
| 434 | 478 |
| 435 if tests_to_run: | 479 if tests_to_run: |
| 436 for test in tests_to_run: | 480 for test in tests_to_run: |
| 437 if (test not in working_tests.keys() and | 481 if (test not in working_tests.keys() and |
| 438 test not in disabled_tests.keys()): | 482 test not in disabled_tests.keys()): |
| 439 print "Skip test: test {} is not in known tests".format(test) | 483 print "Skip test: test {} is not in known tests".format(test) |
| 440 continue | 484 continue |
| 441 if test in working_tests.keys(): | 485 if test in working_tests.keys(): |
| 442 test_class = working_tests[test] | 486 test_class = working_tests[test] |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 args.profile_path[0], | 656 args.profile_path[0], |
| 613 passwords_path, | 657 passwords_path, |
| 614 True, | 658 True, |
| 615 numeric_level, | 659 numeric_level, |
| 616 args.log_screen, | 660 args.log_screen, |
| 617 log_file, | 661 log_file, |
| 618 tested_websites, | 662 tested_websites, |
| 619 args.tests) | 663 args.tests) |
| 620 | 664 |
| 621 saveResults(tests_results, save_path) | 665 saveResults(tests_results, save_path) |
| OLD | NEW |