Commit 6f8b76b3 authored by Patrick James Ong's avatar Patrick James Ong

Fixed orders and added assertions for header content

parent 0613b097
...@@ -15,6 +15,7 @@ class NewVisitorTest(unittest.TestCase): ...@@ -15,6 +15,7 @@ class NewVisitorTest(unittest.TestCase):
def test_can_start_and_display_ingredients_list(self): def test_can_start_and_display_ingredients_list(self):
self.browser.get('http://localhost:8000/ingredients/list') self.browser.get('http://localhost:8000/ingredients/list')
self.assertIn('Ingredients - List', self.browser.title) self.assertIn('Ingredients - List', self.browser.title)
self.assertIn('Ingredients - List', self.browser.find_element_by_tag_name('h1'))
ingredients_list = self.browser.find_element_by_ID('ingredients-list') ingredients_list = self.browser.find_element_by_ID('ingredients-list')
self.assertEqual('ul', ingredients_list.tag_name) self.assertEqual('ul', ingredients_list.tag_name)
...@@ -22,22 +23,26 @@ class NewVisitorTest(unittest.TestCase): ...@@ -22,22 +23,26 @@ class NewVisitorTest(unittest.TestCase):
def test_can_display_ingredients_detail(self): def test_can_display_ingredients_detail(self):
self.browser.get('http://localhost:8000/ingredients/detail') self.browser.get('http://localhost:8000/ingredients/detail')
self.assertIn('Ingredients - Detail', self.browser.title) self.assertIn('Ingredients - Detail', self.browser.title)
self.assertIn('Ingredients - Detail', self.browser.find_element_by_tag_name('h1'))
def test_can_update_ingredient(self): def test_can_update_ingredient(self):
self.browser.get('http://localhost:8000/ingredients/update') self.browser.get('http://localhost:8000/ingredients/update')
self.assertIn('Ingredients - Update', self.browser.title) self.assertIn('Ingredients - Update', self.browser.title)
self.assertIn('Ingredients - Update', self.browser.find_element_by_tag_name('h1'))
def test_can_create_new_ingredient(self): def test_can_create_new_ingredient(self):
self.browser.get('http://localhost:8000/ingredients/new') self.browser.get('http://localhost:8000/ingredients/new')
self.assertIn('Ingredients - Create', self.browser.title) self.assertIn('Ingredients - Create', self.browser.title)
self.assertIn('Ingredients - Create', self.browser.find_element_by_tag_name('h1'))
self.assertIn('', self.browser.find_element_by_ID('new_ingredient_name').text) # self.assertIn('', self.browser.find_element_by_ID('new_ingredient_name').text)
self.assertIn('', self.browser.find_element_by_ID('new_ingredient_quantity').text) # self.assertIn('', self.browser.find_element_by_ID('new_ingredient_quantity').text)
# RECIPES # RECIPES
def test_can_display_recipes_list(self): def test_can_display_recipes_list(self):
self.browser.get('http://localhost:8000/recipes/list') self.browser.get('http://localhost:8000/recipes/list')
self.assertIn('Recipes - List', self.browser.title) self.assertIn('Recipes - List', self.browser.title)
self.assertIn('Recipes - List', self.browser.find_element_by_tag_name('h1'))
recipes_list = self.browser.find_element_by_ID('recipes-list') recipes_list = self.browser.find_element_by_ID('recipes-list')
self.assertEqual('ul', recipes_list.tag_name) self.assertEqual('ul', recipes_list.tag_name)
...@@ -45,44 +50,51 @@ class NewVisitorTest(unittest.TestCase): ...@@ -45,44 +50,51 @@ class NewVisitorTest(unittest.TestCase):
def test_can_display_recipes_detail(self): def test_can_display_recipes_detail(self):
self.browser.get('http://localhost:8000/recipes/detail') self.browser.get('http://localhost:8000/recipes/detail')
self.assertIn('Recipes - Detail', self.browser.title) self.assertIn('Recipes - Detail', self.browser.title)
self.assertIn('Recipes - Detail', self.browser.find_element_by_tag_name('h1'))
def test_can_update_recipe(self): def test_can_update_recipe(self):
self.browser.get('http://localhost:8000/recipes/update') self.browser.get('http://localhost:8000/recipes/update')
self.assertIn('Recipes - Update', self.browser.title) self.assertIn('Recipes - Update', self.browser.title)
self.assertIn('Recipes - Update', self.browser.find_element_by_tag_name('h1'))
def test_can_create_new_recipe(self): def test_can_create_new_recipe(self):
self.browser.get('http://localhost:8000/recipes/new') self.browser.get('http://localhost:8000/recipes/new')
self.assertIn('Recipes - Create', self.browser.title) self.assertIn('Recipes - Create', self.browser.title)
self.assertIn('Recipes - Create', self.browser.find_element_by_tag_name('h1'))
self.assertIn('', self.browser.find_element_by_ID('new_recipe_name').text) # self.assertIn('', self.browser.find_element_by_ID('new_recipe_name').text)
self.assertIn('', self.browser.find_element_by_ID('new_recipe_ingredient').text) # self.assertIn('', self.browser.find_element_by_ID('new_recipe_ingredient').text)
self.assertIn('', self.browser.find_element_by_ID('new_recipe_quantity').text) # self.assertIn('', self.browser.find_element_by_ID('new_recipe_quantity').text)
# ORDERS # ORDERS
def test_can_display_orders_list(self): def test_can_display_orders_list(self):
self.browser.get('http://localhost:8000/orders/list') self.browser.get('http://localhost:8000/orders/list')
self.assertIn('Orders - List', self.browser.title) self.assertIn('Orders - List', self.browser.title)
self.assertIn('Orders - List', self.browser.find_element_by_tag_name('h1'))
ingredients_list = self.browser.find_element_by_ID('orders-list') orders_list = self.browser.find_element_by_ID('orders-list')
self.assertEqual('ul', ingredients_list.tag_name) self.assertEqual('ul', orders_list.tag_name)
def test_can_display_orders_detail(self): def test_can_display_orders_detail(self):
self.browser.get('http://localhost:8000/orders/detail') self.browser.get('http://localhost:8000/orders/detail')
self.assertIn('Ingredients - Detail', self.browser.title) self.assertIn('Orders - Detail', self.browser.title)
self.assertIn('Orders - Detail', self.browser.find_element_by_tag_name('h1'))
def test_can_update_order(self): def test_can_update_order(self):
self.browser.get('http://localhost:8000/orders/update') self.browser.get('http://localhost:8000/orders/update')
self.assertIn('Ingredients - Update', self.browser.title) self.assertIn('Orders - Update', self.browser.title)
self.assertIn('Orders - Update', self.browser.find_element_by_tag_name('h1'))
def test_can_create_new_order(self): def test_can_create_new_order(self):
self.browser.get('http://localhost:8000/orders/new') self.browser.get('http://localhost:8000/orders/new')
self.assertIn('Ingredients - Create', self.browser.title) self.assertIn('Orders - Create', self.browser.title)
self.assertIn('Orders - Create', self.browser.find_element_by_tag_name('h1'))
self.assertIn('', self.browser.find_element_by_ID('new_customer_name').text) # self.assertIn('', self.browser.find_element_by_ID('new_customer_name').text)
self.assertIn('', self.browser.find_element_by_ID('new_size').text) # self.assertIn('', self.browser.find_element_by_ID('new_size').text)
self.assertIn('', self.browser.find_element_by_ID('new_base').text) # self.assertIn('', self.browser.find_element_by_ID('new_base').text)
self.assertIn('', self.browser.find_element_by_ID('new_customization').text) # self.assertIn('', self.browser.find_element_by_ID('new_customization').text)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main(warnings='ignore') unittest.main(warnings='ignore')
\ No newline at end of file
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