add_list_item() helper added to functional_tests.base; further propagated into .test_layout_and_styling, .test_list_item_validation, .test_my_lists & .test_simple_list_creation; all FTs passing locally (tho js-dependent FT still require nginx to serve scripts properly in docker or on server)
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import BACKEND_SESSION_KEY, SESSION_KEY, get_user_model
|
||||
from django.contrib.sessions.backends.db import SessionStore
|
||||
from selenium.webdriver.common.by import By
|
||||
from .base import FunctionalTest
|
||||
from .container_commands import create_session_on_server
|
||||
from .management.commands.create_session import create_pre_authenticated_session
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
class MyListsTest(FunctionalTest):
|
||||
def create_pre_authenticated_session(self, email):
|
||||
@@ -25,11 +22,48 @@ class MyListsTest(FunctionalTest):
|
||||
)
|
||||
)
|
||||
|
||||
def test_logged_in_users_are_saved_as_my_lists(self):
|
||||
email = "discoman@example.com"
|
||||
self.browser.get(self.live_server_url)
|
||||
self.wait_to_be_logged_out(email)
|
||||
def test_logged_in_users_lists_are_saved_as_my_lists(self):
|
||||
self.create_pre_authenticated_session("discoman@example.com")
|
||||
|
||||
self.create_pre_authenticated_session(email)
|
||||
self.browser.get(self.live_server_url)
|
||||
self.wait_to_be_logged_in(email)
|
||||
self.add_list_item("Reticulate splines")
|
||||
self.add_list_item("Regurgitate spines")
|
||||
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",
|
||||
self.browser.find_element(By.CSS_SELECTOR, "h1").text,
|
||||
)
|
||||
)
|
||||
|
||||
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)
|
||||
)
|
||||
|
||||
self.browser.get(self.live_server_url)
|
||||
self.add_list_item("Ribbon of death")
|
||||
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"),
|
||||
[],
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user