Commit 6158ce5d authored by Patrick James Ong's avatar Patrick James Ong

Added and modified functional test

parent 9763b68a
Pipeline #812 canceled with stages
from selenium import webdriver
import unittest
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def tearDown(self):
self.browser.quit()
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')
# 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)
# She sees a list containing three heroes with their corresponding
# names, health points, and damage
self.assertIn('Cloud', self.browser.body)
self.assertIn('Health Points: 600', self.browser.body)
self.assertIn('Base Attack Damage: 57', self.browser.body)
self.assertIn('Jester', self.browser.body)
self.assertIn('Health Points: 660', self.browser.body)
self.assertIn('Base Attack Damage: 64', self.browser.body)
self.assertIn('Sunflowey', self.browser.body)
self.assertIn('Health Points: 650', self.browser.body)
self.assertIn('Base Attack Damage: 43', self.browser.body)
# When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image).
self.assertIn(browser.getCurrentUrl(), 'http://localhost:8000/hero/cloud')
self.assertIn(browser.getCurrentUrl(), 'http://localhost:8000/hero/sunflowey')
self.assertIn(browser.getCurrentUrl(), 'http://localhost:8000/hero/jester')
# She spots the page title and header mentions the name of the hero she selected.
self.assertIn('Cloud', self.browser.title)
self.assertIn('Sunflowey', self.browser.title)
self.assertIn('Jester', 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.
browser.get('http://localhost:8000')
self.fail('Finish the test!')
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