Commit 2dbfd72d authored by rchtara's avatar rchtara Committed by Commit bot

Never run the password manager python tests in the password

internals page tab
This CL fixes that issue by always making sure that at the end
of each test, the current tab is changed from the password
internal page to the test page even if an exception is thrown.

BUG=413273

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

Cr-Commit-Position: refs/heads/master@{#294831}
parent 1894ec5f
...@@ -303,18 +303,20 @@ class WebsiteTest: ...@@ -303,18 +303,20 @@ class WebsiteTest:
not like we expected or if the password is saved. not like we expected or if the password is saved.
""" """
logging.info("\nWrong Login Test for %s \n" % self.name) logging.info("\nWrong Login Test for %s \n" % self.name)
correct_password = self.password try:
self.password = self.password + "1" correct_password = self.password
self.LoginWhenNotAutofilled() self.password = self.password + "1"
self.password = correct_password self.LoginWhenNotAutofilled()
self.Wait(2) self.password = correct_password
self.environment.SwitchToInternals() self.Wait(2)
self.environment.CheckForNewMessage( self.environment.SwitchToInternals()
environment.MESSAGE_SAVE, self.environment.CheckForNewMessage(
False, environment.MESSAGE_SAVE,
"Error: password manager thinks that a login with wrong password was " False,
"successful for the following website : %s \n" % self.name) "Error: password manager thinks that a login with wrong password was "
self.environment.SwitchFromInternals() "successful for the following website : %s \n" % self.name)
finally:
self.environment.SwitchFromInternals()
def SuccessfulLoginTest(self): def SuccessfulLoginTest(self):
"""Does the successful login when the password is not expected to be """Does the successful login when the password is not expected to be
...@@ -329,17 +331,19 @@ class WebsiteTest: ...@@ -329,17 +331,19 @@ class WebsiteTest:
saved. saved.
""" """
logging.info("\nSuccessful Login Test for %s \n" % self.name) logging.info("\nSuccessful Login Test for %s \n" % self.name)
self.LoginWhenNotAutofilled() try:
self.Wait(2) self.LoginWhenNotAutofilled()
self.environment.SwitchToInternals() self.Wait(2)
self.environment.CheckForNewMessage( self.environment.SwitchToInternals()
environment.MESSAGE_SAVE, self.environment.CheckForNewMessage(
True, environment.MESSAGE_SAVE,
"Error: password manager hasn't detected a successful login for the " True,
"following website : %s \n" "Error: password manager hasn't detected a successful login for the "
% self.name) "following website : %s \n"
self.environment.SwitchFromInternals() % self.name)
self.Logout() finally:
self.environment.SwitchFromInternals()
self.Logout()
def SuccessfulLoginWithAutofilledPasswordTest(self): def SuccessfulLoginWithAutofilledPasswordTest(self):
"""Does the successful login when the password is expected to be autofilled """Does the successful login when the password is expected to be autofilled
...@@ -355,17 +359,19 @@ class WebsiteTest: ...@@ -355,17 +359,19 @@ class WebsiteTest:
""" """
logging.info("\nSuccessful Login With Autofilled Password" logging.info("\nSuccessful Login With Autofilled Password"
" Test %s \n" % self.name) " Test %s \n" % self.name)
self.LoginWhenAutofilled() try:
self.Wait(2) self.LoginWhenAutofilled()
self.environment.SwitchToInternals() self.Wait(2)
self.environment.CheckForNewMessage( self.environment.SwitchToInternals()
environment.MESSAGE_SAVE, self.environment.CheckForNewMessage(
True, environment.MESSAGE_SAVE,
"Error: password manager hasn't detected a successful login for the " True,
"following website : %s \n" "Error: password manager hasn't detected a successful login for the "
% self.name) "following website : %s \n"
self.environment.SwitchFromInternals() % self.name)
self.Logout() finally:
self.environment.SwitchFromInternals()
self.Logout()
def PromptTest(self): def PromptTest(self):
"""Does the prompt test: Tries to login with a wrong password and """Does the prompt test: Tries to login with a wrong password and
...@@ -380,25 +386,27 @@ class WebsiteTest: ...@@ -380,25 +386,27 @@ class WebsiteTest:
password or is shown for a wrong one. password or is shown for a wrong one.
""" """
logging.info("\nPrompt Test for %s \n" % self.name) logging.info("\nPrompt Test for %s \n" % self.name)
correct_password = self.password try:
self.password = self.password + "1" correct_password = self.password
self.LoginWhenNotAutofilled() self.password = self.password + "1"
self.password = correct_password self.LoginWhenNotAutofilled()
self.Wait(2) self.password = correct_password
self.environment.SwitchToInternals() self.Wait(2)
self.environment.CheckForNewMessage( self.environment.SwitchToInternals()
environment.MESSAGE_ASK, self.environment.CheckForNewMessage(
False, environment.MESSAGE_ASK,
"Error: password manager thinks that a login with wrong password was " False,
"successful for the following website : %s \n" % self.name) "Error: password manager thinks that a login with wrong password was "
self.environment.SwitchFromInternals() "successful for the following website : %s \n" % self.name)
self.environment.SwitchFromInternals()
self.LoginWhenNotAutofilled()
self.Wait(2) self.LoginWhenNotAutofilled()
self.environment.SwitchToInternals() self.Wait(2)
self.environment.CheckForNewMessage( self.environment.SwitchToInternals()
environment.MESSAGE_ASK, self.environment.CheckForNewMessage(
True, environment.MESSAGE_ASK,
"Error: password manager hasn't detected a successful login for the " True,
"following website : %s \n" % self.name) "Error: password manager hasn't detected a successful login for the "
self.environment.SwitchFromInternals() "following website : %s \n" % self.name)
finally:
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