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
c3171df3
Commit
c3171df3
authored
Feb 25, 2020
by
Nicolò Maria Mezzopera
Committed by
Grzegorz Bizon
Feb 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature test for new registry explorer
- project tests - group tests
parent
a675cc81
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
254 additions
and
0 deletions
+254
-0
spec/features/groups/container_registry_spec.rb
spec/features/groups/container_registry_spec.rb
+93
-0
spec/features/projects/container_registry_spec.rb
spec/features/projects/container_registry_spec.rb
+161
-0
No files found.
spec/features/container_registry_spec.rb
→
spec/features/
groups/
container_registry_spec.rb
View file @
c3171df3
...
@@ -4,30 +4,31 @@ require 'spec_helper'
...
@@ -4,30 +4,31 @@ require 'spec_helper'
describe
'Container Registry'
,
:js
do
describe
'Container Registry'
,
:js
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:container_repository
)
do
let
(
:container_repository
)
do
create
(
:container_repository
,
name:
'my/image'
)
create
(
:container_repository
,
name:
'my/image'
)
end
end
before
do
before
do
group
.
add_owner
(
user
)
sign_in
(
user
)
sign_in
(
user
)
project
.
add_developer
(
user
)
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_tags
(
repository: :any
,
tags:
[])
stub_container_registry_tags
(
repository: :any
,
tags:
[])
stub_feature_flags
(
vue_container_registry_explorer:
false
)
end
end
it
'has a page title set'
do
it
'has a page title set'
do
visit_container_registry
visit_container_registry
expect
(
page
).
to
have_title
(
_
(
'Container Registry'
))
expect
(
page
).
to
have_title
_
(
'Container Registry'
)
end
end
context
'when there are no image repositories'
do
context
'when there are no image repositories'
do
it
'
user visits container registry main pag
e'
do
it
'
list page has no container titl
e'
do
visit_container_registry
visit_container_registry
expect
(
page
).
to
have_content
'no container images'
expect
(
page
).
to
have_content
_
(
'There are no container images available in this group'
)
end
end
end
end
...
@@ -37,39 +38,56 @@ describe 'Container Registry', :js do
...
@@ -37,39 +38,56 @@ describe 'Container Registry', :js do
project
.
container_repositories
<<
container_repository
project
.
container_repositories
<<
container_repository
end
end
it
'
user wants to see multi-level container repository
'
do
it
'
list page has a list of images
'
do
visit_container_registry
visit_container_registry
expect
(
page
).
to
have_content
(
'my/image'
)
expect
(
page
).
to
have_content
'my/image'
end
end
it
'
user removes entire container repository'
,
:sidekiq_might_not_need_inline
do
it
'
image repository delete is disabled'
do
visit_container_registry
visit_container_registry
expect_any_instance_of
(
ContainerRepository
).
to
receive
(
:delete_tags!
).
and_return
(
true
)
delete_btn
=
find
(
'[title="Remove repository"]'
)
expect
(
delete_btn
).
to
be_disabled
end
it
'navigates to repo details'
do
visit_container_registry_details
(
'my/image'
)
click_on
(
class:
'js-remove-repo'
)
expect
(
page
).
to
have_content
'latest'
expect
(
find
(
'.modal .modal-title'
)).
to
have_content
'Remove repository'
find
(
'.modal .modal-footer .btn-danger'
).
click
end
end
it
'user removes a specific tag from container repository'
do
describe
'image repo details'
do
visit_container_registry
before
do
visit_container_registry_details
'my/image'
end
find
(
'.js-toggle-repo'
).
click
it
'shows the details breadcrumb'
do
wait_for_requests
expect
(
find
(
'.breadcrumbs'
)).
to
have_link
'my/image'
end
it
'shows the image title'
do
expect
(
page
).
to
have_content
'my/image tags'
end
it
'user removes a specific tag from container repository'
do
service
=
double
(
'service'
)
service
=
double
(
'service'
)
expect
(
service
).
to
receive
(
:execute
).
with
(
container_repository
)
{
{
status: :success
}
}
expect
(
service
).
to
receive
(
:execute
).
with
(
container_repository
)
{
{
status: :success
}
}
expect
(
Projects
::
ContainerRepository
::
DeleteTagsService
).
to
receive
(
:new
).
with
(
container_repository
.
project
,
user
,
tags:
[
'latest'
])
{
service
}
expect
(
Projects
::
ContainerRepository
::
DeleteTagsService
).
to
receive
(
:new
).
with
(
container_repository
.
project
,
user
,
tags:
[
'latest'
])
{
service
}
click_on
(
class:
'js-delete-registry-row'
,
visible:
false
)
click_on
(
class:
'js-delete-registry'
)
expect
(
find
(
'.modal .modal-title'
)).
to
have_content
'Remove tag'
expect
(
find
(
'.modal .modal-title'
)).
to
have_content
_
(
'Remove tag'
)
find
(
'.modal .modal-footer .btn-danger'
).
click
find
(
'.modal .modal-footer .btn-danger'
).
click
end
end
end
end
end
def
visit_container_registry
def
visit_container_registry
visit
project_container_registry_index_path
(
project
)
visit
group_container_registries_path
(
group
)
end
def
visit_container_registry_details
(
name
)
visit_container_registry
click_link
(
name
)
end
end
end
end
spec/features/projects/container_registry_spec.rb
0 → 100644
View file @
c3171df3
# frozen_string_literal: true
require
'spec_helper'
describe
'Container Registry'
,
:js
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:container_repository
)
do
create
(
:container_repository
,
name:
'my/image'
)
end
before
do
sign_in
(
user
)
project
.
add_developer
(
user
)
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_tags
(
repository: :any
,
tags:
[])
end
describe
'Registry explorer is off'
do
before
do
stub_feature_flags
(
vue_container_registry_explorer:
false
)
end
it
'has a page title set'
do
visit_container_registry
expect
(
page
).
to
have_title
_
(
'Container Registry'
)
end
context
'when there are no image repositories'
do
it
'user visits container registry main page'
do
visit_container_registry
expect
(
page
).
to
have_content
_
(
'no container images'
)
end
end
context
'when there are image repositories'
do
before
do
stub_container_registry_tags
(
repository:
%r{my/image}
,
tags:
%w[latest]
,
with_manifest:
true
)
project
.
container_repositories
<<
container_repository
end
it
'user wants to see multi-level container repository'
do
visit_container_registry
expect
(
page
).
to
have_content
'my/image'
end
it
'user removes entire container repository'
,
:sidekiq_might_not_need_inline
do
visit_container_registry
expect_any_instance_of
(
ContainerRepository
).
to
receive
(
:delete_tags!
).
and_return
(
true
)
click_on
(
class:
'js-remove-repo'
)
expect
(
find
(
'.modal .modal-title'
)).
to
have_content
_
(
'Remove repository'
)
find
(
'.modal .modal-footer .btn-danger'
).
click
end
it
'user removes a specific tag from container repository'
do
visit_container_registry
find
(
'.js-toggle-repo'
).
click
wait_for_requests
service
=
double
(
'service'
)
expect
(
service
).
to
receive
(
:execute
).
with
(
container_repository
)
{
{
status: :success
}
}
expect
(
Projects
::
ContainerRepository
::
DeleteTagsService
).
to
receive
(
:new
).
with
(
container_repository
.
project
,
user
,
tags:
[
'latest'
])
{
service
}
click_on
(
class:
'js-delete-registry-row'
,
visible:
false
)
expect
(
find
(
'.modal .modal-title'
)).
to
have_content
_
(
'Remove tag'
)
find
(
'.modal .modal-footer .btn-danger'
).
click
end
end
end
describe
'Registry explorer is on'
do
it
'has a page title set'
do
visit_container_registry
expect
(
page
).
to
have_title
_
(
'Container Registry'
)
end
context
'when there are no image repositories'
do
it
'list page has no container title'
do
visit_container_registry
expect
(
page
).
to
have_content
_
(
'There are no container images stored for this project'
)
end
it
'list page has quickstart'
do
visit_container_registry
expect
(
page
).
to
have_content
_
(
'Quick Start'
)
end
end
context
'when there are image repositories'
do
before
do
stub_container_registry_tags
(
repository:
%r{my/image}
,
tags:
%w[latest]
,
with_manifest:
true
)
project
.
container_repositories
<<
container_repository
end
it
'list page has a list of images'
do
visit_container_registry
expect
(
page
).
to
have_content
'my/image'
end
it
'user removes entire container repository'
,
:sidekiq_might_not_need_inline
do
visit_container_registry
expect_any_instance_of
(
ContainerRepository
).
to
receive
(
:delete_tags!
).
and_return
(
true
)
find
(
'[title="Remove repository"]'
).
click
expect
(
find
(
'.modal .modal-title'
)).
to
have_content
_
(
'Remove repository'
)
find
(
'.modal .modal-footer .btn-danger'
).
click
end
it
'navigates to repo details'
do
visit_container_registry_details
(
'my/image'
)
expect
(
page
).
to
have_content
'latest'
end
describe
'image repo details'
do
before
do
visit_container_registry_details
'my/image'
end
it
'shows the details breadcrumb'
do
expect
(
find
(
'.breadcrumbs'
)).
to
have_link
'my/image'
end
it
'shows the image title'
do
expect
(
page
).
to
have_content
'my/image tags'
end
it
'user removes a specific tag from container repository'
do
service
=
double
(
'service'
)
expect
(
service
).
to
receive
(
:execute
).
with
(
container_repository
)
{
{
status: :success
}
}
expect
(
Projects
::
ContainerRepository
::
DeleteTagsService
).
to
receive
(
:new
).
with
(
container_repository
.
project
,
user
,
tags:
[
'latest'
])
{
service
}
click_on
(
class:
'js-delete-registry'
)
expect
(
find
(
'.modal .modal-title'
)).
to
have_content
_
(
'Remove tag'
)
find
(
'.modal .modal-footer .btn-danger'
).
click
end
end
end
end
def
visit_container_registry
visit
project_container_registry_index_path
(
project
)
end
def
visit_container_registry_details
(
name
)
visit_container_registry
click_link
(
name
)
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