diff --git a/PyRIGS/tests/regions.py b/PyRIGS/tests/regions.py index 119f22c4..74e20787 100644 --- a/PyRIGS/tests/regions.py +++ b/PyRIGS/tests/regions.py @@ -219,15 +219,3 @@ class Modal(Region): form_element.set_value(value) else: self.__dict__[name] = value - - -# TODO Move to RIGS regions -class ItemModal(Modal): - _header_selector = (By.TAG_NAME, 'h4') - - form_items = { - 'name': (TextBox, (By.ID, 'item_name')), - 'description': (TextBox, (By.ID, 'item_description')), - 'quantity': (TextBox, (By.ID, 'item_quantity')), - 'price': (TextBox, (By.ID, 'item_cost')) - } diff --git a/RIGS/tests/pages.py b/RIGS/tests/pages.py index 0b84090e..9060f277 100644 --- a/RIGS/tests/pages.py +++ b/RIGS/tests/pages.py @@ -155,7 +155,7 @@ class CreateEvent(FormPage): 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) + return rigs_regions.ItemModal(self, element) @property def success(self): diff --git a/RIGS/tests/regions.py b/RIGS/tests/regions.py index 63fc31eb..c5a4d3be 100644 --- a/RIGS/tests/regions.py +++ b/RIGS/tests/regions.py @@ -5,6 +5,7 @@ from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support.select import Select import datetime +from PyRIGS.regions import Modal class Header(Region): @@ -38,3 +39,13 @@ class ItemRow(Region): @property def subtotal(self): return self.find_element(*self._subtotal_locator).text + +class ItemModal(Modal): + _header_selector = (By.TAG_NAME, 'h4') + + form_items = { + 'name': (TextBox, (By.ID, 'item_name')), + 'description': (TextBox, (By.ID, 'item_description')), + 'quantity': (TextBox, (By.ID, 'item_quantity')), + 'price': (TextBox, (By.ID, 'item_cost')) + } diff --git a/RIGS/tests/test_functional.py b/RIGS/tests/test_functional.py index bee3551f..925a3957 100644 --- a/RIGS/tests/test_functional.py +++ b/RIGS/tests/test_functional.py @@ -109,11 +109,8 @@ class TestEventCreate(BaseRigboardTest): def test_rig_creation(self): self.select_event_type("Rig") - self.page.person_selector.toggle() - self.assertTrue(self.page.person_selector.is_open) self.page.person_selector.search(self.client.name) self.page.person_selector.set_option(self.client.name, True) - # TODO This should not be necessary, normally closes automatically self.page.person_selector.toggle() self.assertFalse(self.page.person_selector.is_open) @@ -175,11 +172,8 @@ class TestEventCreate(BaseRigboardTest): def test_date_validation(self): self.select_event_type("Rig") - self.page.person_selector.toggle() - self.assertTrue(self.page.person_selector.is_open) self.page.person_selector.search(self.client.name) self.page.person_selector.set_option(self.client.name, True) - # TODO This should not be necessary, normally closes automatically self.page.person_selector.toggle() self.assertFalse(self.page.person_selector.is_open) @@ -213,8 +207,6 @@ class TestEventCreate(BaseRigboardTest): def test_access_validation(self): self.select_event_type("Rig") - self.page.person_selector.toggle() - self.assertTrue(self.page.person_selector.is_open) self.page.person_selector.search(self.client.name) self.page.person_selector.set_option(self.client.name, True) # TODO This should not be necessary, normally closes automatically @@ -228,6 +220,7 @@ class TestEventCreate(BaseRigboardTest): self.page.submit() self.assertFalse(self.page.success) + self.assertTrue(self.page.errors is not None) self.assertIn("access time cannot be after the event has started.", self.page.errors["General form errors"][0]) # Fix it @@ -242,8 +235,6 @@ class TestEventCreate(BaseRigboardTest): self.page.name = "Test Event with Items" - self.page.person_selector.toggle() - self.assertTrue(self.page.person_selector.is_open) self.page.person_selector.search(self.client.name) self.page.person_selector.set_option(self.client.name, True) # TODO This should not be necessary, normally closes automatically @@ -372,7 +363,6 @@ class TestEventDuplicate(BaseRigboardTest): self.wait.until(animation_is_finished()) # Attempt to save - ActionChains(self.driver).move_to_element(table).perform() self.page.submit() # TODO Rewrite when EventDetail page is implemented