Skip to content

Commit

Permalink
Stabalize test_icon.py flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Apr 22, 2024
1 parent 9c62914 commit 6bccb82
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions panel/tests/ui/widgets/test_icon.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def test_button_icon_name(page):
serve_component(page, button)

assert button.name == "Like"
assert page.locator(".bk-IconLabel").text_content() == "Like"
wait_until(page.locator(".bk-IconLabel").text_content() == "Like", page)


def test_button_icon_name_dynamically(page):
Expand All @@ -356,23 +356,24 @@ def test_button_icon_name_dynamically(page):

button.name = "Dislike"
assert button.name == "Dislike"
assert page.locator(".bk-IconLabel").text_content() == "Dislike"
wait_until(lambda: page.locator(".bk-IconLabel").text_content() == "Dislike", page)

assert page.locator(".bk-IconLabel").bounding_box()["width"] < 40

button.size = "2em"
# check size
assert page.locator(".bk-IconLabel").bounding_box()["width"] >= 40
wait_until(lambda: page.locator(".bk-IconLabel").bounding_box()["width"] >= 40, page)


def test_button_icon_description_dynamically(page):
button = ButtonIcon(description="Like")
serve_component(page, button)

assert button.description == "Like"
wait_until(lambda: page.locator(".bk-TablerIcon"), page)
page.locator(".bk-TablerIcon").click()
assert page.locator(".bk-tooltip-content").text_content() == "Like"

button.description = "Dislike"
page.locator(".bk-TablerIcon").click()
assert page.locator(".bk-tooltip-content").text_content() == "Dislike"
wait_until(lambda: page.locator(".bk-tooltip-content").text_content() == "Dislike", page)

0 comments on commit 6bccb82

Please sign in to comment.