Skip to content

Commit

Permalink
fix: tests being extremely flaky
Browse files Browse the repository at this point in the history
  • Loading branch information
iisakkirotko committed Sep 22, 2023
1 parent c312109 commit b984f4d
Show file tree
Hide file tree
Showing 25 changed files with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions tests/integration/menu_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def Page():
def on_click():
text.set("Works!")

solara.Text(text.value, classes=["test-class-menu"])
solara.Text(text.value, classes=["test-class-text"])

menu_activator = solara.Button("activator")
menu_child = solara.Button("child", on_click=on_click)
menu_child = solara.Button("child", on_click=on_click, classes=["test-class-child"])

if test_type == "Menu":
Menu(activator=menu_activator, children=[menu_child])
Expand All @@ -33,20 +33,18 @@ def on_click():

solara.display(Page())

# For some reason flake8 thinks that full_page is not used
full_page = page_session.locator(".test-class-container") # Ignore: F841
text_el = page_session.locator(".test-class-menu")
text_el = page_session.locator(".test-class-text")
expect(text_el).to_contain_text("pre-test")
activator_button = page_session.locator("text=activator")
assert_solara_snapshot(full_page.screenshot(), postfix="-" + test_type)
expect(page_session.locator(".test-class-child")).to_have_count(0)
if test_type == "ContextMenu":
activator_button.click(button="right")
else:
activator_button.click()

child_button = page_session.locator("text=child")
page_session.wait_for_timeout(350) # Wait for any animations after click
assert_solara_snapshot(full_page.screenshot(), postfix="-" + test_type + "-after")
expect(page_session.locator(".test-class-child")).to_be_visible
child_button.click()
page_session.wait_for_timeout(350)
expect(text_el).to_contain_text("Works!")
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit b984f4d

Please sign in to comment.