Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
Django Lab 1
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
Keith Adrian Santos
Django Lab 1
Commits
2fbe0e7f
Commit
2fbe0e7f
authored
Mar 06, 2020
by
Keith Adrian Santos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finished the functional tests hardcoded everything
parent
493b8d98
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
6 deletions
+35
-6
lab1_functional_test.py
lab1_functional_test.py
+35
-6
No files found.
lab1_functional_test.py
View file @
2fbe0e7f
...
...
@@ -11,20 +11,31 @@ class NewVisitorTest(unittest.TestCase):
def
test_can_display_a_heroes_list_and_more_information_per_hero
(
self
):
# Widget has heard about a new wiki app for the game called The Will of the Wisps.
# She goes to check out its homepage
self
.
browser
.
get
(
'http://localhost:8000'
)
self
.
browser
.
get
(
'http://localhost:8000
/heroes
'
)
# She notices the page title and header mention
# 'The Will of the Wisps Wiki'
#self.assertIn('The Will of the Wisps Wiki', self.browser.title)
self
.
assertIn
(
'The Will of the Wisps Wiki'
,
self
.
browser
.
title
)
# She sees a list containing three heroes with their corresponding
# names, health points, and damage
heroNames
=
self
.
browser
.
find_element_by_tag_id
(
'names'
)
self
.
assertIn
(
'Cloud'
,
' '
.
join
(
heroNames
))
self
.
assertIn
(
'Jester'
,
' '
.
join
(
heroNames
))
self
.
assertIn
(
'Sunflowey'
,
' '
.
join
(
heroNames
))
textholder
=
self
.
browser
.
find_element_by_tag_name
(
'li'
)
.
text
self
.
assert
True
(
'Cloud'
,
'600'
,
'57'
in
textholder
)
self
.
assert
True
(
'Jester'
,
'660'
,
'64'
in
textholder
)
self
.
assert
True
(
'Sunflowey'
,
'650'
,
'43'
in
textholder
)
heroHP
=
self
.
browser
.
find_element_by_tag_id
(
'hp'
)
self
.
assert
In
(
'600'
,
' '
.
join
(
heroHP
)
)
self
.
assert
In
(
'660'
,
' '
.
join
(
heroHP
)
)
self
.
assert
In
(
'650'
,
' '
.
join
(
heroHP
)
)
heroDamage
=
self
.
browser
.
find_element_by_tag_id
(
'dmg'
)
self
.
assertIn
(
'57'
,
' '
.
join
(
heroDamage
))
self
.
assertIn
(
'64'
,
' '
.
join
(
heroDamage
))
self
.
assertIn
(
'43'
,
' '
.
join
(
heroDamage
))
# When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image).
...
...
@@ -33,6 +44,24 @@ class NewVisitorTest(unittest.TestCase):
# While she is in a specific hero's page, she sees a button labeled "Back to Heroes List".
# She clicks this and she is redirected back to the wiki's homepage.
self
.
browser
.
find_element_by_link_text
(
'cloud'
)
.
click
()
self
.
assertIn
(
'/hero/cloud'
,
self
.
browser
.
current_url
)
self
.
assertIn
(
'Cloud'
,
self
.
browser
.
title
)
self
.
browser
.
find_element_by_link_text
(
'Back to Heroes'
)
.
click
()
self
.
assertIn
(
'/heroes'
,
self
.
browser
.
current_url
)
self
.
browser
.
find_element_by_link_text
(
'jester'
)
.
click
()
self
.
assertIn
(
'/hero/jester'
,
self
.
browser
.
current_url
)
self
.
assertIn
(
'Jester'
,
self
.
browser
.
title
)
self
.
browser
.
find_element_by_link_text
(
'Back to Heroes'
)
.
click
()
self
.
assertIn
(
'/heroes'
,
self
.
browser
.
current_url
)
self
.
browser
.
find_element_by_link_text
(
'sunflowey'
)
.
click
()
self
.
assertIn
(
'/hero/sunflowey'
,
self
.
browser
.
current_url
)
self
.
assertIn
(
'Sunflowey'
,
self
.
browser
.
title
)
self
.
browser
.
find_element_by_link_text
(
'Back to Heroes'
)
.
click
()
self
.
assertIn
(
'/heroes'
,
self
.
browser
.
current_url
)
self
.
fail
(
'Finish the test!'
)
if
__name__
==
'__main__'
:
...
...
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