mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Fix the remaining tests
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
{% include 'partials/audit_details.html' %}
|
||||
</div>
|
||||
</div>
|
||||
{% if perms.RIGS.view_asset %}
|
||||
{% if perms.assets.view_asset %}
|
||||
<div class="row justify-content-end">
|
||||
{% include 'partials/asset_buttons.html' %}
|
||||
</div>
|
||||
|
||||
@@ -82,6 +82,8 @@
|
||||
</h1>
|
||||
{% if duplicate %}
|
||||
<form method="POST" id="asset_update_form" action="{% url 'asset_duplicate' pk=previous_asset_id %}">
|
||||
{% elif edit %}
|
||||
<form method="POST" id="asset_update_form" action="{% url 'asset_update' pk=object.asset_id %}">
|
||||
{% else %}
|
||||
<form method="POST" id="asset_update_form" action="{% url 'asset_create' %}">
|
||||
{% endif %}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="input-group">
|
||||
{% render_field form.query|add_class:'form-control' placeholder='Search by Asset ID/Desc/Serial' style="width: 250px"%}
|
||||
<label for="query" class="sr-only">Asset ID/Description/Serial Number:</label>
|
||||
<span class="input-group-append"><button type="submit" class="btn btn-primary">Search</button></span>
|
||||
<span class="input-group-append"><button type="submit" class="btn btn-primary" id="id_search">Search</button></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-end">
|
||||
|
||||
@@ -16,7 +16,7 @@ class AssetList(BasePage):
|
||||
_search_text_locator = (By.ID, 'id_query')
|
||||
_status_select_locator = (By.CSS_SELECTOR, 'div#status-group>div.bootstrap-select')
|
||||
_category_select_locator = (By.CSS_SELECTOR, 'div#category-group>div.bootstrap-select')
|
||||
_go_button_locator = (By.ID, 'filter-submit')
|
||||
_go_button_locator = (By.ID, 'id_search')
|
||||
|
||||
class AssetListRow(Region):
|
||||
_asset_id_locator = (By.CLASS_NAME, "assetID")
|
||||
@@ -123,12 +123,12 @@ class AssetDuplicate(AssetForm):
|
||||
class SupplierList(BasePage):
|
||||
URL_TEMPLATE = reverse('supplier_list')
|
||||
|
||||
_supplier_item_locator = (By.CLASS_NAME, 'supplierRow')
|
||||
_search_text_locator = (By.ID, 'id_query')
|
||||
_supplier_item_locator = (By.ID, 'row_item')
|
||||
_search_text_locator = (By.XPATH, '//*[@id="main"]/div[2]/form/div/input')
|
||||
_go_button_locator = (By.ID, 'id_search')
|
||||
|
||||
class SupplierListRow(Region):
|
||||
_name_locator = (By.CLASS_NAME, "supplierName")
|
||||
_name_locator = (By.ID, "cell_name")
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
||||
@@ -135,15 +135,12 @@ class TestAssetForm(AutoLoginTest):
|
||||
|
||||
self.page.parent_selector.toggle()
|
||||
self.assertTrue(self.page.parent_selector.is_open)
|
||||
# Searching it by ID autoselects it
|
||||
self.page.parent_selector.search(self.parent.asset_id)
|
||||
# Needed here but not earlier for whatever reason
|
||||
self.driver.implicitly_wait(1)
|
||||
# self.page.parent_selector.set_option(self.parent.asset_id + " | " + self.parent.description, True)
|
||||
# Need to explicitly close as we haven't selected anything to trigger the auto close
|
||||
self.page.parent_selector.search(Keys.ESCAPE)
|
||||
self.assertFalse(self.page.parent_selector.is_open)
|
||||
self.page.parent_selector.set_option(self.parent.asset_id + " | " + self.parent.description, True)
|
||||
self.assertTrue(self.page.parent_selector.options[0].selected)
|
||||
self.page.parent_selector.toggle()
|
||||
|
||||
self.assertFalse(self.driver.find_element_by_id('cable-table').is_displayed())
|
||||
|
||||
@@ -220,6 +217,7 @@ class TestSupplierList(AutoLoginTest):
|
||||
def test_search(self):
|
||||
self.page.set_query("TEC")
|
||||
self.page.search()
|
||||
|
||||
self.assertTrue(len(self.page.suppliers) == 1)
|
||||
self.assertEqual("TEC PA & Lighting", self.page.suppliers[0].name)
|
||||
|
||||
@@ -291,7 +289,7 @@ class TestAssetAudit(AutoLoginTest):
|
||||
new_desc = "A BIG hammer"
|
||||
mdl.description = new_desc
|
||||
mdl.submit()
|
||||
self.wait.until(animation_is_finished())
|
||||
self.wait.until(EC.invisibility_of_element_located((By.ID, 'modal')))
|
||||
self.assertFalse(self.driver.find_element_by_id('modal').is_displayed())
|
||||
|
||||
# Check data is correct
|
||||
@@ -309,13 +307,13 @@ class TestAssetAudit(AutoLoginTest):
|
||||
self.assertEqual(len(models.Asset.objects.filter(last_audited_at=None)), len(self.page.assets))
|
||||
|
||||
asset_row = self.page.assets[0]
|
||||
asset_row.find_element(By.XPATH, "//button[contains(., 'Audit')]").click()
|
||||
self.driver.find_element(By.XPATH, "//*[@id='asset_table_body']/tr[1]/td[4]/a").click()
|
||||
self.wait.until(EC.visibility_of_element_located((By.ID, 'modal')))
|
||||
self.assertEqual(self.page.modal.asset_id, asset_row.id)
|
||||
|
||||
# First close button is for the not found error
|
||||
self.page.find_element(By.XPATH, '(//button[@class="close"])[2]').click()
|
||||
self.wait.until(animation_is_finished())
|
||||
self.page.find_element(By.XPATH, '//*[@id="modal"]/div/div/div[1]/button').click()
|
||||
self.wait.until(EC.invisibility_of_element_located((By.ID, 'modal')))
|
||||
self.assertFalse(self.driver.find_element_by_id('modal').is_displayed())
|
||||
# Make sure audit log was NOT filled out
|
||||
audited = models.Asset.objects.get(asset_id=asset_row.id)
|
||||
|
||||
Reference in New Issue
Block a user