TT#70901 selenium: add new login tests

- now check login with no credentials, completley invalid credentials and
only invalid password before logging in

Change-Id: I35be16e0c0a27dcc3c86ae4b144a26cbac62020a
changes/94/40994/2
Nico Schedel 5 years ago
parent a1a74e4f57
commit bbe96a8df1

@ -74,14 +74,43 @@ class testrun(unittest.TestCase):
global filename
filename = "test_login_page.png"
driver = self.driver
print("Try to log in with no credentials...", end="")
driver.get(os.environ['CATALYST_SERVER'])
driver.find_element_by_xpath(
'//*[@id="csc-login"]//div//button').click()
self.assertTrue(len(driver.find_elements_by_xpath(
'//div[contains(@class, "q-alert-container")]')) > 0,
"Error Message was not shown")
print("OK")
print("Try to log in with invalid credentials...", end="")
driver.get(os.environ['CATALYST_SERVER'])
fill_element(
driver, '//*[@id="csc-login-form"]//div//input[@type="text"]', "invaliduser")
fill_element(
driver, '//*[@id="csc-login-form"]//div//input[@type="password"]', "invalidpass")
driver.find_element_by_xpath(
'//*[@id="csc-login-form"]//div//input[@type="text"]'
).send_keys('invalid')
'//*[@id="csc-login"]//div//button').click()
self.assertTrue(len(driver.find_elements_by_xpath(
'//div[contains(@class, "q-alert-container")]')) > 0,
"Error Message was not shown")
print("OK")
print("Try to log in with invalid password...", end="")
driver.get(os.environ['CATALYST_SERVER'])
fill_element(
driver, '//*[@id="csc-login-form"]//div//input[@type="text"]', "testuser@" + self.domainname)
fill_element(
driver, '//*[@id="csc-login-form"]//div//input[@type="password"]', "invalidpass")
driver.find_element_by_xpath(
'//*[@id="csc-login-form"]//div//input[@type="password"]'
).send_keys('user')
'//*[@id="csc-login"]//div//button').click()
self.assertTrue(len(driver.find_elements_by_xpath(
'//div[contains(@class, "q-alert-container")]')) > 0,
"Error Message was not shown")
print("OK")
print("Try to log in with empty password...", end="")
driver.get(os.environ['CATALYST_SERVER'])
fill_element(
driver, '//*[@id="csc-login-form"]//div//input[@type="text"]', "testuser@" + self.domainname)
driver.find_element_by_xpath('//*[@id="csc-login-form"]//div//input[@type="password"]').clear()
driver.find_element_by_xpath(
'//*[@id="csc-login"]//div//button').click()
self.assertTrue(len(driver.find_elements_by_xpath(
@ -90,15 +119,9 @@ class testrun(unittest.TestCase):
print("OK")
print("Try to log in with valid credentials...", end="")
fill_element(
driver,
'//*[@id="csc-login-form"]//div//input[@type="text"]',
"testuser@" + self.domainname
)
driver, '//*[@id="csc-login-form"]//div//input[@type="text"]', "testuser@" + self.domainname)
fill_element(
driver,
'//*[@id="csc-login-form"]//div//input[@type="password"]',
"testpasswd"
)
driver, '//*[@id="csc-login-form"]//div//input[@type="password"]', "testpasswd")
driver.find_element_by_xpath(
'//*[@id="csc-login"]//div//button').click()
self.assertEqual(

Loading…
Cancel
Save