Spaces:
Sleeping
Sleeping
Commit ·
aa068af
1
Parent(s): c617728
make test_multiple_users of FT also test priority
Browse files- functional_tests/tests.py +18 -17
functional_tests/tests.py
CHANGED
|
@@ -69,21 +69,22 @@ class NewVisitorTest(LiveServerTestCase):
|
|
| 69 |
inputbox.send_keys("Medium")
|
| 70 |
inputbox.send_keys(Keys.ENTER)
|
| 71 |
|
|
|
|
|
|
|
| 72 |
|
| 73 |
# Satisfied, he goes back to play game.
|
| 74 |
-
|
| 75 |
def test_multiple_users_can_start_lists_at_different_urls(self):
|
| 76 |
# Jack starts a new to-do list
|
| 77 |
self.browser.get(self.live_server_url)
|
| 78 |
inputbox = self.browser.find_element(By.ID, "id_new_item")
|
| 79 |
inputbox.send_keys("Buy Gearboxes")
|
| 80 |
-
inputbox.send_keys(Keys.ENTER)
|
| 81 |
# He check for Priority
|
| 82 |
inputbox = self.browser.find_element(By.ID, "id_new_priority")
|
| 83 |
inputbox.send_keys("High")
|
| 84 |
inputbox.send_keys(Keys.ENTER)
|
| 85 |
|
| 86 |
-
self.wait_for_row_in_list_table("1: Buy Gearboxes")
|
| 87 |
|
| 88 |
# He notices that his list has a unique URL
|
| 89 |
jack_list_url = self.browser.current_url
|
|
@@ -95,30 +96,30 @@ class NewVisitorTest(LiveServerTestCase):
|
|
| 95 |
## as a way of simulating a brand new user session
|
| 96 |
self.browser.delete_all_cookies()
|
| 97 |
|
| 98 |
-
#
|
| 99 |
-
# list
|
| 100 |
self.browser.get(self.live_server_url)
|
| 101 |
page_text = self.browser.find_element(By.TAG_NAME, "body").text
|
| 102 |
-
self.assertNotIn("Buy
|
| 103 |
|
| 104 |
-
#
|
| 105 |
-
# is less interesting than Edith...
|
| 106 |
inputbox = self.browser.find_element(By.ID, "id_new_item")
|
| 107 |
-
inputbox.send_keys("Buy
|
|
|
|
|
|
|
| 108 |
inputbox.send_keys(Keys.ENTER)
|
| 109 |
-
self.wait_for_row_in_list_table("1: Buy
|
| 110 |
|
| 111 |
-
#
|
| 112 |
-
|
| 113 |
-
self.assertRegex(
|
| 114 |
-
self.assertNotEqual(
|
| 115 |
|
| 116 |
# Again, there is no trace of Edith's list
|
| 117 |
page_text = self.browser.find_element(By.TAG_NAME, "body").text
|
| 118 |
-
self.assertNotIn("Buy
|
| 119 |
-
self.assertIn("Buy
|
| 120 |
|
| 121 |
# Satisfied, they both go back to sleep
|
| 122 |
-
|
| 123 |
if __name__ == "__main__":
|
| 124 |
unittest.main()
|
|
|
|
| 69 |
inputbox.send_keys("Medium")
|
| 70 |
inputbox.send_keys(Keys.ENTER)
|
| 71 |
|
| 72 |
+
self.wait_for_row_in_list_table("2: Use Gearboxes to make a Machine (Medium)")
|
| 73 |
+
self.wait_for_row_in_list_table("1: Buy Gearboxes (High)")
|
| 74 |
|
| 75 |
# Satisfied, he goes back to play game.
|
| 76 |
+
|
| 77 |
def test_multiple_users_can_start_lists_at_different_urls(self):
|
| 78 |
# Jack starts a new to-do list
|
| 79 |
self.browser.get(self.live_server_url)
|
| 80 |
inputbox = self.browser.find_element(By.ID, "id_new_item")
|
| 81 |
inputbox.send_keys("Buy Gearboxes")
|
|
|
|
| 82 |
# He check for Priority
|
| 83 |
inputbox = self.browser.find_element(By.ID, "id_new_priority")
|
| 84 |
inputbox.send_keys("High")
|
| 85 |
inputbox.send_keys(Keys.ENTER)
|
| 86 |
|
| 87 |
+
self.wait_for_row_in_list_table("1: Buy Gearboxes (High)")
|
| 88 |
|
| 89 |
# He notices that his list has a unique URL
|
| 90 |
jack_list_url = self.browser.current_url
|
|
|
|
| 96 |
## as a way of simulating a brand new user session
|
| 97 |
self.browser.delete_all_cookies()
|
| 98 |
|
| 99 |
+
# Henry visits the home page. There is no sign of Edith's
|
|
|
|
| 100 |
self.browser.get(self.live_server_url)
|
| 101 |
page_text = self.browser.find_element(By.TAG_NAME, "body").text
|
| 102 |
+
self.assertNotIn("Buy Gearboxes (High)", page_text)
|
| 103 |
|
| 104 |
+
# Henry starts a new list by entering a new item.
|
|
|
|
| 105 |
inputbox = self.browser.find_element(By.ID, "id_new_item")
|
| 106 |
+
inputbox.send_keys("Buy Wheels")
|
| 107 |
+
inputbox = self.browser.find_element(By.ID, "id_new_priority")
|
| 108 |
+
inputbox.send_keys('High')
|
| 109 |
inputbox.send_keys(Keys.ENTER)
|
| 110 |
+
self.wait_for_row_in_list_table("1: Buy Wheels (High)")
|
| 111 |
|
| 112 |
+
# Henry gets his own unique URL
|
| 113 |
+
henry_list_url = self.browser.current_url
|
| 114 |
+
self.assertRegex(henry_list_url, "/lists/.+")
|
| 115 |
+
self.assertNotEqual(henry_list_url, jack_list_url)
|
| 116 |
|
| 117 |
# Again, there is no trace of Edith's list
|
| 118 |
page_text = self.browser.find_element(By.TAG_NAME, "body").text
|
| 119 |
+
self.assertNotIn("Buy Gearboxes", page_text)
|
| 120 |
+
self.assertIn("Buy Wheels", page_text)
|
| 121 |
|
| 122 |
# Satisfied, they both go back to sleep
|
| 123 |
+
|
| 124 |
if __name__ == "__main__":
|
| 125 |
unittest.main()
|