test(reports): fix stale warning assertions after timeout message change

- Update assert_any_call in per-tile spinner timeout test to include the
  new (load_wait=%ss) suffix and value
- Update assert_any_call in webdriver spinner timeout test to include the
  new (SCREENSHOT_LOAD_WAIT=%ss) suffix and value
- Fix test_per_tile_non_timeout_exceptions: RuntimeError is caught by the
  outer take_tiled_screenshot handler and returns None, not re-raised;
  rename and update assertion to match actual behavior

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Elizabeth Thompson
2026-05-06 19:53:23 +00:00
committed by Sophie
parent 8d7ffac945
commit 86d705dd01
2 changed files with 12 additions and 6 deletions

View File

@@ -356,20 +356,25 @@ class TestTakeTiledScreenshot:
# Warning logged for each tile that timed out
assert mock_logger.warning.call_count == 3
mock_logger.warning.assert_any_call(
"Timed out waiting for visible spinners to clear on tile %s/%s",
"Timed out waiting for visible spinners to clear on tile %s/%s "
"(load_wait=%ss)",
1,
3,
30,
)
def test_per_tile_non_timeout_exceptions_propagate(self, mock_page):
"""Non-timeout exceptions from wait_for_function are not swallowed."""
def test_per_tile_non_timeout_exceptions_return_none(self, mock_page):
"""Non-timeout exceptions from wait_for_function are caught by the outer
handler and return None rather than crashing the caller."""
mock_page.wait_for_function.side_effect = RuntimeError("browser crashed")
with pytest.raises(RuntimeError, match="browser crashed"):
take_tiled_screenshot(
with patch("superset.utils.screenshot_utils.logger"):
result = take_tiled_screenshot(
mock_page, "dashboard", tile_height=2000, load_wait=30
)
assert result is None
def test_load_wait_default_is_sixty_seconds(self):
"""load_wait defaults to 60 to match SCREENSHOT_LOAD_WAIT config default."""
import inspect