Commit e029fa28 authored by Alysha Columbres's avatar Alysha Columbres

edited functional tests file and arranged folder

parent aa5015c3
......@@ -12,36 +12,37 @@ 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
browser.get('http://localhost:8000')
self.browser.get('http://localhost:8000')
# 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)
def test_uses_list_template(self):
# She sees a list containing three heroes with their corresponding
# names, health points, and damage
response = self.client.get('/heroes')
self.assertTemplateUsed(response, 'heroes.html')
seld.assertIn(self.browser.current_url,
'http://localhost:8000/heroes')
# When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image).
response = self.client.get('/hero/cloud')
self.assertTemplateUsed(response, 'detail_cloud.html')
# She spots the page title and header mentions the name of the hero she selected.
self.assertIn('Cloud', self.browser.title)
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)
response = self.client.get('/hero/sunflowey')
self.assertTemplateUsed(response, 'detail_sunflowey.html')
self.assertIn('Sunflowey', self.browser.title)
self.assertIn('Skills', self.browser.find_element_by_id('hero_skills').text)
response = self.client.get('/hero/jester')
self.assertTemplateUsed(response, 'detail_jester.html')
self.assertIn('Jester', self.browser.title)
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.
self.assertIn('Detail - ', self.browser.title)
# 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.assertIn('Back to Heroes List', html)
self.assertTemplateUsed(response, 'heroes.html')
self.fail('Finish the test!')
\ No newline at end of file
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