Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
bae88da8
Commit
bae88da8
authored
Mar 06, 2018
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new tests for metrics dashboard changes
parent
ed993603
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
9 deletions
+34
-9
spec/javascripts/monitoring/dashboard_spec.js
spec/javascripts/monitoring/dashboard_spec.js
+34
-9
No files found.
spec/javascripts/monitoring/dashboard_spec.js
View file @
bae88da8
...
@@ -7,7 +7,7 @@ import { metricsGroupsAPIResponse, mockApiEndpoint } from './mock_data';
...
@@ -7,7 +7,7 @@ import { metricsGroupsAPIResponse, mockApiEndpoint } from './mock_data';
describe
(
'
Dashboard
'
,
()
=>
{
describe
(
'
Dashboard
'
,
()
=>
{
const
fixtureName
=
'
environments/metrics/metrics.html.raw
'
;
const
fixtureName
=
'
environments/metrics/metrics.html.raw
'
;
let
DashboardComponent
;
let
DashboardComponent
;
let
component
;
const
propsData
=
{
const
propsData
=
{
hasMetrics
:
false
,
hasMetrics
:
false
,
documentationPath
:
'
/path/to/docs
'
,
documentationPath
:
'
/path/to/docs
'
,
...
@@ -16,7 +16,7 @@ describe('Dashboard', () => {
...
@@ -16,7 +16,7 @@ describe('Dashboard', () => {
tagsPath
:
'
/path/to/tags
'
,
tagsPath
:
'
/path/to/tags
'
,
projectPath
:
'
/path/to/project
'
,
projectPath
:
'
/path/to/project
'
,
metricsEndpoint
:
mockApiEndpoint
,
metricsEndpoint
:
mockApiEndpoint
,
deploymentEndpoint
:
'
/endpoint/deployments
'
,
deploymentEndpoint
:
null
,
emptyGettingStartedSvgPath
:
'
/path/to/getting-started.svg
'
,
emptyGettingStartedSvgPath
:
'
/path/to/getting-started.svg
'
,
emptyLoadingSvgPath
:
'
/path/to/loading.svg
'
,
emptyLoadingSvgPath
:
'
/path/to/loading.svg
'
,
emptyUnableToConnectSvgPath
:
'
/path/to/unable-to-connect.svg
'
,
emptyUnableToConnectSvgPath
:
'
/path/to/unable-to-connect.svg
'
,
...
@@ -31,12 +31,11 @@ describe('Dashboard', () => {
...
@@ -31,12 +31,11 @@ describe('Dashboard', () => {
describe
(
'
no metrics are available yet
'
,
()
=>
{
describe
(
'
no metrics are available yet
'
,
()
=>
{
it
(
'
shows a getting started empty state when no metrics are present
'
,
()
=>
{
it
(
'
shows a getting started empty state when no metrics are present
'
,
()
=>
{
component
=
new
DashboardComponent
({
co
nst
co
mponent
=
new
DashboardComponent
({
el
:
document
.
querySelector
(
'
#prometheus-graphs
'
),
el
:
document
.
querySelector
(
'
#prometheus-graphs
'
),
propsData
,
propsData
,
});
});
component
.
$mount
();
expect
(
component
.
$el
.
querySelector
(
'
#prometheus-graphs
'
)).
toBe
(
null
);
expect
(
component
.
$el
.
querySelector
(
'
#prometheus-graphs
'
)).
toBe
(
null
);
expect
(
component
.
state
).
toEqual
(
'
gettingStarted
'
);
expect
(
component
.
state
).
toEqual
(
'
gettingStarted
'
);
});
});
...
@@ -46,9 +45,7 @@ describe('Dashboard', () => {
...
@@ -46,9 +45,7 @@ describe('Dashboard', () => {
let
mock
;
let
mock
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
=
new
MockAdapter
(
axios
);
mock
.
onGet
(
mockApiEndpoint
).
reply
(
200
,
{
mock
.
onGet
(
mockApiEndpoint
).
reply
(
200
,
metricsGroupsAPIResponse
);
metricsGroupsAPIResponse
,
});
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -56,15 +53,43 @@ describe('Dashboard', () => {
...
@@ -56,15 +53,43 @@ describe('Dashboard', () => {
});
});
it
(
'
shows up a loading state
'
,
(
done
)
=>
{
it
(
'
shows up a loading state
'
,
(
done
)
=>
{
component
=
new
DashboardComponent
({
co
nst
co
mponent
=
new
DashboardComponent
({
el
:
document
.
querySelector
(
'
#prometheus-graphs
'
),
el
:
document
.
querySelector
(
'
#prometheus-graphs
'
),
propsData
:
{
...
propsData
,
hasMetrics
:
true
},
propsData
:
{
...
propsData
,
hasMetrics
:
true
},
});
});
component
.
$mount
();
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
expect
(
component
.
state
).
toEqual
(
'
loading
'
);
expect
(
component
.
state
).
toEqual
(
'
loading
'
);
done
();
done
();
});
});
});
});
it
(
'
hides the legend when showLegend is false
'
,
(
done
)
=>
{
const
component
=
new
DashboardComponent
({
el
:
document
.
querySelector
(
'
#prometheus-graphs
'
),
propsData
:
{
...
propsData
,
hasMetrics
:
true
,
showLegend
:
false
},
});
setTimeout
(()
=>
{
expect
(
component
.
showEmptyState
).
toEqual
(
false
);
expect
(
component
.
$el
.
querySelector
(
'
.legend-group
'
)).
toBeFalsy
();
expect
(
component
.
$el
.
querySelector
(
'
.prometheus-graph-group
'
)).
toBeTruthy
();
done
();
});
});
it
(
'
hides the group panels when showPanels is false
'
,
(
done
)
=>
{
const
component
=
new
DashboardComponent
({
el
:
document
.
querySelector
(
'
#prometheus-graphs
'
),
propsData
:
{
...
propsData
,
hasMetrics
:
true
,
showPanels
:
false
},
});
setTimeout
(()
=>
{
expect
(
component
.
showEmptyState
).
toEqual
(
false
);
expect
(
component
.
$el
.
querySelector
(
'
.prometheus-panel
'
)).
toBeFalsy
();
expect
(
component
.
$el
.
querySelector
(
'
.prometheus-graph-group
'
)).
toBeTruthy
();
done
();
});
});
});
});
});
});
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