|
@@ -11,6 +11,11 @@ class NewVisitorTest(unittest.TestCase):
|
|
|
def tearDown(self):
|
|
def tearDown(self):
|
|
|
self.browser.quit()
|
|
self.browser.quit()
|
|
|
|
|
|
|
|
|
|
+ def check_for_row_in_list_table(self, row_text):
|
|
|
|
|
+ table = self.browser.find_element_by_id('movie-table')
|
|
|
|
|
+ rows = table.find_elements_by_tag_name('tr')
|
|
|
|
|
+ self.assertIn(row_text, [row.text for row in rows])
|
|
|
|
|
+
|
|
|
def test_can_start_a_list_and_retrieve_it_later(self):
|
|
def test_can_start_a_list_and_retrieve_it_later(self):
|
|
|
# Edith has heard about a cool new online to-do app. She goes
|
|
# Edith has heard about a cool new online to-do app. She goes
|
|
|
# to check out its homepage
|
|
# to check out its homepage
|
|
@@ -35,12 +40,15 @@ class NewVisitorTest(unittest.TestCase):
|
|
|
# "1: Inception" as an item in a to-do list table
|
|
# "1: Inception" as an item in a to-do list table
|
|
|
inputbox.send_keys(Keys.ENTER)
|
|
inputbox.send_keys(Keys.ENTER)
|
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
|
|
|
+ self.check_for_row_in_list_table('1: Inception')
|
|
|
|
|
|
|
|
- table = self.browser.find_element_by_id('movie-table')
|
|
|
|
|
- rows = table.find_elements_by_tag_name('tr')
|
|
|
|
|
- self.assertTrue(
|
|
|
|
|
- any(row.text == '1: Inception' for row in rows)
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ inputbox = self.browser.find_element_by_id('input-new-movie')
|
|
|
|
|
+ inputbox.send_keys('The Sixth Sense')
|
|
|
|
|
+ inputbox.send_keys(Keys.ENTER)
|
|
|
|
|
+ time.sleep(1)
|
|
|
|
|
+
|
|
|
|
|
+ self.check_for_row_in_list_table('1: Inception')
|
|
|
|
|
+ self.check_for_row_in_list_table('2: The Sixth Sense')
|
|
|
|
|
|
|
|
# There is still a text box inviting her to add another item. She
|
|
# There is still a text box inviting her to add another item. She
|
|
|
# enters "Armageddon"
|
|
# enters "Armageddon"
|