From 4af36ca49caf88a2320342b0925ce5e1d13d19c6 Mon Sep 17 00:00:00 2001 From: Disco DeDisco Date: Thu, 1 Jan 2026 17:52:19 -0500 Subject: [PATCH] refactored tests for less clunky explicit wait times --- apps/dashboard/tests.py | 2 +- functional_tests/tests.py | 28 +++++++++++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/apps/dashboard/tests.py b/apps/dashboard/tests.py index c344a17..64b6e73 100644 --- a/apps/dashboard/tests.py +++ b/apps/dashboard/tests.py @@ -9,7 +9,7 @@ class HomePageTest(TestCase): def test_renders_input_form(self): response = self.client.get('/') self.assertContains(response, '
') - self.assertContains(response, ' MAX_WAIT: + raise + time.sleep(0.5) # Test methods def test_can_start_a_todo_list(self): @@ -32,12 +43,11 @@ class NewVisitorTest(LiveServerTestCase): inputbox.send_keys('Buy peacock feathers') inputbox.send_keys(Keys.ENTER) - time.sleep(1) - self.check_for_row_in_list_table('1: Buy peacock feathers') + self.wait_for_row_in_list_table('1: Buy peacock feathers') inputbox = self.browser.find_element(By.ID, 'id-new-item') inputbox.send_keys('Use peacock feathers to make a fly') inputbox.send_keys(Keys.ENTER) - time.sleep(1) - self.check_for_row_in_list_table('2: Use peacock feathers to make a fly') - self.check_for_row_in_list_table('1: Buy peacock feathers') + + self.wait_for_row_in_list_table('2: Use peacock feathers to make a fly') + self.wait_for_row_in_list_table('1: Buy peacock feathers')