Commit 02b1219a authored by Ayn Collado's avatar Ayn Collado

something something i give up

parent 32059956
<html>
<head>
<title>The Will of the Wisps Wiki</title>
</head>
<body>
<div align="center">
<a href="
</div>
</body>
</html>
\ No newline at end of file
from selenium import webdriver
from django.urls import resolve
from django.test import TestCase
import unittest
from .views import home_page
# Create your tests here.
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
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)
# She sees a list containing three heroes with their corresponding
# names, health points, and damage
detail = self.browser.find_element_by_id('cloud_name')
self.assertEqual(detail.get_attribute('innerHTML'), 'Cloud')
detail = self.browser.find_element_by_id('cloud_hp')
self.assertEqual(detail.get_attribute('innerHTML'), '600')
detail = self.browser.find_element_by_id('cloud_ad')
self.assertEqual(detail.get_attribute('innerHTML'), '57')
detail = self.browser.find_element_by_id('sunflowey_name')
self.assertEqual(detail.get_attribute('innerHTML'), 'Sunflowey')
detail = self.browser.find_element_by_id('sunflowey_hp')
self.assertEqual(detail.get_attribute('innerHTML'), '650')
detail = self.browser.find_element_by_id('sunflowey_ad')
self.assertEqual(detail.get_attribute('innerHTML'), '43')
detail = self.browser.find_element_by_id('jester_name')
self.assertEqual(detail.get_attribute('innerHTML'), 'Jester')
detail = self.browser.find_element_by_id('jester_hp')
self.assertEqual(detail.get_attribute('innerHTML'), '660')
detail = self.browser.find_element_by_id('jester_ad')
self.assertEqual(detail.get_attribute('innerHTML'), '64')
# When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image).
self.browser.get('http://localhost:8000/hero/cloud')
self.browser.get('http://localhost:8000/hero/sunflowey')
self.browser.get('http://localhost:8000/hero/jester')
# She spots the page title and header mentions the name of the hero she selected.
detail = self.browser.find_element_by_id('cloud_title')
self.assertEqual(detail.get_attribute('innerHTML'), 'Detail - Cloud')
detail = self.browser.find_element_by_id('cloud_heading')
self.assertEqual(detail.get_attribute('innerHTML'), 'Detail - Cloud')
# 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.
button = self.browser.find_element_by_id('back_button')
self.assertEqual(button.get_attribute('innerHTML'), 'Back to Heroes List')
self.fail('Finish the test!')
if __name__ == '__main__':
unittest.main(warnings='ignore')
\ No newline at end of file
......@@ -2,9 +2,9 @@ from django.urls import path
from .views import home_page, cloud, sunflowey, jester
urlpatterns = [
path(r'^$', home_page, name='home_page'),
path(r'heroes/$', home_page, name='home_page'),
path(r'hero/cloud$', cloud, name='cloud'),
path(r'hero/sunflowey$', sunflowey, name='sunflowey'),
path(r'hero/jester$', jester, name='jester'),
path(r'', home_page, name='home_page'),
path(r'heroes/', home_page, name='home_page'),
path(r'hero/cloud', cloud, name='cloud'),
path(r'hero/sunflowey', sunflowey, name='sunflowey'),
path(r'hero/jester', jester, name='jester'),
]
<!DOCTYPE html>
<html>
<head>
<title>Detail - Cloud</title>
<title id='cloud_title'>Detail - Cloud</title>
</head>
<body>
<img src="./cloud.png" style="width: 10vw;" />
<h1>Detail - Cloud</h1>
<h1 id="cloud_heading">Detail - Cloud</h1>
<dl>
<dt>Health Points</dt><dd>600</dd>
<dt>Base Attack Damage</dt><dd>57</dd>
<dt>Skills</dt><dd>Nimbus, Rain Cloud, Thunderbolt</dd>
<dt>Lore</dt><dd>I am a cloud. When I pee you call it 'rain'.</dd>
</dl>
<button><a href="/heroes" id='back_button'>Back to Heroes List</a></button>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Detail - Jester</title>
<title id='jester_title'>Detail - Jester</title>
</head>
<body>
<img src="./jester.png" style="width: 10vw;"/>
<h1>Detail - Jester</h1>
<h1 id="jester_heading">Detail - Jester</h1>
<dl>
<dt>Health Points</dt><dd>660</dd>
<dt>Base Attack Damage</dt><dd>64</dd>
<dt>Skills</dt><dd>Laugh, Dance, Smile</dd>
<dt>Lore</dt><dd>I do it for the LOLs.</dd>
</dl>
<button><a href="/heroes" id='back_button'>Back to Heroes List</a></button>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Detail - Sunflowey</title>
<title id='sunflowey_title'>Detail - Sunflowey</title>
</head>
<body>
<img src="./sunflowey.png" style="width: 10vw;" />
<h1>Detail - Sunflowey</h1>
<h1 id="sunflowey_heading">Detail - Sunflowey</h1>
<dl>
<dt>Health Points</dt><dd>650</dd>
<dt>Base Attack Damage</dt><dd>43</dd>
<dt>Skills</dt><dd>Power Pellet, Sunshine, Pollen Punch</dd>
<dt>Lore</dt><dd>I am Sunflowey. Sometimes a sun, sometimes a flower.</dd>
</dl>
<button><a href="/heroes" id='back_button'>Back to Heroes List</a></button>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>The Will of the Wisps Wiki</title>
</head>
<body>
<hl><a href="/hero/cloud" id="cloud_name">Cloud</a></hl>
<dl>
<dt>Health Points:</dt> <dd id="cloud_hp">600</dd>
<dt>Base Attack Damage:</dt> <dd id="cloud_ad">57</dd>
</dl>
<hl><a href="/hero/sunflowey" id="sunflowey_name">Sunflowey</a></hl>
<dl>
<dt>Health Points:</dt> <dd id="sunflowey_hp">650</dd>
<dt>Base Attack Damage:</dt> <dd id="sunflowey_ad">43</dd>
</dl>
<hl><a href="/hero/jester" id="jester_name">Jester</a></hl>
<dl>
<dt>Health Points:</dt> <dd id="jester_hp">660</dd>
<dt>Base Attack Damage:</dt> <dd id="jester_ad">64</dd>
</dl>
</body>
</html>
\ No newline at end of file
......@@ -37,6 +37,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'selenium',
'heroes',
]
......@@ -55,7 +56,7 @@ ROOT_URLCONF = 'willowisp.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'DIRS': [os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'heroes', 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
......
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