Minor refactoring of integration tests
Simplify 2 CheckBoxRegion-s by moving their common functionality into mixin. Change-Id: I0cc137702ff408aeb7af433c56c87aba091b8dc6
This commit is contained in:
parent
3a72687ab3
commit
f23d6d957d
@ -76,41 +76,32 @@ class BaseFormFieldRegion(baseregion.BaseRegion):
|
||||
return self.element.is_displayed()
|
||||
|
||||
|
||||
class CheckBoxFormFieldRegion(BaseFormFieldRegion):
|
||||
class CheckBoxMixin(object):
|
||||
def is_marked(self):
|
||||
return self.element.is_selected()
|
||||
|
||||
def mark(self):
|
||||
if not self.is_marked():
|
||||
self.element.click()
|
||||
|
||||
def unmark(self):
|
||||
if self.is_marked():
|
||||
self.element.click()
|
||||
|
||||
|
||||
class CheckBoxFormFieldRegion(BaseFormFieldRegion, CheckBoxMixin):
|
||||
"""Checkbox field."""
|
||||
|
||||
_element_locator = (by.By.CSS_SELECTOR,
|
||||
'div > label > input[type=checkbox]')
|
||||
|
||||
def is_marked(self):
|
||||
return self.element.is_selected()
|
||||
|
||||
def mark(self):
|
||||
if not self.is_marked():
|
||||
self.element.click()
|
||||
|
||||
def unmark(self):
|
||||
if self.is_marked():
|
||||
self.element.click()
|
||||
|
||||
|
||||
class ProjectPageCheckBoxFormFieldRegion(BaseFormFieldRegion):
|
||||
class ProjectPageCheckBoxFormFieldRegion(BaseFormFieldRegion, CheckBoxMixin):
|
||||
"""Checkbox field for Project-page."""
|
||||
|
||||
_element_locator = (by.By.CSS_SELECTOR,
|
||||
'div > input[type=checkbox]')
|
||||
|
||||
def is_marked(self):
|
||||
return self.element.is_selected()
|
||||
|
||||
def mark(self):
|
||||
if not self.is_marked():
|
||||
self.element.click()
|
||||
|
||||
def unmark(self):
|
||||
if self.is_marked():
|
||||
self.element.click()
|
||||
|
||||
|
||||
class ChooseFileFormFieldRegion(BaseFormFieldRegion):
|
||||
"""Choose file field."""
|
||||
|
Loading…
Reference in New Issue
Block a user