Skip to content

Commit

Permalink
fix(pytest): put user output in clean output widget
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenbreddels committed Jun 16, 2023
1 parent 6f0b4bc commit bf8d147
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions solara/test/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,21 @@ def solara_test(solara_server, solara_app, page_session: "playwright.sync_api.Pa
assert len(keys) == 1, "expected only one context, got %s" % keys
context = solara.server.app.contexts[keys[0]]
with context:
test_output_warmup = widgets.Output()
test_output = widgets.Output()
page_session.locator("text=Test in solara").wait_for()
context.container.children[0].children[1].children[1].children = [test_output] # type: ignore
context.container.children[0].children[1].children[1].children = [test_output_warmup] # type: ignore
try:
with test_output:
with test_output_warmup:
warmup()
button = page_session.locator(".solara-warmup-widget")
button.wait_for()
page_session.evaluate("document.fonts.ready")
button.click()
button.wait_for(state="detached")
page_session.evaluate("document.fonts.ready")
context.container.children[0].children[1].children[1].children = [test_output] # type: ignore
with test_output:
yield
finally:
test_output.close()
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.

0 comments on commit bf8d147

Please sign in to comment.