mirror of
https://github.com/Paillat-dev/flagger.git
synced 2026-01-02 09:16:22 +00:00
🥅 Add error handling for UI setup to improve robustness (#4)
This commit is contained in:
@@ -233,6 +233,7 @@ class FlagRenderer:
|
|||||||
return new_path
|
return new_path
|
||||||
|
|
||||||
async def _setup_ui(self, page: playwright.async_api.Page) -> None:
|
async def _setup_ui(self, page: playwright.async_api.Page) -> None:
|
||||||
|
try:
|
||||||
side_panel_btn = page.locator(SITE_PANEL_BTN_XPATH)
|
side_panel_btn = page.locator(SITE_PANEL_BTN_XPATH)
|
||||||
await side_panel_btn.click(timeout=CLICK_TIMEOUT)
|
await side_panel_btn.click(timeout=CLICK_TIMEOUT)
|
||||||
|
|
||||||
@@ -246,6 +247,9 @@ class FlagRenderer:
|
|||||||
|
|
||||||
theater_mode_btn = page.get_by_text(THEATER_MODE_TEXT)
|
theater_mode_btn = page.get_by_text(THEATER_MODE_TEXT)
|
||||||
await theater_mode_btn.click(timeout=CLICK_TIMEOUT, force=True)
|
await theater_mode_btn.click(timeout=CLICK_TIMEOUT, force=True)
|
||||||
|
except playwright.async_api.TimeoutError:
|
||||||
|
logger.exception("Failed to setup the UI")
|
||||||
|
logger.debug("Page content: %s", await page.content())
|
||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
async def render(self, flag: "Flag") -> AsyncIterator[Path]:
|
async def render(self, flag: "Flag") -> AsyncIterator[Path]:
|
||||||
|
|||||||
Reference in New Issue
Block a user