2026-02-07 19:44:47 -05:00
|
|
|
from selenium.webdriver.common.by import By
|
2026-02-17 23:07:12 -05:00
|
|
|
|
2026-02-01 20:06:01 -05:00
|
|
|
from .base import FunctionalTest
|
2026-02-17 23:07:12 -05:00
|
|
|
from .list_page import ListPage
|
|
|
|
|
|
2026-02-01 20:06:01 -05:00
|
|
|
|
|
|
|
|
class MyListsTest(FunctionalTest):
|
2026-02-01 20:18:42 -05:00
|
|
|
|
2026-02-07 19:44:47 -05:00
|
|
|
def test_logged_in_users_lists_are_saved_as_my_lists(self):
|
|
|
|
|
self.create_pre_authenticated_session("discoman@example.com")
|
|
|
|
|
|
2026-02-01 20:18:42 -05:00
|
|
|
self.browser.get(self.live_server_url)
|
2026-02-17 23:07:12 -05:00
|
|
|
list_page = ListPage(self)
|
|
|
|
|
list_page.add_list_item("Reticulate splines")
|
|
|
|
|
list_page.add_list_item("Regurgitate spines")
|
2026-02-07 19:44:47 -05:00
|
|
|
first_list_url = self.browser.current_url
|
|
|
|
|
|
|
|
|
|
self.browser.find_element(By.LINK_TEXT, "My lists").click()
|
|
|
|
|
|
|
|
|
|
self.wait_for(
|
|
|
|
|
lambda: self.assertIn(
|
|
|
|
|
"discoman@example.com",
|
2026-02-07 22:47:04 -05:00
|
|
|
self.browser.find_element(By.CSS_SELECTOR, "h2").text,
|
2026-02-07 19:44:47 -05:00
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
self.wait_for(
|
|
|
|
|
lambda: self.browser.find_element(By.LINK_TEXT, "Reticulate splines")
|
|
|
|
|
)
|
|
|
|
|
self.browser.find_element(By.LINK_TEXT, "Reticulate splines").click()
|
|
|
|
|
self.wait_for(
|
|
|
|
|
lambda: self.assertEqual(self.browser.current_url, first_list_url)
|
|
|
|
|
)
|
2026-02-01 20:18:42 -05:00
|
|
|
|
|
|
|
|
self.browser.get(self.live_server_url)
|
2026-02-17 23:07:12 -05:00
|
|
|
list_page.add_list_item("Ribbon of death")
|
2026-02-07 19:44:47 -05:00
|
|
|
second_list_url = self.browser.current_url
|
|
|
|
|
|
|
|
|
|
self.browser.find_element(By.LINK_TEXT, "My lists").click()
|
|
|
|
|
self.wait_for(
|
|
|
|
|
lambda: self.browser.find_element(By.LINK_TEXT, "Ribbon of death")
|
|
|
|
|
)
|
|
|
|
|
self.browser.find_element(By.LINK_TEXT, "Ribbon of death").click()
|
|
|
|
|
self.wait_for(
|
|
|
|
|
lambda: self.assertEqual(self.browser.current_url, second_list_url)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
self.browser.find_element(By.CSS_SELECTOR, "#id_logout").click()
|
|
|
|
|
self.wait_for(
|
|
|
|
|
lambda: self.assertEqual(
|
|
|
|
|
self.browser.find_elements(By.LINK_TEXT, "My lists"),
|
|
|
|
|
[],
|
|
|
|
|
)
|
|
|
|
|
)
|