Skip to content

Commit

Permalink
Reduce e2e test flakiness by using waiting methods (#7907)
Browse files Browse the repository at this point in the history
* Reduce graphviz e2e test flakiness

* Fix other test

* Fix test

* Update frontend license audit

* Fix audit scan

* Fix link
  • Loading branch information
LukasMasuch committed Jan 5, 2024
1 parent 7ee8f2b commit 02022e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion e2e_playwright/st_both_query_params_error_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


def test_query_params_exception_msg(app: Page):
assert app.get_by_test_id("stException") is not None
expect(app.get_by_test_id("stException")).to_be_visible()
expect(
app.get_by_text(
"Using st.query_params together with either st.experimental_get_query_params or st.experimental_set_query_params is not supported. Please convert your app to only use st.query_params"
Expand Down
22 changes: 11 additions & 11 deletions e2e_playwright/st_graphviz_chart_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@ def click_fullscreen(app: Page):

def test_initial_setup(app: Page):
"""Initial setup: ensure charts are loaded."""

wait_for_app_run(app)
title_count = len(app.locator(".stGraphVizChart > svg > g > title").all())
assert title_count == 6
expect(app.locator(".stGraphVizChart > svg > g > title")).to_have_count(6)


def test_shows_left_and_right_graph(app: Page):
"""Test if it shows left and right graph."""

left_text = app.locator(".stGraphVizChart > svg > g > title").nth(3).text_content()
right_text = app.locator(".stGraphVizChart > svg > g > title").nth(4).text_content()
assert "Left" in left_text and "Right" in right_text
expect(app.locator(".stGraphVizChart > svg > g > title").nth(3)).to_have_text(
"Left"
)
expect(app.locator(".stGraphVizChart > svg > g > title").nth(4)).to_have_text(
"Right"
)


def test_first_graph_dimensions(app: Page):
"""Test the dimensions of the first graph."""

first_graph_svg = get_first_graph_svg(app)
assert first_graph_svg.get_attribute("width") == "79pt"
assert first_graph_svg.get_attribute("height") == "116pt"
expect(first_graph_svg).to_have_attribute("width", "79pt")
expect(first_graph_svg).to_have_attribute("height", "116pt")


def test_first_graph_fullscreen(app: Page, assert_snapshot: ImageCompareFunction):
Expand Down Expand Up @@ -84,8 +84,8 @@ def test_first_graph_after_exit_fullscreen(
click_fullscreen(app)

first_graph_svg = get_first_graph_svg(app)
assert first_graph_svg.get_attribute("width") == "79pt"
assert first_graph_svg.get_attribute("height") == "116pt"
expect(first_graph_svg).to_have_attribute("width", "79pt")
expect(first_graph_svg).to_have_attribute("height", "116pt")
assert_snapshot(first_graph_svg, name="graphviz_after_exit_fullscreen")


Expand Down

0 comments on commit 02022e7

Please sign in to comment.