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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ae20abff
Commit
ae20abff
authored
Jan 20, 2020
by
Miguel Rincon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove .querySelector from dashboard specs
parent
95769190
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
18 deletions
+14
-18
app/assets/javascripts/monitoring/components/dashboard.vue
app/assets/javascripts/monitoring/components/dashboard.vue
+3
-1
spec/features/projects/environments/environment_metrics_spec.rb
...eatures/projects/environments/environment_metrics_spec.rb
+2
-2
spec/frontend/monitoring/components/dashboard_spec.js
spec/frontend/monitoring/components/dashboard_spec.js
+9
-15
No files found.
app/assets/javascripts/monitoring/components/dashboard.vue
View file @
ae20abff
...
@@ -370,7 +370,9 @@ export default {
...
@@ -370,7 +370,9 @@ export default {
>
>
<gl-dropdown
<gl-dropdown
id=
"monitor-environments-dropdown"
id=
"monitor-environments-dropdown"
class=
"mb-0 d-flex js-environments-dropdown"
ref=
"monitorEnvironmentsDropdown"
data-qa-selector=
"environments_dropdown"
class=
"mb-0 d-flex"
toggle-class=
"dropdown-menu-toggle"
toggle-class=
"dropdown-menu-toggle"
:text=
"currentEnvironmentName"
:text=
"currentEnvironmentName"
:disabled=
"environments.length === 0"
:disabled=
"environments.length === 0"
...
...
spec/features/projects/environments/environment_metrics_spec.rb
View file @
ae20abff
...
@@ -30,9 +30,9 @@ describe 'Environment > Metrics' do
...
@@ -30,9 +30,9 @@ describe 'Environment > Metrics' do
click_link
(
'See metrics'
)
click_link
(
'See metrics'
)
expect
(
page
).
to
have_metrics_path
(
environment
)
expect
(
page
).
to
have_metrics_path
(
environment
)
expect
(
page
).
to
have_css
(
'
div.js-environments-dropdown
'
)
expect
(
page
).
to
have_css
(
'
[data-qa-selector="environments_dropdown"]
'
)
within
(
'
div.js-environments-dropdown
'
)
do
within
(
'
[data-qa-selector="environments_dropdown"]
'
)
do
# Click on the dropdown
# Click on the dropdown
click_on
(
environment
.
name
)
click_on
(
environment
.
name
)
...
...
spec/frontend/monitoring/components/dashboard_spec.js
View file @
ae20abff
...
@@ -52,6 +52,9 @@ describe('Dashboard', () => {
...
@@ -52,6 +52,9 @@ describe('Dashboard', () => {
});
});
};
};
const
findEnvironmentsDropdown
=
()
=>
wrapper
.
find
({
ref
:
'
monitorEnvironmentsDropdown
'
});
const
findAllEnvironmentsDropdownItems
=
()
=>
findEnvironmentsDropdown
().
findAll
(
GlDropdownItem
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
store
=
createStore
();
store
=
createStore
();
mock
=
new
MockAdapter
(
axios
);
mock
=
new
MockAdapter
(
axios
);
...
@@ -71,7 +74,7 @@ describe('Dashboard', () => {
...
@@ -71,7 +74,7 @@ describe('Dashboard', () => {
});
});
it
(
'
shows the environment selector
'
,
()
=>
{
it
(
'
shows the environment selector
'
,
()
=>
{
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
.js-environments-dropdown
'
)).
toBeTruthy
(
);
expect
(
findEnvironmentsDropdown
().
exists
()).
toBe
(
true
);
});
});
});
});
...
@@ -83,7 +86,7 @@ describe('Dashboard', () => {
...
@@ -83,7 +86,7 @@ describe('Dashboard', () => {
});
});
it
(
'
shows the environment selector dropdown
'
,
()
=>
{
it
(
'
shows the environment selector dropdown
'
,
()
=>
{
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
.js-environments-dropdown
'
)).
toBeTruthy
(
);
expect
(
findEnvironmentsDropdown
().
exists
()).
toBe
(
true
);
});
});
});
});
...
@@ -113,7 +116,7 @@ describe('Dashboard', () => {
...
@@ -113,7 +116,7 @@ describe('Dashboard', () => {
.
$nextTick
()
.
$nextTick
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
wrapper
.
vm
.
showEmptyState
).
toEqual
(
false
);
expect
(
wrapper
.
vm
.
showEmptyState
).
toEqual
(
false
);
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
.prometheus-panel
'
)).
toEqual
(
null
);
expect
(
wrapper
.
findAll
(
'
.prometheus-panel
'
)).
toHaveLength
(
0
);
done
();
done
();
})
})
...
@@ -152,9 +155,7 @@ describe('Dashboard', () => {
...
@@ -152,9 +155,7 @@ describe('Dashboard', () => {
wrapper
.
vm
wrapper
.
vm
.
$nextTick
()
.
$nextTick
()
.
then
(()
=>
{
.
then
(()
=>
{
const
environmentDropdownItems
=
wrapper
const
environmentDropdownItems
=
findAllEnvironmentsDropdownItems
();
.
find
(
'
.js-environments-dropdown
'
)
.
findAll
(
GlDropdownItem
);
expect
(
wrapper
.
vm
.
environments
.
length
).
toEqual
(
environmentData
.
length
);
expect
(
wrapper
.
vm
.
environments
.
length
).
toEqual
(
environmentData
.
length
);
expect
(
environmentDropdownItems
.
length
).
toEqual
(
wrapper
.
vm
.
environments
.
length
);
expect
(
environmentDropdownItems
.
length
).
toEqual
(
wrapper
.
vm
.
environments
.
length
);
...
@@ -176,10 +177,7 @@ describe('Dashboard', () => {
...
@@ -176,10 +177,7 @@ describe('Dashboard', () => {
wrapper
.
vm
wrapper
.
vm
.
$nextTick
()
.
$nextTick
()
.
then
(()
=>
{
.
then
(()
=>
{
const
environmentDropdownItems
=
wrapper
const
activeItem
=
findAllEnvironmentsDropdownItems
().
wrappers
.
filter
(
itemWrapper
=>
.
find
(
'
.js-environments-dropdown
'
)
.
findAll
(
GlDropdownItem
);
const
activeItem
=
environmentDropdownItems
.
wrappers
.
filter
(
itemWrapper
=>
itemWrapper
.
find
(
'
.active
'
).
exists
(),
itemWrapper
.
find
(
'
.active
'
).
exists
(),
);
);
...
@@ -205,11 +203,7 @@ describe('Dashboard', () => {
...
@@ -205,11 +203,7 @@ describe('Dashboard', () => {
wrapper
.
vm
wrapper
.
vm
.
$nextTick
()
.
$nextTick
()
.
then
(()
=>
{
.
then
(()
=>
{
const
environmentDropdownItems
=
wrapper
expect
(
findAllEnvironmentsDropdownItems
()).
toHaveLength
(
0
);
.
find
(
'
.js-environments-dropdown
'
)
.
findAll
(
GlDropdownItem
);
expect
(
environmentDropdownItems
.
length
).
toEqual
(
0
);
done
();
done
();
})
})
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
...
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