test newest stuff from master on stage #75

Merged
heinzel merged 5 commits from master into stage 2024-09-10 09:42:53 +02:00
4 changed files with 128 additions and 128 deletions
Showing only changes of commit 8a766c760d - Show all commits

View File

@@ -9,7 +9,7 @@ class SeleniumAuthMixin:
username_field = self.wait_on_presence(driver, (By.ID, 'id_username')) username_field = self.wait_on_presence(driver, (By.ID, 'id_username'))
username_field.clear() username_field.clear()
username_field.send_keys(username) username_field.send_keys(username)
password_field = driver.find_element_by_id('id_password') password_field = driver.find_element(By.ID, 'id_password')
password_field.clear() password_field.clear()
password_field.send_keys(password) password_field.send_keys(password)
password_field.send_keys(Keys.RETURN) password_field.send_keys(Keys.RETURN)

View File

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

View File

@@ -40,7 +40,7 @@ class TestCase(SeleniumAuthMixin, SeleniumTestCase):
c = self.selenium c = self.selenium
c.get(self.complete_url('/')) c.get(self.complete_url('/'))
try: try:
c.find_element_by_css_selector('#login-widget a') c.find_element(By.CSS_SELECTOR, '#login-widget a')
except NoSuchElementException as e: # pragma: no cover except NoSuchElementException as e: # pragma: no cover
self.fail(str(e)) self.fail(str(e))
@@ -50,9 +50,9 @@ class TestCase(SeleniumAuthMixin, SeleniumTestCase):
location = reverse('dav_auth:login') location = reverse('dav_auth:login')
c.get(self.complete_url(location)) c.get(self.complete_url(location))
field = c.find_element_by_id('id_username') field = c.find_element(By.ID, 'id_username')
self.assertEqual(field.get_attribute('required'), 'true') self.assertEqual(field.get_attribute('required'), 'true')
field = c.find_element_by_id('id_password') field = c.find_element(By.ID, 'id_password')
self.assertEqual(field.get_attribute('required'), 'true') self.assertEqual(field.get_attribute('required'), 'true')
def test_required_fields_in_set_password_form(self): def test_required_fields_in_set_password_form(self):
@@ -61,7 +61,7 @@ class TestCase(SeleniumAuthMixin, SeleniumTestCase):
c.get(self.complete_url(reverse('dav_auth:set_password'))) c.get(self.complete_url(reverse('dav_auth:set_password')))
field = self.wait_on_presence(c, (By.ID, 'id_new_password')) field = self.wait_on_presence(c, (By.ID, 'id_new_password'))
self.assertEqual(field.get_attribute('required'), 'true') self.assertEqual(field.get_attribute('required'), 'true')
field = c.find_element_by_id('id_new_password_repeat') field = c.find_element(By.ID, 'id_new_password_repeat')
self.assertEqual(field.get_attribute('required'), 'true') self.assertEqual(field.get_attribute('required'), 'true')
field = c.find_element_by_id('id_send_password_mail') field = c.find_element(By.ID, 'id_send_password_mail')
self.assertEqual(field.get_attribute('required'), None) self.assertEqual(field.get_attribute('required'), None)

View File

@@ -135,30 +135,30 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
self.save_screenshot('mode_form', sequence=sequence_name) self.save_screenshot('mode_form', sequence=sequence_name)
if 'mode' in data: if 'mode' in data:
field = c.find_element_by_id('id_mode') field = c.find_element(By.ID, 'id_mode')
radio = field.find_element_by_css_selector('input[value=\'{}\']'.format(data['mode'])) radio = field.find_element(By.CSS_SELECTOR, 'input[value=\'{}\']'.format(data['mode']))
radio.click() radio.click()
if 'sport' in data: if 'sport' in data:
field = c.find_element_by_id('id_sport') field = c.find_element(By.ID, 'id_sport')
radio = field.find_element_by_css_selector('input[value=\'{}\']'.format(data['sport'])) radio = field.find_element(By.CSS_SELECTOR, 'input[value=\'{}\']'.format(data['sport']))
radio.click() radio.click()
if 'level' in data: if 'level' in data:
field = c.find_element_by_id('id_level') field = c.find_element(By.ID, 'id_level')
radio = field.find_element_by_css_selector('input[value=\'{}\']'.format(data['level'])) radio = field.find_element(By.CSS_SELECTOR, 'input[value=\'{}\']'.format(data['level']))
radio.click() radio.click()
if 'ski_lift' in data and data['ski_lift']: if 'ski_lift' in data and data['ski_lift']:
field = c.find_element_by_id('id_ski_lift') field = c.find_element(By.ID, 'id_ski_lift')
field.click() field.click()
field = c.find_element_by_css_selector('input#id_first_day_widget') field = c.find_element(By.CSS_SELECTOR, 'input#id_first_day_widget')
field.send_keys(data['first_day']) field.send_keys(data['first_day'])
td = c.find_element_by_css_selector('div.datetimepicker-days td.active') td = c.find_element(By.CSS_SELECTOR, 'div.datetimepicker-days td.active')
td.click() td.click()
field = c.find_element_by_css_selector('input#id_last_day_widget') field = c.find_element(By.CSS_SELECTOR, 'input#id_last_day_widget')
field.click() field.click()
if screenshots: if screenshots:
self.save_screenshot('last_date_widget', sequence=sequence_name) self.save_screenshot('last_date_widget', sequence=sequence_name)
@@ -166,74 +166,74 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
field.send_keys(data['last_day']) field.send_keys(data['last_day'])
if 'alt_first_day' in data: if 'alt_first_day' in data:
field = c.find_element_by_css_selector('input#id_alt_first_day_widget') field = c.find_element(By.CSS_SELECTOR, 'input#id_alt_first_day_widget')
field.send_keys(data['alt_first_day']) field.send_keys(data['alt_first_day'])
if 'alt_last_day' in data: if 'alt_last_day' in data:
field = c.find_element_by_css_selector('input#id_alt_last_day_widget') field = c.find_element(By.CSS_SELECTOR, 'input#id_alt_last_day_widget')
field.send_keys(data['alt_last_day']) field.send_keys(data['alt_last_day'])
button = c.find_element_by_id('btn-form-next') button = c.find_element(By.ID, 'btn-form-next')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
if screenshots: if screenshots:
self.save_screenshot('location_form', sequence=sequence_name) self.save_screenshot('location_form', sequence=sequence_name)
if 'country' in data: if 'country' in data:
field = c.find_element_by_id('id_country') field = c.find_element(By.ID, 'id_country')
Select(field).select_by_value(data['country']) Select(field).select_by_value(data['country'])
if 'terrain' in data: if 'terrain' in data:
field = c.find_element_by_id('id_terrain') field = c.find_element(By.ID, 'id_terrain')
Select(field).select_by_value(data['terrain']) Select(field).select_by_value(data['terrain'])
if 'location' in data: if 'location' in data:
field = c.find_element_by_id('id_location') field = c.find_element(By.ID, 'id_location')
field.send_keys(data['location']) field.send_keys(data['location'])
if 'transport_other' in data: if 'transport_other' in data:
field = c.find_element_by_id('id_transport_other') field = c.find_element(By.ID, 'id_transport_other')
field.send_keys(data['transport_other']) field.send_keys(data['transport_other'])
if 'transport' in data: if 'transport' in data:
field = c.find_element_by_id('id_transport') field = c.find_element(By.ID, 'id_transport')
Select(field).select_by_value(data['transport']) Select(field).select_by_value(data['transport'])
button = c.find_element_by_id('btn-form-next') button = c.find_element(By.ID, 'btn-form-next')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
if screenshots: if screenshots:
self.save_screenshot('journey_form', sequence=sequence_name) self.save_screenshot('journey_form', sequence=sequence_name)
if 'meeting_point_other' in data: if 'meeting_point_other' in data:
field = c.find_element_by_id('id_meeting_point_other') field = c.find_element(By.ID, 'id_meeting_point_other')
field.send_keys(data['meeting_point_other']) field.send_keys(data['meeting_point_other'])
if 'meeting_point' in data: if 'meeting_point' in data:
field = c.find_element_by_id('id_meeting_point') field = c.find_element(By.ID, 'id_meeting_point')
Select(field).select_by_value(data['meeting_point']) Select(field).select_by_value(data['meeting_point'])
if 'meeting_time' in data: if 'meeting_time' in data:
field = c.find_element_by_css_selector('input#id_meeting_time_widget') field = c.find_element(By.CSS_SELECTOR, 'input#id_meeting_time_widget')
field.send_keys(data['meeting_time']) field.send_keys(data['meeting_time'])
if 'departure_time' in data: if 'departure_time' in data:
field = c.find_element_by_css_selector('input#id_departure_time_widget') field = c.find_element(By.CSS_SELECTOR, 'input#id_departure_time_widget')
field.send_keys(data['departure_time']) field.send_keys(data['departure_time'])
if 'departure_ride' in data: if 'departure_ride' in data:
field = c.find_element_by_id('id_departure_ride') field = c.find_element(By.ID, 'id_departure_ride')
field.send_keys(data['departure_ride']) field.send_keys(data['departure_ride'])
if 'return_departure_time' in data: if 'return_departure_time' in data:
field = c.find_element_by_css_selector('input#id_return_departure_time_widget') field = c.find_element(By.CSS_SELECTOR, 'input#id_return_departure_time_widget')
field.send_keys(data['return_departure_time']) field.send_keys(data['return_departure_time'])
if 'return_arrival_time' in data: if 'return_arrival_time' in data:
field = c.find_element_by_css_selector('input#id_return_arrival_time_widget') field = c.find_element(By.CSS_SELECTOR, 'input#id_return_arrival_time_widget')
field.send_keys(data['return_arrival_time']) field.send_keys(data['return_arrival_time'])
if 'arrival_previous_day' in data and data['arrival_previous_day']: if 'arrival_previous_day' in data and data['arrival_previous_day']:
field = c.find_element_by_id('id_arrival_previous_day') field = c.find_element(By.ID, 'id_arrival_previous_day')
field.click() field.click()
button = c.find_element_by_id('btn-form-next') button = c.find_element(By.ID, 'btn-form-next')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
@@ -242,18 +242,18 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
self.save_screenshot('accommodation_form', sequence=sequence_name) self.save_screenshot('accommodation_form', sequence=sequence_name)
if 'basecamp' in data: if 'basecamp' in data:
field = c.find_element_by_id('id_basecamp') field = c.find_element(By.ID, 'id_basecamp')
field.send_keys(data['basecamp']) field.send_keys(data['basecamp'])
if 'accommodation' in data: if 'accommodation' in data:
field = c.find_element_by_id('id_accommodation') field = c.find_element(By.ID, 'id_accommodation')
Select(field).select_by_value(data['accommodation']) Select(field).select_by_value(data['accommodation'])
if 'meals_other' in data: if 'meals_other' in data:
field = c.find_element_by_id('id_meals_other') field = c.find_element(By.ID, 'id_meals_other')
field.send_keys(data['meals_other']) field.send_keys(data['meals_other'])
button = c.find_element_by_id('btn-form-next') button = c.find_element(By.ID, 'btn-form-next')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
@@ -261,7 +261,7 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
self.save_screenshot('requirements_form', sequence=sequence_name) self.save_screenshot('requirements_form', sequence=sequence_name)
if 'requirements_add' in data: if 'requirements_add' in data:
field = c.find_element_by_id('id_requirements') field = c.find_element(By.ID, 'id_requirements')
field.send_keys(Keys.RETURN) field.send_keys(Keys.RETURN)
if isinstance(data['requirements_add'], list): if isinstance(data['requirements_add'], list):
field.send_keys(Keys.RETURN.join(data['requirements_add'])) field.send_keys(Keys.RETURN.join(data['requirements_add']))
@@ -269,14 +269,14 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
field.send_keys(data['requirements_add']) field.send_keys(data['requirements_add'])
if 'pre_meeting_1' in data: if 'pre_meeting_1' in data:
field = c.find_element_by_css_selector('input#id_pre_meeting_1_widget') field = c.find_element(By.CSS_SELECTOR, 'input#id_pre_meeting_1_widget')
field.send_keys(data['pre_meeting_1']) field.send_keys(data['pre_meeting_1'])
if 'pre_meeting_2' in data: if 'pre_meeting_2' in data:
field = c.find_element_by_css_selector('input#id_pre_meeting_2_widget') field = c.find_element(By.CSS_SELECTOR, 'input#id_pre_meeting_2_widget')
field.send_keys(data['pre_meeting_2']) field.send_keys(data['pre_meeting_2'])
button = c.find_element_by_id('btn-form-next') button = c.find_element(By.ID, 'btn-form-next')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
if screenshots: if screenshots:
@@ -289,60 +289,60 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
field.send_keys(data['trainer_firstname']) field.send_keys(data['trainer_firstname'])
if 'trainer_familyname' in data: if 'trainer_familyname' in data:
field = c.find_element_by_id('id_trainer_familyname') field = c.find_element(By.ID, 'id_trainer_familyname')
if auth: if auth:
field.clear() field.clear()
field.send_keys(data['trainer_familyname']) field.send_keys(data['trainer_familyname'])
if 'trainer_email' in data: if 'trainer_email' in data:
field = c.find_element_by_id('id_trainer_email') field = c.find_element(By.ID, 'id_trainer_email')
if auth: if auth:
field.clear() field.clear()
field.send_keys(data['trainer_email']) field.send_keys(data['trainer_email'])
if 'trainer_phone' in data: if 'trainer_phone' in data:
field = c.find_element_by_id('id_trainer_phone') field = c.find_element(By.ID, 'id_trainer_phone')
if auth: if auth:
field.clear() field.clear()
field.send_keys(data['trainer_phone']) field.send_keys(data['trainer_phone'])
if 'trainer_2_fullname' in data: if 'trainer_2_fullname' in data:
field = c.find_element_by_id('id_trainer_2_fullname') field = c.find_element(By.ID, 'id_trainer_2_fullname')
field.send_keys(data['trainer_2_fullname']) field.send_keys(data['trainer_2_fullname'])
if 'trainer_3_fullname' in data: if 'trainer_3_fullname' in data:
field = c.find_element_by_id('id_trainer_3_fullname') field = c.find_element(By.ID, 'id_trainer_3_fullname')
field.send_keys(data['trainer_3_fullname']) field.send_keys(data['trainer_3_fullname'])
button = c.find_element_by_id('btn-form-next') button = c.find_element(By.ID, 'btn-form-next')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
if screenshots: if screenshots:
self.save_screenshot('registration_form', sequence=sequence_name) self.save_screenshot('registration_form', sequence=sequence_name)
if 'deadline' in data: if 'deadline' in data:
field = c.find_element_by_id('id_deadline') field = c.find_element(By.ID, 'id_deadline')
radio = field.find_element_by_css_selector('input[value=\'{}\']'.format(data['deadline'])) radio = field.find_element(By.CSS_SELECTOR, 'input[value=\'{}\']'.format(data['deadline']))
radio.click() radio.click()
button = c.find_element_by_id('btn-form-next') button = c.find_element(By.ID, 'btn-form-next')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
if screenshots: if screenshots:
self.save_screenshot('charges_form', sequence=sequence_name) self.save_screenshot('charges_form', sequence=sequence_name)
if 'charge' in data: if 'charge' in data:
field = c.find_element_by_id('id_charge') field = c.find_element(By.ID, 'id_charge')
field.clear() field.clear()
field.send_keys(data['charge']) field.send_keys(data['charge'])
if 'additional_costs' in data: if 'additional_costs' in data:
field = c.find_element_by_id('id_additional_costs') field = c.find_element(By.ID, 'id_additional_costs')
field.clear() field.clear()
if data['additional_costs'] is not None: if data['additional_costs'] is not None:
field.send_keys(data['additional_costs']) field.send_keys(data['additional_costs'])
button = c.find_element_by_id('btn-form-next') button = c.find_element(By.ID, 'btn-form-next')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
@@ -350,49 +350,49 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
if screenshots: if screenshots:
self.save_screenshot('training_form', sequence=sequence_name) self.save_screenshot('training_form', sequence=sequence_name)
field = c.find_element_by_id('id_course_topic_1') field = c.find_element(By.ID, 'id_course_topic_1')
if isinstance(data['course_topic_1'], list): if isinstance(data['course_topic_1'], list):
field.send_keys(Keys.RETURN.join(data['course_topic_1'])) field.send_keys(Keys.RETURN.join(data['course_topic_1']))
else: else:
field.send_keys(data['course_topic_1']) field.send_keys(data['course_topic_1'])
if 'course_topic_2' in data: if 'course_topic_2' in data:
field = c.find_element_by_id('id_course_topic_2') field = c.find_element(By.ID, 'id_course_topic_2')
field.send_keys(data['course_topic_2']) field.send_keys(data['course_topic_2'])
if 'course_topic_3' in data: if 'course_topic_3' in data:
button = c.find_element_by_id('btn-topic-add') button = c.find_element(By.ID, 'btn-topic-add')
button.click() button.click()
field = c.find_element_by_id('id_course_topic_3') field = c.find_element(By.ID, 'id_course_topic_3')
field.send_keys(data['course_topic_3']) field.send_keys(data['course_topic_3'])
if 'course_topic_4' in data: if 'course_topic_4' in data:
button.click() button.click()
field = c.find_element_by_id('id_course_topic_4') field = c.find_element(By.ID, 'id_course_topic_4')
field.send_keys(data['course_topic_4']) field.send_keys(data['course_topic_4'])
field = c.find_element_by_id('id_course_goal_1') field = c.find_element(By.ID, 'id_course_goal_1')
if isinstance(data['course_goal_1'], list): if isinstance(data['course_goal_1'], list):
field.send_keys(Keys.RETURN.join(data['course_goal_1'])) field.send_keys(Keys.RETURN.join(data['course_goal_1']))
else: else:
field.send_keys(data['course_goal_1']) field.send_keys(data['course_goal_1'])
if 'course_goal_2' in data: if 'course_goal_2' in data:
field = c.find_element_by_id('id_course_goal_2') field = c.find_element(By.ID, 'id_course_goal_2')
field.send_keys(data['course_goal_2']) field.send_keys(data['course_goal_2'])
if 'course_goal_3' in data: if 'course_goal_3' in data:
button = c.find_element_by_id('btn-goal-add') button = c.find_element(By.ID, 'btn-goal-add')
button.click() button.click()
field = c.find_element_by_id('id_course_goal_3') field = c.find_element(By.ID, 'id_course_goal_3')
field.send_keys(data['course_goal_3']) field.send_keys(data['course_goal_3'])
if 'course_goal_4' in data: if 'course_goal_4' in data:
button.click() button.click()
field = c.find_element_by_id('id_course_goal_4') field = c.find_element(By.ID, 'id_course_goal_4')
field.send_keys(data['course_goal_4']) field.send_keys(data['course_goal_4'])
button = c.find_element_by_id('btn-form-next') button = c.find_element(By.ID, 'btn-form-next')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
@@ -400,29 +400,29 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
self.save_screenshot('description_form', sequence=sequence_name) self.save_screenshot('description_form', sequence=sequence_name)
if 'title' in data: if 'title' in data:
field = c.find_element_by_id('id_title') field = c.find_element(By.ID, 'id_title')
field.clear() field.clear()
field.send_keys(data['title']) field.send_keys(data['title'])
field = c.find_element_by_id('id_description') field = c.find_element(By.ID, 'id_description')
if isinstance(data['description'], list): if isinstance(data['description'], list):
field.send_keys(Keys.RETURN.join(data['description'])) field.send_keys(Keys.RETURN.join(data['description']))
else: else:
field.send_keys(data['description']) field.send_keys(data['description'])
button = c.find_element_by_id('btn-form-next') button = c.find_element(By.ID, 'btn-form-next')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
if screenshots: if screenshots:
self.save_screenshot('summary_form', sequence=sequence_name) self.save_screenshot('summary_form', sequence=sequence_name)
button = c.find_element_by_id('btn-form-back') button = c.find_element(By.ID, 'btn-form-back')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
for i in range(0, 11): for i in range(0, 11):
try: try:
button = c.find_element_by_id('btn-form-next') button = c.find_element(By.ID, 'btn-form-next')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
except NoSuchElementException: except NoSuchElementException:
@@ -431,13 +431,13 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
self.fail('Too many sub forms') self.fail('Too many sub forms')
if 'internal_note' in data: if 'internal_note' in data:
field = c.find_element_by_id('id_internal_note') field = c.find_element(By.ID, 'id_internal_note')
if isinstance(data['internal_note'], list): if isinstance(data['internal_note'], list):
field.send_keys(Keys.RETURN.join(data['internal_note'])) field.send_keys(Keys.RETURN.join(data['internal_note']))
else: else:
field.send_keys(data['internal_note']) field.send_keys(data['internal_note'])
button = c.find_element_by_id('btn-form-submit') button = c.find_element(By.ID, 'btn-form-submit')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
@@ -445,9 +445,9 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
if screenshots: if screenshots:
self.save_screenshot('user_and_event_created_set_password', sequence=sequence_name) self.save_screenshot('user_and_event_created_set_password', sequence=sequence_name)
field = c.find_element_by_id('id_new_password') field = c.find_element(By.ID, 'id_new_password')
field.send_keys(TEST_PASSWORD) field.send_keys(TEST_PASSWORD)
field = c.find_element_by_id('id_new_password_repeat') field = c.find_element(By.ID, 'id_new_password_repeat')
field.send_keys(TEST_PASSWORD) field.send_keys(TEST_PASSWORD)
field.send_keys(Keys.RETURN) field.send_keys(Keys.RETURN)
@@ -471,20 +471,20 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
if screenshots: if screenshots:
self.save_screenshot('event_list_before', sequence=sequence_name) self.save_screenshot('event_list_before', sequence=sequence_name)
link = c.find_element_by_link_text(title) link = c.find_element(By.LINK_TEXT, title)
link.click() link.click()
self.wait_until_stale(c, link) self.wait_until_stale(c, link)
if screenshots: if screenshots:
self.save_screenshot('event_details', sequence=sequence_name) self.save_screenshot('event_details', sequence=sequence_name)
button = c.find_element_by_id('btn-clone') button = c.find_element(By.ID, 'btn-clone')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
for i in range(0, 11): for i in range(0, 11):
try: try:
button = c.find_element_by_id('btn-form-next') button = c.find_element(By.ID, 'btn-form-next')
except NoSuchElementException: except NoSuchElementException:
break break
@@ -492,8 +492,8 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
self.save_screenshot('form', sequence=sequence_name) self.save_screenshot('form', sequence=sequence_name)
try: try:
field = c.find_element_by_id('id_deadline') field = c.find_element(By.ID, 'id_deadline')
radio = field.find_element_by_css_selector('input[value=\'OTHER\']') radio = field.find_element(By.CSS_SELECTOR, 'input[value=\'OTHER\']')
radio.click() radio.click()
except NoSuchElementException: except NoSuchElementException:
pass pass
@@ -506,7 +506,7 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
if screenshots: if screenshots:
self.save_screenshot('summary', sequence=sequence_name) self.save_screenshot('summary', sequence=sequence_name)
button = c.find_element_by_id('btn-form-submit') button = c.find_element(By.ID, 'btn-form-submit')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
@@ -523,28 +523,28 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
link = c.find_element_by_link_text(title) link = c.find_element(By.LINK_TEXT, title)
link.click() link.click()
self.wait_until_stale(c, link) self.wait_until_stale(c, link)
action_tabs = c.find_element_by_css_selector('.action-tabs > ul.nav-tabs') action_tabs = c.find_element(By.CSS_SELECTOR, '.action-tabs > ul.nav-tabs')
tab = action_tabs.find_element_by_link_text(ugettext(u'Ändern')) tab = action_tabs.find_element(By.LINK_TEXT, ugettext(u'Ändern'))
tab.click() tab.click()
self.wait_until_stale(c, tab) self.wait_until_stale(c, tab)
panels = c.find_elements_by_css_selector('#form-accordion .panel-collapse') panels = c.find_elements(By.CSS_SELECTOR, '#form-accordion .panel-collapse')
for panel in panels[:-1]: for panel in panels[:-1]:
if screenshots: if screenshots:
self.save_screenshot('edit-form', sequence=sequence_name) self.save_screenshot('edit-form', sequence=sequence_name)
button = panel.find_element_by_partial_link_text(ugettext(u'Nächster Abschnitt')) button = panel.find_element(By.PARTIAL_LINK_TEXT, ugettext(u'Nächster Abschnitt'))
button.click() button.click()
time.sleep(.5) time.sleep(.5)
if screenshots: if screenshots:
self.save_screenshot('edit-form', sequence=sequence_name) self.save_screenshot('edit-form', sequence=sequence_name)
button = c.find_element_by_css_selector('form button[type="submit"]') button = c.find_element(By.CSS_SELECTOR, 'form button[type="submit"]')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
@@ -561,26 +561,26 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
if screenshots: if screenshots:
self.save_screenshot('event_list_before', sequence=sequence_name) self.save_screenshot('event_list_before', sequence=sequence_name)
link = c.find_element_by_link_text(title) link = c.find_element(By.LINK_TEXT, title)
link.click() link.click()
self.wait_until_stale(c, link) self.wait_until_stale(c, link)
if screenshots: if screenshots:
self.save_screenshot('event_details', sequence=sequence_name) self.save_screenshot('event_details', sequence=sequence_name)
button = c.find_element_by_id('btn-accept') button = c.find_element(By.ID, 'btn-accept')
button.click() button.click()
time.sleep(.5) time.sleep(.5)
if screenshots: if screenshots:
self.save_screenshot('accept_modal', sequence=sequence_name) self.save_screenshot('accept_modal', sequence=sequence_name)
button = c.find_element_by_css_selector('#modal-accept-dialog a.btn-success') button = c.find_element(By.CSS_SELECTOR, '#modal-accept-dialog a.btn-success')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
if screenshots: if screenshots:
self.save_screenshot('accepted', sequence=sequence_name) self.save_screenshot('accepted', sequence=sequence_name)
link = c.find_element_by_link_text(ugettext('Veranstaltungsliste')) link = c.find_element(By.LINK_TEXT, ugettext('Veranstaltungsliste'))
link.click() link.click()
self.wait_until_stale(c, link) self.wait_until_stale(c, link)
if screenshots: if screenshots:
@@ -599,26 +599,26 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
if screenshots: if screenshots:
self.save_screenshot('event_list_before', sequence=sequence_name) self.save_screenshot('event_list_before', sequence=sequence_name)
link = c.find_element_by_link_text(title) link = c.find_element(By.LINK_TEXT, title)
link.click() link.click()
self.wait_until_stale(c, link) self.wait_until_stale(c, link)
if screenshots: if screenshots:
self.save_screenshot('event_details', sequence=sequence_name) self.save_screenshot('event_details', sequence=sequence_name)
button = c.find_element_by_id('btn-confirmpublication') button = c.find_element(By.ID, 'btn-confirmpublication')
button.click() button.click()
time.sleep(.5) time.sleep(.5)
if screenshots: if screenshots:
self.save_screenshot('confirmpublication_modal', sequence=sequence_name) self.save_screenshot('confirmpublication_modal', sequence=sequence_name)
button = c.find_element_by_css_selector('#btn-confirmpublication-{}'.format(channel)) button = c.find_element(By.CSS_SELECTOR, '#btn-confirmpublication-{}'.format(channel))
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
if screenshots: if screenshots:
self.save_screenshot('confirmed_{}'.format(channel), sequence=sequence_name) self.save_screenshot('confirmed_{}'.format(channel), sequence=sequence_name)
link = c.find_element_by_link_text(ugettext('Veranstaltungsliste')) link = c.find_element(By.LINK_TEXT, ugettext('Veranstaltungsliste'))
link.click() link.click()
self.wait_until_stale(c, link) self.wait_until_stale(c, link)
if screenshots: if screenshots:
@@ -637,20 +637,20 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
if screenshots: if screenshots:
self.save_screenshot('event_list_before', sequence=sequence_name) self.save_screenshot('event_list_before', sequence=sequence_name)
link = c.find_element_by_link_text(title) link = c.find_element(By.LINK_TEXT, title)
link.click() link.click()
self.wait_until_stale(c, link) self.wait_until_stale(c, link)
if screenshots: if screenshots:
self.save_screenshot('event_details', sequence=sequence_name) self.save_screenshot('event_details', sequence=sequence_name)
button = c.find_element_by_id('btn-confirmclearance') button = c.find_element(By.ID, 'btn-confirmclearance')
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
if screenshots: if screenshots:
self.save_screenshot('confirmed_clearance', sequence=sequence_name) self.save_screenshot('confirmed_clearance', sequence=sequence_name)
link = c.find_element_by_link_text(ugettext('Veranstaltungsliste')) link = c.find_element(By.LINK_TEXT, ugettext('Veranstaltungsliste'))
link.click() link.click()
self.wait_until_stale(c, link) self.wait_until_stale(c, link)
if screenshots: if screenshots:
@@ -688,7 +688,7 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
self.create_event(TEST_EVENT_DATA_W, auth=True) self.create_event(TEST_EVENT_DATA_W, auth=True)
self.create_event(TEST_EVENT_DATA_M, auth=True) self.create_event(TEST_EVENT_DATA_M, auth=True)
link = c.find_element_by_link_text(TEST_EVENT_DATA_W['title']) link = c.find_element(By.LINK_TEXT, TEST_EVENT_DATA_W['title'])
link.click() link.click()
self.wait_until_stale(c, link) self.wait_until_stale(c, link)
self.save_screenshot('owner_event_details') self.save_screenshot('owner_event_details')
@@ -730,7 +730,7 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase):
button.click() button.click()
self.wait_until_stale(c, button) self.wait_until_stale(c, button)
link = c.find_element_by_partial_link_text(ugettext(u'Veranstaltungsliste herunterladen')) link = c.find_element(By.PARTIAL_LINK_TEXT, ugettext(u'Veranstaltungsliste herunterladen'))
link.click() link.click()
self.wait_until_stale(c, link) self.wait_until_stale(c, link)
self.save_screenshot('event_export_form') self.save_screenshot('event_export_form')