Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lopez-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
Jay Lopez
lopez-django-lab-1
Commits
b517844a
Commit
b517844a
authored
Mar 07, 2020
by
Jay Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
functional test completed
parent
bae3e4c9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
fxntest.py
fxntest.py
+13
-1
No files found.
fxntest.py
View file @
b517844a
from
random
import
randint
from
selenium
import
webdriver
from
selenium
import
webdriver
import
unittest
import
unittest
class
NewVisitorTest
(
unittest
.
TestCase
):
class
NewVisitorTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
browser
=
webdriver
.
Chrome
()
self
.
browser
=
webdriver
.
Chrome
()
...
@@ -11,7 +13,7 @@ class NewVisitorTest(unittest.TestCase):
...
@@ -11,7 +13,7 @@ class NewVisitorTest(unittest.TestCase):
def
test_can_display_a_heroes_list_and_more_information_per_hero
(
self
):
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.
# Widget has heard about a new wiki app for the game called The Will of the Wisps.
# She goes to check out its homepage
# She goes to check out its homepage
self
.
browser
.
get
(
'http
://localhost:8000
'
)
self
.
browser
.
get
(
'http
s://localhost:8000/heroes
'
)
# She notices the page title and header mention
# She notices the page title and header mention
# 'The Will of the Wisps Wiki'
# 'The Will of the Wisps Wiki'
...
@@ -19,14 +21,24 @@ class NewVisitorTest(unittest.TestCase):
...
@@ -19,14 +21,24 @@ class NewVisitorTest(unittest.TestCase):
# She sees a list containing three heroes with their corresponding
# She sees a list containing three heroes with their corresponding
# names, health points, and damage
# names, health points, and damage
hero_list
=
self
.
browser
.
find_element_by_tag_name
(
'ul'
)
# When she selects one of the heroes, she is sent to another page
# When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image).
# containing more information about the hero (additional stats, lore, image).
links
=
hero_list
.
find_elements_by_tag_name
(
'li'
)
selected_hero_link
=
links
[
randint
(
0
,
2
)]
hero_name
=
selected_hero_link
.
text
.
split
()[
0
]
selected_hero_link
.
click
()
# She spots the page title and header mentions the name of the hero she selected.
# She spots the page title and header mentions the name of the hero she selected.
self
.
assertIn
(
hero_name
,
self
.
browser
.
title
)
# While she is in a specific hero's page, she sees a button labeled "Back to Heroes List".
# 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.
# She clicks this and she is redirected back to the wiki's homepage.
home_button
=
self
.
browser
.
find_element_by_tag_name
(
'button'
)
self
.
assertIn
(
'Back to Heroes List'
,
home_button
.
text
)
home_button
.
click
()
self
.
assertIn
(
'/heroes'
,
self
.
browser
.
current_url
)
self
.
fail
(
'Finish the test!'
)
self
.
fail
(
'Finish the test!'
)
...
...
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