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

Unified Diff: components/test/data/password_manager/automated_tests/websitetest.py

Issue 1138353003: [Password manager tests automation] Fixes buzzfeed test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/test/data/password_manager/automated_tests/websitetest.py
diff --git a/components/test/data/password_manager/automated_tests/websitetest.py b/components/test/data/password_manager/automated_tests/websitetest.py
index d8148f489fbae83890a7fb83677fdad8e5b035d4..4f8aaf801f74ff00ba83ea64a67fda5294a56dcf 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=True):
vabr (Chromium) 2015/05/18 16:13:34 Should the default value be False?
melandory 2015/05/19 08:06:34 Done.
"""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.

Powered by Google App Engine
This is Rietveld 408576698