Commit 8c6ee144 authored by littleredpanda14's avatar littleredpanda14

Implemented functional test

parent d4cf4c84
...@@ -7,9 +7,11 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -7,9 +7,11 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
def setUp(self): def setUp(self):
self.browser = webdriver.Firefox() self.browser = webdriver.Firefox()
def tearDown(self): def tearDown(self):
self.browser.quit() self.browser.quit()
def test_can_summon_janet_with_all_froyo_info(self): def test_can_summon_janet_with_all_froyo_info(self):
# Eleanor wants to find out more about the Froyo Shop # Eleanor wants to find out more about the Froyo Shop
# She calls on The Good Place's omniscient database Janet to find out more. # She calls on The Good Place's omniscient database Janet to find out more.
...@@ -19,7 +21,6 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -19,7 +21,6 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
# 'Hi. My name is Janet.' # 'Hi. My name is Janet.'
self.assertIn('Hi. My name is Janet.', self.browser.title) self.assertIn('Hi. My name is Janet.', self.browser.title)
#Janet gives Eleanor all the information she has on the Froyo shop which includes: #Janet gives Eleanor all the information she has on the Froyo shop which includes:
#Ingredients, Recipes and Orders #Ingredients, Recipes and Orders
froyo = self.browser.find_element_by_id('janet') froyo = self.browser.find_element_by_id('janet')
...@@ -40,7 +41,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -40,7 +41,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
self.browser.getCurrentUrl() self.browser.getCurrentUrl()
) )
# It is called the 'Ingredients - List' Janet tells her. # "It is called the 'Ingredients - List'" Janet tells her.
self.assertIn('Ingredients - List', self.browser.title) self.assertIn('Ingredients - List', self.browser.title)
...@@ -55,11 +56,11 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -55,11 +56,11 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
self.browser.getCurrentUrl() self.browser.getCurrentUrl()
) )
# It is called the 'Ingredients - Detail' Janet tells her. # "It is called the 'Ingredients - Detail'" Janet tells her.
self.assertIn('Ingredients - Detail', self.browser.title) self.assertIn('Ingredients - Detail', self.browser.title)
# Eleanor wants to update the ingredient information because she can. So she asks Janet # Eleanor wants to update the ingredient details because she can. So she asks Janet
# to give her an ingredients update form. # to give her an ingredients update form.
ingredients_update_form = self.browser.find_element_by_id('ingredients_update') ingredients_update_form = self.browser.find_element_by_id('ingredients_update')
ingredients_update_form.click() ingredients_update_form.click()
...@@ -70,7 +71,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -70,7 +71,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
self.browser.getCurrentUrl() self.browser.getCurrentUrl()
) )
# It is called the 'Ingredients - Update' Janet tells her. # "It is called the 'Ingredients - Update'" Janet tells her.
self.assertIn('Ingredients - Update', self.browser.title) self.assertIn('Ingredients - Update', self.browser.title)
...@@ -85,12 +86,12 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -85,12 +86,12 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
self.browser.getCurrentUrl() self.browser.getCurrentUrl()
) )
# It is called the 'Ingredients - Create' Janet tells her. # "It is called the 'Ingredients - Create'" Janet tells her.
self.assertIn('Ingredients - Create', self.browser.title) self.assertIn('Ingredients - Create', self.browser.title)
#Eleanor decides that she now wants to look at the recipes # Eleanor decides that she now wants to look at the recipes
#Janet shows her the list of recipes. # Janet shows her the list of recipes.
recipes_list = self.browser.find_element_by_id('recipes_list') recipes_list = self.browser.find_element_by_id('recipes_list')
recipes_list.click() recipes_list.click()
time.sleep(1) time.sleep(1)
...@@ -100,7 +101,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -100,7 +101,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
self.browser.getCurrentUrl() self.browser.getCurrentUrl()
) )
# It is called the 'Recipes - List' Janet tells her. # "It is called the 'Recipes - List'" Janet tells her.
self.assertIn('Recipes - List', self.browser.title) self.assertIn('Recipes - List', self.browser.title)
...@@ -114,7 +115,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -114,7 +115,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
self.browser.getCurrentUrl() self.browser.getCurrentUrl()
) )
# It is called the 'Recipes - Detail' Janet tells her. # "It is called the 'Recipes - Detail'" Janet tells her.
self.assertIn('Recipes - Detail', self.browser.title) self.assertIn('Recipes - Detail', self.browser.title)
...@@ -129,7 +130,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -129,7 +130,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
self.browser.getCurrentUrl() self.browser.getCurrentUrl()
) )
# It is called the 'Recipes - Update' Janet tells her. # "It is called the 'Recipes - Update'" Janet tells her.
self.assertIn('Recipes - Update', self.browser.title) self.assertIn('Recipes - Update', self.browser.title)
...@@ -144,7 +145,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -144,7 +145,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
self.browser.getCurrentUrl() self.browser.getCurrentUrl()
) )
# It is called the 'Recipes - Create' Janet tells her. # "It is called the 'Recipes - Create'" Janet tells her.
self.assertIn('Recipes - Create', self.browser.title) self.assertIn('Recipes - Create', self.browser.title)
...@@ -159,7 +160,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -159,7 +160,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
self.browser.getCurrentUrl() self.browser.getCurrentUrl()
) )
# It is called the 'Orders - List' Janet tells her. # "It is called the 'Orders - List'" Janet tells her.
self.assertIn('Orders - List', self.browser.title) self.assertIn('Orders - List', self.browser.title)
...@@ -174,7 +175,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -174,7 +175,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
self.browser.getCurrentUrl() self.browser.getCurrentUrl()
) )
# It is called the 'Orders - Detail' Janet tells her. # "It is called the 'Orders - Detail'" Janet tells her.
self.assertIn('Orders - Detail', self.browser.title) self.assertIn('Orders - Detail', self.browser.title)
...@@ -220,7 +221,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -220,7 +221,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
time.sleep(1) time.sleep(1)
self.assertEqual( self.assertEqual(
'http://localhost:8000/froyo/ingredients', 'http://localhost:8000/froyo',
self.browser.getCurrentUrl() self.browser.getCurrentUrl()
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment