Commit 03b08926 authored by rchtara@chromium.org's avatar rchtara@chromium.org

The password manager python tests are updated to work with the latest

version of the tested websites.
Some of the tested websites have changed over the last weeks. This cl
updates the password manager python tests so they can support
the new version of websites.
This cl adds also the tests for Twitter.
BUG=404647

Review URL: https://codereview.chromium.org/483763002

Cr-Commit-Position: refs/heads/master@{#291164}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291164 0039d316-1c4b-4281-b951-d872f2087c98
parent c9cad8ec
......@@ -40,6 +40,7 @@ class Google(WebsiteTest):
def Login(self):
self.GoTo("https://accounts.google.com/ServiceLogin?sacu=1&continue=")
self.WaitUntilDisplayed("#Email")
self.FillUsernameInto("#Email")
self.FillPasswordInto("#Passwd")
self.Submit("#Passwd")
......@@ -101,6 +102,16 @@ class Tumblr(WebsiteTest):
self.Submit("#signup_password")
class Twitter(WebsiteTest):
def Login(self):
self.GoTo("https:///twitter.com")
self.WaitUntilDisplayed("#signin-email")
self.FillUsernameInto("#signin-email")
self.FillPasswordInto("#signin-password")
self.Submit("#signin-password")
class Wikipedia(WebsiteTest):
def Login(self):
......@@ -110,6 +121,15 @@ class Wikipedia(WebsiteTest):
self.Submit("#wpPassword1")
class Yahoo(WebsiteTest):
def Login(self):
self.GoTo("https://login.yahoo.com")
self.FillUsernameInto("#username")
self.FillPasswordInto("#passwd")
self.Submit("#passwd")
class Yandex(WebsiteTest):
def Login(self):
......@@ -132,7 +152,7 @@ class Amazon(WebsiteTest):
"%2Fauth%2F2.0")
self.FillUsernameInto("[name='email']")
self.FillPasswordInto("[name='password']")
self.Submit("[name='password']")
self.Click("#signInSubmit-input")
# Password not saved.
......@@ -152,8 +172,7 @@ class Ask(WebsiteTest):
class Baidu(WebsiteTest):
def Login(self):
self.GoTo("http://www.baidu.com/")
self.Click("[name='tj_login']")
self.GoTo("https://passport.baidu.com")
self.WaitUntilDisplayed("[name='userName']")
self.FillUsernameInto("[name='userName']")
self.FillPasswordInto("[name='password']")
......@@ -183,6 +202,7 @@ class Ebay(WebsiteTest):
def Login(self):
self.GoTo("https://signin.ebay.com/")
self.WaitUntilDisplayed("[name='userid']")
self.FillUsernameInto("[name='userid']")
self.FillPasswordInto("[name='pass']")
self.Submit("[name='pass']")
......@@ -211,7 +231,8 @@ class Espn(WebsiteTest):
class Live(WebsiteTest):
def Login(self):
self.GoTo("https://www.live.com")
self.GoTo("https://login.live.com")
self.WaitUntilDisplayed("[name='login']")
self.FillUsernameInto("[name='login']")
self.FillPasswordInto("[name='passwd']")
self.Submit("[name='passwd']")
......@@ -222,6 +243,7 @@ class One63(WebsiteTest):
def Login(self):
self.GoTo("http://www.163.com")
self.WaitUntilDisplayed("#js_N_navHighlight")
self.HoverOver("#js_N_navHighlight")
self.WaitUntilDisplayed("#js_loginframe_username")
self.FillUsernameInto("#js_loginframe_username")
......@@ -234,6 +256,7 @@ class Vube(WebsiteTest):
def Login(self):
self.GoTo("https://vube.com")
self.WaitUntilDisplayed("[vube-login='']")
self.Click("[vube-login='']")
self.WaitUntilDisplayed("[ng-model='login.user']")
self.FillUsernameInto("[ng-model='login.user']")
......@@ -244,18 +267,6 @@ class Vube(WebsiteTest):
self.Wait(1)
# Tests that can cause a crash.
class Yahoo(WebsiteTest):
def Login(self):
self.GoTo("https://login.yahoo.com")
self.FillUsernameInto("#username")
self.FillPasswordInto("#passwd")
self.Submit("#passwd")
def Tests(environment):
......@@ -278,10 +289,13 @@ def Tests(environment):
environment.AddWebsiteTest(Tumblr("tumblr", username_not_auto=True))
environment.AddWebsiteTest(Twitter("twitter"))
environment.AddWebsiteTest(Wikipedia("wikipedia", username_not_auto=True))
environment.AddWebsiteTest(Yandex("yandex"))
environment.AddWebsiteTest(Yahoo("yahoo", username_not_auto=True))
environment.AddWebsiteTest(Yandex("yandex"))
# Disabled tests.
......@@ -314,11 +328,6 @@ def Tests(environment):
# http://crbug.com/368690
environment.AddWebsiteTest(Vube("vube"), disabled=True)
# Tests that can cause a crash (the cause of the crash is not related to the
# password manager).
environment.AddWebsiteTest(Yahoo("yahoo", username_not_auto=True),
disabled=True)
def saveResults(environment_tests_results, environment_save_path):
"""Save the test results in an xml file.
......
......@@ -211,20 +211,9 @@ class WebsiteTest:
password_element = self.driver.find_element_by_css_selector(selector)
# Chrome protects the password inputs and doesn't fill them until
# the user interacts with the page. To be sure that such thing has
# happened we click on the password fields or one of its ancestors.
element = password_element
while True:
try:
element.click()
break
except Exception:
try:
element = element.parent
except AttributeError:
raise Exception("Error: unable to find a clickable element to "
"release the password protection for the following website: %s \n"
% (self.name))
# happened we perform |Keys.CONTROL| keypress.
action_chains = ActionChains(self.driver)
action_chains.key_down(Keys.CONTROL).key_up(Keys.CONTROL).perform()
if self.mode == self.Mode.AUTOFILLED:
autofilled_password = password_element.get_attribute("value")
if autofilled_password != self.password:
......@@ -406,6 +395,6 @@ class WebsiteTest:
self.environment.CheckForNewMessage(
environment.MESSAGE_ASK,
True,
"Error: password manager thinks that a login with wrong password was "
"successful for the following website : %s \n" % self.name)
"Error: password manager hasn't detected a successful login for the "
"following website : %s \n" % self.name)
self.environment.SwitchFromInternals()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment