Skip to content

Commit ea1fa2c

Browse files
authored
chore(test): Playwright test refactors and clean up (#1204)
1 parent 26d6d45 commit ea1fa2c

File tree

3 files changed

+23
-31
lines changed

3 files changed

+23
-31
lines changed

tests/playwright/shiny/components/test_sidebar.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from conftest import ShinyAppProc, create_doc_example_core_fixture
22
from controls import OutputTextVerbatim, Sidebar
3-
from playwright.sync_api import Page
3+
from playwright.sync_api import Page, expect
44

55
app = create_doc_example_core_fixture("sidebar")
66

@@ -48,6 +48,5 @@ def test_sidebar_position_and_open(page: Page, app: ShinyAppProc) -> None:
4848
output_txt_always.expect_value("input.sidebar_always(): True")
4949
# Handle is included but it should have `display: none`
5050
always_sidebar.expect_handle(True)
51-
from playwright.sync_api import expect
5251

5352
expect(always_sidebar.loc_handle).to_have_css("display", "none")

tests/playwright/shiny/components/value_box/smoke/test_valuebox.py

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,25 @@
88
def test_valuebox(page: Page, local_app: ShinyAppProc, value_box_id: str) -> None:
99
page.goto(local_app.url)
1010

11-
value_box1 = ValueBox(page, "valuebox1")
12-
# value_box1.expect_height(None); TODO-fix-karan;
13-
value_box1.expect_title("KPI Title")
14-
value_box1.expect_value("$1 Billion Dollars")
15-
value_box1.expect_full_screen(False)
16-
value_box1.open_full_screen()
17-
value_box1.expect_full_screen(True)
18-
value_box1.expect_body(["30% VS PREVIOUS 30 DAYS"])
19-
value_box1.close_full_screen()
20-
value_box1.expect_full_screen(False)
21-
22-
value_box2 = ValueBox(page, "valuebox2")
23-
# value_box2.expect_height("300px"); TODO-fix-karan;
24-
value_box2.expect_title("title")
25-
value_box2.expect_value("value")
26-
value_box2.expect_full_screen(False)
27-
value_box2.open_full_screen()
28-
value_box2.expect_full_screen(True)
29-
value_box2.expect_body(["content", "more body"])
30-
value_box2.close_full_screen()
31-
value_box2.expect_full_screen(False)
32-
33-
title_tag_name = (
34-
value_box2.loc_title.locator("*")
35-
.nth(0)
36-
.evaluate("el => el.tagName.toLowerCase()")
37-
)
38-
assert title_tag_name == "p"
11+
value_box = ValueBox(page, value_box_id)
12+
value_box.expect_full_screen(False)
13+
value_box.open_full_screen()
14+
value_box.expect_full_screen(True)
15+
if value_box_id == "valuebox1":
16+
value_box.expect_height(None)
17+
value_box.expect_title("KPI Title")
18+
value_box.expect_value("$1 Billion Dollars")
19+
value_box.expect_body(["30% VS PREVIOUS 30 DAYS"])
20+
else:
21+
# value_box.expect_height("300px") # TODO-fix-karan;
22+
value_box.expect_title("title")
23+
value_box.expect_value("value")
24+
value_box.expect_body(["content", "more body"])
25+
title_tag_name = (
26+
value_box.loc_title.locator("*")
27+
.nth(0)
28+
.evaluate("el => el.tagName.toLowerCase()")
29+
)
30+
assert title_tag_name == "p"
31+
value_box.close_full_screen()
32+
value_box.expect_full_screen(False)

tests/playwright/shiny/inputs/test_input_switch.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ def test_input_switch_kitchen(page: Page, app: ShinyAppProc) -> None:
99
page.goto(app.url)
1010

1111
somevalue = InputSwitch(page, "somevalue")
12-
somevalue.expect_label
1312

1413
expect(somevalue.loc_label).to_have_text("Some value")
1514
somevalue.expect_label("Some value")

0 commit comments

Comments
 (0)