From 3004b03295d852a2d070d77348ec35ebdb513876 Mon Sep 17 00:00:00 2001 From: Karan Gathani Date: Thu, 9 Jan 2025 20:49:51 -0800 Subject: [PATCH 1/2] Add missing expect_max_height method for value box controllers --- shiny/playwright/controller/_card.py | 15 +++++++++++++++ .../value_box/kitchensink/test_valuebox_ks.py | 2 +- .../components/value_box/smoke/test_valuebox.py | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/shiny/playwright/controller/_card.py b/shiny/playwright/controller/_card.py index dda14507f..d00ac4b09 100644 --- a/shiny/playwright/controller/_card.py +++ b/shiny/playwright/controller/_card.py @@ -239,6 +239,21 @@ def expect_height(self, value: StyleValue, *, timeout: Timeout = None) -> None: timeout The maximum time to wait for the expectation to pass. Defaults to `None`. """ + _expect_style_to_have_value( + self.loc_container, "height", value, timeout=timeout + ) + + def expect_max_height(self, value: StyleValue, *, timeout: Timeout = None) -> None: + """ + Expects the value box to have a specific maximum height. + + Parameters + ---------- + value + The expected maximum height value. + timeout + The maximum time to wait for the expectation to pass. Defaults to `None`. + """ _expect_style_to_have_value( self.loc_container, "max-height", value, timeout=timeout ) diff --git a/tests/playwright/shiny/components/value_box/kitchensink/test_valuebox_ks.py b/tests/playwright/shiny/components/value_box/kitchensink/test_valuebox_ks.py index 67b855cce..08e4609f7 100644 --- a/tests/playwright/shiny/components/value_box/kitchensink/test_valuebox_ks.py +++ b/tests/playwright/shiny/components/value_box/kitchensink/test_valuebox_ks.py @@ -99,7 +99,7 @@ def test_valuebox(page: Page, local_app: ShinyAppProc) -> None: assert get_value_box_bg_color(value_box4) == "rgb(255, 255, 255)" value_box5 = controller.ValueBox(page, "valuebox5") - value_box5.expect_height("500px") + value_box5.expect_max_height("500px") assert get_title_tag_name(value_box5) == "p" value_box5.expect_title("No showcase w/ showcase layout") value_box5.expect_value("Red text - fill is False") 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 4574cb5ff..88bec6bc2 100644 --- a/tests/playwright/shiny/components/value_box/smoke/test_valuebox.py +++ b/tests/playwright/shiny/components/value_box/smoke/test_valuebox.py @@ -19,7 +19,8 @@ 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("500px") + value_box.expect_max_height("500px") + value_box.expect_height("300px") value_box.expect_title("title") value_box.expect_value("value") value_box.expect_body(["content", "more body"]) From 37a28e7cf17d57efe333e401c78c556e09f6f248 Mon Sep 17 00:00:00 2001 From: Karan Gathani Date: Thu, 27 Feb 2025 10:49:24 -0800 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 476338fe7..ef056b447 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,10 +15,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * `shiny create` includes new and improved `ui.Chat()` template options. Most of these templates leverage the new [`{chatlas}` package](https://posit-dev.github.io/chatlas/), our opinionated approach to interfacing with various LLM. (#1806) +* Added a new `expect_max_height()` method to the Valuebox controllers to check the maximum height of a value box (#1816) + ### Bug fixes * `ui.Chat()` now correctly handles new `ollama.chat()` return value introduced in `ollama` v0.4. (#1787) +* Updated `expect_height()` for Valuebox controllers to check the height property instead of max-height. (#1816) + ## [1.2.1] - 2024-11-14 ### Bug fixes