mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix(playwright): Download dashboard correctly (#35484)
Co-authored-by: Erkka Tahvanainen <erkka.tahvanainen@confidently.fi>
This commit is contained in:
committed by
GitHub
parent
0b3fe3d60c
commit
d089a96163
@@ -216,6 +216,13 @@ class WebDriverPlaywright(WebDriverProxy):
|
||||
|
||||
return error_messages
|
||||
|
||||
@staticmethod
|
||||
def _get_screenshot(page: Page, element: Locator, element_name: str) -> bytes:
|
||||
if element_name == "standalone":
|
||||
return page.screenshot(full_page=True)
|
||||
else:
|
||||
return element.screenshot()
|
||||
|
||||
def get_screenshot( # pylint: disable=too-many-locals, too-many-statements # noqa: C901
|
||||
self, url: str, element_name: str, user: User
|
||||
) -> bytes | None:
|
||||
@@ -363,11 +370,18 @@ class WebDriverPlaywright(WebDriverProxy):
|
||||
"falling back to standard screenshot"
|
||||
)
|
||||
)
|
||||
img = element.screenshot()
|
||||
img = WebDriverPlaywright._get_screenshot(
|
||||
page, element, element_name
|
||||
)
|
||||
else:
|
||||
img = element.screenshot()
|
||||
img = WebDriverPlaywright._get_screenshot(
|
||||
page, element, element_name
|
||||
)
|
||||
else:
|
||||
img = element.screenshot()
|
||||
img = WebDriverPlaywright._get_screenshot(
|
||||
page, element, element_name
|
||||
)
|
||||
|
||||
except PlaywrightTimeout:
|
||||
# raise again for the finally block, but handled above
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user