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
c52e2fc1
Commit
c52e2fc1
authored
Dec 03, 2021
by
Peter Hegman
Committed by
Sanad Liaquat
Dec 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates admin deploy keys feature specs after refactoring to Vue
parent
1e87fad1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
55 deletions
+79
-55
spec/features/admin/admin_deploy_keys_spec.rb
spec/features/admin/admin_deploy_keys_spec.rb
+79
-55
No files found.
spec/features/admin/admin_deploy_keys_spec.rb
View file @
c52e2fc1
...
@@ -3,101 +3,125 @@
...
@@ -3,101 +3,125 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
'admin deploy keys'
do
RSpec
.
describe
'admin deploy keys'
do
include
Spec
::
Support
::
Helpers
::
ModalHelpers
let_it_be
(
:admin
)
{
create
(
:admin
)
}
let_it_be
(
:admin
)
{
create
(
:admin
)
}
let!
(
:deploy_key
)
{
create
(
:deploy_key
,
public:
true
)
}
let!
(
:deploy_key
)
{
create
(
:deploy_key
,
public:
true
)
}
let!
(
:another_deploy_key
)
{
create
(
:another_deploy_key
,
public:
true
)
}
let!
(
:another_deploy_key
)
{
create
(
:another_deploy_key
,
public:
true
)
}
before
do
before
do
stub_feature_flags
(
admin_deploy_keys_vue:
false
)
sign_in
(
admin
)
sign_in
(
admin
)
gitlab_enable_admin_mode_sign_in
(
admin
)
gitlab_enable_admin_mode_sign_in
(
admin
)
end
end
it
'show all public deploy keys'
do
shared_examples
'renders deploy keys correctly'
do
visit
admin_deploy_keys_path
it
'show all public deploy keys'
do
visit
admin_deploy_keys_path
page
.
within
(
find
(
'[data-testid="deploy-keys-list"]'
,
match: :first
))
do
page
.
within
(
find
(
'[data-testid="deploy-keys-list"]'
,
match: :first
))
do
expect
(
page
).
to
have_content
(
deploy_key
.
title
)
expect
(
page
).
to
have_content
(
deploy_key
.
title
)
expect
(
page
).
to
have_content
(
another_deploy_key
.
title
)
expect
(
page
).
to
have_content
(
another_deploy_key
.
title
)
end
end
end
end
it
'shows all the projects the deploy key has write access'
do
it
'shows all the projects the deploy key has write access'
do
write_key
=
create
(
:deploy_keys_project
,
:write_access
,
deploy_key:
deploy_key
)
write_key
=
create
(
:deploy_keys_project
,
:write_access
,
deploy_key:
deploy_key
)
visit
admin_deploy_keys_path
visit
admin_deploy_keys_path
page
.
within
(
find
(
'[data-testid="deploy-keys-list"]'
,
match: :first
))
do
page
.
within
(
find
(
'[data-testid="deploy-keys-list"]'
,
match: :first
))
do
expect
(
page
).
to
have_content
(
write_key
.
project
.
full_name
)
expect
(
page
).
to
have_content
(
write_key
.
project
.
full_name
)
end
end
end
end
describe
'create a new deploy key'
do
describe
'create a new deploy key'
do
let
(
:new_ssh_key
)
{
attributes_for
(
:key
)[
:key
]
}
let
(
:new_ssh_key
)
{
attributes_for
(
:key
)[
:key
]
}
before
do
before
do
visit
admin_deploy_keys_path
visit
admin_deploy_keys_path
click_link
'New deploy key'
click_link
'New deploy key'
end
end
it
'creates a new deploy key'
do
it
'creates a new deploy key'
do
fill_in
'deploy_key_title'
,
with:
'laptop'
fill_in
'deploy_key_title'
,
with:
'laptop'
fill_in
'deploy_key_key'
,
with:
new_ssh_key
fill_in
'deploy_key_key'
,
with:
new_ssh_key
click_button
'Create'
click_button
'Create'
expect
(
current_path
).
to
eq
admin_deploy_keys_path
expect
(
current_path
).
to
eq
admin_deploy_keys_path
page
.
within
(
find
(
'[data-testid="deploy-keys-list"]'
,
match: :first
))
do
page
.
within
(
find
(
'[data-testid="deploy-keys-list"]'
,
match: :first
))
do
expect
(
page
).
to
have_content
(
'laptop'
)
expect
(
page
).
to
have_content
(
'laptop'
)
end
end
end
end
end
end
describe
'update an existing deploy key'
do
describe
'update an existing deploy key'
do
before
do
before
do
visit
admin_deploy_keys_path
visit
admin_deploy_keys_path
find
(
'tr'
,
text:
deploy_key
.
title
).
click_link
(
'Edit'
)
page
.
within
(
'tr'
,
text:
deploy_key
.
title
)
do
end
click_link
(
_
(
'Edit deploy key'
))
end
end
it
'updates an existing deploy key'
do
it
'updates an existing deploy key'
do
fill_in
'deploy_key_title'
,
with:
'new-title'
fill_in
'deploy_key_title'
,
with:
'new-title'
click_button
'Save changes'
click_button
'Save changes'
expect
(
current_path
).
to
eq
admin_deploy_keys_path
expect
(
current_path
).
to
eq
admin_deploy_keys_path
page
.
within
(
find
(
'[data-testid="deploy-keys-list"]'
,
match: :first
))
do
page
.
within
(
find
(
'[data-testid="deploy-keys-list"]'
,
match: :first
))
do
expect
(
page
).
to
have_content
(
'new-title'
)
expect
(
page
).
to
have_content
(
'new-title'
)
end
end
end
end
end
end
end
describe
'remove an existing deploy key'
do
context
'when `admin_deploy_keys_vue` feature flag is enabled'
,
:js
do
before
do
it_behaves_like
'renders deploy keys correctly'
visit
admin_deploy_keys_path
end
it
'removes an existing deploy key'
do
describe
'remove an existing deploy key'
do
find
(
'tr'
,
text:
deploy_key
.
title
).
click_link
(
'Remove'
)
before
do
visit
admin_deploy_keys_path
end
expect
(
current_path
).
to
eq
admin_deploy_keys_path
it
'removes an existing deploy key'
do
page
.
within
(
find
(
'[data-testid="deploy-keys-list"]'
,
match: :first
))
do
accept_gl_confirm
(
'Are you sure you want to delete this deploy key?'
,
button_text:
'Delete'
)
do
expect
(
page
).
not_to
have_content
(
deploy_key
.
title
)
page
.
within
(
'tr'
,
text:
deploy_key
.
title
)
do
click_button
_
(
'Delete deploy key'
)
end
end
expect
(
current_path
).
to
eq
admin_deploy_keys_path
page
.
within
(
find
(
'[data-testid="deploy-keys-list"]'
,
match: :first
))
do
expect
(
page
).
not_to
have_content
(
deploy_key
.
title
)
end
end
end
end
end
end
end
context
'when `admin_deploy_keys_vue` feature flag is
enabled'
,
:js
do
context
'when `admin_deploy_keys_vue` feature flag is
disabled'
do
before
do
before
do
stub_feature_flags
(
admin_deploy_keys_vue:
true
)
stub_feature_flags
(
admin_deploy_keys_vue:
false
)
visit
admin_deploy_keys_path
end
end
it
'renders the Vue app'
,
:aggregate_failures
do
it_behaves_like
'renders deploy keys correctly'
expect
(
page
).
to
have_content
(
'Public deploy keys'
)
expect
(
page
).
to
have_selector
(
'[data-testid="deploy-keys-list"]'
)
describe
'remove an existing deploy key'
do
expect
(
page
).
to
have_link
(
'New deploy key'
,
href:
new_admin_deploy_key_path
)
before
do
visit
admin_deploy_keys_path
end
it
'removes an existing deploy key'
do
page
.
within
(
'tr'
,
text:
deploy_key
.
title
)
do
click_link
_
(
'Remove deploy key'
)
end
expect
(
current_path
).
to
eq
admin_deploy_keys_path
page
.
within
(
find
(
'[data-testid="deploy-keys-list"]'
,
match: :first
))
do
expect
(
page
).
not_to
have_content
(
deploy_key
.
title
)
end
end
end
end
end
end
end
end
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