Updated tests for new version of selenium
All checks were successful
Run tests / Execute tox to run the test suite (push) Successful in 2m2s
Run tests every night at 05:05 / Execute tox to run the test suite (push) Successful in 2m46s

This commit is contained in:
2024-08-29 14:09:44 +02:00
parent af838d8fb6
commit 8a766c760d
4 changed files with 128 additions and 128 deletions

View File

@@ -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'))