From 5aa3e7fd86f72a1c9bd749884a0b164ce7c55ff4 Mon Sep 17 00:00:00 2001 From: CopyDemon Date: Wed, 23 Oct 2024 11:02:21 -0700 Subject: [PATCH] revert timeout only left on load page and button click and test --- idaes_ui/fv/fsvis.py | 13 ++++++------- some/user_defined_path/test_diagram.svg | 1 + test_diagram.json | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 some/user_defined_path/test_diagram.svg create mode 100644 test_diagram.json diff --git a/idaes_ui/fv/fsvis.py b/idaes_ui/fv/fsvis.py index c697ac5..991fa8a 100644 --- a/idaes_ui/fv/fsvis.py +++ b/idaes_ui/fv/fsvis.py @@ -416,17 +416,16 @@ async def _async_save_diagram( from IPython.display import display as IPythonDisplay async with async_playwright() as p: - timeout = 800000 browser = await p.chromium.launch( - headless=True, args=["--no-sandbox"], timeout=timeout + headless=True, args=["--no-sandbox"], timeout=500000 ) context = await browser.new_context(viewport={"width": 1920, "height": 1080}) page = await context.new_page() try: # Go to visualizer URL and wait document load - await page.goto(live_server_url, timeout=timeout) - await page.wait_for_load_state("networkidle", timeout=timeout) + await page.goto(live_server_url) + await page.wait_for_load_state("networkidle") # Hover on download menu show download option list await page.hover("#diagram_download_icon") @@ -438,14 +437,14 @@ async def _async_save_diagram( await page.click("#headerExportSvgBtn") # Click download btn on UI pop modal - async with page.expect_download(timeout=timeout) as download_info: - await page.click(".control-button") + async with page.expect_download() as download_info: + await page.click(".control-button", timeout=500000) # Get download value download = await download_info.value # Wait for download to complete - download_path = await download.path(timeout=timeout) + download_path = await download.path() diagram_saved_path = os.path.join( save_to, f"{screenshot_name}.{image_type}" diff --git a/some/user_defined_path/test_diagram.svg b/some/user_defined_path/test_diagram.svg new file mode 100644 index 0000000..f39f4c1 --- /dev/null +++ b/some/user_defined_path/test_diagram.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test_diagram.json b/test_diagram.json new file mode 100644 index 0000000..ef17edf --- /dev/null +++ b/test_diagram.json @@ -0,0 +1 @@ +{"model": {"stream_table": {"index": [], "columns": ["Variable", "Units"], "data": []}, "id": "test_diagram", "unit_models": {}, "arcs": {}}, "routing_config": {}, "cells": []} \ No newline at end of file