Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
1
184424-Santos-Lab1-CSCI-40
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
Kirby Ezekiel Santos
184424-Santos-Lab1-CSCI-40
Commits
b78dd5bd
Commit
b78dd5bd
authored
Mar 07, 2020
by
Kirby Ezekiel Santos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for checking hero page titles and headers
parent
58b2d792
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
3 deletions
+30
-3
tests.py
heroes/tests.py
+30
-3
No files found.
heroes/tests.py
View file @
b78dd5bd
...
@@ -3,7 +3,8 @@ import unittest
...
@@ -3,7 +3,8 @@ import unittest
class
CheckContents
(
unittest
.
TestCase
):
class
CheckContents
(
unittest
.
TestCase
):
def
check_cloud
(
self
):
def
check_cloud_in_home_page
(
self
):
self
.
browser
.
get
(
'http://localhost:8000'
)
cloudName
=
self
.
browser
.
find_element_by_id
(
'cloudName'
)
cloudName
=
self
.
browser
.
find_element_by_id
(
'cloudName'
)
self
.
assertEqual
(
cloudName
.
get_attribute
(
'innerHTML'
),
'Cloud'
)
self
.
assertEqual
(
cloudName
.
get_attribute
(
'innerHTML'
),
'Cloud'
)
cloudHealth
=
self
.
browser
.
find_element_by_id
(
'cloudHealth'
)
cloudHealth
=
self
.
browser
.
find_element_by_id
(
'cloudHealth'
)
...
@@ -11,7 +12,8 @@ class CheckContents(unittest.TestCase):
...
@@ -11,7 +12,8 @@ class CheckContents(unittest.TestCase):
cloudAttack
=
self
.
browser
.
find_element_by_id
(
'cloudAttack'
)
cloudAttack
=
self
.
browser
.
find_element_by_id
(
'cloudAttack'
)
self
.
assertEqual
(
cloudAttack
.
get_attribute
(
'innerHTML'
),
'57'
)
self
.
assertEqual
(
cloudAttack
.
get_attribute
(
'innerHTML'
),
'57'
)
def
check_jester
(
self
):
def
check_jester_in_home_page
(
self
):
self
.
browser
.
get
(
'http://localhost:8000'
)
jesterName
=
self
.
browser
.
find_element_by_id
(
'jesterName'
)
jesterName
=
self
.
browser
.
find_element_by_id
(
'jesterName'
)
self
.
assertEqual
(
jesterName
.
get_attribute
(
'innerHTML'
),
'Jester'
)
self
.
assertEqual
(
jesterName
.
get_attribute
(
'innerHTML'
),
'Jester'
)
jesterHealth
=
self
.
browser
.
find_element_by_id
(
'jesterHealth'
)
jesterHealth
=
self
.
browser
.
find_element_by_id
(
'jesterHealth'
)
...
@@ -19,7 +21,8 @@ class CheckContents(unittest.TestCase):
...
@@ -19,7 +21,8 @@ class CheckContents(unittest.TestCase):
jesterAttack
=
self
.
browser
.
find_element_by_id
(
'jesterAttack'
)
jesterAttack
=
self
.
browser
.
find_element_by_id
(
'jesterAttack'
)
self
.
assertEqual
(
jesterAttak
.
get_attribute
(
'innerHTML'
),
'64'
)
self
.
assertEqual
(
jesterAttak
.
get_attribute
(
'innerHTML'
),
'64'
)
def
check_sunflowey
(
self
):
def
check_sunflowey_in_home_page
(
self
):
self
.
browser
.
get
(
'http://localhost:8000'
)
sunfloweyName
=
self
.
browser
.
find_element_by_id
(
'sunfloweyName'
)
sunfloweyName
=
self
.
browser
.
find_element_by_id
(
'sunfloweyName'
)
self
.
assertEqual
(
jesterName
.
get_attribute
(
'innerHTML'
),
'Sunflowey'
)
self
.
assertEqual
(
jesterName
.
get_attribute
(
'innerHTML'
),
'Sunflowey'
)
sunfloweyHealth
=
self
.
browser
.
find_element_by_id
(
'sunfloweyHealth'
)
sunfloweyHealth
=
self
.
browser
.
find_element_by_id
(
'sunfloweyHealth'
)
...
@@ -27,5 +30,29 @@ class CheckContents(unittest.TestCase):
...
@@ -27,5 +30,29 @@ class CheckContents(unittest.TestCase):
sunfloweyAttack
=
self
.
browser
.
find_element_by_id
(
'sunfloweyAttack'
)
sunfloweyAttack
=
self
.
browser
.
find_element_by_id
(
'sunfloweyAttack'
)
self
.
assertEqual
(
sunfloweyAttack
.
get_attribute
(
'innerHTML'
),
'43'
)
self
.
assertEqual
(
sunfloweyAttack
.
get_attribute
(
'innerHTML'
),
'43'
)
def
check_cloud_page_title_and_heading
(
self
):
self
.
browser
.
get
(
'http://localhost:8000/hero/cloud'
)
cloudTitle
=
self
.
browser
.
find_element_by_id
(
'cloudTitle'
)
self
.
assertEqual
(
cloudTitle
.
get_attribute
(
'innerHTML'
),
'Detail - Cloud'
)
cloudHeading
=
self
.
browser
.
find_element_b_id
(
'cloudHeader'
)
self
.
assertEqual
(
cloudHeader
.
get_attribute
(
'innerHTML'
),
'Detail - Cloud'
)
def
check_jester_page_title_and_heading
(
self
):
self
.
browser
.
get
(
'http://localhost:8000/hero/jester'
)
jesterTitle
=
self
.
browser
.
find_element_by_id
(
'jesterTitle'
)
self
.
assertEqual
(
jesterTitle
.
get_attribute
(
'innerHTML'
),
'Detail - Jester'
)
jesterHeading
=
self
.
browser
.
find_element_b_id
(
'jesterHeader'
)
self
.
assertEqual
(
jesterHeader
.
get_attribute
(
'innerHTML'
),
'Detail - Jester'
)
def
check_sunflowey_page_title_and_heading
(
self
):
self
.
browser
.
get
(
'http://localhost:8000/hero/sunflowey'
)
sunfloweyTitle
=
self
.
browser
.
find_element_by_id
(
'sunfloweyTitle'
)
self
.
assertEqual
(
sunfloweyTitle
.
get_attribute
(
'innerHTML'
),
'Detail - Sunflowey'
)
sunfloweyHeading
=
self
.
browser
.
find_element_b_id
(
'sunfloweyHeader'
)
self
.
assertEqual
(
sunfloweyHeader
.
get_attribute
(
'innerHTML'
),
'Detail - Sunflowey'
)
# Create your tests here.
# Create your tests here.
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