diff --git a/tests/e2e/bugs/0666-sidebar/test_sidebar_colors.py b/tests/e2e/bugs/0666-sidebar/test_sidebar_colors.py index 1f519f35a..4949550b0 100644 --- a/tests/e2e/bugs/0666-sidebar/test_sidebar_colors.py +++ b/tests/e2e/bugs/0666-sidebar/test_sidebar_colors.py @@ -2,8 +2,7 @@ from colors import bg_color, fg_color from conftest import ShinyAppProc - -# from controls import Sidebar +from controls import Sidebar from playwright.sync_api import Page, expect @@ -29,8 +28,7 @@ def test_sidebar_bg_colors(page: Page, local_app: ShinyAppProc) -> None: expect(first_sidebar).to_have_css("background-color", bg_color) expect(first_sidebar).to_have_css("color", fg_color) - # # TODO-karan; Test that sidebar position is left - # s1 = Sidebar(page, "s1") - # s1.expect_position("left") - # s2 = Sidebar(page, "s2") - # s2.expect_position("right") + s1 = Sidebar(page, "s1") + s1.expect_position("left") + s2 = Sidebar(page, "s2") + s2.expect_position("right") diff --git a/tests/e2e/controls.py b/tests/e2e/controls.py index 4e337361e..b44ae26a1 100644 --- a/tests/e2e/controls.py +++ b/tests/e2e/controls.py @@ -2390,10 +2390,22 @@ def __init__(self, page: Page, id: str) -> None: loc_container="div.bslib-sidebar-layout", ) self.loc_handle = self.loc_container.locator("button.collapse-toggle") + self.loc_position = self.loc.locator("..") def expect_title(self, value: PatternOrStr, *, timeout: Timeout = None) -> None: playwright_expect(self.loc).to_have_text(value, timeout=timeout) + def expect_position( + self, position: Literal["left", "right"], *, timeout: Timeout = None + ) -> None: + is_right_sidebar = position == "right" + _expect_class_value( + self.loc_position, + f"sidebar-{position}", + is_right_sidebar, + timeout=timeout, + ) + def expect_handle(self, exists: bool, *, timeout: Timeout = None) -> None: playwright_expect(self.loc_handle).to_have_count(int(exists), timeout=timeout)