Commit 0ef98e28 authored by Dan Davison's avatar Dan Davison

Merge branch 'test-group-support-nuget' into 'master'

Add group endpoint test for nuget

See merge request gitlab-org/gitlab!52197
parents 8dd60a10 a58faf3d
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
- if group_packages_nav? - if group_packages_nav?
= nav_link(controller: ['groups/packages', 'groups/registry/repositories', 'groups/dependency_proxies']) do = nav_link(controller: ['groups/packages', 'groups/registry/repositories', 'groups/dependency_proxies']) do
= link_to packages_link, title: _('Packages') do = link_to packages_link, title: _('Packages'), data: { qa_selector: 'group_packages_item' } do
.nav-icon-container .nav-icon-container
= sprite_icon('package') = sprite_icon('package')
%span.nav-item-name %span.nav-item-name
= _('Packages & Registries') = _('Packages & Registries')
%ul.sidebar-sub-level-items %ul.sidebar-sub-level-items{ data: { qa_selector: 'group_packages_submenu' } }
= nav_link(controller: [:packages, :repositories], html_options: { class: "fly-out-top-item" } ) do = nav_link(controller: [:packages, :repositories], html_options: { class: "fly-out-top-item" } ) do
= link_to packages_link, title: _('Packages & Registries') do = link_to packages_link, title: _('Packages & Registries') do
%strong.fly-out-top-item-name %strong.fly-out-top-item-name
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
%li.divider.fly-out-top-item %li.divider.fly-out-top-item
- if group_packages_list_nav? - if group_packages_list_nav?
= nav_link(controller: 'groups/packages') do = nav_link(controller: 'groups/packages') do
= link_to group_packages_path(@group), title: _('Packages') do = link_to group_packages_path(@group), title: _('Packages'), data: { qa_selector: 'group_packages_link' } do
%span= _('Package Registry') %span= _('Package Registry')
- if group_container_registry_nav? - if group_container_registry_nav?
= nav_link(controller: 'groups/registry/repositories') do = nav_link(controller: 'groups/registry/repositories') do
......
...@@ -53,6 +53,12 @@ module QA ...@@ -53,6 +53,12 @@ module QA
view 'ee/app/views/layouts/nav/sidebar/_group_iterations_link.html.haml' do view 'ee/app/views/layouts/nav/sidebar/_group_iterations_link.html.haml' do
element :group_iterations_link element :group_iterations_link
end end
view 'ee/app/views/groups/sidebar/_packages.html.haml' do
element :group_packages_item
element :group_packages_link
element :group_packages_submenu
end
end end
end end
...@@ -140,6 +146,14 @@ module QA ...@@ -140,6 +146,14 @@ module QA
end end
end end
def go_to_group_packages
hover_element(:group_packages_item) do
within_submenu(:group_packages_submenu) do
click_element(:group_packages_link)
end
end
end
def click_group_wiki_link def click_group_wiki_link
within_sidebar do within_sidebar do
click_element(:wiki_link) click_element(:wiki_link)
......
...@@ -13,6 +13,13 @@ module QA ...@@ -13,6 +13,13 @@ module QA
end end
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 let!(:runner) do
Resource::Runner.fabricate! do |runner| Resource::Runner.fabricate! do |runner|
runner.name = "qa-runner-#{Time.now.to_i}" runner.name = "qa-runner-#{Time.now.to_i}"
...@@ -22,11 +29,21 @@ module QA ...@@ -22,11 +29,21 @@ module QA
end end
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 after do
runner.remove_via_api! runner.remove_via_api!
another_runner.remove_via_api!
end 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 Flow::Login.sign_in
Resource::Repository::Commit.fabricate_via_api! do |commit| Resource::Repository::Commit.fabricate_via_api! do |commit|
...@@ -37,23 +54,23 @@ module QA ...@@ -37,23 +54,23 @@ module QA
{ {
file_path: '.gitlab-ci.yml', file_path: '.gitlab-ci.yml',
content: <<~YAML content: <<~YAML
image: mcr.microsoft.com/dotnet/core/sdk:3.1 image: mcr.microsoft.com/dotnet/core/sdk:3.1
stages: stages:
- deploy - deploy
deploy: deploy:
stage: deploy stage: deploy
script: script:
- dotnet restore -p:Configuration=Release - dotnet restore -p:Configuration=Release
- dotnet build -c Release - dotnet build -c Release
- dotnet pack -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 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 - dotnet nuget push "bin/Release/*.nupkg" --source gitlab
only: only:
- "#{project.default_branch}" - "#{project.default_branch}"
tags: tags:
- "runner-for-#{project.name}" - "runner-for-#{project.name}"
YAML YAML
} }
] ]
...@@ -71,7 +88,67 @@ module QA ...@@ -71,7 +88,67 @@ module QA
expect(job).to be_successful(timeout: 800) expect(job).to be_successful(timeout: 800)
end 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| Page::Project::Packages::Index.perform do |index|
expect(index).to have_package(package_name) expect(index).to have_package(package_name)
......
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