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 |
11 from environment import Environment | 11 from environment import Environment |
12 from websitetest import WebsiteTest | 12 from websitetest import WebsiteTest |
13 | 13 |
14 | 14 |
15 class TypeOfTestedWebsites: | 15 class TypeOfTestedWebsites: |
16 """An enum to specify which groups of tests to run.""" | 16 """An enum to specify which groups of tests to run.""" |
17 # Runs only the disabled tests. | 17 # Runs only the disabled tests. |
18 # TODO(vabr): Remove this option. | 18 # TODO(vabr): Remove this option. |
19 DISABLED_TESTS = 0 | 19 DISABLED_TESTS = 0 |
20 # Runs only the enabled tests. | 20 # Runs only the enabled tests. |
21 ENABLED_TESTS = 1 | 21 ENABLED_TESTS = 1 |
22 # Runs all the tests. | 22 # Runs all the tests. |
23 ALL_TESTS = 2 | 23 ALL_TESTS = 2 |
24 # Runs a specified list of tests. | 24 # Runs a specified list of tests. |
25 LIST_OF_TESTS = 3 | 25 LIST_OF_TESTS = 3 |
26 | 26 |
27 def __init__(self): | 27 def __init__(self): |
28 pass | 28 pass |
29 | 29 |
30 | |
vabr (Chromium)
2015/03/13 16:10:31
nit: Please keep two spaces between the classes. I
battre
2015/03/16 10:48:05
2 newlines is correct. This was a mistake.
Done.
| |
31 class Alexa(WebsiteTest): | 30 class Alexa(WebsiteTest): |
32 | 31 |
33 def Login(self): | 32 def Login(self): |
34 self.GoTo("https://www.alexa.com/secure/login") | 33 self.GoTo("https://www.alexa.com/secure/login") |
35 self.FillUsernameInto("#email") | 34 self.FillUsernameInto("#email") |
36 self.FillPasswordInto("#pwd") | 35 self.FillPasswordInto("#pwd") |
37 self.Submit("#pwd") | 36 self.Submit("#pwd") |
38 | 37 |
39 | 38 |
40 class Facebook(WebsiteTest): | 39 class Facebook(WebsiteTest): |
41 | 40 |
42 def Login(self): | 41 def Login(self): |
43 self.GoTo("https://www.facebook.com") | 42 self.GoTo("https://www.facebook.com") |
44 self.FillUsernameInto("[name='email']") | 43 self.FillUsernameInto("[name='email']") |
45 self.FillPasswordInto("[name='pass']") | 44 self.FillPasswordInto("[name='pass']") |
46 self.Submit("[name='pass']") | 45 self.Submit("[name='pass']") |
47 | 46 |
48 | 47 |
48 class Github(WebsiteTest): | |
49 | |
50 def Login(self): | |
51 self.GoTo("https://github.com/login") | |
52 self.FillUsernameInto("[name='login']") | |
53 self.FillPasswordInto("[name='password']") | |
54 self.Submit("[name='commit']") | |
55 | |
56 | |
49 class Google(WebsiteTest): | 57 class Google(WebsiteTest): |
50 | 58 |
51 def Login(self): | 59 def Login(self): |
52 self.GoTo("https://accounts.google.com/ServiceLogin?sacu=1&continue=") | 60 self.GoTo("https://accounts.google.com/ServiceLogin?sacu=1&continue=") |
53 self.FillUsernameInto("#Email") | 61 self.FillUsernameInto("#Email") |
54 self.FillPasswordInto("#Passwd") | 62 self.FillPasswordInto("#Passwd") |
55 self.Submit("#Passwd") | 63 self.Submit("#Passwd") |
56 | 64 |
57 | 65 |
58 class Imgur(WebsiteTest): | 66 class Imgur(WebsiteTest): |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 def Login(self): | 176 def Login(self): |
169 self.GoTo("https://mail.yandex.com") | 177 self.GoTo("https://mail.yandex.com") |
170 self.FillUsernameInto("#b-mail-domik-username11") | 178 self.FillUsernameInto("#b-mail-domik-username11") |
171 self.FillPasswordInto("#b-mail-domik-password11") | 179 self.FillPasswordInto("#b-mail-domik-password11") |
172 self.Click(".b-mail-button__button") | 180 self.Click(".b-mail-button__button") |
173 | 181 |
174 | 182 |
175 # Disabled tests. | 183 # Disabled tests. |
176 | 184 |
177 | 185 |
186 # Fails to save password. | |
vabr (Chromium)
2015/03/13 16:10:31
Ideally we should have a bug for every failing tes
battre
2015/03/16 10:48:05
Thanks for taking care of analyzing the details an
| |
187 class Adobe(WebsiteTest): | |
188 | |
189 def Login(self): | |
190 self.GoTo("https://adobeid-na1.services.adobe.com/renga-idprovider/pages/log in?callback=https%3A%2F%2Fims-na1.adobelogin.com%2Fims%2Fadobeid%2Fadobedotcom2% 2FAdobeID%2Ftoken%3Fredirect_uri%3Dhttps%253A%252F%252Fwww.adobe.com%252F%2523fr om_ims%253Dtrue%2526old_hash%253D%2526client_id%253Dadobedotcom2%2526scope%253Dc reative_cloud%25252CAdobeID%25252Copenid%25252Cgnav%25252Cread_organizations%252 52Cadditional_info.projectedProductContext%2526api%253Dauthorize&client_id=adobe dotcom2&scope=creative_cloud%2CAdobeID%2Copenid%2Cgnav%2Cread_organizations%2Cad ditional_info.projectedProductContext&display=web_v2&denied_callback=https%3A%2F %2Fims-na1.adobelogin.com%2Fims%2Fdenied%2Fadobedotcom2%3Fredirect_uri%3Dhttps%2 53A%252F%252Fwww.adobe.com%252F%2523from_ims%253Dtrue%2526old_hash%253D%2526clie nt_id%253Dadobedotcom2%2526scope%253Dcreative_cloud%25252CAdobeID%25252Copenid%2 5252Cgnav%25252Cread_organizations%25252Cadditional_info.projectedProductContext %2526api%253Dauthorize%26response_type%3Dtoken&relay=afebfef8-e2b3-4c0e-9c94-07b af205bae8&locale=en_US&flow_type=token&dc=false&client_redirect=https%3A%2F%2Fim s-na1.adobelogin.com%2Fims%2Fredirect%2Fadobedotcom2%3Fclient_redirect%3Dhttps%2 53A%252F%252Fwww.adobe.com%252F%2523from_ims%253Dtrue%2526old_hash%253D%2526clie nt_id%253Dadobedotcom2%2526scope%253Dcreative_cloud%25252CAdobeID%25252Copenid%2 5252Cgnav%25252Cread_organizations%25252Cadditional_info.projectedProductContext %2526api%253Dauthorize&idp_flow_type=login") | |
vabr (Chromium)
2015/03/13 16:10:31
That's an impressive URL. :)
| |
191 self.FillUsernameInto("[name='username']") | |
192 self.FillPasswordInto("[name='password']") | |
193 self.Submit("#sign_in") | |
194 | |
195 | |
178 # Bug not reproducible without test. | 196 # Bug not reproducible without test. |
179 class Amazon(WebsiteTest): | 197 class Amazon(WebsiteTest): |
180 | 198 |
181 def Login(self): | 199 def Login(self): |
182 self.GoTo( | 200 self.GoTo( |
183 "https://www.amazon.com/ap/signin?openid.assoc_handle=usflex" | 201 "https://www.amazon.com/ap/signin?openid.assoc_handle=usflex" |
184 "&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net" | 202 "&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net" |
185 "%2Fauth%2F2.0") | 203 "%2Fauth%2F2.0") |
186 self.FillUsernameInto("[name='email']") | 204 self.FillUsernameInto("[name='email']") |
187 self.FillPasswordInto("[name='password']") | 205 self.FillPasswordInto("[name='password']") |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 self.FillUsernameInto("#email") | 353 self.FillUsernameInto("#email") |
336 self.FillPasswordInto("#password") | 354 self.FillPasswordInto("#password") |
337 self.Click(".login input") | 355 self.Click(".login input") |
338 | 356 |
339 | 357 |
340 def Tests(environment, tests_to_run=None): | 358 def Tests(environment, tests_to_run=None): |
341 | 359 |
342 working_tests = { | 360 working_tests = { |
343 "alexa": Alexa("alexa"), | 361 "alexa": Alexa("alexa"), |
344 "facebook": Facebook("facebook"), | 362 "facebook": Facebook("facebook"), |
363 "github": Github("github"), | |
345 "google": Google("google"), | 364 "google": Google("google"), |
346 "imgur": Imgur("imgur"), | 365 "imgur": Imgur("imgur"), |
347 "liveinternet": Liveinternet("liveinternet"), | 366 "liveinternet": Liveinternet("liveinternet"), |
348 "linkedin": Linkedin("linkedin"), | 367 "linkedin": Linkedin("linkedin"), |
349 "mailru": Mailru("mailru"), | 368 "mailru": Mailru("mailru"), |
350 "nytimes": Nytimes("nytimes"), | 369 "nytimes": Nytimes("nytimes"), |
351 "odnoklassniki": Odnoklassniki("odnoklassniki"), | 370 "odnoklassniki": Odnoklassniki("odnoklassniki"), |
352 "pinterest": Pinterest("pinterest"), | 371 "pinterest": Pinterest("pinterest"), |
353 "reddit": Reddit("reddit", username_not_auto=True), | 372 "reddit": Reddit("reddit", username_not_auto=True), |
354 "tumblr": Tumblr("tumblr", username_not_auto=True), | 373 "tumblr": Tumblr("tumblr", username_not_auto=True), |
355 "twitter": Twitter("twitter"), | 374 "twitter": Twitter("twitter"), |
356 "wikipedia": Wikipedia("wikipedia", username_not_auto=True), | 375 "wikipedia": Wikipedia("wikipedia", username_not_auto=True), |
357 "yahoo": Yahoo("yahoo", username_not_auto=True), | 376 "yahoo": Yahoo("yahoo", username_not_auto=True), |
358 "yandex": Yandex("yandex") | 377 "yandex": Yandex("yandex") |
359 } | 378 } |
360 | 379 |
361 disabled_tests = { | 380 disabled_tests = { |
381 "adobe": Adobe("adobe"), # Password saving not offered. | |
362 "amazon": Amazon("amazon"), # Bug not reproducible without test. | 382 "amazon": Amazon("amazon"), # Bug not reproducible without test. |
363 "ask": Ask("ask"), # Password not saved. | 383 "ask": Ask("ask"), # Password not saved. |
364 "baidu": Baidu("baidu"), # Password not saved. | 384 "baidu": Baidu("baidu"), # Password not saved. |
365 "cnn": Cnn("cnn"), # http://crbug.com/368690 | 385 "cnn": Cnn("cnn"), # http://crbug.com/368690 |
366 "craigslist": Craigslist("craigslist"), # Too many failed logins per time. | 386 "craigslist": Craigslist("craigslist"), # Too many failed logins per time. |
367 "dailymotion": Dailymotion("dailymotion"), # Crashes. | 387 "dailymotion": Dailymotion("dailymotion"), # Crashes. |
368 "ebay": Ebay("ebay"), # http://crbug.com/368690 | 388 "ebay": Ebay("ebay"), # http://crbug.com/368690 |
369 "espn": Espn("espn"), # Iframe, password saved but not autofileld. | 389 "espn": Espn("espn"), # Iframe, password saved but not autofileld. |
370 "instagram": Instagram("instagram"), # Iframe, pw saved but not autofilled. | 390 "instagram": Instagram("instagram"), # Iframe, pw saved but not autofilled. |
371 "live": Live("live", username_not_auto=True), # http://crbug.com/367768 | 391 "live": Live("live", username_not_auto=True), # http://crbug.com/367768 |
372 "163": One63("163"), # http://crbug.com/368690 | 392 "163": One63("163"), # http://crbug.com/368690 |
373 "vube": Vube("vube"), # http://crbug.com/368690 | 393 "vube": Vube("vube"), # http://crbug.com/368690 |
374 "ziddu": Ziddu("ziddu"), #Password not saved | 394 "ziddu": Ziddu("ziddu"), # Password not saved. |
375 } | 395 } |
376 | 396 |
377 if tests_to_run: | 397 if tests_to_run: |
378 for test in tests_to_run: | 398 for test in tests_to_run: |
379 if (test not in working_tests.keys() and | 399 if (test not in working_tests.keys() and |
380 test not in disabled_tests.keys()): | 400 test not in disabled_tests.keys()): |
381 print "Skip test: test {} is not in known tests".format(test) | 401 print "Skip test: test {} is not in known tests".format(test) |
382 continue | 402 continue |
383 if test in working_tests.keys(): | 403 if test in working_tests.keys(): |
384 test_class = working_tests[test] | 404 test_class = working_tests[test] |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
554 args.profile_path[0], | 574 args.profile_path[0], |
555 passwords_path, | 575 passwords_path, |
556 True, | 576 True, |
557 numeric_level, | 577 numeric_level, |
558 args.log_screen, | 578 args.log_screen, |
559 log_file, | 579 log_file, |
560 tested_websites, | 580 tested_websites, |
561 args.tests) | 581 args.tests) |
562 | 582 |
563 saveResults(tests_results, save_path) | 583 saveResults(tests_results, save_path) |
OLD | NEW |