Skip to content

Commit

Permalink
Wait for panels state=Done
Browse files Browse the repository at this point in the history
  • Loading branch information
intermittentnrg committed Oct 15, 2023
1 parent 6350326 commit e6bc987
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions grafanimate/marionette.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import atexit
import json
import logging
import time
from collections import OrderedDict

import where
Expand Down Expand Up @@ -170,6 +171,16 @@ def render_image(self, element=None):
"""
Return screenshot from element.
"""
while True:
result = self.marionette.execute_script('''
panels = Object.values(window.wrappedJSObject.grafanaRuntime.getPanelData())
return panels.length && panels.every(function(o) {return o?.state=='Done'})
''')
if result:
break
logger.info("waiting for panels to load")
time.sleep(0.1)

image = self.marionette.screenshot(element=element, format="binary")
return image

Expand Down

0 comments on commit e6bc987

Please sign in to comment.