Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CSCI40-Midterm-Project
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
Andrea Tsai
CSCI40-Midterm-Project
Commits
24d49e81
Commit
24d49e81
authored
Mar 21, 2020
by
littleredpanda14
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated functional_test
parent
5b76a145
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
137 additions
and
4 deletions
+137
-4
functional_test.py
functional_test.py
+137
-4
No files found.
functional_test.py
View file @
24d49e81
...
@@ -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 see
s a button labeled "Back to Janet".
#
She always comes acros
s 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
(
...
...
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