Skip to content

Commit

Permalink
Full page image: Fix wait condition for dashboard with rows (#542)
Browse files Browse the repository at this point in the history
* Full page image: Fix dashboard with rows wait condition

* Update all-panels.json

* update test image

* update test res

* use dark theme

* support old versions
  • Loading branch information
AgnesToulet authored Jul 15, 2024
1 parent 6c41728 commit 08be054
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 20 deletions.
59 changes: 40 additions & 19 deletions scripts/drone/provisioning/dashboards/all-panels.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
"id": 3,
"links": [],
"panels": [
{
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
},
"id": 13,
"title": "Main row",
"type": "row"
},
{
"datasource": {
"type": "grafana-testdata-datasource",
Expand All @@ -30,7 +41,7 @@
"h": 9,
"w": 6,
"x": 0,
"y": 0
"y": 1
},
"id": 12,
"options": {
Expand All @@ -42,7 +53,7 @@
"content": "# Test dashboard\n\nThis dashboard is aiming to test most panels with the grafana-image-renderer.",
"mode": "markdown"
},
"pluginVersion": "10.4.3",
"pluginVersion": "11.2.0-pre",
"title": "Text panel",
"type": "text"
},
Expand Down Expand Up @@ -86,7 +97,7 @@
"h": 9,
"w": 10,
"x": 6,
"y": 0
"y": 1
},
"id": 10,
"options": {
Expand Down Expand Up @@ -136,7 +147,11 @@
"tooltip": false,
"viz": false
},
"lineWidth": 1
"lineWidth": 1,
"stacking": {
"group": "A",
"mode": "none"
}
},
"mappings": [],
"thresholds": {
Expand All @@ -159,7 +174,7 @@
"h": 9,
"w": 8,
"x": 16,
"y": 0
"y": 1
},
"id": 11,
"options": {
Expand All @@ -168,6 +183,10 @@
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
Expand Down Expand Up @@ -208,7 +227,7 @@
"h": 8,
"w": 12,
"x": 0,
"y": 9
"y": 10
},
"id": 9,
"options": {
Expand Down Expand Up @@ -245,7 +264,7 @@
"reverse": false
}
},
"pluginVersion": "10.4.3",
"pluginVersion": "11.2.0-pre",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -302,7 +321,7 @@
"h": 8,
"w": 12,
"x": 12,
"y": 9
"y": 10
},
"id": 8,
"options": {
Expand Down Expand Up @@ -365,7 +384,7 @@
"h": 8,
"w": 12,
"x": 0,
"y": 17
"y": 18
},
"id": 4,
"options": {
Expand All @@ -383,7 +402,7 @@
"showThresholdMarkers": true,
"sizing": "auto"
},
"pluginVersion": "10.4.3",
"pluginVersion": "11.2.0-pre",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -423,7 +442,7 @@
"h": 8,
"w": 12,
"x": 12,
"y": 17
"y": 18
},
"id": 5,
"options": {
Expand Down Expand Up @@ -490,7 +509,7 @@
"h": 8,
"w": 12,
"x": 0,
"y": 25
"y": 26
},
"id": 7,
"options": {
Expand All @@ -511,7 +530,7 @@
"sizing": "auto",
"valueMode": "color"
},
"pluginVersion": "10.4.3",
"pluginVersion": "11.2.0-pre",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -578,7 +597,7 @@
"h": 8,
"w": 12,
"x": 12,
"y": 25
"y": 26
},
"id": 2,
"options": {
Expand Down Expand Up @@ -647,14 +666,15 @@
"h": 8,
"w": 12,
"x": 0,
"y": 33
"y": 34
},
"id": 3,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
Expand All @@ -666,7 +686,7 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.4.3",
"pluginVersion": "11.2.0-pre",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -719,7 +739,7 @@
"h": 8,
"w": 12,
"x": 12,
"y": 33
"y": 34
},
"id": 6,
"options": {
Expand All @@ -734,7 +754,7 @@
},
"showHeader": true
},
"pluginVersion": "10.4.3",
"pluginVersion": "11.2.0-pre",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -766,6 +786,7 @@
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
Expand Down Expand Up @@ -812,7 +833,7 @@
"h": 9,
"w": 24,
"x": 0,
"y": 41
"y": 42
},
"id": 1,
"options": {
Expand Down
3 changes: 2 additions & 1 deletion src/browser/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,8 @@ async function waitForQueriesAndVisualizations(page: puppeteer.Page, options: Im
}
});

const totalPanelsRendered = panelsRenderedCount + document.querySelectorAll('.dashboard-row').length;
const rowCount = document.querySelectorAll('.dashboard-row').length || document.querySelectorAll("[data-testid='dashboard-row-container']").length
const totalPanelsRendered = panelsRenderedCount + rowCount;
return totalPanelsRendered >= panelCount;
}

Expand Down
Binary file modified tests/testdata/full-page-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 08be054

Please sign in to comment.