Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
a521a39e
Unverified
Commit
a521a39e
authored
May 11, 2020
by
Marcus Andersson
Committed by
GitHub
May 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TimeZone: added e2e tests for the custom time zone support. (#24442)
parent
e341d4b2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
110 additions
and
4 deletions
+110
-4
devenv/dev-dashboards/scenarios/time_zone_support.json
+0
-0
e2e/suite1/specs/dashboard-time-zone.spec.ts
+94
-0
packages/grafana-e2e-selectors/src/selectors/components.ts
+8
-0
public/app/core/components/SharedPreferences/SharedPreferences.tsx
+2
-1
public/app/features/dashboard/components/DashboardSettings/TimePickerSettings.tsx
+2
-1
public/app/features/dashboard/dashgrid/PanelChrome.tsx
+2
-1
public/app/features/dashboard/dashgrid/PanelChromeAngular.tsx
+2
-1
No files found.
devenv/dev-dashboards/scenarios/time_zone_support.json
0 → 100644
View file @
a521a39e
This diff is collapsed.
Click to expand it.
e2e/suite1/specs/dashboard-time-zone.spec.ts
0 → 100644
View file @
a521a39e
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
;
};
packages/grafana-e2e-selectors/src/selectors/components.ts
View file @
a521a39e
...
@@ -18,6 +18,7 @@ export const Components = {
...
@@ -18,6 +18,7 @@ export const Components = {
Panel
:
{
Panel
:
{
title
:
(
title
:
string
)
=>
`Panel header title item
${
title
}
`
,
title
:
(
title
:
string
)
=>
`Panel header title item
${
title
}
`
,
headerItems
:
(
item
:
string
)
=>
`Panel header item
${
item
}
`
,
headerItems
:
(
item
:
string
)
=>
`Panel header item
${
item
}
`
,
containerByTitle
:
(
title
:
string
)
=>
`Panel container title
${
title
}
`
,
},
},
Visualization
:
{
Visualization
:
{
Graph
:
{
Graph
:
{
...
@@ -28,6 +29,9 @@ export const Components = {
...
@@ -28,6 +29,9 @@ export const Components = {
legendItemAlias
:
(
name
:
string
)
=>
`gpl alias
${
name
}
`
,
legendItemAlias
:
(
name
:
string
)
=>
`gpl alias
${
name
}
`
,
showLegendSwitch
:
'gpl show legend'
,
showLegendSwitch
:
'gpl show legend'
,
},
},
xAxis
:
{
labels
:
()
=>
'div.flot-x-axis > div.flot-tick-label'
,
},
},
},
},
},
},
},
...
@@ -109,6 +113,7 @@ export const Components = {
...
@@ -109,6 +113,7 @@ export const Components = {
Select
:
{
Select
:
{
option
:
'Select option'
,
option
:
'Select option'
,
input
:
()
=>
'input[id*="react-select-"]'
,
input
:
()
=>
'input[id*="react-select-"]'
,
singleValue
:
()
=>
'div[class*="-singleValue"]'
,
},
},
FieldConfigEditor
:
{
FieldConfigEditor
:
{
content
:
'Field config editor content'
,
content
:
'Field config editor content'
,
...
@@ -119,4 +124,7 @@ export const Components = {
...
@@ -119,4 +124,7 @@ export const Components = {
FolderPicker
:
{
FolderPicker
:
{
container
:
'Folder picker select container'
,
container
:
'Folder picker select container'
,
},
},
TimeZonePicker
:
{
container
:
'Time zone picker select container'
,
},
};
};
public/app/core/components/SharedPreferences/SharedPreferences.tsx
View file @
a521a39e
...
@@ -6,6 +6,7 @@ const { Select } = LegacyForms;
...
@@ -6,6 +6,7 @@ const { Select } = LegacyForms;
import
{
DashboardSearchHit
,
DashboardSearchItemType
}
from
'app/features/search/types'
;
import
{
DashboardSearchHit
,
DashboardSearchItemType
}
from
'app/features/search/types'
;
import
{
backendSrv
}
from
'app/core/services/backend_srv'
;
import
{
backendSrv
}
from
'app/core/services/backend_srv'
;
import
{
getTimeZoneGroups
,
SelectableValue
}
from
'@grafana/data'
;
import
{
getTimeZoneGroups
,
SelectableValue
}
from
'@grafana/data'
;
import
{
selectors
}
from
'@grafana/e2e-selectors'
;
export
interface
Props
{
export
interface
Props
{
resourceUri
:
string
;
resourceUri
:
string
;
...
@@ -156,7 +157,7 @@ export class SharedPreferences extends PureComponent<Props, State> {
...
@@ -156,7 +157,7 @@ export class SharedPreferences extends PureComponent<Props, State> {
width=
{
20
}
width=
{
20
}
/>
/>
</
div
>
</
div
>
<
div
className=
"gf-form"
>
<
div
className=
"gf-form"
aria
-
label=
{
selectors
.
components
.
TimeZonePicker
.
container
}
>
<
label
className=
"gf-form-label width-11"
>
Timezone
</
label
>
<
label
className=
"gf-form-label width-11"
>
Timezone
</
label
>
<
Select
<
Select
isSearchable=
{
true
}
isSearchable=
{
true
}
...
...
public/app/features/dashboard/components/DashboardSettings/TimePickerSettings.tsx
View file @
a521a39e
...
@@ -5,6 +5,7 @@ import { getTimeZoneGroups, TimeZone, rangeUtil, SelectableValue } from '@grafan
...
@@ -5,6 +5,7 @@ import { getTimeZoneGroups, TimeZone, rangeUtil, SelectableValue } from '@grafan
import
{
config
}
from
'@grafana/runtime'
;
import
{
config
}
from
'@grafana/runtime'
;
import
kbn
from
'app/core/utils/kbn'
;
import
kbn
from
'app/core/utils/kbn'
;
import
isEmpty
from
'lodash/isEmpty'
;
import
isEmpty
from
'lodash/isEmpty'
;
import
{
selectors
}
from
'@grafana/e2e-selectors'
;
const
grafanaTimeZones
=
[
const
grafanaTimeZones
=
[
{
value
:
''
,
label
:
'Default'
},
{
value
:
''
,
label
:
'Default'
},
...
@@ -112,7 +113,7 @@ export class TimePickerSettings extends PureComponent<Props, State> {
...
@@ -112,7 +113,7 @@ export class TimePickerSettings extends PureComponent<Props, State> {
<
div
className=
"editor-row"
>
<
div
className=
"editor-row"
>
<
h5
className=
"section-heading"
>
Time Options
</
h5
>
<
h5
className=
"section-heading"
>
Time Options
</
h5
>
<
div
className=
"gf-form-group"
>
<
div
className=
"gf-form-group"
>
<
div
className=
"gf-form"
>
<
div
className=
"gf-form"
aria
-
label=
{
selectors
.
components
.
TimeZonePicker
.
container
}
>
<
label
className=
"gf-form-label width-7"
>
Timezone
</
label
>
<
label
className=
"gf-form-label width-7"
>
Timezone
</
label
>
<
Select
isSearchable=
{
true
}
value=
{
value
}
onChange=
{
this
.
onTimeZoneChange
}
options=
{
timeZones
}
width=
{
40
}
/>
<
Select
isSearchable=
{
true
}
value=
{
value
}
onChange=
{
this
.
onTimeZoneChange
}
options=
{
timeZones
}
width=
{
40
}
/>
</
div
>
</
div
>
...
...
public/app/features/dashboard/dashgrid/PanelChrome.tsx
View file @
a521a39e
...
@@ -26,6 +26,7 @@ import {
...
@@ -26,6 +26,7 @@ import {
PanelPlugin
,
PanelPlugin
,
FieldConfigSource
,
FieldConfigSource
,
}
from
'@grafana/data'
;
}
from
'@grafana/data'
;
import
{
selectors
}
from
'@grafana/e2e-selectors'
;
const
DEFAULT_PLUGIN_ERROR
=
'Error in plugin'
;
const
DEFAULT_PLUGIN_ERROR
=
'Error in plugin'
;
...
@@ -329,7 +330,7 @@ export class PanelChrome extends PureComponent<Props, State> {
...
@@ -329,7 +330,7 @@ export class PanelChrome extends PureComponent<Props, State> {
});
});
return
(
return
(
<
div
className=
{
containerClassNames
}
>
<
div
className=
{
containerClassNames
}
aria
-
label=
{
selectors
.
components
.
Panels
.
Panel
.
containerByTitle
(
panel
.
title
)
}
>
<
PanelHeader
<
PanelHeader
panel=
{
panel
}
panel=
{
panel
}
dashboard=
{
dashboard
}
dashboard=
{
dashboard
}
...
...
public/app/features/dashboard/dashgrid/PanelChromeAngular.tsx
View file @
a521a39e
...
@@ -16,6 +16,7 @@ import { StoreState } from 'app/types';
...
@@ -16,6 +16,7 @@ import { StoreState } from 'app/types';
import
{
DefaultTimeRange
,
LoadingState
,
PanelData
,
PanelEvents
,
PanelPlugin
}
from
'@grafana/data'
;
import
{
DefaultTimeRange
,
LoadingState
,
PanelData
,
PanelEvents
,
PanelPlugin
}
from
'@grafana/data'
;
import
{
updateLocation
}
from
'app/core/actions'
;
import
{
updateLocation
}
from
'app/core/actions'
;
import
{
PANEL_BORDER
}
from
'app/core/constants'
;
import
{
PANEL_BORDER
}
from
'app/core/constants'
;
import
{
selectors
}
from
'@grafana/e2e-selectors'
;
interface
OwnProps
{
interface
OwnProps
{
panel
:
PanelModel
;
panel
:
PanelModel
;
...
@@ -238,7 +239,7 @@ export class PanelChromeAngularUnconnected extends PureComponent<Props, State> {
...
@@ -238,7 +239,7 @@ export class PanelChromeAngularUnconnected extends PureComponent<Props, State> {
});
});
return
(
return
(
<
div
className=
{
containerClassNames
}
>
<
div
className=
{
containerClassNames
}
aria
-
label=
{
selectors
.
components
.
Panels
.
Panel
.
containerByTitle
(
panel
.
title
)
}
>
<
PanelHeader
<
PanelHeader
panel=
{
panel
}
panel=
{
panel
}
dashboard=
{
dashboard
}
dashboard=
{
dashboard
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment