Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
thegoodplace
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patrick James Ong
thegoodplace
Commits
6f8b76b3
Commit
6f8b76b3
authored
Mar 18, 2020
by
Patrick James Ong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed orders and added assertions for header content
parent
0613b097
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
functional_tests.py
thegoodplace/functional_tests.py
+27
-15
No files found.
thegoodplace/functional_tests.py
View file @
6f8b76b3
...
@@ -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'
))
ingredient
s_list
=
self
.
browser
.
find_element_by_ID
(
'orders-list'
)
order
s_list
=
self
.
browser
.
find_element_by_ID
(
'orders-list'
)
self
.
assertEqual
(
'ul'
,
ingredient
s_list
.
tag_name
)
self
.
assertEqual
(
'ul'
,
order
s_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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment