diff options
Diffstat (limited to 'qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb')
-rw-r--r-- | qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb | 119 |
1 files changed, 97 insertions, 22 deletions
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 be806fcbb3e..8c3f0930207 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 @@ -13,6 +13,13 @@ module QA end end + let(:another_project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'nuget-package-install-project' + project.template_name = 'dotnetcore' + end + end + let!(:runner) do Resource::Runner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" @@ -22,11 +29,21 @@ module QA end end + let!(:another_runner) do + Resource::Runner.fabricate! do |runner| + runner.name = "qa-runner-#{Time.now.to_i}" + runner.tags = ["runner-for-#{another_project.name}"] + runner.executor = :docker + runner.project = another_project + end + end + after do runner.remove_via_api! + another_runner.remove_via_api! end - it 'publishes a nuget package and deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1073' do + it 'publishes a nuget package at the project level, installs and deletes it at the group level', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1073' do Flow::Login.sign_in Resource::Repository::Commit.fabricate_via_api! do |commit| @@ -37,23 +54,23 @@ module QA { file_path: '.gitlab-ci.yml', content: <<~YAML - image: mcr.microsoft.com/dotnet/core/sdk:3.1 - - stages: - - deploy - - deploy: - stage: deploy - script: - - dotnet restore -p:Configuration=Release - - dotnet build -c Release - - dotnet pack -c Release - - 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: - - "#{project.default_branch}" - tags: - - "runner-for-#{project.name}" + image: mcr.microsoft.com/dotnet/core/sdk:3.1 + + stages: + - deploy + + deploy: + stage: deploy + script: + - dotnet restore -p:Configuration=Release + - dotnet build -c Release + - dotnet pack -c Release + - 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: + - "#{project.default_branch}" + tags: + - "runner-for-#{project.name}" YAML } ] @@ -71,16 +88,74 @@ module QA expect(job).to be_successful(timeout: 800) end - Page::Project::Menu.perform(&:click_packages_link) + another_project.visit! + + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = another_project + commit.commit_message = 'Add new csproj file' + commit.add_files( + [ + { + file_path: 'otherdotnet.csproj', + content: <<~EOF + <Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>netcoreapp3.1</TargetFramework> + </PropertyGroup> + + </Project> + EOF + } + ] + ) + commit.update_files( + [ + { + file_path: '.gitlab-ci.yml', + content: <<~YAML + image: mcr.microsoft.com/dotnet/core/sdk:3.1 + + stages: + - install + + install: + stage: install + script: + - dotnet nuget locals all --clear + - dotnet nuget add source "$CI_SERVER_URL/api/v4/groups/#{another_project.group.id}/-/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text + - "dotnet add otherdotnet.csproj package #{package_name} --version 1.0.0" + only: + - "#{another_project.default_branch}" + tags: + - "runner-for-#{another_project.name}" + YAML + } + ] + ) + end + + Flow::Pipeline.visit_latest_pipeline + + Page::Project::Pipeline::Show.perform do |pipeline| + pipeline.click_job('install') + end + + Page::Project::Job::Show.perform do |job| + expect(job).to be_successful(timeout: 800) + end + + project.group.sandbox.visit! + + Page::Group::Menu.perform(&:go_to_group_packages) 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::Show.perform(&:click_delete) Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") |