Skip to content

Commit a7d5d5e

Browse files
committed
Remove controller since their isn't much of anything worth providing. Cleanup test
1 parent 2eb2698 commit a7d5d5e

File tree

3 files changed

+10
-66
lines changed

3 files changed

+10
-66
lines changed

shiny/playwright/controller/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@
5050
from ._chat import (
5151
Chat,
5252
)
53-
from ._markdown_stream import (
54-
MarkdownStream,
55-
)
5653
from ._navs import (
5754
NavPanel,
5855
NavsetBar,
@@ -107,7 +104,6 @@
107104
"OutputUi",
108105
"ValueBox",
109106
"Card",
110-
"MarkdownStream",
111107
"Chat",
112108
"Accordion",
113109
"AccordionPanel",

shiny/playwright/controller/_markdown_stream.py

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
from playwright.sync_api import Page, expect
2-
from utils.deploy_utils import skip_on_webkit
32

4-
from shiny.playwright import controller
53
from shiny.run import ShinyAppProc
64

75

8-
async def is_element_scrolled_to_bottom(page: Page, selector: str) -> bool:
9-
return await page.evaluate(
6+
def is_element_scrolled_to_bottom(page: Page, selector: str) -> bool:
7+
return page.evaluate(
108
"""(selector) => {
119
const element = document.querySelector(selector);
1210
if (!element) return false;
@@ -16,23 +14,24 @@ async def is_element_scrolled_to_bottom(page: Page, selector: str) -> bool:
1614
const scrollHeight = Math.round(element.scrollHeight);
1715
const clientHeight = Math.round(element.clientHeight);
1816
17+
// Check if the element is scrollable
18+
if (scrollHeight <= clientHeight) return false;
19+
1920
// Check if we're at the bottom (allowing for 1px difference due to rounding)
2021
return Math.abs((scrollTop + clientHeight) - scrollHeight) <= 1;
2122
}""",
2223
selector,
2324
)
2425

2526

26-
@skip_on_webkit
27-
async def test_validate_stream_basic(page: Page, local_app: ShinyAppProc) -> None:
27+
def test_validate_stream_basic(page: Page, local_app: ShinyAppProc) -> None:
2828
page.goto(local_app.url)
2929

30-
stream = controller.MarkdownStream(page, "shiny-readme")
31-
32-
expect(stream.loc).to_be_visible(timeout=30 * 1000)
33-
stream.expect_content("pip install shiny")
30+
stream = page.locator("#shiny-readme")
31+
expect(stream).to_be_visible(timeout=30 * 1000)
32+
expect(stream).to_contain_text("pip install shiny")
3433

3534
# Check that the card body container (the parent of the markdown stream) is scrolled
3635
# all the way to the bottom
37-
is_scrolled = await is_element_scrolled_to_bottom(page, ".card-body")
36+
is_scrolled = is_element_scrolled_to_bottom(page, ".card-body")
3837
assert is_scrolled, "The card body container should be scrolled to the bottom"

0 commit comments

Comments
 (0)