Fix failing tests in staging after django upgrade (#451)
This commit is contained in:
Родитель
62ce2da828
Коммит
ef97765635
|
@ -10,10 +10,8 @@ from pages.base import Base
|
|||
|
||||
class Register(Base):
|
||||
|
||||
_error_locator = (By.CSS_SELECTOR, 'div.alert.alert-error')
|
||||
_full_name_field_locator = (By.ID, 'id_full_name')
|
||||
_privacy_locator = (By.ID, 'id_optin')
|
||||
_privacy_error_message_locator = (By.CSS_SELECTOR, '.error-message')
|
||||
_create_profile_button_locator = (By.CSS_SELECTOR, '#form-submit-registration')
|
||||
_recaptcha_checkbox_locator = (By.CSS_SELECTOR, '.recaptcha-checkbox-checkmark')
|
||||
_recaptcha_checkbox_checked = (By.CSS_SELECTOR, '.recaptcha-checkbox-checked')
|
||||
|
@ -34,17 +32,13 @@ class Register(Base):
|
|||
return self
|
||||
|
||||
@property
|
||||
def error_message(self):
|
||||
return self.find_element(*self._error_locator).text
|
||||
def privacy_error_message(self):
|
||||
return self.find_element(*self._privacy_locator).get_attribute('validationMessage')
|
||||
|
||||
def set_full_name(self, full_name):
|
||||
element = self.find_element(*self._full_name_field_locator)
|
||||
element.send_keys(full_name)
|
||||
|
||||
@property
|
||||
def privacy_error_message(self):
|
||||
return self.find_element(*self._privacy_error_message_locator).text
|
||||
|
||||
def select_country(self, country):
|
||||
self.find_element(*self._country_countainer_locator).click()
|
||||
self.find_element(*self._input_locator).send_keys(country)
|
||||
|
|
|
@ -167,39 +167,37 @@ class Settings(Base):
|
|||
_select_year_locator = (By.ID, 'id_date_mozillian_year')
|
||||
_month_locator = (By.CSS_SELECTOR, '#id_date_mozillian_month > option')
|
||||
_year_locator = (By.CSS_SELECTOR, '#id_date_mozillian_year > option')
|
||||
_selected_month_locator = (By.CSS_SELECTOR, '#id_date_mozillian_month > option[selected="selected"]')
|
||||
_selected_year_locator = (By.CSS_SELECTOR, '#id_date_mozillian_year > option[selected="selected"]')
|
||||
_update_locator = (By.ID, 'form-submit-contribution')
|
||||
|
||||
def select_month(self, option_month):
|
||||
element = self.find_element(*self._select_month_locator)
|
||||
select = Select(element)
|
||||
select.select_by_value(option_month)
|
||||
select.select_by_visible_text(option_month)
|
||||
|
||||
def select_year(self, option_year):
|
||||
element = self.find_element(*self._select_year_locator)
|
||||
select = Select(element)
|
||||
select.select_by_value(option_year)
|
||||
select.select_by_visible_text(option_year)
|
||||
|
||||
@property
|
||||
def month(self):
|
||||
# Return selected month text
|
||||
return self.find_element(*self._selected_month_locator).text
|
||||
return [month.text for month in self.find_elements(*self._month_locator) if month.get_property('selected')]
|
||||
|
||||
@property
|
||||
def year(self):
|
||||
# Return selected year text
|
||||
return self.find_element(*self._selected_year_locator).text
|
||||
return [year.text for year in self.find_elements(*self._year_locator) if year.get_property('selected')]
|
||||
|
||||
@property
|
||||
def months_values(self):
|
||||
# Return all month values
|
||||
return [month.get_attribute('value') for month in self.find_elements(*self._month_locator)]
|
||||
return [month.text for month in self.find_elements(*self._month_locator)]
|
||||
|
||||
@property
|
||||
def years_values(self):
|
||||
# Return all year values
|
||||
return [year.get_attribute('value') for year in self.find_elements(*self._year_locator)]
|
||||
return [year.text for year in self.find_elements(*self._year_locator)]
|
||||
|
||||
def select_random_month(self):
|
||||
return self.select_month(random.choice(self.months_values[1:]))
|
||||
|
|
|
@ -49,4 +49,4 @@ class TestRegister:
|
|||
profile.check_recaptcha()
|
||||
|
||||
profile = profile.click_create_profile_button(leavepage=False)
|
||||
assert 'Please correct the errors below.' == profile.error_message
|
||||
assert 'Please check this box if you want to proceed.' == profile.privacy_error_message
|
||||
|
|
Загрузка…
Ссылка в новой задаче