Skip to content

Commit f097d97

Browse files
authored
fix(tests): Fix several failing tests (#2029)
1 parent d656fdb commit f097d97

File tree

9 files changed

+28
-3
lines changed

9 files changed

+28
-3
lines changed

tests/playwright/ai_generated_apps/bookmark/accordion/test_accordion_bookmarking.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ def test_accordion_bookmarking_demo(page: Page, app: ShinyAppProc) -> None:
1919
acc_mod.expect_open(["Section A"])
2020
acc_mod.set(["Section C"])
2121

22+
existing_url = page.url
2223
# click bookmark button
2324
bookmark_button = controller.InputBookmarkButton(page)
2425
bookmark_button.click()
2526

27+
page.wait_for_url(lambda url: url != existing_url, timeout=5 * 1000)
28+
2629
# reload page
2730
page.reload()
2831

@@ -32,8 +35,12 @@ def test_accordion_bookmarking_demo(page: Page, app: ShinyAppProc) -> None:
3235
acc_single.set([])
3336
acc_mod.set([])
3437

38+
existing_url = page.url
39+
3540
bookmark_button.click()
3641

42+
page.wait_for_url(lambda url: url != existing_url, timeout=5 * 1000)
43+
3744
# reload page
3845
page.reload()
3946

tests/playwright/ai_generated_apps/bookmark/input_checkbox/test_input_checkbox_express_bookmarking.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ def test_checkbox_demo(page: Page, app: ShinyAppProc) -> None:
3333
module_checkbox.expect_checked(True)
3434
module_text.expect_value("Checkbox value: True")
3535

36+
existing_url = page.url
3637
bookmark_button = controller.InputBookmarkButton(page)
3738
bookmark_button.click()
3839

40+
page.wait_for_url(lambda url: url != existing_url, timeout=5 * 1000)
41+
3942
# reload the page to test bookmark
4043
page.reload()
4144

tests/playwright/ai_generated_apps/bookmark/input_checkbox_group/test_input_checkbox_group_express_bookmarking.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ def test_checkbox_group_demo(page: Page, app: ShinyAppProc) -> None:
3535
module_group.expect_selected(["Choice A", "Choice C"])
3636
module_text.expect_value("Checkbox group values: ('Choice A', 'Choice C')")
3737

38+
existing_url = page.url
3839
# Bookmark the state
3940
bookmark_button = controller.InputBookmarkButton(page)
4041
bookmark_button.click()
42+
page.wait_for_url(lambda url: url != existing_url, timeout=5 * 1000)
4143

4244
# Reload the page to test bookmark
4345
page.reload()

tests/playwright/ai_generated_apps/bookmark/input_file/test_input_file_express_bookmarking.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,12 @@ def test_file_input_bookmarking(page: Page, app: ShinyAppProc) -> None:
4444

4545
mod_file_output_txt.expect_value("File name(s): users.csv, users2.csv")
4646

47+
existing_url = page.url
48+
4749
# click bookmark button
4850
bookmark_button = controller.InputBookmarkButton(page)
4951
bookmark_button.click()
52+
page.wait_for_url(lambda url: url != existing_url, timeout=5 * 1000)
5053

5154
page.reload()
5255

tests/playwright/ai_generated_apps/bookmark/input_password/test_input_password_express_bookmarking.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ def test_text_input_demo(page: Page, app: ShinyAppProc) -> None:
4646

4747
# click bookmark button
4848
bookmark_button = controller.InputBookmarkButton(page)
49+
existing_url = page.url
4950
bookmark_button.click()
5051

52+
page.wait_for_url(lambda url: url != existing_url, timeout=5 * 1000)
53+
5154
page.reload()
5255

5356
# Check if the values are retained after reloading the page

tests/playwright/ai_generated_apps/bookmark/navsets/test_navsets_express_bookmarking.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ def test_navsets_bookmarking_demo(
4444
mod_navset_cont = navset_controller(page, f"first-{navset_name}_{navset_variant}")
4545
mod_navset_cont.set(f"{navset_name}_b")
4646

47+
existing_url = page.url
48+
4749
# Click bookmark button
4850
controller.InputBookmarkButton(page).click()
49-
51+
page.wait_for_url(lambda url: url != existing_url, timeout=5 * 1000)
5052
# Reload page
5153
page.reload()
5254

@@ -55,3 +57,4 @@ def test_navsets_bookmarking_demo(
5557
navset_cont.expect_value(f"{navset_name}_c")
5658
mod_navset_collection.expect_value(navset_name)
5759
mod_navset_cont.expect_value(f"{navset_name}_b")
60+
mod_navset_cont.expect_value(f"{navset_name}_b")

tests/playwright/ai_generated_apps/bookmark/navsets/test_navsets_hidden_bookmarking.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ def test_navset_hidden_bookmarking(
4141
mod_navset_btn = controller.InputActionButton(page, f"first-{navset_id}_button")
4242
mod_navset_btn.click()
4343

44+
existing_url = page.url
45+
4446
# Click bookmark button
4547
controller.InputBookmarkButton(page).click()
48+
page.wait_for_url(lambda url: url != existing_url, timeout=5 * 1000)
4649

4750
# Reload page
4851
page.reload()

tests/playwright/examples/example_apps.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def get_apps(path: str) -> typing.List[str]:
8989
"FutureWarning: The default of observed=False is deprecated",
9090
# seaborn: https://github.com/mwaskom/seaborn/pull/3355
9191
"FutureWarning: use_inf_as_na option is deprecated",
92-
"pd.option_context('mode.use_inf_as_na", # continutation of line above
92+
"pd.option_context('mode.use_inf_as_na", # continutation of line above,
93+
"RuntimeWarning: invalid value encountered in dot", # some groups didn't have enough data points to create a meaningful line
9394
]
9495
app_allow_js_errors: typing.Dict[str, typing.List[str]] = {
9596
"examples/brownian": ["Failed to acquire camera feed:"],

tests/playwright/shiny/bookmark/chat/chatlas/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
# Use ChatOpenAI as it does not need credentials until submission to the server.
2525
# However, if we use `.set_turns()` and `.get_turns()`, a submission is never made to the server... therefore we don't need credentials.
2626
chat_client = chatlas.ChatOpenAI( # pyright: ignore[reportUnknownMemberType]
27-
turns=[],
2827
api_key="<not_utilized>",
2928
)
29+
chat_client.set_turns([]) # type: ignore[arg-type]
3030
chat.enable_bookmarking(chat_client, bookmark_store="url")
3131

3232

0 commit comments

Comments
 (0)