Commit 1f7e3b95 authored by King Arthur's avatar King Arthur

Passed all the tests.

parent 9f7d3ba6
Pipeline #913 failed with stages
This diff is collapsed.
...@@ -4,13 +4,14 @@ ...@@ -4,13 +4,14 @@
<title>Detail - Cloud</title> <title>Detail - Cloud</title>
</head> </head>
<body> <body>
<img src="./cloud.png" style="width: 10vw;" /> <img src="/static/cloud.png" style="width: 10vw;" />
<h1>Detail - Cloud</h1> <h1>Detail - Cloud</h1>
<dl> <dl>
<dt>Health Points</dt><dd>600</dd> <dt>Health Points</dt><dd>600</dd>
<dt>Base Attack Damage</dt><dd>57</dd> <dt>Base Attack Damage</dt><dd>57</dd>
<dt>Skills</dt><dd>Nimbus, Rain Cloud, Thunderbolt</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> <dt>Lore</dt><dd>I am a cloud. When I pee you call it 'rain'.</dd>
<dt><a href="http://localhost:8000/heroes" class="previous-page">Back to Heroes</a></dt>
</dl> </dl>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -4,13 +4,14 @@ ...@@ -4,13 +4,14 @@
<title>Detail - Jester</title> <title>Detail - Jester</title>
</head> </head>
<body> <body>
<img src="./jester.png" style="width: 10vw;"/> <img src="/static/jester.png" style="width: 10vw;"/>
<h1>Detail - Jester</h1> <h1>Detail - Jester</h1>
<dl> <dl>
<dt>Health Points</dt><dd>660</dd> <dt>Health Points</dt><dd>660</dd>
<dt>Base Attack Damage</dt><dd>64</dd> <dt>Base Attack Damage</dt><dd>64</dd>
<dt>Skills</dt><dd>Laugh, Dance, Smile</dd> <dt>Skills</dt><dd>Laugh, Dance, Smile</dd>
<dt>Lore</dt><dd>I do it for the LOLs.</dd> <dt>Lore</dt><dd>I do it for the LOLs.</dd>
<dt><a href="http://localhost:8000/heroes" class="previous-page">Back to Heroes</a></dt>
</dl> </dl>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -4,13 +4,14 @@ ...@@ -4,13 +4,14 @@
<title>Detail - Sunflowey</title> <title>Detail - Sunflowey</title>
</head> </head>
<body> <body>
<img src="./sunflowey.png" style="width: 10vw;" /> <img src="/static/sunflowey.png" style="width: 10vw;" />
<h1>Detail - Sunflowey</h1> <h1>Detail - Sunflowey</h1>
<dl> <dl>
<dt>Health Points</dt><dd>650</dd> <dt>Health Points</dt><dd>650</dd>
<dt>Base Attack Damage</dt><dd>43</dd> <dt>Base Attack Damage</dt><dd>43</dd>
<dt>Skills</dt><dd>Power Pellet, Sunshine, Pollen Punch</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> <dt>Lore</dt><dd>I am Sunflowey. Sometimes a sun, sometimes a flower.</dd>
<dt><a href="http://localhost:8000/heroes" class="previous-page">Back to Heroes</a></dt>
</dl> </dl>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<li class="char-name">Name: Cloud</li> <li class="char-name">Name: Cloud</li>
<li class="char-hp">Health Points: 600</li> <li class="char-hp">Health Points: 600</li>
<li class="char-damage">Base Attack Damage: 57</li> <li class="char-damage">Base Attack Damage: 57</li>
<li><a href="http://localhost:8000/hero/cloud" class="next-page">More info</a></li>
</ul> </ul>
</li> </li>
<li id="char-sunflowey"><br> <li id="char-sunflowey"><br>
...@@ -17,6 +18,7 @@ ...@@ -17,6 +18,7 @@
<li class="char-name">Name: Sunflowey</li> <li class="char-name">Name: Sunflowey</li>
<li class="char-hp">Health Points: 650</li> <li class="char-hp">Health Points: 650</li>
<li class="char-damage">Base Attack Damage: 43</li> <li class="char-damage">Base Attack Damage: 43</li>
<li><a href="http://localhost:8000/hero/sunflowey" class="next-page">More info</a></li>
</ul> </ul>
</li> </li>
<li id="char-jester"><br> <li id="char-jester"><br>
...@@ -24,6 +26,7 @@ ...@@ -24,6 +26,7 @@
<li class="char-name">Name: Jester</li> <li class="char-name">Name: Jester</li>
<li class="char-hp">Health Points: 660</li> <li class="char-hp">Health Points: 660</li>
<li class="char-damage">Base Attack Damage: 64</li> <li class="char-damage">Base Attack Damage: 64</li>
<li><a href="http://localhost:8000/hero/jester" class="next-page">More info</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
......
from django.conf.urls import url from django.conf.urls import url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from .views import HomePageView from .views import HomePageView
from .views import DetailCloudView from .views import DetailCloudView
...@@ -11,3 +12,5 @@ urlpatterns = [ ...@@ -11,3 +12,5 @@ urlpatterns = [
url(r"^hero/sunflowey$", DetailSunfloweyView.as_view(), name="detail_sunflowey"), url(r"^hero/sunflowey$", DetailSunfloweyView.as_view(), name="detail_sunflowey"),
url(r"^hero/jester$", DetailJesterView.as_view(), name="detail_jester"), url(r"^hero/jester$", DetailJesterView.as_view(), name="detail_jester"),
] ]
urlpatterns += staticfiles_urlpatterns()
\ No newline at end of file
from selenium import webdriver from selenium import webdriver
import unittest import unittest
import time
class NewVisitorTest(unittest.TestCase): class NewVisitorTest(unittest.TestCase):
def setUp(self): def setUp(self):
...@@ -19,7 +20,6 @@ class NewVisitorTest(unittest.TestCase): ...@@ -19,7 +20,6 @@ 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
char_list = self.browser.find_element_by_id("char-list")
chars = [{ chars = [{
"name": "Cloud", "name": "Cloud",
"hp": "600", "hp": "600",
...@@ -37,6 +37,8 @@ class NewVisitorTest(unittest.TestCase): ...@@ -37,6 +37,8 @@ class NewVisitorTest(unittest.TestCase):
}] }]
for char in chars: for char in chars:
char_list = self.browser.find_element_by_id("char-list")
char_element = char_list.find_element_by_id("char-" + char["name"].lower()) char_element = char_list.find_element_by_id("char-" + char["name"].lower())
for field in char: for field in char:
...@@ -51,6 +53,8 @@ class NewVisitorTest(unittest.TestCase): ...@@ -51,6 +53,8 @@ class NewVisitorTest(unittest.TestCase):
next_page_button = char_element.find_element_by_class_name("next-page") next_page_button = char_element.find_element_by_class_name("next-page")
next_page_button.click() next_page_button.click()
time.sleep(1)
page_source = self.browser.page_source page_source = self.browser.page_source
self.assertIn("Skills", page_source) self.assertIn("Skills", page_source)
...@@ -79,9 +83,9 @@ class NewVisitorTest(unittest.TestCase): ...@@ -79,9 +83,9 @@ class NewVisitorTest(unittest.TestCase):
previous_page_button.click() previous_page_button.click()
self.assertIn('The Will of the Wisps Wiki', self.browser.title) time.sleep(1)
self.fail('Finish the test!') self.assertIn('The Will of the Wisps Wiki', self.browser.title)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main(warnings = 'ignore') unittest.main(warnings = 'ignore')
\ No newline at end of file
...@@ -119,3 +119,7 @@ USE_TZ = True ...@@ -119,3 +119,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/3.0/howto/static-files/ # https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "heroes/templates")
]
\ 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