Commit 24d49e81 authored by littleredpanda14's avatar littleredpanda14

Updated functional_test

parent 5b76a145
...@@ -28,6 +28,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -28,6 +28,7 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
froyo.tag_name froyo.tag_name
) )
# When she asks for information about the Ingredients, Janet sends her to another page # When she asks for information about the Ingredients, Janet sends her to another page
# which has the list of ingredients. # which has the list of ingredients.
ingredients = self.browser.find_element_by_id('ingredients_list') ingredients = self.browser.find_element_by_id('ingredients_list')
...@@ -38,20 +39,26 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -38,20 +39,26 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
'http://localhost:8000/froyo/ingredients', 'http://localhost:8000/froyo/ingredients',
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)
# Eleanor asks Janet to give more specific details on each item on the list # Eleanor asks Janet to give more specific details on each item on the list
# so Janet sends her to a different page depending on the ingredient Eleanor has selected # so Janet sends her to a different page depending on the ingredient Eleanor has selected
ingredients_detail = self.browser.find_element_by_id('almonds') ingredients_detail = self.browser.find_element_by_id('ingredient_name')
ingredients_detail.click() ingredients_detail.click()
time.sleep(1) time.sleep(1)
self.assertEqual( self.assertEqual(
'http://localhost:8000/froyo/ingredients/almonds', 'http://localhost:8000/froyo/ingredients/ingredient_name',
self.browser.getCurrentUrl() self.browser.getCurrentUrl()
) )
# It is called the 'Ingredients - Detail' Janet tells her.
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 information 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')
...@@ -63,6 +70,10 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -63,6 +70,10 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
self.browser.getCurrentUrl() self.browser.getCurrentUrl()
) )
# It is called the 'Ingredients - Update' Janet tells her.
self.assertIn('Ingredients - Update', self.browser.title)
# Eleanor then decides that she wants to create new ingredients for the inventory. # Eleanor then decides that she wants to create new ingredients for the inventory.
# She asks Janet to provide an ingredients create form for her to use. # She asks Janet to provide an ingredients create form for her to use.
ingredients_create_form = self.browser.find_element_by_id('ingredients_create') ingredients_create_form = self.browser.find_element_by_id('ingredients_create')
...@@ -74,9 +85,131 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase): ...@@ -74,9 +85,131 @@ class WelcomeToTheGoodPlaceTest(unittest.TestCase):
self.browser.getCurrentUrl() self.browser.getCurrentUrl()
) )
# It is called the 'Ingredients - Create' Janet tells her.
self.assertIn('Ingredients - Create', self.browser.title)
#Eleanor decides that she now wants to look at the recipes
#Janet shows her the list of recipes.
recipes_list = self.browser.find_element_by_id('recipes_list')
recipes_list.click()
time.sleep(1)
self.assertEqual(
'http://localhost:8000/froyo/recipes',
self.browser.getCurrentUrl()
)
# It is called the 'Recipes - List' Janet tells her.
self.assertIn('Recipes - List', self.browser.title)
#Eleanor tells Janet to show her the details of the Coffee Crumble recipe
recipes_detail = self.browser.find_element_by_id('recipe_name')
recipes_detail.click()
time.sleep(1)
self.assertEqual(
'http://localhost:8000/froyo/recipes/recipe_name',
self.browser.getCurrentUrl()
)
# It is called the 'Recipes - Detail' Janet tells her.
self.assertIn('Recipes - Detail', self.browser.title)
# Afterwards, Eleanor asks Janet if she can update that recipe.
# Janet leads her to a page with a recipe udpate form.
recipes_update_form = self.browser.find_element_by_id('recipes_update')
recipes_update_form.click()
time.sleep(1)
self.assertEqual(
'http://localhost:8000/froyo/recipes/update',
self.browser.getCurrentUrl()
)
# It is called the 'Recipes - Update' Janet tells her.
self.assertIn('Recipes - Update', self.browser.title)
# Eleanor decides to create her own Froyo recipe.
# Janet gives her a recipe create form.
recipes_create_form = self.browser.find_element_by_id('recipes_create')
recipe_create_form.click()
time.sleep(1)
self.assertEqual(
'http://localhost:8000/froyo/recipes/create',
self.browser.getCurrentUrl()
)
# It is called the 'Recipes - Create' Janet tells her.
self.assertIn('Recipes - Create', self.browser.title)
# Eleanor decides that she now wants to see the orders being made in the Froyo shop
# Janet shows her the list of orders.
orders_list = self.browser.find_element_by_id('orders_list')
orders_list.click()
time.sleep(1)
self.assertEqual(
'http://localhost:8000/froyo/orders',
self.browser.getCurrentUrl()
)
# It is called the 'Orders - List' Janet tells her.
self.assertIn('Orders - List', self.browser.title)
# Now Eleanor wants to see the details of her neighbor, Crystal's order.
# Janet shows her the details of Crystal's order
orders_detail = self.browser.find_element_by_id('order_name')
orders_list.click()
time.sleep(1)
self.assertEqual(
'http://localhost:8000/froyo/orders/order_name',
self.browser.getCurrentUrl()
)
# It is called the 'Orders - Detail' Janet tells her.
self.assertIn('Orders - Detail', self.browser.title)
#Eleanor says she wants to update Crystal's order to get back at her parrot for pooping on her the other day.
#Janet is hesitant but eventually complies and gives her an order update form.
orders_update_form = self.browser.find_element_by_id('orders_update')
order_update_form.click()
time.sleep(1)
self.assertEqual(
'http://localhost:8000/froyo/orders/update',
self.browser.getCurrentUrl()
)
# It is called the 'Orders - Update' Janet tells her.
self.assertIn('Orders - Update', self.browser.title)
# After all this talk of Froyo, Eleanor realizes she's really hungry. She actually starts craving Froyo.
# So she asks Janet to create an order form for her. Janet happily agrees.
order_create_form = self.browser.find_element_by_id('order_create')
order_create_form.click()
time.sleep(1)
self.assertEqual(
'http://localhost:8000/froyo/orders/create',
self.browser.getCurrentUrl()
)
# It is called the 'Orders - Create' Janet tells her.
self.assertIn('Orders - Create', self.browser.title)
# While she browsing through any specific janet page (either ingredients, recipes or orders), # While browsing through any specific janet page (either ingredients, recipes or orders),
# she sees a button labeled "Back to Janet". # She always comes across a button labeled "Back to Janet".
# She clicks this and is sent back to Janet. # She clicks this and is sent back to Janet.
back_button = self.browser.find_element_by_id('back_button') back_button = self.browser.find_element_by_id('back_button')
self.assertEqual( self.assertEqual(
......
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