mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-22 16:02:16 +00:00
Minor test futzing
This commit is contained in:
@@ -219,15 +219,3 @@ class Modal(Region):
|
|||||||
form_element.set_value(value)
|
form_element.set_value(value)
|
||||||
else:
|
else:
|
||||||
self.__dict__[name] = value
|
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'))
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ class CreateEvent(FormPage):
|
|||||||
self.find_element(*self._add_item_selector).click()
|
self.find_element(*self._add_item_selector).click()
|
||||||
element = self.driver.find_element_by_id('itemModal')
|
element = self.driver.find_element_by_id('itemModal')
|
||||||
self.wait.until(EC.visibility_of(element))
|
self.wait.until(EC.visibility_of(element))
|
||||||
return regions.ItemModal(self, element)
|
return rigs_regions.ItemModal(self, element)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def success(self):
|
def success(self):
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from selenium.webdriver.remote.webelement import WebElement
|
|||||||
from selenium.webdriver.support.ui import WebDriverWait
|
from selenium.webdriver.support.ui import WebDriverWait
|
||||||
from selenium.webdriver.support.select import Select
|
from selenium.webdriver.support.select import Select
|
||||||
import datetime
|
import datetime
|
||||||
|
from PyRIGS.regions import Modal
|
||||||
|
|
||||||
|
|
||||||
class Header(Region):
|
class Header(Region):
|
||||||
@@ -38,3 +39,13 @@ class ItemRow(Region):
|
|||||||
@property
|
@property
|
||||||
def subtotal(self):
|
def subtotal(self):
|
||||||
return self.find_element(*self._subtotal_locator).text
|
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'))
|
||||||
|
}
|
||||||
|
|||||||
@@ -109,11 +109,8 @@ class TestEventCreate(BaseRigboardTest):
|
|||||||
def test_rig_creation(self):
|
def test_rig_creation(self):
|
||||||
self.select_event_type("Rig")
|
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.search(self.client.name)
|
||||||
self.page.person_selector.set_option(self.client.name, True)
|
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.page.person_selector.toggle()
|
||||||
self.assertFalse(self.page.person_selector.is_open)
|
self.assertFalse(self.page.person_selector.is_open)
|
||||||
|
|
||||||
@@ -175,11 +172,8 @@ class TestEventCreate(BaseRigboardTest):
|
|||||||
def test_date_validation(self):
|
def test_date_validation(self):
|
||||||
self.select_event_type("Rig")
|
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.search(self.client.name)
|
||||||
self.page.person_selector.set_option(self.client.name, True)
|
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.page.person_selector.toggle()
|
||||||
self.assertFalse(self.page.person_selector.is_open)
|
self.assertFalse(self.page.person_selector.is_open)
|
||||||
|
|
||||||
@@ -213,8 +207,6 @@ class TestEventCreate(BaseRigboardTest):
|
|||||||
def test_access_validation(self):
|
def test_access_validation(self):
|
||||||
self.select_event_type("Rig")
|
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.search(self.client.name)
|
||||||
self.page.person_selector.set_option(self.client.name, True)
|
self.page.person_selector.set_option(self.client.name, True)
|
||||||
# TODO This should not be necessary, normally closes automatically
|
# TODO This should not be necessary, normally closes automatically
|
||||||
@@ -228,6 +220,7 @@ class TestEventCreate(BaseRigboardTest):
|
|||||||
|
|
||||||
self.page.submit()
|
self.page.submit()
|
||||||
self.assertFalse(self.page.success)
|
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])
|
self.assertIn("access time cannot be after the event has started.", self.page.errors["General form errors"][0])
|
||||||
|
|
||||||
# Fix it
|
# Fix it
|
||||||
@@ -242,8 +235,6 @@ class TestEventCreate(BaseRigboardTest):
|
|||||||
|
|
||||||
self.page.name = "Test Event with Items"
|
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.search(self.client.name)
|
||||||
self.page.person_selector.set_option(self.client.name, True)
|
self.page.person_selector.set_option(self.client.name, True)
|
||||||
# TODO This should not be necessary, normally closes automatically
|
# TODO This should not be necessary, normally closes automatically
|
||||||
@@ -372,7 +363,6 @@ class TestEventDuplicate(BaseRigboardTest):
|
|||||||
self.wait.until(animation_is_finished())
|
self.wait.until(animation_is_finished())
|
||||||
|
|
||||||
# Attempt to save
|
# Attempt to save
|
||||||
ActionChains(self.driver).move_to_element(table).perform()
|
|
||||||
self.page.submit()
|
self.page.submit()
|
||||||
|
|
||||||
# TODO Rewrite when EventDetail page is implemented
|
# TODO Rewrite when EventDetail page is implemented
|
||||||
|
|||||||
Reference in New Issue
Block a user