Commit 87af8550 authored by Kevin Sibug's avatar Kevin Sibug

Added functional tests

parent 2d2f5d1a
...@@ -11,21 +11,40 @@ class NewVisitorTest(unittest.TestCase): ...@@ -11,21 +11,40 @@ 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')
# 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'
self.assertIn('The Will of the Wisps Wiki', self.browser.title) self.assertIn('The Will of the Wisps Wiki', self.browser.title)
# 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('Cloud', self.browser.find_element_by_id('cloud').text)
self.assertIn('Jester', self.browser.find_element_by_id('jester').text)
self.assertIn('Sunflowey', self.browser.find_element_by_id('sunflowey').text)
self.assertIn('Health Points', self.browser.find_element_by_id('cloud').text)
self.assertIn('Base Attack Damage', self.browser.find_element_by_id('cloud').text)
self.assertIn('Health Points', self.browser.find_element_by_id('jester').text)
self.assertIn('Base Attack Damage', self.browser.find_element_by_id('jester').text)
self.assertIn('Health Points', self.browser.find_element_by_id('sunflowey').text)
self.assertIn('Base Attack Damage', self.browser.find_element_by_id('sunflowey').text)
# 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).
link = self.browser.find_element_by_id('cloud-view')
link.click()
self.assertEquals('http://localhost:8000/hero/cloud/',self.browser.current_url)
list_of_attributes = self.browser.find_elements_by_tag_name('dt')
self.assertIn('Health Points', list_of_attributes[0].text)
self.assertIn('Base Attack Damage', list_of_attributes[1].text)
self.assertIn('Skills', list_of_attributes[2].text)
self.assertIn('Lore', list_of_attributes[3].text)
# 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 - Cloud', 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!')
\ No newline at end of file
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