Commit 0295d65c authored by martin0726's avatar martin0726

Filled up the functional tests

I filled up the functional tests with the required functions. I also editted the html files by adding ids for the functional test to use
parent c0166255
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
<title>Detail - Cloud</title> <title>Detail - Cloud</title>
</head> </head>
<body> <body>
<img src="./cloud.png" style="width: 10vw;" /> <img id='hero_image' src="./cloud.png" style="width: 10vw;" />
<h1>Detail - Cloud</h1> <h1>Detail - Cloud</h1>
<dl> <dl>
<dt>Health Points</dt><dd>600</dd> <dt id='hero_health'>Health Points</dt><dd>600</dd>
<dt>Base Attack Damage</dt><dd>57</dd> <dt id='hero_attack'>Base Attack Damage</dt><dd>57</dd>
<dt>Skills</dt><dd>Nimbus, Rain Cloud, Thunderbolt</dd> <dt id='hero_skils'>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 id='hero_lore'>Lore</dt><dd>I am a cloud. When I pee you call it 'rain'.</dd>
</dl> </dl>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
<title>Detail - Jester</title> <title>Detail - Jester</title>
</head> </head>
<body> <body>
<img src="./jester.png" style="width: 10vw;"/> <img id='hero_image' src="./jester.png" style="width: 10vw;"/>
<h1>Detail - Jester</h1> <h1>Detail - Jester</h1>
<dl> <dl>
<dt>Health Points</dt><dd>660</dd> <dt id='hero_health'>Health Points</dt><dd>660</dd>
<dt>Base Attack Damage</dt><dd>64</dd> <dt id='hero_attack'>Base Attack Damage</dt><dd>64</dd>
<dt>Skills</dt><dd>Laugh, Dance, Smile</dd> <dt id='hero_skils'>Skills</dt><dd>Laugh, Dance, Smile</dd>
<dt>Lore</dt><dd>I do it for the LOLs.</dd> <dt id='hero_lore'>Lore</dt><dd>I do it for the LOLs.</dd>
</dl> </dl>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
<title>Detail - Sunflowey</title> <title>Detail - Sunflowey</title>
</head> </head>
<body> <body>
<img src="./sunflowey.png" style="width: 10vw;" /> <img id='hero_image' src="./sunflowey.png" style="width: 10vw;" />
<h1>Detail - Sunflowey</h1> <h1>Detail - Sunflowey</h1>
<dl> <dl>
<dt>Health Points</dt><dd>650</dd> <dt id='hero_health'>Health Points</dt><dd>650</dd>
<dt>Base Attack Damage</dt><dd>43</dd> <dt id='hero_attack'>Base Attack Damage</dt><dd>43</dd>
<dt>Skills</dt><dd>Power Pellet, Sunshine, Pollen Punch</dd> <dt id='hero_skils'>Skills</dt><dd>Power Pellet, Sunshine, Pollen Punch</dd>
<dt>Lore</dt><dd>I am Sunflowey. Sometimes a sun, sometimes a flower.</dd> <dt id='hero_lore'>Lore</dt><dd>I am Sunflowey. Sometimes a sun, sometimes a flower.</dd>
</dl> </dl>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -11,7 +11,7 @@ class NewVisitorTest(unittest.TestCase): ...@@ -11,7 +11,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
browser.get('http://localhost:8000') self.browser.get('http://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,13 +19,29 @@ class NewVisitorTest(unittest.TestCase): ...@@ -19,13 +19,29 @@ 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
self.assertIn(self.browser.get_current_url,
'http://localhost:8000/heroes')
# 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).
self.browser.get('http://localhost:8000/hero/cloud')
self.assertIn('Health Points', self.browser.find_element_by_id('hero_health').text)
self.assertIn('Base Attack Damage', self.browser.find_element_by_id('hero_attack').text)
self.assertIn('Skills', self.browser.find_element_by_id('hero_skills').text)
self.assertIn('Lore', self.browser.find_element_by_id('hero_lore').text)
self.assertIn('.png,' self.browser.find_element_by_id('hero_image').get_attribute('src'))
# 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('Detail - ', 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.
self.fail('Finish the test!') self.fail('Finish the test!')
if __name__ == '__main__':
unittest.main(warnings = 'ignore')
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment