Commit 67704e4d authored by cianlaguesma's avatar cianlaguesma

Added more tests

parent 8c6cbda8
......@@ -3,4 +3,21 @@
<title>The Good Place FroYo Shop</title>
<h1 id="header_home">The Good Place Froyo Shop</h1>
</head>
<body>
<ul>
<li><a href="http://localhost:8000/ingredients/create_form" id="ingredients_create_form">Create form for Ingredients</a></li>
<li><a href="http://localhost:8000/ingredients/update_form" id="ingredients_update_form">Update form for Ingredients</a></li>
<li><a href="http://localhost:8000/ingredients/list" id="ingredients_list">See List for all Ingredients</a></li>
<li><a href="http://localhost:8000/ingredients/detail" id="ingredients_detail">See Details for an Ingredient</a></li>
<li><a href="http://localhost:8000/recipes/create_form" id="recipe_create_form">Create form for Recipe</a></li>
<li><a href="http://localhost:8000/recipes/update_form" id="recipe_update_form">Update form for Recipe</a></li>
<li><a href="http://localhost:8000/recipes/list" id="recipe_list">See List for all Recipes</a></li>
<li><a href="http://localhost:8000/recipes/detail" id="recipe_detail">See Details for a Recipe</a></li>
<li><a href="http://localhost:8000/orders/create_form" id="orders_create_form">Create form for Orders</a></li>
<li><a href="http://localhost:8000/orders/update_form" id="orders_update_form">Update form for Orders</a></li>
<li><a href="http://localhost:8000/orders/list" id="orders_list">See List for all Orders</a></li>
<li><a href="http://localhost:8000/orders/detail" id="orders_detail">See Details for an Order</a></li>
</ul>
</body>
</html>
......@@ -2,4 +2,5 @@
<head>
<h1 id="ingredients_create_form_header">Ingredients - Create Form</h1>
</head>
<body><a href="http://localhost:8000/index" id="home">Return to Home Page</a></body>
</html>
......@@ -2,4 +2,5 @@
<head>
<h1 id="ingredients_detail_header">Ingredients - Detail</h1>
</head>
<body><a href="http://localhost:8000/index" id="home">Return to Home Page</a></body>
</html>
......@@ -2,4 +2,5 @@
<head>
<h1 id="ingredients_list_header">Ingredients - List</h1>
</head>
<body><a href="http://localhost:8000/index" id="home">Return to Home Page</a></body>
</html>
......@@ -2,4 +2,5 @@
<head>
<h1 id="ingredients_update_form_header">Ingredients - Update Form</h1>
</head>
<body><a href="http://localhost:8000/index" id="home">Return to Home Page</a></body>
</html>
......@@ -2,4 +2,5 @@
<head>
<h1 id="orders_create_form_header">Orders - Create Form</h1>
</head>
<body><a href="http://localhost:8000/index" id="home">Return to Home Page</a></body>
</html>
......@@ -3,4 +3,5 @@
<h1 id="orders_detail_header">Orders - Detail</h1>
</head>
<body><a href="http://localhost:8000/index" id="home">Return to Home Page</a></body>
</html>
......@@ -3,4 +3,5 @@
<h1 id="orders_list_header">Orders - List</h1>
</head>
<body><a href="http://localhost:8000/index" id="home">Return to Home Page</a></body>
</html>
......@@ -3,4 +3,5 @@
<h1 id="orders_update_form_header">Orders - Update Form</h1>
</head>
<body><a href="http://localhost:8000/index" id="home">Return to Home Page</a></body>
</html>
......@@ -3,4 +3,5 @@
<h1 id="recipes_create_form_header">Recipes - Create Form</h1>
</head>
<body><a href="http://localhost:8000/index" id="home">Return to Home Page</a></body>
</html>
......@@ -3,4 +3,5 @@
<h1 id="recipes_detail_header">Recipes - Detail</h1>
</head>
<body><a href="http://localhost:8000/index" id="home">Return to Home Page</a></body>
</html>
......@@ -3,4 +3,5 @@
<h1 id="recipes_list_header">Recipes - List</h1>
</head>
<body><a href="http://localhost:8000/index" id="home">Return to Home Page</a></body>
</html>
......@@ -3,4 +3,5 @@
<h1 id="recipes_update_form_header">Recipes - Update Form</h1>
</head>
<body><a href="http://localhost:8000/index" id="home">Return to Home Page</a></body>
</html>
from selenium import webdriver
import unittest
import unittest, time
class NewVisitorTest(unittest.TestCase):
......@@ -9,43 +9,227 @@ class NewVisitorTest(unittest.TestCase):
def tearDown(self):
self.browser.quit()
def test_froyo_shop(self):
def test_froyo_shop_home(self):
# Cian has heard about the Good Place FroYo Shop so, he goes to check out its homepage
self.browser.get('http://localhost:8000/index')
# He notices the page title and header mention
# The Good Place Froyo Shopz
self.assertIn('The Good Place FroYo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
# She notices the page title and header mention
# 'The Will of the Wisps Wiki'
def test_froyo_create_form_ingredients(self):
# He noticed that he can create a form for the ingredients so he went there and he noticed the header Ingredients - Create Form so he clicked it
self.browser.get('http://localhost:8000/index')
create_ingredient = self.browser.find_element_by_id('ingredients_create_form')
create_ingredient.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/ingredients/create_form',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("ingredients_create_form_header"))
# After creating the ingredient, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/index',self.browser.current_url)
self.assertIn('The Good Place FroYo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_update_form_ingredients(self):
# He noticed that he can also update the forms so he went there and he noticed the header Ingredients - Update Form so he clicked it and updated his form
self.browser.get('http://localhost:8000/index')
update_ingredient = self.browser.find_element_by_id('ingredients_update_form')
update_ingredient.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/ingredients/update_form',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("ingredients_update_form_header"))
# After Updating the ingredient, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/index',self.browser.current_url)
self.assertIn('The Good Place FroYo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
#
self.browser.get('http://localhost:8000/ingredients/detail')
def test_froyo_display_detail_ingredients(self):
# He noticed that there are details for the ingredients so he went there and he noticed the header Ingredients - Detail
self.browser.get('http://localhost:8000/index')
detail_ingredient = self.browser.find_element_by_id('ingredients_detail')
detail_ingredient.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/ingredients/detail',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("ingredients_detail_header"))
self.browser.get('http://localhost:8000/ingredients/list')
# After Updating the ingredient, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/index',self.browser.current_url)
self.assertIn('The Good Place FroYo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_list_ingredients(self):
# He noticed that there are also lists for the ingredients so he went there and he noticed the header Ingredients - List
self.browser.get('http://localhost:8000/index')
list_ingredient = self.browser.find_element_by_id('ingredients_list')
list_ingredient.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/ingredients/list',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("ingredients_list_header"))
self.browser.get('http://localhost:8000/ingredients/create_form')
self.assertTrue(self.browser.find_element_by_id("ingredients_create_form_header"))
self.browser.get('http://localhost:8000/ingredients/update_form')
self.assertTrue(self.browser.find_element_by_id("ingredients_update_form_header"))
#
self.browser.get('http://localhost:8000/orders/detail')
# After Updating the ingredient, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/index',self.browser.current_url)
self.assertIn('The Good Place FroYo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_create_form_orders(self):
#He noticed that he can create a form to create an order so he went there and he noticed the header Orders - Create Form
self.browser.get('http://localhost:8000/index')
create_order = self.browser.find_element_by_id('orders_create_form')
create_order.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/orders/create_form',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("orders_create_form_header"))
# After Updating the ingredient, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/index',self.browser.current_url)
self.assertIn('The Good Place FroYo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_update_form_orders(self):
#He noticed that he can update a form to update an order so he went there and he noticed the header Orders - Update Form
self.browser.get('http://localhost:8000/index')
update_order = self.browser.find_element_by_id('orders_update_form')
update_order.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/orders/update_form',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("orders_create_form_header"))
# After Updating the ingredient, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/index',self.browser.current_url)
self.assertIn('The Good Place FroYo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_detail_orders(self):
#He also wanted to look at the detail of a record for an orderso he went and looked at one and he noticed the header Orders - Detail
self.browser.get('http://localhost:8000/index')
detail_order = self.browser.find_element_by_id('orders_detail')
detail_order.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/orders/detail',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("orders_detail_header"))
self.browser.get('http://localhost:8000/orders/list')
# After Updating the ingredient, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/index',self.browser.current_url)
self.assertIn('The Good Place FroYo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_list_orders(self):
#He also wanted to look at the list records for orders so he went and he noticed the header Orders - List
self.browser.get('http://localhost:8000/index')
list_order = self.browser.find_element_by_id('orders_list')
list_order.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/orders/list',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("orders_list_header"))
self.browser.get('http://localhost:8000/orders/create_form')
self.assertTrue(self.browser.find_element_by_id("orders_create_form_header"))
self.browser.get('http://localhost:8000/orders/update_form')
self.assertTrue(self.browser.find_element_by_id("orders_update_form_header"))
#
self.browser.get('http://localhost:8000/recipes/detail')
# After Updating the ingredient, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/index',self.browser.current_url)
self.assertIn('The Good Place FroYo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_create_form_recipes(self):
#He noticed that he can create a form for a recipe so he went there and he noticed the header Recipes - Create Form
self.assertTrue(self.browser.find_element_by_id("recipes_detail_header"))
self.browser.get('http://localhost:8000/recipes/list')
self.assertTrue(self.browser.find_element_by_id("recipes_list_header"))
self.browser.get('http://localhost:8000/recipes/create_form')
self.browser.get('http://localhost:8000/index')
create_recipe = self.browser.find_element_by_id('recipe_create_form')
create_recipe.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/recipes/create_form',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("recipes_create_form_header"))
self.browser.get('http://localhost:8000/recipes/update_form')
# After Updating the ingredient, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/index',self.browser.current_url)
self.assertIn('The Good Place FroYo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_update_form_recipes(self):
#He noticed that he can update a form for a recipe so he went there and he noticed the header Recipes - Update Form
self.browser.get('http://localhost:8000/index')
update_recipe = self.browser.find_element_by_id('recipe_update_form')
update_recipe.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/recipes/update_form',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("recipes_update_form_header"))
# After Updating the ingredient, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/index',self.browser.current_url)
self.assertIn('The Good Place FroYo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_detail_recipes(self):
#He also wanted to look at the detail of a record for a recipe so he went and looked at one and he noticed the header Recipes - Detail
self.browser.get('http://localhost:8000/index')
detail_recipe = self.browser.find_element_by_id('recipe_detail')
detail_recipe.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/recipes/detail',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("recipes_detail_header"))
# After Updating the ingredient, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/index',self.browser.current_url)
self.assertIn('The Good Place FroYo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_list_recipes(self):
#He also wanted to look at the list records for recipes so he went and he noticed the header Recipes - List
self.browser.get('http://localhost:8000/index')
list_recipe = self.browser.find_element_by_id('recipe_list')
list_recipe.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/recipes/list',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("recipes_list_header"))
# After Updating the ingredient, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/index',self.browser.current_url)
self.assertIn('The Good Place FroYo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
self.fail('Finish the test!')
if __name__ == '__main__':
......
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