summaryrefslogtreecommitdiffstats
path: root/components/test
diff options
context:
space:
mode:
authormelandory <melandory@chromium.org>2015-05-19 03:36:47 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-19 10:36:50 +0000
commitf1be3c264853e564c69053f580d14fabfbfea62b (patch)
tree0b9fcc95dd4b5faf7088c6454545799ba7005e12 /components/test
parentf0d41ff457719264be0af4071ff3c05e2e8e13d1 (diff)
downloadchromium_src-f1be3c264853e564c69053f580d14fabfbfea62b.zip
chromium_src-f1be3c264853e564c69053f580d14fabfbfea62b.tar.gz
chromium_src-f1be3c264853e564c69053f580d14fabfbfea62b.tar.bz2
[Password manager tests automation] Fixed buzzfeed.
Fixes buzzfeed by introducing password_not_auto parameter. BUG=369521 R=vabr@chromium.org Review URL: https://codereview.chromium.org/1138353003 Cr-Commit-Position: refs/heads/master@{#330502}
Diffstat (limited to 'components/test')
-rw-r--r--components/test/data/password_manager/automated_tests/tests.py4
-rw-r--r--components/test/data/password_manager/automated_tests/websitetest.py30
2 files changed, 22 insertions, 12 deletions
diff --git a/components/test/data/password_manager/automated_tests/tests.py b/components/test/data/password_manager/automated_tests/tests.py
index ac5a44a..6c92c7c 100644
--- a/components/test/data/password_manager/automated_tests/tests.py
+++ b/components/test/data/password_manager/automated_tests/tests.py
@@ -449,7 +449,9 @@ all_tests = {
"amazon": Amazon("amazon"), # Bug not reproducible without test.
"ask": Ask("ask"), # Password not saved.
"baidu": Baidu("baidu"), # Password not saved.
- "buzzfeed": Buzzfeed("buzzfeed"),
+ "buzzfeed": Buzzfeed("buzzfeed",
+ username_not_auto=True,
+ password_not_auto=True),
"cnn": Cnn("cnn"), # http://crbug.com/368690
"craigslist": Craigslist("craigslist"), # Too many failed logins per time.
"dailymotion": Dailymotion("dailymotion"), # Crashes.
diff --git a/components/test/data/password_manager/automated_tests/websitetest.py b/components/test/data/password_manager/automated_tests/websitetest.py
index d8148f4..7e165a245 100644
--- a/components/test/data/password_manager/automated_tests/websitetest.py
+++ b/components/test/data/password_manager/automated_tests/websitetest.py
@@ -30,18 +30,21 @@ class WebsiteTest:
# interaction.
MAX_WAIT_TIME_IN_SECONDS = 200
- def __init__(self, name, username_not_auto=False):
+ def __init__(self, name, username_not_auto=False, password_not_auto=False):
"""Creates a new WebsiteTest.
Args:
name: The website name, identifying it in the test results.
username_not_auto: Expect that the tested website fills username field
on load, and Chrome cannot autofill in that case.
+ password_not_auto: Expect that the tested website fills password field
+ on load, and Chrome cannot autofill in that case.
"""
self.name = name
self.username = None
self.password = None
self.username_not_auto = username_not_auto
+ self.password_not_auto = password_not_auto
# Specify, whether it is expected that credentials get autofilled.
self.autofill_expectation = WebsiteTest.NOT_AUTOFILLED
@@ -195,7 +198,9 @@ class WebsiteTest:
Depending on self.autofill_expectation, this either checks that the
element already has the password autofilled, or checks that the value
- is empty and replaces it with the password.
+ is empty and replaces it with the password. If self.password_not_auto
+ is true, it skips the checks and just overwrites the value with the
+ password.
Args:
selector: The CSS selector for the filled element.
@@ -215,15 +220,18 @@ class WebsiteTest:
action_chains.key_down(Keys.CONTROL).key_up(Keys.CONTROL).perform()
self.Wait(2) # TODO(vabr): Detect when autofill finished.
- if self.autofill_expectation == WebsiteTest.AUTOFILLED:
- if password_element.get_attribute("value") != self.password:
- raise Exception("Error: autofilled password is different from the saved"
- " one on website: %s" % self.name)
- elif self.autofill_expectation == WebsiteTest.NOT_AUTOFILLED:
- if password_element.get_attribute("value"):
- raise Exception("Error: password value unexpectedly not empty on"
- "website: %s" % self.name)
- password_element.send_keys(self.password)
+ if not self.password_not_auto:
+ if self.autofill_expectation == WebsiteTest.AUTOFILLED:
+ if password_element.get_attribute("value") != self.password:
+ raise Exception("Error: autofilled password is different from the"
+ "saved one on website: %s" % self.name)
+ elif self.autofill_expectation == WebsiteTest.NOT_AUTOFILLED:
+ if password_element.get_attribute("value"):
+ raise Exception("Error: password value unexpectedly not empty on"
+ "website: %s" % self.name)
+
+ password_element.clear()
+ password_element.send_keys(self.password)
def FillUsernameInto(self, selector):
"""Ensures that the selected element's value is the saved username.