Initial refactor of event item testing

This commit is contained in:
2020-05-21 22:48:46 +01:00
parent 919975e1ba
commit 813db2c474
5 changed files with 121 additions and 211 deletions

View File

@@ -4,8 +4,10 @@ from selenium.webdriver.support import expected_conditions
from selenium.webdriver import Chrome
from django.urls import reverse
from PyRIGS.tests import regions
from RIGS.tests import regions as rigs_regions
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')
@@ -59,6 +61,7 @@ class CreateEvent(FormPage):
_mic_selector_selector = (By.XPATH, '//*[@id="form-hws"]/div[7]/div[1]/div/div')
_add_person_selector = (By.XPATH, '//a[@data-target="#id_person" and contains(@href, "add")]')
_add_item_selector = (By.XPATH, '//button[contains(@class, "item-add")]')
form_items = {
'description': (regions.TextBox, (By.ID, 'id_description')),
@@ -81,6 +84,9 @@ class CreateEvent(FormPage):
def select_event_type(self, type_name):
self.find_element(By.XPATH, '//button[.="' + type_name + '"]').click()
def item_row(self, ID):
return rigs_regions.ItemRow(self, self.find_element(By.ID, "item-" + ID))
@property
def is_expanded(self):
return self.find_element(*self._bottom_save_selector).is_displayed()
@@ -101,6 +107,12 @@ class CreateEvent(FormPage):
self.find_element(*self._add_person_selector).click()
return regions.Modal(self, self.driver.find_element_by_id('modal'))
def add_event_item(self):
self.find_element(*self._add_item_selector).click()
element = self.driver.find_element_by_id('itemModal')
self.wait.until(EC.visibility_of(element))
return regions.ItemModal(self, element)
@property
def success(self):
return '/create' not in self.driver.current_url