First Functional Test specced out in comments, Added unittest
This commit is contained in:
parent
9c3c604462
commit
49c79f3bbe
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,4 +1,4 @@
|
|||||||
db.sqlite3
|
db.sqlite3
|
||||||
.venv
|
.venv
|
||||||
"__pycache__"
|
__pycache__
|
||||||
"*.pyc"
|
*.pyc
|
||||||
|
@ -1,7 +1,35 @@
|
|||||||
|
import unittest
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
|
|
||||||
browser = webdriver.Firefox()
|
class NewVisitorTest(unittest.TestCase):
|
||||||
browser.get("http://localhost:8000")
|
def setUp(self):
|
||||||
|
self.browser = webdriver.Firefox()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.browser.quit()
|
||||||
|
|
||||||
|
def test_can_start_a_todo_list(self):
|
||||||
|
# Ig has heard about a cool new online to-do app.
|
||||||
|
# He goes to check out its homepage
|
||||||
|
self.browser.get("http://localhost:8000")
|
||||||
|
# He notices the page title and header mention to-do lists
|
||||||
|
self.assertIn("To-Do", self.browser.title)
|
||||||
|
|
||||||
assert "Congratulations!" in browser.title
|
# He is invited to enter a to-do item straight away
|
||||||
print("OK")
|
self.fail("Finish the test!")
|
||||||
|
|
||||||
|
# He types "Buy peacock feathers" into a text box
|
||||||
|
# (Ig's hobby is tying fly-fishing lures)
|
||||||
|
|
||||||
|
# When he hits enter, the page updates, and now the page lists
|
||||||
|
# "1: Buy peacock feathers" as an item in a to-do list
|
||||||
|
|
||||||
|
# There is still a text box inviting him to add another item.
|
||||||
|
# He enters "Use peacock feathers to make a fly" (Ig is very methodical)
|
||||||
|
|
||||||
|
# The page updates again, and now shows both items on his list
|
||||||
|
|
||||||
|
# Satisfied, he goes back to sleep
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
Loading…
Reference in New Issue
Block a user