Skip to content

Commit b38472d

Browse files
committed
fixing flaky tests for stylesheet not loaded initially
1 parent d986a84 commit b38472d

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

tests/test_user_style.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,11 @@ def test_us002_legacy_themes(dash_duo, theme):
109109

110110
# Base styles: assert that the grid height is <= 400px because an unstyled
111111
# grid is very "tall"
112-
root_wrapper = dash_duo.find_element(".ag-root-wrapper")
113-
wrapper_height = root_wrapper.size["height"]
114-
assert wrapper_height <= 400, f"Grid appears to be unstyled: height is too tall ({wrapper_height}px)"
115-
112+
until(
113+
lambda: dash_duo.find_element(".ag-root-wrapper").size["height"] <= 400,
114+
timeout=3,
115+
msg=f"Grid appears to be unstyled: height is too tall ({dash_duo.find_element('.ag-root-wrapper').size['height']}px)"
116+
)
116117
# Specific themes: Assert that cell headers are bold
117118
header_cell_text = dash_duo.find_element(".ag-header-cell-text")
118119
font_weight = header_cell_text.value_of_css_property("font-weight")
@@ -155,9 +156,11 @@ def test_us003_part_themes(dash_duo, theme):
155156

156157
# Base styles: assert that the grid height is <= 400px because an unstyled
157158
# grid is very "tall"
158-
root_wrapper = dash_duo.find_element(".ag-root-wrapper")
159-
wrapper_height = root_wrapper.size["height"]
160-
assert wrapper_height <= 400, f"Grid appears to be unstyled: height is too tall ({wrapper_height}px)"
159+
until(
160+
lambda: dash_duo.find_element(".ag-root-wrapper").size["height"] <= 400,
161+
timeout=3,
162+
msg=f"Grid appears to be unstyled: height is too tall ({dash_duo.find_element('.ag-root-wrapper').size['height']}px)"
163+
)
161164

162165
# Specific themes: Assert that cell headers are bold
163166
header_cell_text = dash_duo.find_element(".ag-header-cell-text")

0 commit comments

Comments
 (0)