Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: components/test/data/password_manager/automated_tests/tests.py

Issue 994573002: [Password manager tests automation] Add ability to run single test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 DISABLED_TESTS = 0 18 DISABLED_TESTS = 0
vabr (Chromium) 2015/03/09 14:52:17 Could you please add a # TODO(vabr): Remove this o
melandory 2015/03/09 15:00:27 Done.
19 # Runs only the enabled tests. 19 # Runs only the enabled tests.
20 ENABLED_TESTS = 1 20 ENABLED_TESTS = 1
21 # Runs all the tests. 21 # Runs all the tests.
22 ALL_TESTS = 2 22 ALL_TESTS = 2
23 # Runs a specified list of tests. 23 # Runs a specified list of tests.
24 LIST_OF_TESTS = 3 24 LIST_OF_TESTS = 3
25 25
26 def __init__(self): 26 def __init__(self):
27 pass 27 pass
28 28
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 self.GoTo("https://vube.com") 250 self.GoTo("https://vube.com")
251 self.Click("[vube-login='']") 251 self.Click("[vube-login='']")
252 self.FillUsernameInto("[ng-model='login.user']") 252 self.FillUsernameInto("[ng-model='login.user']")
253 self.FillPasswordInto("[ng-model='login.pass']") 253 self.FillPasswordInto("[ng-model='login.pass']")
254 while (self.IsDisplayed("[ng-model='login.pass']") 254 while (self.IsDisplayed("[ng-model='login.pass']")
255 and not self.IsDisplayed(".prompt.alert")): 255 and not self.IsDisplayed(".prompt.alert")):
256 self.ClickIfClickable("[ng-click='login()']") 256 self.ClickIfClickable("[ng-click='login()']")
257 self.Wait(1) 257 self.Wait(1)
258 258
259 259
260 def Tests(environment): 260 def Tests(environment, tests_to_run=None):
261 261
262 262 # Working tests
vabr (Chromium) 2015/03/09 14:52:17 nit: The comment here and on line 278 is no longer
263 # Working tests. 263 working_tests = {
264 264 "facebook": Facebook("facebook"),
265 265 "google": Google("google"),
266 environment.AddWebsiteTest(Facebook("facebook")) 266 "linkedin": Linkedin("linkedin"),
267 267 "mailru": Mailru("mailru"),
268 environment.AddWebsiteTest(Google("google")) 268 "nytimes": Nytimes("nytimes"),
269 269 "pinterest": Pinterest("pinterest"),
270 environment.AddWebsiteTest(Linkedin("linkedin")) 270 "reddit": Reddit("reddit", username_not_auto=True),
271 271 "tumblr": Tumblr("tumblr", username_not_auto=True),
272 environment.AddWebsiteTest(Mailru("mailru")) 272 "twitter": Twitter("twitter"),
273 273 "wikipedia": Wikipedia("wikipedia", username_not_auto=True),
274 environment.AddWebsiteTest(Nytimes("nytimes")) 274 "yahoo": Yahoo("yahoo", username_not_auto=True),
275 275 "yandex": Yandex("yandex")
276 environment.AddWebsiteTest(Pinterest("pinterest")) 276 }
277
278 environment.AddWebsiteTest(Reddit("reddit", username_not_auto=True))
279
280 environment.AddWebsiteTest(Tumblr("tumblr", username_not_auto=True))
281
282 environment.AddWebsiteTest(Twitter("twitter"))
283
284 environment.AddWebsiteTest(Wikipedia("wikipedia", username_not_auto=True))
285
286 environment.AddWebsiteTest(Yahoo("yahoo", username_not_auto=True))
287
288 environment.AddWebsiteTest(Yandex("yandex"))
289 277
290 # Disabled tests. 278 # Disabled tests.
279 disabled_tests = {
280 "amazon": Amazon("amazon"), # Bug not reproducible without test.
281 "ask": Ask("ask"), # Password not saved.
282 "baidu": Baidu("baidu"), # Password not saved.
283 "cnn": Cnn("cnn"), # http://crbug.com/368690
284 "ebay": Ebay("ebay"), # http://crbug.com/368690
285 "espn": Espn("espn"), # Iframe, password saved but not autofileld.
286 "live": Live("live", username_not_auto=True), # http://crbug.com/367768
287 "163": One63("163"), # http://crbug.com/368690
288 "vube": Vube("vube"), # http://crbug.com/368690
289 }
291 290
291 if tests_to_run:
292 for test in tests_to_run:
293 if (test not in working_tests.keys() and
294 test not in disabled_tests.keys()):
295 print "Skip test: test {} is not in known tests".format(test)
296 continue
297 if test in working_tests.keys():
298 test_class = working_tests[test]
299 else:
300 test_class = disabled_tests[test]
301 environment.AddWebsiteTest(test_class)
302 else:
303 for _, test in working_tests:
304 environment.AddWebsiteTest(test)
305 for _, test in disabled_tests:
306 environment.AddWebsiteTest(test, disabled=True)
292 307
293 # Bug not reproducible without test.
294 environment.AddWebsiteTest(Amazon("amazon"), disabled=True)
295
296 # Password not saved.
297 environment.AddWebsiteTest(Ask("ask"), disabled=True)
298
299 # Password not saved.
300 environment.AddWebsiteTest(Baidu("baidu"), disabled=True)
301
302 # http://crbug.com/368690
303 environment.AddWebsiteTest(Cnn("cnn"), disabled=True)
304
305 # http://crbug.com/368690
306 environment.AddWebsiteTest(Ebay("ebay"), disabled=True)
307
308 # Iframe, password saved but not autofileld.
309 environment.AddWebsiteTest(Espn("espn"), disabled=True)
310
311 # http://crbug.com/367768
312 environment.AddWebsiteTest(Live("live", username_not_auto=True),
313 disabled=True)
314
315 # http://crbug.com/368690
316 environment.AddWebsiteTest(One63("163"), disabled=True)
317
318 # http://crbug.com/368690
319 environment.AddWebsiteTest(Vube("vube"), disabled=True)
320 308
321 def saveResults(environment_tests_results, environment_save_path): 309 def saveResults(environment_tests_results, environment_save_path):
322 """Save the test results in an xml file. 310 """Save the test results in an xml file.
323 311
324 Args: 312 Args:
325 environment_tests_results: A list of the TestResults that are going to be 313 environment_tests_results: A list of the TestResults that are going to be
326 saved. 314 saved.
327 environment_save_path: The file where the results are going to be saved. 315 environment_save_path: The file where the results are going to be saved.
328 If it's None, the results are not going to be stored. 316 If it's None, the results are not going to be stored.
329 Raises: 317 Raises:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 environment_passwords_path, 360 environment_passwords_path,
373 enable_automatic_password_saving, 361 enable_automatic_password_saving,
374 environment_numeric_level, 362 environment_numeric_level,
375 log_to_console, 363 log_to_console,
376 environment_log_file) 364 environment_log_file)
377 365
378 # Test which care about the save-password prompt need the prompt 366 # Test which care about the save-password prompt need the prompt
379 # to be shown. Automatic password saving results in no prompt. 367 # to be shown. Automatic password saving results in no prompt.
380 run_prompt_tests = not enable_automatic_password_saving 368 run_prompt_tests = not enable_automatic_password_saving
381 369
382 Tests(environment) 370 Tests(environment, tests)
383 371
384 if environment_tested_websites == TypeOfTestedWebsites.ALL_TESTS: 372 if environment_tested_websites == TypeOfTestedWebsites.ALL_TESTS:
385 environment.AllTests(run_prompt_tests) 373 environment.AllTests(run_prompt_tests)
386 elif environment_tested_websites == TypeOfTestedWebsites.DISABLED_TESTS: 374 elif environment_tested_websites == TypeOfTestedWebsites.DISABLED_TESTS:
387 environment.DisabledTests(run_prompt_tests) 375 environment.DisabledTests(run_prompt_tests)
388 elif environment_tested_websites == TypeOfTestedWebsites.LIST_OF_TESTS: 376 elif environment_tested_websites == TypeOfTestedWebsites.LIST_OF_TESTS:
389 environment.Test(tests, run_prompt_tests) 377 environment.Test(tests, run_prompt_tests)
390 elif environment_tested_websites == TypeOfTestedWebsites.ENABLED_TESTS: 378 elif environment_tested_websites == TypeOfTestedWebsites.ENABLED_TESTS:
391 environment.WorkingTests(run_prompt_tests) 379 environment.WorkingTests(run_prompt_tests)
392 else: 380 else:
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 args.profile_path[0], 468 args.profile_path[0],
481 passwords_path, 469 passwords_path,
482 True, 470 True,
483 numeric_level, 471 numeric_level,
484 args.log_screen, 472 args.log_screen,
485 log_file, 473 log_file,
486 tested_websites, 474 tested_websites,
487 args.tests) 475 args.tests)
488 476
489 saveResults(tests_results, save_path) 477 saveResults(tests_results, save_path)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698