mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-26 18:02:18 +00:00
pep8
This commit is contained in:
@@ -9,6 +9,7 @@ from PyRIGS.tests.pages import BasePage, FormPage
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
|
||||
|
||||
class Index(BasePage):
|
||||
URL_TEMPLATE = reverse('index')
|
||||
|
||||
@@ -47,34 +48,35 @@ class Rigboard(BasePage):
|
||||
@property
|
||||
def events(self):
|
||||
return [self.EventListRow(self, i) for i in self.find_elements(*self._event_row_locator)]
|
||||
|
||||
|
||||
|
||||
class EventDetail(BasePage):
|
||||
URL_TEMPLATE = 'event/{event_id}'
|
||||
|
||||
|
||||
# TODO Refactor into regions to match template fragmentation
|
||||
_event_name_selector = (By.XPATH, '//h1')
|
||||
_person_panel_selector = (By.XPATH, '//div[contains(text(), "Contact Details")]/..')
|
||||
_name_selector = (By.XPATH, '//dt[text()="Person"]/following-sibling::dd[1]')
|
||||
_email_selector = (By.XPATH, '//dt[text()="Email"]/following-sibling::dd[1]')
|
||||
_phone_selector = (By.XPATH, '//dt[text()="Phone Number"]/following-sibling::dd[1]')
|
||||
|
||||
|
||||
@property
|
||||
def event_name(self):
|
||||
return self.find_element(*self._event_name_selector).text
|
||||
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self.find_element(*self._person_panel_selector).find_element(*self._name_selector).text
|
||||
|
||||
|
||||
@property
|
||||
def email(self):
|
||||
return self.find_element(*self._person_panel_selector).find_element(*self._email_selector).text
|
||||
|
||||
|
||||
@property
|
||||
def phone(self):
|
||||
return self.find_element(*self._person_panel_selector).find_element(*self._phone_selector).text
|
||||
|
||||
|
||||
class CreateEvent(FormPage):
|
||||
URL_TEMPLATE = reverse('event_create')
|
||||
|
||||
@@ -88,7 +90,7 @@ class CreateEvent(FormPage):
|
||||
|
||||
_add_person_selector = (By.XPATH, '//a[@data-target="#id_person" and contains(@href, "add")]')
|
||||
_add_item_selector = (By.XPATH, '//button[contains(@class, "item-add")]')
|
||||
|
||||
|
||||
_event_table_selector = (By.ID, 'item-table')
|
||||
_warning_selector = (By.XPATH, '/html/body/div[1]/div[1]')
|
||||
|
||||
@@ -115,11 +117,11 @@ class CreateEvent(FormPage):
|
||||
|
||||
def item_row(self, ID):
|
||||
return rigs_regions.ItemRow(self, self.find_element(By.ID, "item-" + ID))
|
||||
|
||||
|
||||
@property
|
||||
def item_table(self):
|
||||
return self.find_element(*self._event_table_selector)
|
||||
|
||||
|
||||
@property
|
||||
def warning(self):
|
||||
return self.find_element(*self._warning_selector).text
|
||||
@@ -153,25 +155,27 @@ class CreateEvent(FormPage):
|
||||
@property
|
||||
def success(self):
|
||||
return '/create' not in self.driver.current_url
|
||||
|
||||
|
||||
|
||||
class DuplicateEvent(CreateEvent):
|
||||
URL_TEMPLATE = 'event/{event_id}/duplicate'
|
||||
_submit_locator = (By.XPATH, '/html/body/div[1]/form/div/div[5]/div/button')
|
||||
|
||||
|
||||
@property
|
||||
def success(self):
|
||||
return '/duplicate' not in self.driver.current_url
|
||||
|
||||
|
||||
|
||||
class EditEvent(CreateEvent):
|
||||
URL_TEMPLATE = 'event/{event_id}/edit'
|
||||
_submit_locator = (By.XPATH, '/html/body/div[1]/form/div/div[5]/div/button')
|
||||
|
||||
|
||||
@property
|
||||
def success(self):
|
||||
return '/edit' not in self.driver.current_url
|
||||
|
||||
|
||||
class GenericList(BasePage):
|
||||
_search_selector = (By.CSS_SELECTOR, 'div.input-group:nth-child(2) > input:nth-child(1)')
|
||||
_search_go_selector = (By.ID, 'id_search')
|
||||
_add_item_selector = (By.CSS_SELECTOR, '.btn-success')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user