Minor test futzing

This commit is contained in:
2020-05-26 13:35:50 +01:00
parent 08f40bce9e
commit 7356d020b2
4 changed files with 13 additions and 24 deletions

View File

@@ -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'))
}

View File

@@ -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):

View File

@@ -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'))
}

View File

@@ -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