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

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

Issue 1084553003: [Password manager tests automation] Adds an ability to specify test_case which should be run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@save_only_errors
Patch Set: Created 5 years, 8 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
« no previous file with comments | « components/test/data/password_manager/automated_tests/tests.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """WebsiteTest testing class.""" 5 """WebsiteTest testing class."""
6 6
7 import logging 7 import logging
8 import time 8 import time
9 9
10 from selenium.webdriver.common.action_chains import ActionChains 10 from selenium.webdriver.common.action_chains import ActionChains
(...skipping 12 matching lines...) Expand all
23 """ 23 """
24 24
25 # Possible values of self.autofill_expectation. 25 # Possible values of self.autofill_expectation.
26 AUTOFILLED = 1 # Expect password and username to be autofilled. 26 AUTOFILLED = 1 # Expect password and username to be autofilled.
27 NOT_AUTOFILLED = 2 # Expect password and username not to be autofilled. 27 NOT_AUTOFILLED = 2 # Expect password and username not to be autofilled.
28 28
29 # The maximal accumulated time to spend in waiting for website UI 29 # The maximal accumulated time to spend in waiting for website UI
30 # interaction. 30 # interaction.
31 MAX_WAIT_TIME_IN_SECONDS = 200 31 MAX_WAIT_TIME_IN_SECONDS = 200
32 32
33 # Types of test to be passed to self.RunTest().
34 TEST_TYPE_PROMPT_FAIL = 1
35 TEST_TYPE_PROMPT_SUCCESS = 2
36 TEST_TYPE_SAVE_AND_AUTOFILL = 3
37
38 def __init__(self, name, username_not_auto=False): 33 def __init__(self, name, username_not_auto=False):
39 """Creates a new WebsiteTest. 34 """Creates a new WebsiteTest.
40 35
41 Args: 36 Args:
42 name: The website name, identifying it in the test results. 37 name: The website name, identifying it in the test results.
43 username_not_auto: Expect that the tested website fills username field 38 username_not_auto: Expect that the tested website fills username field
44 on load, and Chrome cannot autofill in that case. 39 on load, and Chrome cannot autofill in that case.
45 """ 40 """
46 self.name = name 41 self.name = name
47 self.username = None 42 self.username = None
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 [environment.MESSAGE_SAVE], 356 [environment.MESSAGE_SAVE],
362 True, 357 True,
363 "Error: did not detect login success on website: %s" % self.name) 358 "Error: did not detect login success on website: %s" % self.name)
364 self.Logout() 359 self.Logout()
365 self.LoginWhenAutofilled() 360 self.LoginWhenAutofilled()
366 self.environment.CheckForNewString( 361 self.environment.CheckForNewString(
367 [environment.MESSAGE_SAVE], 362 [environment.MESSAGE_SAVE],
368 True, 363 True,
369 "Error: failed autofilled login on website: %s" % self.name) 364 "Error: failed autofilled login on website: %s" % self.name)
370 365
371 def RunTest(self, test_type):
372 """Runs test according to the |test_type|.
373
374 Raises:
375 Exception: If |test_type| is not one of the TEST_TYPE_* constants.
376 """
377
378 if test_type == WebsiteTest.TEST_TYPE_PROMPT_FAIL:
379 self.PromptFailTest()
380 elif test_type == WebsiteTest.TEST_TYPE_PROMPT_SUCCESS:
381 self.PromptSuccessTest()
382 elif test_type == WebsiteTest.TEST_TYPE_SAVE_AND_AUTOFILL:
383 self.SaveAndAutofillTest()
384 else:
385 raise Exception("Unknown test type {}.".format(test_type))
OLDNEW
« no previous file with comments | « components/test/data/password_manager/automated_tests/tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698