Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
Lab1
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
Kyla Nicole Villegas
Lab1
Commits
a8c5a288
Commit
a8c5a288
authored
Mar 07, 2020
by
Kyla Villegas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working lab1_functional_test.py
parent
55cd6b41
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1063 additions
and
38 deletions
+1063
-38
geckodriver.log
geckodriver.log
+1024
-0
detail_cloud.html
heroes/templates/detail_cloud.html
+1
-1
detail_jester.html
heroes/templates/detail_jester.html
+1
-1
detail_sunflowey.html
heroes/templates/detail_sunflowey.html
+1
-1
heroes.html
heroes/templates/heroes.html
+4
-3
lab1_functional_test.py
lab1_functional_test.py
+32
-32
No files found.
geckodriver.log
View file @
a8c5a288
This diff is collapsed.
Click to expand it.
heroes/templates/detail_cloud.html
View file @
a8c5a288
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<dt>
Skills
</dt><dd>
Nimbus, Rain Cloud, Thunderbolt
</dd>
<dt>
Skills
</dt><dd>
Nimbus, Rain Cloud, Thunderbolt
</dd>
<dt>
Lore
</dt><dd>
I am a cloud. When I pee you call it 'rain'.
</dd>
<dt>
Lore
</dt><dd>
I am a cloud. When I pee you call it 'rain'.
</dd>
</dl>
</dl>
<button
type=
"button"
><a
href =
http://127.0.0.1:8000/heroes
>
Back to Heroes List
</a>
</button>
<button
type=
"button"
onclick =
"location.href='http://localhost:8000/heroes'"
>
Back to Heroes List
</button>
</div>
</div>
</body>
</body>
</html>
</html>
heroes/templates/detail_jester.html
View file @
a8c5a288
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<dt>
Skills
</dt><dd>
Laugh, Dance, Smile
</dd>
<dt>
Skills
</dt><dd>
Laugh, Dance, Smile
</dd>
<dt>
Lore
</dt><dd>
I do it for the LOLs.
</dd>
<dt>
Lore
</dt><dd>
I do it for the LOLs.
</dd>
</dl>
</dl>
<button
type=
"button"
><a
href =
http://127.0.0.1:8000/heroes
>
Back to Heroes List
</a>
</button>
<button
type=
"button"
onclick =
"location.href='http://localhost:8000/heroes'"
>
Back to Heroes List
</button>
</div>
</div>
</body>
</body>
</html>
</html>
heroes/templates/detail_sunflowey.html
View file @
a8c5a288
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<dt>
Skills
</dt><dd>
Power Pellet, Sunshine, Pollen Punch
</dd>
<dt>
Skills
</dt><dd>
Power Pellet, Sunshine, Pollen Punch
</dd>
<dt>
Lore
</dt><dd>
I am Sunflowey. Sometimes a sun, sometimes a flower.
</dd>
<dt>
Lore
</dt><dd>
I am Sunflowey. Sometimes a sun, sometimes a flower.
</dd>
</dl>
</dl>
<button
type=
"button"
><a
href =
http://127.0.0.1:8000/heroes
>
Back to Heroes List
</a>
</button>
<button
type=
"button"
onclick =
"location.href='http://localhost:8000/heroes'"
>
Back to Heroes List
</button>
</div>
</div>
</body>
</body>
</html>
</html>
heroes/templates/heroes.html
View file @
a8c5a288
...
@@ -8,13 +8,14 @@
...
@@ -8,13 +8,14 @@
<div
id =
"sunflowey"
>
<div
id =
"sunflowey"
>
<div
id =
"jester"
>
<div
id =
"jester"
>
<h1>
The Will of the Wisps Wiki
</h1>
<h1>
The Will of the Wisps Wiki
</h1>
<a
href=
'/hero/cloud'
>
Cloud
</a>
<ul>
<li><a
href=
'http://localhost:8000/hero/cloud'
class=
"link"
>
Cloud
</a></li>
<p>
Health Points: 600
</p>
<p>
Health Points: 600
</p>
<p>
Damage: 57
</p>
<p>
Damage: 57
</p>
<
a
href=
'/hero/sunflowey'
>
Sunflowey
</a
>
<
li><a
href=
'http://localhost:8000/hero/sunflowey'
class=
"link"
>
Sunflowey
</a></li
>
<p>
Health Points: 650
</p>
<p>
Health Points: 650
</p>
<p>
Damage: 43
</p>
<p>
Damage: 43
</p>
<
a
href=
'/hero/jester'
>
Jester
</a
>
<
li><a
href=
'http://localhost:8000/hero/jester'
class=
"link"
>
Jester
</a></li
>
<p>
Health Points: 660
</p>
<p>
Health Points: 660
</p>
<p>
Damage: 64
</p>
<p>
Damage: 64
</p>
</ul>
</ul>
...
...
lab1_functional_test.py
View file @
a8c5a288
import
unittest
import
time
from
selenium
import
webdriver
from
selenium
import
webdriver
import
unittest
class
NewVisitorTest
(
unittest
.
TestCase
):
class
NewVisitorTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
browser
=
webdriver
.
Firefox
()
self
.
browser
=
webdriver
.
Firefox
()
...
@@ -40,43 +39,44 @@ class NewVisitorTest(unittest.TestCase):
...
@@ -40,43 +39,44 @@ class NewVisitorTest(unittest.TestCase):
# 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).
if
cloud_link
.
click
():
self
.
assertEquals
(
'http://localhost:8000/hero/cloud/'
,
self
.
browser
.
current_url
)
elif
sunflowey_link
.
click
():
self
.
assertEquals
(
'http://localhost:8000/hero/sunflowey/'
,
self
.
browser
.
current_url
)
elif
jester_link
.
click
():
self
.
assertEquals
(
'http://localhost:8000/hero/jester/'
,
self
.
browser
.
current_url
)
# 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.
if
cloud_link
.
click
():
self
.
assertIn
(
'Detail - Cloud'
,
self
.
browser
.
title
)
header_text
=
self
.
browser
.
find_element_by_tag_name
(
'head'
)
#kyla header
self
.
assertIn
(
'Detail - Cloud'
,
header_text
)
elif
sunflowey_link
.
click
():
self
.
assertIn
(
'Detail - Sunflowey'
,
self
.
browser
.
title
)
header_text
=
self
.
browser
.
find_element_by_tag_name
(
'head'
)
#kyla header
self
.
assertIn
(
'Detail - Sunflowey'
,
header_text
)
elif
jester_link
.
click
():
self
.
assertIn
(
'Detail - Jester'
,
self
.
browser
.
title
)
header_text
=
self
.
browser
.
find_element_by_tag_name
(
'head'
)
#kyla header
self
.
assertIn
(
'Detail - Jester'
,
header_text
)
# 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.
while
(
cloud_link
.
click
()
==
True
or
sunflowey_link
.
click
()
==
True
or
jester_link
.
click
()
==
True
):
button
=
driver
.
find_element_by_tag_name
(
'button'
)
self
.
assertIn
(
'Back to Heroes List'
,
button
)
button
.
click
()
time
.
sleep
(
1
)
self
.
assertIn
(
browser
.
getCurrentUrl
(),
'http://localhost:8000/heroes'
)
# input.send_keys('Back to Heroes List')
cloud
=
self
.
browser
.
find_element_by_link_text
(
'Cloud'
)
# input.send_keys(Keys.Enter)
cloud
.
click
()
# time.sleep(1)
self
.
assertEqual
(
'http://localhost:8000/hero/cloud/'
,
self
.
browser
.
current_url
)
# self.assertIn(browser.getCurrentUrl(), 'http://localhost:8000/heroes')
self
.
assertIn
(
'Detail - Cloud'
,
self
.
browser
.
title
)
cloud
=
self
.
browser
.
find_element_by_tag_name
(
'button'
)
self
.
assertIn
(
'Back to Heroes List'
,
cloud
.
text
)
cloud
.
click
()
self
.
assertEqual
(
'http://localhost:8000/heroes'
,
self
.
browser
.
current_url
)
self
.
assertIn
(
'The Will of the Wisps Wiki'
,
self
.
browser
.
title
)
sunflowey
=
self
.
browser
.
find_element_by_link_text
(
'Sunflowey'
)
sunflowey
.
click
()
self
.
assertEqual
(
'http://localhost:8000/hero/sunflowey/'
,
self
.
browser
.
current_url
)
self
.
assertIn
(
'Detail - Sunflowey'
,
self
.
browser
.
title
)
sunflowey
=
self
.
browser
.
find_element_by_tag_name
(
'button'
)
self
.
assertIn
(
'Back to Heroes List'
,
sunflowey
.
text
)
sunflowey
.
click
()
self
.
assertEqual
(
'http://localhost:8000/heroes'
,
self
.
browser
.
current_url
)
self
.
assertIn
(
'The Will of the Wisps Wiki'
,
self
.
browser
.
title
)
self
.
fail
(
'Finish the test!'
)
jester
=
self
.
browser
.
find_element_by_link_text
(
'Jester'
)
jester
.
click
()
self
.
assertEqual
(
'http://localhost:8000/hero/jester/'
,
self
.
browser
.
current_url
)
self
.
assertIn
(
'Detail - Jester'
,
self
.
browser
.
title
)
jester
=
self
.
browser
.
find_element_by_tag_name
(
'button'
)
self
.
assertIn
(
'Back to Heroes List'
,
jester
.
text
)
jester
.
click
()
self
.
assertEqual
(
'http://localhost:8000/heroes'
,
self
.
browser
.
current_url
)
self
.
assertIn
(
'The Will of the Wisps Wiki'
,
self
.
browser
.
title
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
(
warnings
=
'ignore'
)
unittest
.
main
(
warnings
=
'ignore'
)
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