created functional_tests.my_lists_page to contain helpers for viewing shared lists; refactored several other FTs to passing
This commit is contained in:
@@ -30,7 +30,7 @@ class ListPage:
|
|||||||
def get_share_box(self):
|
def get_share_box(self):
|
||||||
return self.test.browser.find_element(
|
return self.test.browser.find_element(
|
||||||
By.CSS_SELECTOR,
|
By.CSS_SELECTOR,
|
||||||
'input[name="recipient]',
|
'input[name="recipient"]',
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_shared_with_list(self):
|
def get_shared_with_list(self):
|
||||||
@@ -47,3 +47,6 @@ class ListPage:
|
|||||||
email, [item.text for item in self.get_shared_with_list()]
|
email, [item.text for item in self.get_shared_with_list()]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_list_owner(self):
|
||||||
|
return self.test.browser.find_element(By.ID, "id_list_owner").text
|
||||||
|
|||||||
17
src/functional_tests/my_lists_page.py
Normal file
17
src/functional_tests/my_lists_page.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
|
class MyListsPage:
|
||||||
|
def __init__(self, test):
|
||||||
|
self.test = test
|
||||||
|
|
||||||
|
def go_to_my_lists_page(self, email):
|
||||||
|
self.test.browser.get(self.test.live_server_url)
|
||||||
|
self.test.browser.find_element(By.LINK_TEXT, "My lists").click()
|
||||||
|
self.test.wait_for(
|
||||||
|
lambda: self.test.assertIn(
|
||||||
|
email,
|
||||||
|
self.test.browser.find_element(By.TAG_NAME, "h2").text,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return self
|
||||||
@@ -2,6 +2,7 @@ from selenium.webdriver.common.by import By
|
|||||||
|
|
||||||
from .base import FunctionalTest
|
from .base import FunctionalTest
|
||||||
from .list_page import ListPage
|
from .list_page import ListPage
|
||||||
|
from .my_lists_page import MyListsPage
|
||||||
|
|
||||||
|
|
||||||
class MyListsTest(FunctionalTest):
|
class MyListsTest(FunctionalTest):
|
||||||
@@ -15,14 +16,7 @@ class MyListsTest(FunctionalTest):
|
|||||||
list_page.add_list_item("Regurgitate spines")
|
list_page.add_list_item("Regurgitate spines")
|
||||||
first_list_url = self.browser.current_url
|
first_list_url = self.browser.current_url
|
||||||
|
|
||||||
self.browser.find_element(By.LINK_TEXT, "My lists").click()
|
MyListsPage(self).go_to_my_lists_page("discoman@example.com")
|
||||||
|
|
||||||
self.wait_for(
|
|
||||||
lambda: self.assertIn(
|
|
||||||
"discoman@example.com",
|
|
||||||
self.browser.find_element(By.CSS_SELECTOR, "h2").text,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
self.wait_for(
|
self.wait_for(
|
||||||
lambda: self.browser.find_element(By.LINK_TEXT, "Reticulate splines")
|
lambda: self.browser.find_element(By.LINK_TEXT, "Reticulate splines")
|
||||||
@@ -40,10 +34,7 @@ class MyListsTest(FunctionalTest):
|
|||||||
self.wait_for(
|
self.wait_for(
|
||||||
lambda: self.browser.find_element(By.LINK_TEXT, "Ribbon of death")
|
lambda: self.browser.find_element(By.LINK_TEXT, "Ribbon of death")
|
||||||
)
|
)
|
||||||
self.browser.find_element(By.LINK_TEXT, "Ribbon of death").click()
|
MyListsPage(self).go_to_my_lists_page("discoman@example.com")
|
||||||
self.wait_for(
|
|
||||||
lambda: self.assertEqual(self.browser.current_url, second_list_url)
|
|
||||||
)
|
|
||||||
|
|
||||||
self.browser.find_element(By.CSS_SELECTOR, "#id_logout").click()
|
self.browser.find_element(By.CSS_SELECTOR, "#id_logout").click()
|
||||||
self.wait_for(
|
self.wait_for(
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from selenium.webdriver.common.by import By
|
|||||||
|
|
||||||
from .base import FunctionalTest
|
from .base import FunctionalTest
|
||||||
from .list_page import ListPage
|
from .list_page import ListPage
|
||||||
|
from .my_lists_page import MyListsPage
|
||||||
|
|
||||||
|
|
||||||
# Helper fns
|
# Helper fns
|
||||||
@@ -36,3 +37,18 @@ class SharingTest(FunctionalTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
list_page.share_list_with("friend@example.com")
|
list_page.share_list_with("friend@example.com")
|
||||||
|
|
||||||
|
self.browser = ali_browser
|
||||||
|
MyListsPage(self).go_to_my_lists_page("alice@example.com")
|
||||||
|
|
||||||
|
self.browser.find_element(By.LINK_TEXT, "Send help").click()
|
||||||
|
|
||||||
|
self.wait_for(
|
||||||
|
lambda: self.assertEqual(list_page.get_list_owner(), "discoman@example.com")
|
||||||
|
)
|
||||||
|
|
||||||
|
list_page.add_list_item("At your command, Disco King")
|
||||||
|
|
||||||
|
self.browser = disco_browser
|
||||||
|
self.browser.refresh()
|
||||||
|
list_page.wait_for_row_in_list_table("At your command, Disco King", 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user