Merge "Scroll grafana pages to force all graphs to load"
This commit is contained in:
@@ -47,12 +47,18 @@ def test_grafana_screenshots(host):
|
||||
cmd = host.run("curl -s --insecure "
|
||||
"--resolve grafana.opendev.org:443:127.0.0.1 "
|
||||
"https://grafana.opendev.org/api/search")
|
||||
# Scroll to the bottom of the graph pages to force grafana to render each
|
||||
# graph on the page. Adapted from:
|
||||
# https://stackoverflow.com/questions/42982950/how-to-scroll-down-the-page-till-bottomend-page-in-the-selenium-webdriver
|
||||
scroll_to_bottom = 'window.scrollTo(' \
|
||||
'{top: document.body.scrollHeight, left: 0, behavior: "smooth"})'
|
||||
j = json.loads(cmd.stdout)
|
||||
for dashboard in j:
|
||||
url = dashboard["url"]
|
||||
uid = dashboard["uid"]
|
||||
name = dashboard["uri"].split("/")[-1]
|
||||
shots.append(("https://localhost" + url, None, name + '.png'))
|
||||
shots.append(
|
||||
("https://localhost" + url, scroll_to_bottom, name + '.png'))
|
||||
json_defs.append((uid, name + '.json'))
|
||||
take_screenshots(host, shots)
|
||||
host.run('mkdir /tmp/json_blobs')
|
||||
|
Reference in New Issue
Block a user