changed _ naming convention in el ids to -; expanded home.html to include head w. title, body w. h1, input & table for testing purposes; functional_tests updated to accomodate above changes & for more specific error handling during tests
This commit is contained in:
@@ -17,7 +17,7 @@ class NewVisitorTest(unittest.TestCase):
|
|||||||
header_text = self.browser.find_element(By.TAG_NAME, 'h1').text
|
header_text = self.browser.find_element(By.TAG_NAME, 'h1').text
|
||||||
self.assertIn('To-Do', header_text)
|
self.assertIn('To-Do', header_text)
|
||||||
|
|
||||||
inputbox = self.browser.find_element(By.ID, 'id_new_item')
|
inputbox = self.browser.find_element(By.ID, 'id-new-item')
|
||||||
self.assertEqual(inputbox.get_attribute('placeholder'), 'Enter a to-do item')
|
self.assertEqual(inputbox.get_attribute('placeholder'), 'Enter a to-do item')
|
||||||
|
|
||||||
inputbox.send_keys('Buy peacock feathers')
|
inputbox.send_keys('Buy peacock feathers')
|
||||||
@@ -25,9 +25,12 @@ class NewVisitorTest(unittest.TestCase):
|
|||||||
inputbox.send_keys(Keys.ENTER)
|
inputbox.send_keys(Keys.ENTER)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
table = self.browser.find_element(By.ID, 'id_list_table')
|
table = self.browser.find_element(By.ID, 'id-list-table')
|
||||||
rows = table.find_elements(By.TAG_NAME, 'tr')
|
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',
|
||||||
|
)
|
||||||
|
|
||||||
self.fail("Finish the test!")
|
self.fail("Finish the test!")
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
<html>
|
<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>
|
</html>
|
||||||
Reference in New Issue
Block a user