Updated tests for new version of selenium
This commit is contained in:
@@ -31,25 +31,25 @@ class TestCase(ScreenshotTestCase):
|
||||
# Go to login page via login button on root page -> save plain login form
|
||||
c = self.selenium
|
||||
c.get(self.complete_url('/'))
|
||||
link = c.find_element_by_css_selector('#login-widget a')
|
||||
link = c.find_element(By.CSS_SELECTOR, '#login-widget a')
|
||||
link.click()
|
||||
self.wait_on_presence(c, (By.ID, 'id_username'))
|
||||
self.save_screenshot('empty_login_form', sequence=sequence_name)
|
||||
|
||||
# Fill in a password -> Save dots in password field
|
||||
username_field = c.find_element_by_id('id_username')
|
||||
username_field = c.find_element(By.ID, 'id_username')
|
||||
username_field.clear()
|
||||
username_field.send_keys('username')
|
||||
password_field = c.find_element_by_id('id_password')
|
||||
password_field = c.find_element(By.ID, 'id_password')
|
||||
password_field.clear()
|
||||
password_field.send_keys(self.test_password)
|
||||
self.save_screenshot('filled_login_form', sequence=sequence_name)
|
||||
|
||||
# Wrong username -> save error message
|
||||
username_field = c.find_element_by_id('id_username')
|
||||
username_field = c.find_element(By.ID, 'id_username')
|
||||
username_field.clear()
|
||||
username_field.send_keys(self.test_username[::-1])
|
||||
password_field = c.find_element_by_id('id_password')
|
||||
password_field = c.find_element(By.ID, 'id_password')
|
||||
password_field.clear()
|
||||
password_field.send_keys(self.test_password)
|
||||
password_field.send_keys(Keys.RETURN)
|
||||
@@ -58,10 +58,10 @@ class TestCase(ScreenshotTestCase):
|
||||
alert_button.click()
|
||||
|
||||
# Wrong password -> save error message
|
||||
username_field = c.find_element_by_id('id_username')
|
||||
username_field = c.find_element(By.ID, 'id_username')
|
||||
username_field.clear()
|
||||
username_field.send_keys(self.test_username)
|
||||
password_field = c.find_element_by_id('id_password')
|
||||
password_field = c.find_element(By.ID, 'id_password')
|
||||
password_field.clear()
|
||||
password_field.send_keys(self.test_password[::-1])
|
||||
password_field.send_keys(Keys.RETURN)
|
||||
@@ -72,10 +72,10 @@ class TestCase(ScreenshotTestCase):
|
||||
# Login of inactive user -> save error message
|
||||
self.user.is_active = False
|
||||
self.user.save()
|
||||
username_field = c.find_element_by_id('id_username')
|
||||
username_field = c.find_element(By.ID, 'id_username')
|
||||
username_field.clear()
|
||||
username_field.send_keys(self.test_username)
|
||||
password_field = c.find_element_by_id('id_password')
|
||||
password_field = c.find_element(By.ID, 'id_password')
|
||||
password_field.clear()
|
||||
password_field.send_keys(self.test_password)
|
||||
password_field.send_keys(Keys.RETURN)
|
||||
@@ -87,10 +87,10 @@ class TestCase(ScreenshotTestCase):
|
||||
self.user.save()
|
||||
|
||||
# Login -> save success message
|
||||
username_field = c.find_element_by_id('id_username')
|
||||
username_field = c.find_element(By.ID, 'id_username')
|
||||
username_field.clear()
|
||||
username_field.send_keys(self.test_username)
|
||||
password_field = c.find_element_by_id('id_password')
|
||||
password_field = c.find_element(By.ID, 'id_password')
|
||||
password_field.clear()
|
||||
password_field.send_keys(self.test_password)
|
||||
password_field.send_keys(Keys.RETURN)
|
||||
@@ -104,18 +104,18 @@ class TestCase(ScreenshotTestCase):
|
||||
self.save_screenshot('user_menu', sequence=sequence_name)
|
||||
|
||||
# Click on 'set password' -> save set password page
|
||||
user_menu = c.find_element_by_css_selector('#login-widget ul')
|
||||
link = user_menu.find_element_by_partial_link_text(ugettext('Passwort ändern'))
|
||||
user_menu = c.find_element(By.CSS_SELECTOR, '#login-widget ul')
|
||||
link = user_menu.find_element(By.PARTIAL_LINK_TEXT, ugettext('Passwort ändern'))
|
||||
link.click()
|
||||
password_field = self.wait_on_presence(c, (By.ID, 'id_new_password'))
|
||||
self.save_screenshot('empty_set_password_form', sequence=sequence_name)
|
||||
|
||||
# Fill in a password -> Save dots in password field
|
||||
send_mail_field = c.find_element_by_id('id_send_password_mail')
|
||||
send_mail_field = c.find_element(By.ID, 'id_send_password_mail')
|
||||
send_mail_field.click()
|
||||
password_field.clear()
|
||||
password_field.send_keys(self.test_password)
|
||||
password2_field = c.find_element_by_id('id_new_password_repeat')
|
||||
password2_field = c.find_element(By.ID, 'id_new_password_repeat')
|
||||
password2_field.clear()
|
||||
password2_field.send_keys(self.test_password)
|
||||
self.save_screenshot('filled_set_password_form', sequence=sequence_name)
|
||||
@@ -131,10 +131,10 @@ class TestCase(ScreenshotTestCase):
|
||||
|
||||
# New passwords too common and too short -> save error message
|
||||
password = 'abcdef'
|
||||
password_field = c.find_element_by_id('id_new_password')
|
||||
password_field = c.find_element(By.ID, 'id_new_password')
|
||||
password_field.clear()
|
||||
password_field.send_keys(password)
|
||||
password2_field = c.find_element_by_id('id_new_password_repeat')
|
||||
password2_field = c.find_element(By.ID, 'id_new_password_repeat')
|
||||
password2_field.clear()
|
||||
password2_field.send_keys(password)
|
||||
password2_field.send_keys(Keys.RETURN)
|
||||
@@ -143,10 +143,10 @@ class TestCase(ScreenshotTestCase):
|
||||
|
||||
# New passwords entirely_numeric -> save error message
|
||||
password = '9126735804'
|
||||
password_field = c.find_element_by_id('id_new_password')
|
||||
password_field = c.find_element(By.ID, 'id_new_password')
|
||||
password_field.clear()
|
||||
password_field.send_keys(password)
|
||||
password2_field = c.find_element_by_id('id_new_password_repeat')
|
||||
password2_field = c.find_element(By.ID, 'id_new_password_repeat')
|
||||
password2_field.clear()
|
||||
password2_field.send_keys(password)
|
||||
password2_field.send_keys(Keys.RETURN)
|
||||
@@ -155,10 +155,10 @@ class TestCase(ScreenshotTestCase):
|
||||
|
||||
# New passwords too similar -> save error message
|
||||
password = self.test_username
|
||||
password_field = c.find_element_by_id('id_new_password')
|
||||
password_field = c.find_element(By.ID, 'id_new_password')
|
||||
password_field.clear()
|
||||
password_field.send_keys(password)
|
||||
password2_field = c.find_element_by_id('id_new_password_repeat')
|
||||
password2_field = c.find_element(By.ID, 'id_new_password_repeat')
|
||||
password2_field.clear()
|
||||
password2_field.send_keys(password)
|
||||
password2_field.send_keys(Keys.RETURN)
|
||||
@@ -167,10 +167,10 @@ class TestCase(ScreenshotTestCase):
|
||||
|
||||
# Change password -> save success message
|
||||
password = self.test_password[::-1]
|
||||
password_field = c.find_element_by_id('id_new_password')
|
||||
password_field = c.find_element(By.ID, 'id_new_password')
|
||||
password_field.clear()
|
||||
password_field.send_keys(password)
|
||||
password2_field = c.find_element_by_id('id_new_password_repeat')
|
||||
password2_field = c.find_element(By.ID, 'id_new_password_repeat')
|
||||
password2_field.clear()
|
||||
password2_field.send_keys(password)
|
||||
password2_field.send_keys(Keys.RETURN)
|
||||
@@ -179,7 +179,7 @@ class TestCase(ScreenshotTestCase):
|
||||
|
||||
# Get password recreate page -> since we are logged in, it should
|
||||
# redirect to set password page again -> save
|
||||
html = c.find_element_by_tag_name('html')
|
||||
html = c.find_element(By.TAG_NAME, 'html')
|
||||
c.get(self.complete_url(reverse('dav_auth:recreate_password')))
|
||||
self.wait_until_stale(c, html)
|
||||
self.wait_on_presence(c, (By.ID, 'id_new_password'))
|
||||
@@ -188,19 +188,19 @@ class TestCase(ScreenshotTestCase):
|
||||
# Click on 'logout' -> save page
|
||||
dropdown_button = self.wait_on_presence(c, (By.ID, 'user_dropdown_button'))
|
||||
dropdown_button.click()
|
||||
user_menu = c.find_element_by_css_selector('#login-widget ul')
|
||||
link = user_menu.find_element_by_partial_link_text(ugettext('Logout'))
|
||||
user_menu = c.find_element(By.CSS_SELECTOR, '#login-widget ul')
|
||||
link = user_menu.find_element(By.PARTIAL_LINK_TEXT, ugettext('Logout'))
|
||||
link.click()
|
||||
self.wait_until_stale(c, user_menu)
|
||||
self.save_screenshot('logout_succeed', sequence=sequence_name)
|
||||
|
||||
# Click on 'login' to access password recreate link
|
||||
link = c.find_element_by_css_selector('#login-widget a')
|
||||
link = c.find_element(By.CSS_SELECTOR, '#login-widget a')
|
||||
link.click()
|
||||
self.wait_on_presence(c, (By.ID, 'id_username'))
|
||||
|
||||
# Locate password recreate link, click it -> save password recreate form
|
||||
link = c.find_element_by_partial_link_text(ugettext('Passwort vergessen'))
|
||||
link = c.find_element(By.PARTIAL_LINK_TEXT, ugettext('Passwort vergessen'))
|
||||
link.click()
|
||||
username_field = self.wait_on_presence(c, (By.ID, 'id_username'))
|
||||
self.save_screenshot('empty_recreate_password_form', sequence=sequence_name)
|
||||
@@ -212,7 +212,7 @@ class TestCase(ScreenshotTestCase):
|
||||
self.save_screenshot('recreate_password_invalid_user', sequence=sequence_name)
|
||||
|
||||
# Locate password recreate link, click it
|
||||
link = c.find_element_by_partial_link_text(ugettext('Passwort vergessen'))
|
||||
link = c.find_element(By.PARTIAL_LINK_TEXT, ugettext('Passwort vergessen'))
|
||||
link.click()
|
||||
username_field = self.wait_on_presence(c, (By.ID, 'id_username'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user