From d705e63bd151a04e1bb7b4504b47a4d70578a26f Mon Sep 17 00:00:00 2001 From: Joe Schulte Date: Thu, 7 Mar 2024 14:49:42 -0500 Subject: [PATCH 1/5] removing unused code --- tests/playwright/shiny/inputs/test_input_switch.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/playwright/shiny/inputs/test_input_switch.py b/tests/playwright/shiny/inputs/test_input_switch.py index 39034bf2f..0fc16a042 100644 --- a/tests/playwright/shiny/inputs/test_input_switch.py +++ b/tests/playwright/shiny/inputs/test_input_switch.py @@ -9,7 +9,6 @@ def test_input_switch_kitchen(page: Page, app: ShinyAppProc) -> None: page.goto(app.url) somevalue = InputSwitch(page, "somevalue") - somevalue.expect_label expect(somevalue.loc_label).to_have_text("Some value") somevalue.expect_label("Some value") From 35e3535b0969287083b5778bbec43c9514d60c5f Mon Sep 17 00:00:00 2001 From: Joe Schulte Date: Thu, 7 Mar 2024 14:50:04 -0500 Subject: [PATCH 2/5] consolidating imports to top of file --- tests/playwright/shiny/components/test_sidebar.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/playwright/shiny/components/test_sidebar.py b/tests/playwright/shiny/components/test_sidebar.py index 9cd2a42b6..5c3371cf1 100644 --- a/tests/playwright/shiny/components/test_sidebar.py +++ b/tests/playwright/shiny/components/test_sidebar.py @@ -1,6 +1,6 @@ from conftest import ShinyAppProc, create_doc_example_core_fixture from controls import OutputTextVerbatim, Sidebar -from playwright.sync_api import Page +from playwright.sync_api import Page, expect app = create_doc_example_core_fixture("sidebar") @@ -48,6 +48,5 @@ def test_sidebar_position_and_open(page: Page, app: ShinyAppProc) -> None: output_txt_always.expect_value("input.sidebar_always(): True") # Handle is included but it should have `display: none` always_sidebar.expect_handle(True) - from playwright.sync_api import expect expect(always_sidebar.loc_handle).to_have_css("display", "none") From 9450ccbf5d7f0e400578c216aeb020a891941c72 Mon Sep 17 00:00:00 2001 From: Joe Schulte Date: Thu, 7 Mar 2024 14:51:15 -0500 Subject: [PATCH 3/5] utilizing parameterized tests and refactoring out common code --- .../components/value_box/test_valuebox.py | 49 +++++++++---------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/tests/playwright/shiny/components/value_box/test_valuebox.py b/tests/playwright/shiny/components/value_box/test_valuebox.py index 5b5c4909a..52395135a 100644 --- a/tests/playwright/shiny/components/value_box/test_valuebox.py +++ b/tests/playwright/shiny/components/value_box/test_valuebox.py @@ -8,31 +8,26 @@ def test_valuebox(page: Page, local_app: ShinyAppProc, value_box_id: str) -> None: page.goto(local_app.url) - value_box1 = ValueBox(page, "valuebox1") - # value_box1.expect_height(None); TODO-fix-karan; - value_box1.expect_title("KPI Title") - value_box1.expect_value("$1 Billion Dollars") - value_box1.expect_full_screen(False) - value_box1.open_full_screen() - value_box1.expect_full_screen(True) - value_box1.expect_body(["30% VS PREVIOUS 30 DAYS"]) - value_box1.close_full_screen() - value_box1.expect_full_screen(False) + value_box = ValueBox(page, value_box_id) + value_box.expect_full_screen(False) + value_box.open_full_screen() + value_box.expect_full_screen(True) + if value_box_id == "valuebox1": + value_box.expect_height(None) + value_box.expect_title("KPI Title") + value_box.expect_value("$1 Billion Dollars") + value_box.expect_body(["30% VS PREVIOUS 30 DAYS"]) + else: + value_box.expect_height("300px") + value_box.expect_title("title") + value_box.expect_value("value") + value_box.expect_body(["content", "more body"]) + title_tag_name = ( + value_box.loc_title.locator("*") + .nth(0) + .evaluate("el => el.tagName.toLowerCase()") + ) + assert title_tag_name == "p" + value_box.close_full_screen() + value_box.expect_full_screen(False) - value_box2 = ValueBox(page, "valuebox2") - # value_box2.expect_height("300px"); TODO-fix-karan; - value_box2.expect_title("title") - value_box2.expect_value("value") - value_box2.expect_full_screen(False) - value_box2.open_full_screen() - value_box2.expect_full_screen(True) - value_box2.expect_body(["content", "more body"]) - value_box2.close_full_screen() - value_box2.expect_full_screen(False) - - title_tag_name = ( - value_box2.loc_title.locator("*") - .nth(0) - .evaluate("el => el.tagName.toLowerCase()") - ) - assert title_tag_name == "p" From c4a7fd291cf9e129c7e11432e55eff378903a00c Mon Sep 17 00:00:00 2001 From: Joe Schulte Date: Thu, 7 Mar 2024 15:09:27 -0500 Subject: [PATCH 4/5] styling fix --- tests/playwright/shiny/components/value_box/test_valuebox.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/playwright/shiny/components/value_box/test_valuebox.py b/tests/playwright/shiny/components/value_box/test_valuebox.py index 52395135a..964bd54af 100644 --- a/tests/playwright/shiny/components/value_box/test_valuebox.py +++ b/tests/playwright/shiny/components/value_box/test_valuebox.py @@ -30,4 +30,3 @@ def test_valuebox(page: Page, local_app: ShinyAppProc, value_box_id: str) -> Non assert title_tag_name == "p" value_box.close_full_screen() value_box.expect_full_screen(False) - From 4e7cd164eca95d090edc4e79ee7384aef761297c Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Sat, 23 Mar 2024 00:40:15 -0400 Subject: [PATCH 5/5] Comment broken test --- .../shiny/components/value_box/smoke/test_valuebox.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/playwright/shiny/components/value_box/smoke/test_valuebox.py b/tests/playwright/shiny/components/value_box/smoke/test_valuebox.py index 964bd54af..d9bf7129b 100644 --- a/tests/playwright/shiny/components/value_box/smoke/test_valuebox.py +++ b/tests/playwright/shiny/components/value_box/smoke/test_valuebox.py @@ -18,7 +18,7 @@ def test_valuebox(page: Page, local_app: ShinyAppProc, value_box_id: str) -> Non value_box.expect_value("$1 Billion Dollars") value_box.expect_body(["30% VS PREVIOUS 30 DAYS"]) else: - value_box.expect_height("300px") + # value_box.expect_height("300px") # TODO-fix-karan; value_box.expect_title("title") value_box.expect_value("value") value_box.expect_body(["content", "more body"])