Commit 48418196 authored by svistas's avatar svistas

Test container registry in staging

Prior to this change, there were no container registry
tests for staging. This test is the minimal base of test
for the staging environment.

This particular test targets the staging environment specific
since with omnibus it is needed to create the runner as well
parent fa0da1ee
......@@ -166,6 +166,7 @@ export default {
:title="$options.i18n.REMOVE_TAG_BUTTON_TITLE"
:tooltip-title="$options.i18n.REMOVE_TAG_BUTTON_DISABLE_TOOLTIP"
:tooltip-disabled="tag.canDelete"
data-qa-selector="tag_delete_button"
data-testid="single-delete-button"
@delete="$emit('delete')"
/>
......
......@@ -92,6 +92,7 @@ export default {
<router-link
class="gl-text-body gl-font-weight-bold"
data-testid="details-link"
data-qa-selector="registry_image_content"
:to="{ name: 'details', params: { id } }"
>
{{ item.path }}
......
......@@ -293,6 +293,10 @@ module QA
autoload :Show, 'qa/page/project/packages/show'
end
module Registry
autoload :Show, 'qa/page/project/registry/show'
end
module Settings
autoload :Advanced, 'qa/page/project/settings/advanced'
autoload :Main, 'qa/page/project/settings/main'
......
# frozen_string_literal: true
module QA
module Page
module Project
module Registry
class Show < QA::Page::Base
view 'app/assets/javascripts/registry/explorer/components/list_page/image_list_row.vue' do
element :registry_image_content
end
view 'app/assets/javascripts/registry/explorer/components/details_page/tags_list_row.vue' do
element :tag_delete_button
end
def has_image_repository?(name)
find('a[data-testid="details-link"]', text: name)
end
def click_on_image(name)
find('a[data-testid="details-link"]', text: name).click
end
def has_tag?(tag_name)
has_button?(tag_name)
end
def has_no_tag?(tag_name)
has_no_button?(tag_name)
end
def click_delete
find('[data-testid="single-delete-button"]').click
find_button('Confirm').click
end
end
end
end
end
end
......@@ -22,6 +22,25 @@ module QA
click_element :packages_link
end
end
def go_to_container_registry
hover_registry do
within_submenu do
click_link('Container Registry')
end
end
end
private
def hover_registry
within_sidebar do
scroll_to_element(:packages_link)
find_element(:packages_link).hover
yield
end
end
end
end
end
......
# frozen_string_literal: true
module QA
RSpec.describe 'Package', :orchestrated do
describe 'Container Registry', only: { subdomain: :staging } do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'project-with-registry'
project.template_name = 'express'
end
end
let!(:gitlab_ci_yaml) do
<<~YAML
build:
image: docker:19.03.12
stage: build
services:
- docker:19.03.12-dind
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
YAML
end
it 'pushes project image to the container registry and deletes tag', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1699' do
Flow::Login.sign_in
project.visit!
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project
commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([{
file_path: '.gitlab-ci.yml',
content: gitlab_ci_yaml
}])
end
Flow::Pipeline.visit_latest_pipeline
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job('build')
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 800)
end
Page::Project::Menu.perform(&:go_to_container_registry)
Page::Project::Registry::Show.perform do |registry|
expect(registry).to have_image_repository(project.path_with_namespace)
registry.click_on_image(project.path_with_namespace)
expect(registry).to have_tag('master')
registry.click_delete
expect(registry).not_to have_tag('master')
end
end
end
end
end
......@@ -15,6 +15,7 @@ module Matchers
pipeline
related_issue_item
snippet_description
tag
].each do |predicate|
RSpec::Matchers.define "have_#{predicate}" do |*args, **kwargs|
match do |page_object|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment