Commit a58faf3d authored by Sofia Vistas's avatar Sofia Vistas Committed by Dan Davison

Add group endpoint test for nuget

Prior to this MR we were testing nuget package
manager at the project level and push of a
package.

This MR rewrites the test to use the newly
 added group functionality to pull packages
at the group level
parent 85972542
......@@ -2,12 +2,12 @@
- if group_packages_nav?
= 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
= sprite_icon('package')
%span.nav-item-name
= _('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
= link_to packages_link, title: _('Packages & Registries') do
%strong.fly-out-top-item-name
......@@ -15,7 +15,7 @@
%li.divider.fly-out-top-item
- if group_packages_list_nav?
= 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')
- if group_container_registry_nav?
= nav_link(controller: 'groups/registry/repositories') do
......
......@@ -53,6 +53,12 @@ module QA
view 'ee/app/views/layouts/nav/sidebar/_group_iterations_link.html.haml' do
element :group_iterations_link
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
......@@ -140,6 +146,14 @@ module QA
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
within_sidebar do
click_element(:wiki_link)
......
......@@ -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|
......@@ -71,7 +88,67 @@ 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)
......
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