diff options
Diffstat (limited to 'qa/qa/specs/features/browser_ui/5_package')
8 files changed, 157 insertions, 14 deletions
diff --git a/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb index 7783dba3fa7..be6f3b17ccd 100644 --- a/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb @@ -81,8 +81,7 @@ module QA end project.visit! - Page::Project::Menu.perform(&:click_ci_cd_pipelines) - Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline) + Flow::Pipeline.visit_latest_pipeline Page::Project::Pipeline::Show.perform do |pipeline| pipeline.click_job('publish') @@ -112,7 +111,7 @@ module QA Page::Project::Packages::Index.perform do |index| aggregate_failures 'package deletion' do expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb index 2b06ba8646f..ae0580ff51b 100644 --- a/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb @@ -31,7 +31,7 @@ module QA runner.remove_via_api! end - it 'publishes a conan package and deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1077' do + it 'publishes, installs, and deletes a Conan package', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1077' do Flow::Login.sign_in Resource::Repository::Commit.fabricate_via_api! do |commit| @@ -43,13 +43,14 @@ module QA <<~YAML image: conanio/gcc7 - create_package: + test_package: stage: deploy script: - "conan remote add gitlab #{gitlab_address_with_port}/api/v4/projects/#{project.id}/packages/conan" - "conan new #{package_name}/0.1 -t" - "conan create . mycompany/stable" - "CONAN_LOGIN_USERNAME=ci_user CONAN_PASSWORD=${CI_JOB_TOKEN} conan upload #{package_name}/0.1@mycompany/stable --all --remote=gitlab" + - "conan install conantest/0.1@mycompany/stable --remote=gitlab" tags: - "runner-for-#{project.name}" YAML @@ -60,7 +61,7 @@ module QA Flow::Pipeline.visit_latest_pipeline Page::Project::Pipeline::Show.perform do |pipeline| - pipeline.click_job('create_package') + pipeline.click_job('test_package') end Page::Project::Job::Show.perform do |job| @@ -80,7 +81,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/generic_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/generic_repository_spec.rb new file mode 100644 index 00000000000..9a0d832de09 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/5_package/generic_repository_spec.rb @@ -0,0 +1,116 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Package', :orchestrated, :packages do + describe 'Generic Repository' do + let(:package_name) { 'my_package' } + + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'generic-package-project' + end + end + + let!(:runner) do + Resource::Runner.fabricate! do |runner| + runner.name = "qa-runner-#{Time.now.to_i}" + runner.tags = ["runner-for-#{project.name}"] + runner.executor = :docker + runner.project = project + end + end + + let(:gitlab_ci_yaml) do + <<~YAML + image: curlimages/curl:latest + + stages: + - upload + - download + + upload: + stage: upload + script: + - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file file.txt ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/my_package/0.0.1/file.txt' + tags: + - "runner-for-#{project.name}" + download: + stage: download + script: + - 'wget --header="JOB-TOKEN: $CI_JOB_TOKEN" ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/my_package/0.0.1/file.txt -O file_downloaded.txt' + tags: + - "runner-for-#{project.name}" + YAML + end + + let(:file_txt) do + <<~EOF + Hello, world! + EOF + end + + before do + Flow::Login.sign_in + + 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 + }, + { + file_path: 'file.txt', + content: file_txt + }] + ) + end + + project.visit! + Flow::Pipeline.visit_latest_pipeline + + Page::Project::Pipeline::Show.perform do |pipeline| + pipeline.click_job('upload') + end + + Page::Project::Job::Show.perform do |job| + expect(job).to be_successful(timeout: 800) + + job.click_element(:pipeline_path) + end + + Page::Project::Pipeline::Show.perform do |pipeline| + pipeline.click_job('download') + end + + Page::Project::Job::Show.perform do |job| + expect(job).to be_successful(timeout: 800) + end + end + + after do + runner.remove_via_api! + end + + it 'uploads a generic package, downloads and deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1108' do + Page::Project::Menu.perform(&:click_packages_link) + + Page::Project::Packages::Index.perform do |index| + expect(index).to have_package(package_name) + index.click_package(package_name) + end + + Page::Project::Packages::Show.perform do |package| + package.click_delete + end + + Page::Project::Packages::Index.perform do |index| + aggregate_failures 'package deletion' do + expect(index).to have_content("Package deleted successfully") + expect(index).to have_no_package(package_name) + end + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb index e163fcbe574..552302addf9 100644 --- a/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb @@ -54,7 +54,7 @@ module QA script: - 'gradle publish' only: - - master + - "#{project.default_branch}" tags: - "runner-for-#{project.name}" YAML @@ -118,7 +118,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb index 4ca356c9b65..5410b5023d9 100644 --- a/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb @@ -96,7 +96,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb index 817e146adfe..fa88ace1556 100644 --- a/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb @@ -69,7 +69,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb index 0b70adf9ff6..be806fcbb3e 100644 --- a/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb @@ -51,7 +51,7 @@ module QA - dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text - dotnet nuget push "bin/Release/*.nupkg" --source gitlab only: - - master + - "#{project.default_branch}" tags: - "runner-for-#{project.name}" YAML @@ -84,7 +84,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb index 35c41bbb2b0..d5eca171d6c 100644 --- a/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb @@ -87,6 +87,7 @@ module QA after do runner.remove_via_api! + project&.remove_via_api! end it 'publishes a pypi package and deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1087' do @@ -104,7 +105,33 @@ module QA Page::Project::Packages::Index.perform do |index| aggregate_failures do expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) + end + end + end + + context 'Geo', :orchestrated, :geo do + it 'replicates a published pypi package to the Geo secondary site', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1120' do + QA::Runtime::Logger.debug('Visiting the secondary Geo site') + + QA::Flow::Login.while_signed_in(address: :geo_secondary) do + EE::Page::Main::Banner.perform do |banner| + expect(banner).to have_secondary_read_only_banner + end + + Page::Main::Menu.perform(&:go_to_projects) + + Page::Dashboard::Projects.perform do |dashboard| + dashboard.wait_for_project_replication(project.name) + dashboard.go_to_project(project.name) + end + + Page::Project::Menu.perform(&:click_packages_link) + + Page::Project::Packages::Index.perform do |index| + index.wait_for_package_replication(package_name) + expect(index).to have_package(package_name) + end end end end |