Skip to content

Commit

Permalink
fix: change order of webdriver timeout checks (#22698)
Browse files Browse the repository at this point in the history
  • Loading branch information
eschutho committed Jan 17, 2023
1 parent edcbf59 commit 0a2fc9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions superset/utils/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,19 @@ def get_screenshot(
element = WebDriverWait(driver, self._screenshot_locate_wait).until(
EC.presence_of_element_located((By.CLASS_NAME, element_name))
)
logger.debug("Wait for .loading to be done")
WebDriverWait(driver, self._screenshot_load_wait).until_not(
EC.presence_of_all_elements_located((By.CLASS_NAME, "loading"))
)
logger.debug("Wait for chart to have content")

logger.debug("Wait for chart containers to draw")
WebDriverWait(driver, self._screenshot_locate_wait).until(
EC.visibility_of_all_elements_located(
(By.CLASS_NAME, "slice_container")
)
)

logger.debug("Wait for loading element of charts to be gone")
WebDriverWait(driver, self._screenshot_load_wait).until_not(
EC.presence_of_all_elements_located((By.CLASS_NAME, "loading"))
)

selenium_animation_wait = current_app.config[
"SCREENSHOT_SELENIUM_ANIMATION_WAIT"
]
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/thumbnails_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def test_screenshot_selenium_load_wait(self, mock_webdriver, mock_webdriver_wait
)
url = get_url_path("Superset.slice", slice_id=1, standalone="true")
webdriver.get_screenshot(url, "chart-container", user=user)
assert mock_webdriver_wait.call_args_list[1] == call(ANY, 15)
assert mock_webdriver_wait.call_args_list[2] == call(ANY, 15)

@patch("superset.utils.webdriver.WebDriverWait")
@patch("superset.utils.webdriver.firefox")
Expand Down

0 comments on commit 0a2fc9c

Please sign in to comment.