diff --git a/functional_tests/__init__.py b/functional_tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/functional_tests.py b/functional_tests/tests.py similarity index 91% rename from functional_tests.py rename to functional_tests/tests.py index 753d95d..ad40225 100644 --- a/functional_tests.py +++ b/functional_tests/tests.py @@ -1,10 +1,11 @@ +from django.test import LiveServerTestCase from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys import time import unittest -class NewVisitorTest(unittest.TestCase): +class NewVisitorTest(LiveServerTestCase): # Helper methods def setUp(self): self.browser = webdriver.Firefox() @@ -19,7 +20,7 @@ class NewVisitorTest(unittest.TestCase): # Test methods def test_can_start_a_todo_list(self): - self.browser.get("http://localhost:8000") + self.browser.get(self.live_server_url) self.assertIn("To-Do", self.browser.title) header_text = self.browser.find_element(By.TAG_NAME, 'h1').text @@ -40,6 +41,3 @@ class NewVisitorTest(unittest.TestCase): 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') - -if __name__ == "__main__": - unittest.main() \ No newline at end of file