'theme_switcher,' 'theme-picker' & 'theme' renamed everywhere to simply 'palette'; new urls & views & their corresponding ITs ensure applet menu checkbox functionality
This commit is contained in:
@@ -4,7 +4,7 @@ from .base import FunctionalTest
|
||||
|
||||
|
||||
class SiteThemeTest(FunctionalTest):
|
||||
def test_page_renders_with_earthman_theme(self):
|
||||
def test_page_renders_with_earthman_palette(self):
|
||||
self.browser.get(self.live_server_url)
|
||||
body = self.browser.find_element(By.TAG_NAME, "body")
|
||||
self.assertIn("theme-default", body.get_attribute("class"))
|
||||
self.assertIn("palette-default", body.get_attribute("class"))
|
||||
@@ -43,9 +43,9 @@ class DashboardMaintenanceTest(FunctionalTest):
|
||||
# 1. Auth as discoman@example.com, navigate home
|
||||
self.create_pre_authenticated_session("discoman@example.com")
|
||||
self.browser.get(self.live_server_url)
|
||||
# 2. Assert both applets present on page (id_applet_username, id_applet_theme_switcher)
|
||||
# 2. Assert both applets present on page (id_applet_username, id_applet_palette)
|
||||
self.browser.find_element(By.ID, "id_applet_username")
|
||||
self.browser.find_element(By.ID, "id_applet_theme_switcher")
|
||||
self.browser.find_element(By.ID, "id_applet_palette")
|
||||
# 3. Click el w. id="id_dash_gear"
|
||||
dash_gear = self.browser.find_element(By.ID, "id_dash_gear")
|
||||
dash_gear.click()
|
||||
@@ -53,15 +53,15 @@ class DashboardMaintenanceTest(FunctionalTest):
|
||||
self.wait_for(
|
||||
lambda: self.browser.find_element(By.ID, "id_applet_menu")
|
||||
)
|
||||
# 5. Find two checkboxes in menu, name="username" & name="theme-switcher"; assert both .is_selected()
|
||||
# 5. Find two checkboxes in menu, name="username" & name="palette"; assert both .is_selected()
|
||||
menu = self.browser.find_element(By.ID, "id_applet_menu")
|
||||
username_cb = menu.find_element(By.NAME, "username")
|
||||
theme_cb = menu.find_element(By.NAME, "theme-switcher")
|
||||
palette_cb = menu.find_element(By.NAME, "palette")
|
||||
self.assertTrue(username_cb.is_selected())
|
||||
self.assertTrue(theme_cb.is_selected())
|
||||
# 6. Click theme-switcher box to uncheck it
|
||||
theme_cb.click()
|
||||
self.assertFalse(theme_cb.is_selected())
|
||||
self.assertTrue(palette_cb.is_selected())
|
||||
# 6. Click palette box to uncheck it
|
||||
palette_cb.click()
|
||||
self.assertFalse(palette_cb.is_selected())
|
||||
self.browser.execute_script("window.__no_reload_marker = True")
|
||||
# 7. Submit the menu form via [type="submit"] btn inside menu
|
||||
menu.find_element(By.CSS_SELECTOR, '[type="submit"]').click()
|
||||
@@ -70,24 +70,24 @@ class DashboardMaintenanceTest(FunctionalTest):
|
||||
self.browser.find_element(By.ID, "id_applet_menu").is_displayed()
|
||||
)
|
||||
)
|
||||
# 8. wait_for theme-switcher applet to be gone
|
||||
# 8. wait_for palette applet to be gone
|
||||
self.wait_for(
|
||||
lambda: self.assertRaises(
|
||||
NoSuchElementException,
|
||||
self.browser.find_element,
|
||||
By.ID, "id_applet_theme_switcher"
|
||||
By.ID, "id_applet_palette"
|
||||
)
|
||||
)
|
||||
# 9. assert id_applet_username remains
|
||||
self.browser.find_element(By.ID, "id_applet_username")
|
||||
# 10. Click gear again, find menu, find theme-switcher checkbox; assert now NOT selected
|
||||
# 10. Click gear again, find menu, find palette checkbox; assert now NOT selected
|
||||
dash_gear.click()
|
||||
self.assertFalse(theme_cb.is_selected())
|
||||
self.assertFalse(palette_cb.is_selected())
|
||||
# 11. Click it to re-check box; submit
|
||||
theme_cb.click()
|
||||
self.assertTrue(theme_cb.is_selected())
|
||||
palette_cb.click()
|
||||
self.assertTrue(palette_cb.is_selected())
|
||||
menu.find_element(By.CSS_SELECTOR, '[type="submit"]').click()
|
||||
# 12. wait_for id_applet_theme_switcher to reappear
|
||||
# 12. wait_for id_applet_palette to reappear
|
||||
self.wait_for(
|
||||
lambda: self.assertFalse(
|
||||
self.browser.find_element(By.ID, "id_applet_menu").is_displayed()
|
||||
@@ -95,7 +95,7 @@ class DashboardMaintenanceTest(FunctionalTest):
|
||||
)
|
||||
self.wait_for(
|
||||
lambda: self.assertTrue(
|
||||
self.browser.find_element(By.ID, "id_applet_theme_switcher")
|
||||
self.browser.find_element(By.ID, "id_applet_palette")
|
||||
)
|
||||
)
|
||||
self.assertTrue(self.browser.execute_script("return window.__no_reload_marker === true"))
|
||||
|
||||
Reference in New Issue
Block a user