test_chart_renderer.py 888 B

1234567891011121314151617181920212223242526
  1. from sentry.testutils.cases import AcceptanceTestCase
  2. from sentry.testutils.helpers.response import close_streaming_response
  3. class TestChartRenderer(AcceptanceTestCase):
  4. def test_debug_renders(self):
  5. options = {
  6. "chart-rendering.enabled": True,
  7. "system.url-prefix": self.browser.live_server_url,
  8. }
  9. with self.options(options):
  10. self.browser.get("debug/chart-renderer/")
  11. images = self.browser.elements(selector="img")
  12. assert len(images) > 0
  13. for image in images:
  14. src = image.get_attribute("src")
  15. resp = self.client.get(src)
  16. # Ensure our chart images actually look like pngs
  17. assert resp.status_code == 200
  18. assert close_streaming_response(resp)[:4] == b"\x89PNG"
  19. self.browser.snapshot("chart renderer debug view via chartcuterie")