Fakultas Ilmu Komputer UI

Commit 429fb6fb authored by Kevin Albert Simanjuntak's avatar Kevin Albert Simanjuntak
Browse files

Front page HTML now generated from a template

parent 851c8cd9
Pipeline #20524 passed with stage
in 43 seconds
......@@ -3,18 +3,19 @@ from selenium.webdriver.common.keys import Keys
import time
import unittest
class NewVisitorTest(unittest.TestCase):
class NewVisitorTest(unittest.TestCase):
def setUp(self):
def setUp(self):
self.browser = webdriver.Firefox()
def tearDown(self):
def tearDown(self):
self.browser.quit()
# She is invited to enter a to-do item straight away
def test_can_start_a_list_and_retrieve_it_later(self):
# Edith has heard about a cool new online to-do app. She goes
# to check out its homepage
self.browser.get('http://localhost:8000')
# Edith has heard about a cool new online to-do app. She goes
# to check out its homepage
self.browser.get('http://localhost:8000/homepage')
# She notices the page title and header mention to-do lists
self.assertIn('To-Do', self.browser.title)
......@@ -39,13 +40,13 @@ class NewVisitorTest(unittest.TestCase):
table = self.browser.find_element_by_id('id_list_table')
rows = table.find_elements_by_tag_name('tr')
self.assertTrue(
any(row.text == '1: Buy peacock feathers' for row in rows)
)
self.assertTrue(any(row.text == '1: Buy peacock feathers' for row in rows),"New to-do item did not appear in table")
# There is still a text box inviting her to add another item. She
# enters "Use peacock feathers to make a fly" (Edith is very
# methodical)
self.fail('Finish the test!')
# The page updates again, and now shows both items on her list
\ No newline at end of file
# The page updates again, and now shows both items on her list
if __name__ == '__main__':
unittest.main(warnings='ignore')
\ No newline at end of file
<html>
<title>To-Do lists</title>
<head>
<title>To-Do lists</title>
</head>
<body>
<h1>Your To-Do list</h1>
<input id="id_new_item" placeholder="Enter a to-do item" />
<table id="id_list_table">
</table>
</body>
</html>
\ No newline at end of file
Supports Markdown
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