35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
|
|
from selenium import webdriver
|
||
|
|
from selenium.webdriver.common.by import By
|
||
|
|
from .base import FunctionalTest
|
||
|
|
|
||
|
|
|
||
|
|
# Helper fns
|
||
|
|
def quit_if_possible(browser):
|
||
|
|
try:
|
||
|
|
browser.quit()
|
||
|
|
except:
|
||
|
|
pass
|
||
|
|
|
||
|
|
|
||
|
|
# Test mdls
|
||
|
|
class SharingTest(FunctionalTest):
|
||
|
|
def test_can_share_a_list_with_another_user(self):
|
||
|
|
self.create_pre_authenticated_session("discoman@example.com")
|
||
|
|
disco_browser = self.browser
|
||
|
|
self.addCleanup(lambda: quit_if_possible(disco_browser))
|
||
|
|
|
||
|
|
ali_browser = webdriver.Firefox()
|
||
|
|
self.addCleanup(lambda: quit_if_possible(ali_browser))
|
||
|
|
self.browser = ali_browser
|
||
|
|
self.create_pre_authenticated_session("alice@example.com")
|
||
|
|
|
||
|
|
self.browser = disco_browser
|
||
|
|
self.browser.get(self.live_server_url)
|
||
|
|
self.add_list_item("Send help")
|
||
|
|
|
||
|
|
share_box = self.browser.find_element(By.CSS_SELECTOR, 'input[name="shareable"]')
|
||
|
|
self.assertEqual(
|
||
|
|
share_box.get_attribute("placeholder"),
|
||
|
|
"friend@example.com",
|
||
|
|
)
|