Skip to content

Commit

Permalink
Update test_broadway.py
Browse files Browse the repository at this point in the history
  • Loading branch information
slaclau authored Jul 16, 2024
1 parent e38ed11 commit 6fea9ad
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions test/demo/broadway/test_broadway.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,19 @@ def on_activate(self, app):
def test_demo(demo, browser):
fig = get_test_figure(demo)
app = DemoApplication(fig, application_id="io.github.slaclau.plotly_gtk.test")

def screenshot():
directory = (pathlib.Path(__file__).parent / "results").resolve()

browser.get("http://127.0.0.1:8085/")
time.sleep(5)
browser.save_screenshot(directory / f"{demo}.png")

img = Image.open(directory / f"{demo}.png")
assert np.mean(img.convert("RGB").getdata()) < 0xFF
app.quit()
return False
test_thread = threading.Thread(daemon=True, target=screenshot)
test_thread.start()
app.run()

directory = (pathlib.Path(__file__).parent / "results").resolve()

browser.get("http://127.0.0.1:8085/")
time.sleep(5)
browser.save_screenshot(directory / f"{demo}.png")

img = Image.open(directory / f"{demo}.png")
assert np.mean(img.convert("RGB").getdata()) < 0xFF
app.quit()
test_thread.join()

0 comments on commit 6fea9ad

Please sign in to comment.