mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 13:32:15 +00:00
What about this?
Swear I spend my life jiggerypokerying the damn test suite...
This commit is contained in:
2
.github/workflows/django.yml
vendored
2
.github/workflows/django.yml
vendored
@@ -58,7 +58,7 @@ jobs:
|
||||
if: failure() # Screenshots only make sense for the non-parallel, i.e. interaction tests anyway
|
||||
with:
|
||||
name: failure-screenshots ${{ matrix.test-group }}
|
||||
path: screenshots/*
|
||||
path: screenshots/
|
||||
retention-days: 5
|
||||
- name: Run Tests (Parallel)
|
||||
if: ${{ matrix.parallel }}
|
||||
|
||||
@@ -20,9 +20,6 @@ def create_datetime(year, month, day, hour, min):
|
||||
def create_browser():
|
||||
options = webdriver.ChromeOptions()
|
||||
options.add_argument("--window-size=1920,1080")
|
||||
# No caching, please and thank you
|
||||
options.add_argument("--aggressive-cache-discard")
|
||||
options.add_argument("--disk-cache-size=0")
|
||||
options.add_argument("--headless")
|
||||
if settings.CI:
|
||||
options.add_argument("--no-sandbox")
|
||||
|
||||
@@ -243,6 +243,7 @@ class AssetAuditList(AssetList):
|
||||
# self.wait.until(lambda x: not self.is_displayed) TODO
|
||||
|
||||
def close(self):
|
||||
previous_errors = self.errors
|
||||
self.page.find_element(*self._close_selector).click()
|
||||
|
||||
def remove_all_required(self):
|
||||
|
||||
@@ -294,17 +294,16 @@ class TestAssetAudit(AutoLoginTest):
|
||||
asset_id = "1111"
|
||||
self.page.set_query(asset_id)
|
||||
self.page.search()
|
||||
mdl = self.page.modal
|
||||
self.wait.until(EC.visibility_of_element_located((By.ID, 'modal')))
|
||||
# Do it wrong on purpose to check error display
|
||||
mdl.remove_all_required()
|
||||
mdl.description = ""
|
||||
mdl.submit()
|
||||
self.page.modal.remove_all_required()
|
||||
self.page.modal.description = ""
|
||||
self.page.modal.submit()
|
||||
self.wait.until(animation_is_finished())
|
||||
self.assertIn("This field is required.", mdl.errors["Description"])
|
||||
self.assertIn("This field is required.", self.page.modal.errors["Description"])
|
||||
# Now do it properly
|
||||
mdl.description = new_desc = "A BIG hammer"
|
||||
mdl.submit()
|
||||
self.page.modal.description = new_desc = "A BIG hammer"
|
||||
self.page.modal.submit()
|
||||
submit_time = timezone.now()
|
||||
self.wait.until(EC.invisibility_of_element_located((By.ID, 'modal')))
|
||||
self.assertFalse(self.driver.find_element_by_id('modal').is_displayed())
|
||||
@@ -325,14 +324,14 @@ class TestAssetAudit(AutoLoginTest):
|
||||
self.driver.find_element(By.XPATH, "//a[contains(@class,'btn') and contains(., 'Audit')]").click()
|
||||
self.wait.until(EC.visibility_of_element_located((By.ID, 'modal')))
|
||||
self.assertEqual(self.page.modal.asset_id, asset_row.id)
|
||||
|
||||
self.page.modal.close()
|
||||
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())
|
||||
# Make sure audit log was NOT filled out
|
||||
audited = models.Asset.objects.get(asset_id=asset_row.id)
|
||||
self.assertEqual(None, audited.last_audited_by)
|
||||
|
||||
def test_audit_search(self):
|
||||
# Check that a failed search works
|
||||
self.page.set_query("NOTFOUND")
|
||||
self.page.search()
|
||||
|
||||
Reference in New Issue
Block a user