FTs now exist in own test files, ea. reliant on base.py to execute
This commit is contained in:
33
src/functional_tests/base.py
Normal file
33
src/functional_tests/base.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
|
||||
from selenium import webdriver
|
||||
from selenium.common.exceptions import WebDriverException
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
MAX_WAIT = 5
|
||||
|
||||
class FunctionalTest(StaticLiveServerTestCase):
|
||||
# Helper methods
|
||||
def setUp(self):
|
||||
self.browser = webdriver.Firefox()
|
||||
if test_server := os.environ.get('TEST_SERVER'):
|
||||
self.live_server_url = 'http://' + test_server
|
||||
|
||||
def tearDown(self):
|
||||
self.browser.quit()
|
||||
|
||||
def wait_for_row_in_list_table(self, row_text):
|
||||
start_time = time.time()
|
||||
while True:
|
||||
try:
|
||||
table = self.browser.find_element(By.ID, 'id-list-table')
|
||||
rows = table.find_elements(By.TAG_NAME, 'tr')
|
||||
self.assertIn(row_text, [row.text for row in rows])
|
||||
return
|
||||
except (AssertionError, WebDriverException):
|
||||
if time.time() - start_time > MAX_WAIT:
|
||||
raise
|
||||
time.sleep(0.5)
|
||||
|
||||
Reference in New Issue
Block a user