Redid functional test.

parent 0667c726
from selenium import webdriver from selenium import webdriver
import unittest import unittest
from selenium import webdriver
class NewVisitorTest(unittest.TestCase): class NewVisitorTest(unittest.TestCase):
def setUp(self): def setUp(self):
self.browser = webdriver.Firefox() self.browser = webdriver.Firefox()
...@@ -19,6 +22,7 @@ class NewVisitorTest(unittest.TestCase): ...@@ -19,6 +22,7 @@ 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
self.assertIn('http://localhost:8000/heroes', self.browser.current_url)
# 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).
...@@ -31,7 +35,7 @@ class NewVisitorTest(unittest.TestCase): ...@@ -31,7 +35,7 @@ class NewVisitorTest(unittest.TestCase):
# 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.browser.get('http://localhost:8000/heroes') self.browser.get('http://localhost:8000/heroes')
# She decides to do it again UwU # She decides to do it again
self.browser.get('http://localhost:8000/hero/sunflowey') self.browser.get('http://localhost:8000/hero/sunflowey')
self.assertIn('Detail - Sunflowey', self.browser.title) self.assertIn('Detail - Sunflowey', self.browser.title)
self.browser.get('http://localhost:8000/heroes') self.browser.get('http://localhost:8000/heroes')
...@@ -40,7 +44,6 @@ class NewVisitorTest(unittest.TestCase): ...@@ -40,7 +44,6 @@ class NewVisitorTest(unittest.TestCase):
self.assertIn('Detail - Jester', self.browser.title) self.assertIn('Detail - Jester', self.browser.title)
self.browser.get('http://localhost:8000/heroes') self.browser.get('http://localhost:8000/heroes')
self.fail('Finish the test!')
if __name__ == '__main__': if __name__ == '__main__':
unittest.main(warnings='ignore') unittest.main(warnings='ignore')
from django.urls import resolve
from django.test import TestCase from django.test import TestCase
class HomePageTest(TestCase): class HomePageTest(TestCase):
......
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