mirror of https://github.com/grafana/grafana
TimeZone: added e2e tests for the custom time zone support. (#24442)
parent
e341d4b26f
commit
a521a39ebf
@ -0,0 +1,695 @@ |
||||
{ |
||||
"annotations": { |
||||
"list": [ |
||||
{ |
||||
"builtIn": 1, |
||||
"datasource": "-- Grafana --", |
||||
"enable": true, |
||||
"hide": true, |
||||
"iconColor": "rgba(0, 211, 255, 1)", |
||||
"name": "Annotations & Alerts", |
||||
"type": "dashboard" |
||||
} |
||||
] |
||||
}, |
||||
"editable": true, |
||||
"gnetId": null, |
||||
"graphTooltip": 0, |
||||
"id": 28, |
||||
"links": [], |
||||
"panels": [ |
||||
{ |
||||
"aliasColors": {}, |
||||
"bars": false, |
||||
"dashLength": 10, |
||||
"dashes": false, |
||||
"datasource": "gdev-testdata", |
||||
"editable": true, |
||||
"error": false, |
||||
"fieldConfig": { |
||||
"defaults": { |
||||
"custom": {} |
||||
}, |
||||
"overrides": [] |
||||
}, |
||||
"fill": 1, |
||||
"fillGradient": 0, |
||||
"gridPos": { |
||||
"h": 7, |
||||
"w": 12, |
||||
"x": 0, |
||||
"y": 0 |
||||
}, |
||||
"hiddenSeries": false, |
||||
"id": 4, |
||||
"legend": { |
||||
"avg": false, |
||||
"current": false, |
||||
"max": false, |
||||
"min": false, |
||||
"show": true, |
||||
"total": false, |
||||
"values": false |
||||
}, |
||||
"lines": true, |
||||
"linewidth": 2, |
||||
"links": [], |
||||
"nullPointMode": "connected", |
||||
"options": { |
||||
"dataLinks": [] |
||||
}, |
||||
"percentage": false, |
||||
"pointradius": 5, |
||||
"points": false, |
||||
"renderer": "flot", |
||||
"seriesOverrides": [], |
||||
"spaceLength": 10, |
||||
"stack": false, |
||||
"steppedLine": false, |
||||
"targets": [ |
||||
{ |
||||
"refId": "A", |
||||
"scenario": "random_walk", |
||||
"scenarioId": "random_walk", |
||||
"target": "" |
||||
} |
||||
], |
||||
"thresholds": [], |
||||
"timeFrom": "2s", |
||||
"timeRegions": [], |
||||
"timeShift": null, |
||||
"title": "Millisecond res x-axis and tooltip", |
||||
"tooltip": { |
||||
"msResolution": false, |
||||
"shared": true, |
||||
"sort": 0, |
||||
"value_type": "cumulative" |
||||
}, |
||||
"type": "graph", |
||||
"xaxis": { |
||||
"buckets": null, |
||||
"mode": "time", |
||||
"name": null, |
||||
"show": true, |
||||
"values": [] |
||||
}, |
||||
"yaxes": [ |
||||
{ |
||||
"format": "short", |
||||
"label": null, |
||||
"logBase": 1, |
||||
"max": null, |
||||
"min": null, |
||||
"show": true |
||||
}, |
||||
{ |
||||
"format": "short", |
||||
"label": null, |
||||
"logBase": 1, |
||||
"max": null, |
||||
"min": null, |
||||
"show": true |
||||
} |
||||
], |
||||
"yaxis": { |
||||
"align": false, |
||||
"alignLevel": null |
||||
} |
||||
}, |
||||
{ |
||||
"aliasColors": {}, |
||||
"bars": false, |
||||
"dashLength": 10, |
||||
"dashes": false, |
||||
"datasource": "gdev-testdata", |
||||
"editable": true, |
||||
"error": false, |
||||
"fieldConfig": { |
||||
"defaults": { |
||||
"custom": {} |
||||
}, |
||||
"overrides": [] |
||||
}, |
||||
"fill": 1, |
||||
"fillGradient": 0, |
||||
"gridPos": { |
||||
"h": 7, |
||||
"w": 12, |
||||
"x": 12, |
||||
"y": 0 |
||||
}, |
||||
"hiddenSeries": false, |
||||
"id": 3, |
||||
"legend": { |
||||
"avg": false, |
||||
"current": false, |
||||
"max": false, |
||||
"min": false, |
||||
"show": true, |
||||
"total": false, |
||||
"values": false |
||||
}, |
||||
"lines": true, |
||||
"linewidth": 2, |
||||
"links": [], |
||||
"nullPointMode": "connected", |
||||
"options": { |
||||
"dataLinks": [] |
||||
}, |
||||
"percentage": false, |
||||
"pointradius": 5, |
||||
"points": false, |
||||
"renderer": "flot", |
||||
"seriesOverrides": [], |
||||
"spaceLength": 10, |
||||
"stack": false, |
||||
"steppedLine": false, |
||||
"targets": [ |
||||
{ |
||||
"refId": "A", |
||||
"scenario": "random_walk", |
||||
"scenarioId": "random_walk", |
||||
"target": "" |
||||
} |
||||
], |
||||
"thresholds": [], |
||||
"timeFrom": null, |
||||
"timeRegions": [], |
||||
"timeShift": null, |
||||
"title": "Random walk series", |
||||
"tooltip": { |
||||
"msResolution": false, |
||||
"shared": true, |
||||
"sort": 0, |
||||
"value_type": "cumulative" |
||||
}, |
||||
"type": "graph", |
||||
"xaxis": { |
||||
"buckets": null, |
||||
"mode": "time", |
||||
"name": null, |
||||
"show": true, |
||||
"values": [] |
||||
}, |
||||
"yaxes": [ |
||||
{ |
||||
"format": "short", |
||||
"label": null, |
||||
"logBase": 1, |
||||
"max": null, |
||||
"min": null, |
||||
"show": true |
||||
}, |
||||
{ |
||||
"format": "short", |
||||
"label": null, |
||||
"logBase": 1, |
||||
"max": null, |
||||
"min": null, |
||||
"show": true |
||||
} |
||||
], |
||||
"yaxis": { |
||||
"align": false, |
||||
"alignLevel": null |
||||
} |
||||
}, |
||||
{ |
||||
"aliasColors": {}, |
||||
"bars": false, |
||||
"dashLength": 10, |
||||
"dashes": false, |
||||
"datasource": "gdev-testdata", |
||||
"editable": true, |
||||
"error": false, |
||||
"fieldConfig": { |
||||
"defaults": { |
||||
"custom": {} |
||||
}, |
||||
"overrides": [] |
||||
}, |
||||
"fill": 1, |
||||
"fillGradient": 0, |
||||
"gridPos": { |
||||
"h": 8, |
||||
"w": 12, |
||||
"x": 0, |
||||
"y": 7 |
||||
}, |
||||
"hiddenSeries": false, |
||||
"id": 5, |
||||
"legend": { |
||||
"avg": false, |
||||
"current": false, |
||||
"max": false, |
||||
"min": false, |
||||
"show": true, |
||||
"total": false, |
||||
"values": false |
||||
}, |
||||
"lines": true, |
||||
"linewidth": 2, |
||||
"links": [], |
||||
"nullPointMode": "connected", |
||||
"options": { |
||||
"dataLinks": [] |
||||
}, |
||||
"percentage": false, |
||||
"pointradius": 5, |
||||
"points": false, |
||||
"renderer": "flot", |
||||
"seriesOverrides": [ |
||||
{ |
||||
"alias": "B-series", |
||||
"yaxis": 2 |
||||
} |
||||
], |
||||
"spaceLength": 10, |
||||
"stack": false, |
||||
"steppedLine": false, |
||||
"targets": [ |
||||
{ |
||||
"refId": "A", |
||||
"scenarioId": "csv_metric_values", |
||||
"stringInput": "1,20,90,30,5,0", |
||||
"target": "" |
||||
}, |
||||
{ |
||||
"refId": "B", |
||||
"scenarioId": "csv_metric_values", |
||||
"stringInput": "2000,3000,4000,1000,3000,10000", |
||||
"target": "" |
||||
} |
||||
], |
||||
"thresholds": [], |
||||
"timeFrom": null, |
||||
"timeRegions": [], |
||||
"timeShift": null, |
||||
"title": "2 yaxis and axis labels", |
||||
"tooltip": { |
||||
"msResolution": false, |
||||
"shared": true, |
||||
"sort": 0, |
||||
"value_type": "cumulative" |
||||
}, |
||||
"type": "graph", |
||||
"xaxis": { |
||||
"buckets": null, |
||||
"mode": "time", |
||||
"name": null, |
||||
"show": true, |
||||
"values": [] |
||||
}, |
||||
"yaxes": [ |
||||
{ |
||||
"format": "percent", |
||||
"label": "Perecent", |
||||
"logBase": 1, |
||||
"max": null, |
||||
"min": null, |
||||
"show": true |
||||
}, |
||||
{ |
||||
"format": "short", |
||||
"label": "Pressure", |
||||
"logBase": 1, |
||||
"max": null, |
||||
"min": null, |
||||
"show": true |
||||
} |
||||
], |
||||
"yaxis": { |
||||
"align": false, |
||||
"alignLevel": null |
||||
} |
||||
}, |
||||
{ |
||||
"aliasColors": {}, |
||||
"bars": false, |
||||
"dashLength": 10, |
||||
"dashes": false, |
||||
"datasource": "gdev-testdata", |
||||
"editable": true, |
||||
"error": false, |
||||
"fieldConfig": { |
||||
"defaults": { |
||||
"custom": {} |
||||
}, |
||||
"overrides": [] |
||||
}, |
||||
"fill": 1, |
||||
"fillGradient": 0, |
||||
"gridPos": { |
||||
"h": 8, |
||||
"w": 12, |
||||
"x": 12, |
||||
"y": 7 |
||||
}, |
||||
"hiddenSeries": false, |
||||
"id": 9, |
||||
"legend": { |
||||
"avg": false, |
||||
"current": false, |
||||
"max": false, |
||||
"min": false, |
||||
"show": true, |
||||
"total": false, |
||||
"values": false |
||||
}, |
||||
"lines": true, |
||||
"linewidth": 2, |
||||
"links": [], |
||||
"nullPointMode": "null", |
||||
"options": { |
||||
"dataLinks": [] |
||||
}, |
||||
"percentage": false, |
||||
"pointradius": 5, |
||||
"points": false, |
||||
"renderer": "flot", |
||||
"seriesOverrides": [ |
||||
{ |
||||
"alias": "B-series", |
||||
"zindex": -3 |
||||
} |
||||
], |
||||
"spaceLength": 10, |
||||
"stack": true, |
||||
"steppedLine": false, |
||||
"targets": [ |
||||
{ |
||||
"hide": false, |
||||
"refId": "B", |
||||
"scenarioId": "csv_metric_values", |
||||
"stringInput": "1,20,null,null,null,null,null,null,100,10,10,20,30,40,10", |
||||
"target": "" |
||||
}, |
||||
{ |
||||
"alias": "", |
||||
"hide": false, |
||||
"refId": "A", |
||||
"scenarioId": "csv_metric_values", |
||||
"stringInput": "1,20,90,30,5,10,20,30,40,40,40,100,10,20,20", |
||||
"target": "" |
||||
}, |
||||
{ |
||||
"alias": "", |
||||
"hide": false, |
||||
"refId": "C", |
||||
"scenarioId": "csv_metric_values", |
||||
"stringInput": "1,20,90,30,5,10,20,30,40,40,40,100,10,20,20", |
||||
"target": "" |
||||
} |
||||
], |
||||
"thresholds": [], |
||||
"timeFrom": null, |
||||
"timeRegions": [], |
||||
"timeShift": null, |
||||
"title": "Stacking value ontop of nulls", |
||||
"tooltip": { |
||||
"msResolution": false, |
||||
"shared": true, |
||||
"sort": 0, |
||||
"value_type": "cumulative" |
||||
}, |
||||
"type": "graph", |
||||
"xaxis": { |
||||
"buckets": null, |
||||
"mode": "time", |
||||
"name": null, |
||||
"show": true, |
||||
"values": [] |
||||
}, |
||||
"yaxes": [ |
||||
{ |
||||
"format": "short", |
||||
"label": null, |
||||
"logBase": 1, |
||||
"max": null, |
||||
"min": null, |
||||
"show": true |
||||
}, |
||||
{ |
||||
"format": "short", |
||||
"label": null, |
||||
"logBase": 1, |
||||
"max": null, |
||||
"min": null, |
||||
"show": true |
||||
} |
||||
], |
||||
"yaxis": { |
||||
"align": false, |
||||
"alignLevel": null |
||||
} |
||||
}, |
||||
{ |
||||
"aliasColors": {}, |
||||
"bars": false, |
||||
"dashLength": 10, |
||||
"dashes": false, |
||||
"datasource": "gdev-testdata", |
||||
"editable": true, |
||||
"error": false, |
||||
"fieldConfig": { |
||||
"defaults": { |
||||
"custom": {} |
||||
}, |
||||
"overrides": [] |
||||
}, |
||||
"fill": 0, |
||||
"fillGradient": 0, |
||||
"gridPos": { |
||||
"h": 7, |
||||
"w": 12, |
||||
"x": 0, |
||||
"y": 15 |
||||
}, |
||||
"hiddenSeries": false, |
||||
"id": 21, |
||||
"legend": { |
||||
"avg": false, |
||||
"current": false, |
||||
"max": false, |
||||
"min": false, |
||||
"show": true, |
||||
"total": false, |
||||
"values": false |
||||
}, |
||||
"lines": true, |
||||
"linewidth": 2, |
||||
"links": [], |
||||
"nullPointMode": "null", |
||||
"options": { |
||||
"dataLinks": [] |
||||
}, |
||||
"percentage": false, |
||||
"pointradius": 5, |
||||
"points": false, |
||||
"renderer": "flot", |
||||
"seriesOverrides": [ |
||||
{ |
||||
"alias": "C-series", |
||||
"steppedLine": true |
||||
} |
||||
], |
||||
"spaceLength": 10, |
||||
"stack": false, |
||||
"steppedLine": false, |
||||
"targets": [ |
||||
{ |
||||
"alias": "", |
||||
"hide": false, |
||||
"refId": "B", |
||||
"scenarioId": "csv_metric_values", |
||||
"stringInput": "1,null,40,null,90,null,null,100,null,null,100,null,null,80,null", |
||||
"target": "" |
||||
}, |
||||
{ |
||||
"alias": "", |
||||
"hide": false, |
||||
"refId": "C", |
||||
"scenarioId": "csv_metric_values", |
||||
"stringInput": "20,null40,null,null,50,null,70,null,100,null,10,null,30,null", |
||||
"target": "" |
||||
} |
||||
], |
||||
"thresholds": [], |
||||
"timeFrom": null, |
||||
"timeRegions": [], |
||||
"timeShift": null, |
||||
"title": "Null between points", |
||||
"tooltip": { |
||||
"msResolution": false, |
||||
"shared": true, |
||||
"sort": 0, |
||||
"value_type": "cumulative" |
||||
}, |
||||
"type": "graph", |
||||
"xaxis": { |
||||
"buckets": null, |
||||
"mode": "time", |
||||
"name": null, |
||||
"show": true, |
||||
"values": [] |
||||
}, |
||||
"yaxes": [ |
||||
{ |
||||
"format": "short", |
||||
"label": null, |
||||
"logBase": 1, |
||||
"max": null, |
||||
"min": null, |
||||
"show": true |
||||
}, |
||||
{ |
||||
"format": "short", |
||||
"label": null, |
||||
"logBase": 1, |
||||
"max": null, |
||||
"min": null, |
||||
"show": true |
||||
} |
||||
], |
||||
"yaxis": { |
||||
"align": false, |
||||
"alignLevel": null |
||||
} |
||||
}, |
||||
{ |
||||
"aliasColors": {}, |
||||
"bars": false, |
||||
"dashLength": 10, |
||||
"dashes": false, |
||||
"datasource": "gdev-testdata", |
||||
"decimals": 3, |
||||
"fieldConfig": { |
||||
"defaults": { |
||||
"custom": {} |
||||
}, |
||||
"overrides": [] |
||||
}, |
||||
"fill": 1, |
||||
"fillGradient": 0, |
||||
"gridPos": { |
||||
"h": 7, |
||||
"w": 12, |
||||
"x": 12, |
||||
"y": 15 |
||||
}, |
||||
"hiddenSeries": false, |
||||
"id": 16, |
||||
"legend": { |
||||
"alignAsTable": true, |
||||
"avg": true, |
||||
"current": true, |
||||
"max": true, |
||||
"min": true, |
||||
"show": true, |
||||
"total": true, |
||||
"values": true |
||||
}, |
||||
"lines": true, |
||||
"linewidth": 1, |
||||
"links": [], |
||||
"nullPointMode": "null", |
||||
"options": { |
||||
"dataLinks": [] |
||||
}, |
||||
"percentage": false, |
||||
"pointradius": 5, |
||||
"points": false, |
||||
"renderer": "flot", |
||||
"seriesOverrides": [], |
||||
"spaceLength": 10, |
||||
"stack": false, |
||||
"steppedLine": false, |
||||
"targets": [ |
||||
{ |
||||
"refId": "A", |
||||
"scenarioId": "csv_metric_values", |
||||
"stringInput": "1,20,90,30,5,0", |
||||
"target": "" |
||||
}, |
||||
{ |
||||
"refId": "B", |
||||
"scenarioId": "csv_metric_values", |
||||
"stringInput": "1,20,90,30,5,0", |
||||
"target": "" |
||||
}, |
||||
{ |
||||
"refId": "C", |
||||
"scenarioId": "csv_metric_values", |
||||
"stringInput": "1,20,90,30,5,0", |
||||
"target": "" |
||||
}, |
||||
{ |
||||
"refId": "D", |
||||
"scenarioId": "csv_metric_values", |
||||
"stringInput": "1,20,90,30,5,0", |
||||
"target": "" |
||||
} |
||||
], |
||||
"thresholds": [], |
||||
"timeFrom": null, |
||||
"timeRegions": [], |
||||
"timeShift": null, |
||||
"title": "Legend Table No Scroll Visible", |
||||
"tooltip": { |
||||
"shared": true, |
||||
"sort": 0, |
||||
"value_type": "individual" |
||||
}, |
||||
"type": "graph", |
||||
"xaxis": { |
||||
"buckets": null, |
||||
"mode": "time", |
||||
"name": null, |
||||
"show": true, |
||||
"values": [] |
||||
}, |
||||
"yaxes": [ |
||||
{ |
||||
"format": "short", |
||||
"label": null, |
||||
"logBase": 1, |
||||
"max": null, |
||||
"min": null, |
||||
"show": true |
||||
}, |
||||
{ |
||||
"format": "short", |
||||
"label": null, |
||||
"logBase": 1, |
||||
"max": null, |
||||
"min": null, |
||||
"show": true |
||||
} |
||||
], |
||||
"yaxis": { |
||||
"align": false, |
||||
"alignLevel": null |
||||
} |
||||
} |
||||
], |
||||
"refresh": false, |
||||
"revision": 8, |
||||
"schemaVersion": 25, |
||||
"style": "dark", |
||||
"tags": ["gdev", "panel-tests", "graph", "table"], |
||||
"templating": { |
||||
"list": [] |
||||
}, |
||||
"time": { |
||||
"from": "now-1h", |
||||
"to": "now" |
||||
}, |
||||
"timepicker": { |
||||
"refresh_intervals": ["10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"], |
||||
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"] |
||||
}, |
||||
"timezone": "utc", |
||||
"title": "Panel Tests - Time zone support", |
||||
"uid": "5SdHCasdf", |
||||
"version": 1 |
||||
} |
@ -0,0 +1,94 @@ |
||||
import { e2e } from '@grafana/e2e'; |
||||
|
||||
e2e.scenario({ |
||||
describeName: 'Dashboard time zone support', |
||||
itName: 'Tests dashboard time zone scenarios', |
||||
addScenarioDataSource: false, |
||||
addScenarioDashBoard: false, |
||||
skipScenario: false, |
||||
scenario: () => { |
||||
e2e.flows.openDashboard('5SdHCasdf'); |
||||
|
||||
const fromTimeZone = 'UTC'; |
||||
const toTimeZone = 'America/Chicago'; |
||||
const offset = -5; |
||||
|
||||
const panelsToCheck = [ |
||||
'Random walk series', |
||||
'Millisecond res x-axis and tooltip', |
||||
'2 yaxis and axis labels', |
||||
'Stacking value ontop of nulls', |
||||
'Null between points', |
||||
'Legend Table No Scroll Visible', |
||||
]; |
||||
|
||||
const timesInUtc: Record<string, string> = {}; |
||||
|
||||
for (const title of panelsToCheck) { |
||||
e2e.components.Panels.Panel.containerByTitle(title) |
||||
.should('be.visible') |
||||
.within(() => |
||||
e2e.components.Panels.Visualization.Graph.xAxis |
||||
.labels() |
||||
.should('be.visible') |
||||
.last() |
||||
.should(element => { |
||||
timesInUtc[title] = element.text(); |
||||
}) |
||||
); |
||||
} |
||||
|
||||
e2e.pages.Dashboard.Toolbar.toolbarItems('Dashboard settings').click(); |
||||
|
||||
e2e.components.TimeZonePicker.container() |
||||
.should('be.visible') |
||||
.within(() => { |
||||
e2e.components.Select.singleValue() |
||||
.should('be.visible') |
||||
.should('have.text', fromTimeZone); |
||||
|
||||
e2e.components.Select.input() |
||||
.should('be.visible') |
||||
.click(); |
||||
|
||||
e2e.components.Select.option() |
||||
.should('be.visible') |
||||
.contains(toTimeZone) |
||||
.click(); |
||||
}); |
||||
|
||||
e2e.components.BackButton.backArrow().click(); |
||||
|
||||
for (const title of panelsToCheck) { |
||||
e2e.components.Panels.Panel.containerByTitle(title) |
||||
.should('be.visible') |
||||
.within(() => |
||||
e2e.components.Panels.Visualization.Graph.xAxis |
||||
.labels() |
||||
.should('be.visible') |
||||
.last() |
||||
.should(element => { |
||||
const utc = timesInUtc[title]; |
||||
const tz = element.text(); |
||||
const isCorrect = isTimeCorrect(utc, tz, offset); |
||||
assert.isTrue(isCorrect, `Panel with title: "${title}"`); |
||||
}) |
||||
); |
||||
} |
||||
}, |
||||
}); |
||||
|
||||
const isTimeCorrect = (utc: string, tz: string, offset: number): boolean => { |
||||
const minutes = 1000 * 60; |
||||
|
||||
const a = Cypress.moment(utc, 'HH:mm') |
||||
.set('seconds', 0) |
||||
.set('milliseconds', 0); |
||||
|
||||
const b = Cypress.moment(tz, 'HH:mm') |
||||
.set('seconds', 0) |
||||
.set('milliseconds', 0) |
||||
.add('hours', offset); |
||||
|
||||
return a.diff(b, 'minutes') <= 6 * minutes; |
||||
}; |
Loading…
Reference in new issue