mirror of https://github.com/apache/superset.git
feat: make screenshot timeout configurable (#10517)
* made screenshot timeout configurable * added default value to config and refractored use * black * updated config comment * moves config variables to thumbnail section Co-authored-by: Jason Davis <@dropbox.com>
This commit is contained in:
parent
e040bf7acf
commit
72ced53d2a
|
@ -337,6 +337,12 @@ THUMBNAIL_CACHE_CONFIG: CacheConfig = {
|
|||
"CACHE_NO_NULL_WARNING": True,
|
||||
}
|
||||
|
||||
# Used for thumbnails and other api: Time in seconds before selenium
|
||||
# times out after trying to locate an element on the page and wait
|
||||
# for that element to load for an alert screenshot.
|
||||
SCREENSHOT_LOCATE_WAIT = 10
|
||||
SCREENSHOT_LOAD_WAIT = 60
|
||||
|
||||
# ---------------------------------------------------
|
||||
# Image and file configuration
|
||||
# ---------------------------------------------------
|
||||
|
|
|
@ -159,11 +159,11 @@ class AuthWebDriverProxy:
|
|||
time.sleep(SELENIUM_HEADSTART)
|
||||
try:
|
||||
logger.debug("Wait for the presence of %s", element_name)
|
||||
element = WebDriverWait(driver, 10).until(
|
||||
EC.presence_of_element_located((By.CLASS_NAME, element_name))
|
||||
)
|
||||
element = WebDriverWait(
|
||||
driver, current_app.config["SCREENSHOT_LOCATE_WAIT"]
|
||||
).until(EC.presence_of_element_located((By.CLASS_NAME, element_name)))
|
||||
logger.debug("Wait for .loading to be done")
|
||||
WebDriverWait(driver, 60).until_not(
|
||||
WebDriverWait(driver, current_app.config["SCREENSHOT_LOAD_WAIT"]).until_not(
|
||||
EC.presence_of_all_elements_located((By.CLASS_NAME, "loading"))
|
||||
)
|
||||
logger.info("Taking a PNG screenshot")
|
||||
|
|
Loading…
Reference in New Issue