Commit 2b259c3e authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 334f887e 7fd347f3
...@@ -9,7 +9,13 @@ export default () => { ...@@ -9,7 +9,13 @@ export default () => {
return null; return null;
} }
const { activityEmptyStateImage, agentName, emptyStateSvgPath, projectPath } = el.dataset; const {
activityEmptyStateImage,
agentName,
canAdminVulnerability,
emptyStateSvgPath,
projectPath,
} = el.dataset;
return new Vue({ return new Vue({
el, el,
...@@ -17,6 +23,7 @@ export default () => { ...@@ -17,6 +23,7 @@ export default () => {
provide: { provide: {
activityEmptyStateImage, activityEmptyStateImage,
agentName, agentName,
canAdminVulnerability,
emptyStateSvgPath, emptyStateSvgPath,
projectPath, projectPath,
}, },
......
...@@ -18,8 +18,6 @@ export function expandSection(sectionArg) { ...@@ -18,8 +18,6 @@ export function expandSection(sectionArg) {
const $section = $(sectionArg); const $section = $(sectionArg);
$section.find('.js-settings-toggle:not(.js-settings-toggle-trigger-only)').text(__('Collapse')); $section.find('.js-settings-toggle:not(.js-settings-toggle-trigger-only)').text(__('Collapse'));
// eslint-disable-next-line @gitlab/no-global-event-off
$section.find('.settings-content').off('scroll.expandSection').scrollTop(0);
$section.addClass('expanded'); $section.addClass('expanded');
if (!$section.hasClass('no-animate')) { if (!$section.hasClass('no-animate')) {
$section $section
...@@ -32,7 +30,6 @@ export function closeSection(sectionArg) { ...@@ -32,7 +30,6 @@ export function closeSection(sectionArg) {
const $section = $(sectionArg); const $section = $(sectionArg);
$section.find('.js-settings-toggle:not(.js-settings-toggle-trigger-only)').text(__('Expand')); $section.find('.js-settings-toggle:not(.js-settings-toggle-trigger-only)').text(__('Expand'));
$section.find('.settings-content').on('scroll.expandSection', () => expandSection($section));
$section.removeClass('expanded'); $section.removeClass('expanded');
if (!$section.hasClass('no-animate')) { if (!$section.hasClass('no-animate')) {
$section $section
...@@ -55,18 +52,16 @@ export default function initSettingsPanels() { ...@@ -55,18 +52,16 @@ export default function initSettingsPanels() {
const $section = $(elm); const $section = $(elm);
$section.on('click.toggleSection', '.js-settings-toggle', () => toggleSection($section)); $section.on('click.toggleSection', '.js-settings-toggle', () => toggleSection($section));
if (!isExpanded($section)) {
$section.find('.settings-content').on('scroll.expandSection', () => {
$section.removeClass('no-animate');
expandSection($section);
});
}
});
if (window.location.hash) { if (window.location.hash) {
const $target = $(window.location.hash); const $target = $(window.location.hash);
if ($target.length && $target.hasClass('settings')) { if (
expandSection($target); $target.length &&
!isExpanded($section) &&
($section.is($target) || $section.find($target).length)
) {
$section.addClass('no-animate');
expandSection($section);
} }
} }
});
} }
...@@ -5,6 +5,7 @@ module Projects::ClusterAgentsHelper ...@@ -5,6 +5,7 @@ module Projects::ClusterAgentsHelper
{ {
activity_empty_state_image: image_path('illustrations/empty-state/empty-state-agents.svg'), activity_empty_state_image: image_path('illustrations/empty-state/empty-state-agents.svg'),
agent_name: agent_name, agent_name: agent_name,
can_admin_vulnerability: can?(current_user, :admin_vulnerability, project).to_s,
empty_state_svg_path: image_path('illustrations/operations-dashboard_empty.svg'), empty_state_svg_path: image_path('illustrations/operations-dashboard_empty.svg'),
project_path: project.full_path project_path: project.full_path
} }
......
<script> <script>
import { PortalTarget } from 'portal-vue';
import { helpPagePath } from '~/helpers/help_page_helper'; import { helpPagePath } from '~/helpers/help_page_helper';
import VulnerabilityListGraphql from '../shared/vulnerability_report/vulnerability_list_graphql.vue'; import VulnerabilityListGraphql from '../shared/vulnerability_report/vulnerability_list_graphql.vue';
import VulnerabilityFilters from '../shared/vulnerability_report/vulnerability_filters.vue'; import VulnerabilityFilters from '../shared/vulnerability_report/vulnerability_filters.vue';
...@@ -15,6 +16,7 @@ const PORTAL_NAME = 'vulnerability-report-sticky'; ...@@ -15,6 +16,7 @@ const PORTAL_NAME = 'vulnerability-report-sticky';
export default { export default {
components: { components: {
PortalTarget,
VulnerabilityFilters, VulnerabilityFilters,
VulnerabilityListGraphql, VulnerabilityListGraphql,
}, },
...@@ -29,7 +31,6 @@ export default { ...@@ -29,7 +31,6 @@ export default {
return { return {
dashboardDocumentation: helpPagePath('user/application_security/security_dashboard/index'), dashboardDocumentation: helpPagePath('user/application_security/security_dashboard/index'),
dashboardType: DASHBOARD_TYPES.PROJECT, dashboardType: DASHBOARD_TYPES.PROJECT,
canAdminVulnerability: true,
fullPath: this.projectPath, fullPath: this.projectPath,
canViewFalsePositive: false, canViewFalsePositive: false,
hasJiraVulnerabilitiesIntegrationEnabled: false, hasJiraVulnerabilitiesIntegrationEnabled: false,
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
module QA module QA
RSpec.describe 'Package', :orchestrated, :registry, only: { pipeline: :main } do RSpec.describe 'Package', :orchestrated, :registry, only: { pipeline: :main } do
describe 'Dependency Proxy' do describe 'Dependency Proxy' do
using RSpec::Parameterized::TableSyntax
let(:project) do let(:project) do
Resource::Project.fabricate_via_api! do |project| Resource::Project.fabricate_via_api! do |project|
project.name = 'dependency-proxy-project' project.name = 'dependency-proxy-project'
...@@ -40,12 +42,13 @@ module QA ...@@ -40,12 +42,13 @@ module QA
runner.remove_via_api! runner.remove_via_api!
end end
where(:docker_client_version) do where(:case_name, :docker_client_version, :testcase) do
%w[docker:19.03.12 docker:20.10] 'using docker:19.03.12' | 'docker:19.03.12' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347605'
'using docker:20.10' | 'docker:20.10' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347604'
end end
with_them do with_them do
it "pulls an image using the dependency proxy" do it "pulls an image using the dependency proxy", testcase: params[:testcase] do
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit| Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project commit.project = project
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
module QA module QA
RSpec.describe 'Package', :orchestrated, :packages, :object_storage do RSpec.describe 'Package', :orchestrated, :packages, :object_storage do
describe 'Helm Registry' do describe 'Helm Registry' do
using RSpec::Parameterized::TableSyntax
include Runtime::Fixtures include Runtime::Fixtures
include_context 'packages registry qa scenario' include_context 'packages registry qa scenario'
...@@ -10,8 +11,13 @@ module QA ...@@ -10,8 +11,13 @@ module QA
let(:package_version) { '1.3.7' } let(:package_version) { '1.3.7' }
let(:package_type) { 'helm' } let(:package_type) { 'helm' }
%i[personal_access_token ci_job_token project_deploy_token].each do |authentication_token_type| where(:case_name, :authentication_token_type, :testcase) do
context "using a #{authentication_token_type}" do 'using personal access token' | :personal_access_token | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347586'
'using ci job token' | :ci_job_token | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347587'
'using project deploy token' | :project_deploy_token | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347588'
end
with_them do
let(:username) do let(:username) do
case authentication_token_type case authentication_token_type
when :personal_access_token when :personal_access_token
...@@ -34,7 +40,7 @@ module QA ...@@ -34,7 +40,7 @@ module QA
end end
end end
it "pushes and pulls a helm chart" do it "pushes and pulls a helm chart", testcase: params[:testcase] do
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit| Resource::Repository::Commit.fabricate_via_api! do |commit|
helm_upload_yaml = ERB.new(read_fixture('package_managers/helm', 'helm_upload_package.yaml.erb')).result(binding) helm_upload_yaml = ERB.new(read_fixture('package_managers/helm', 'helm_upload_package.yaml.erb')).result(binding)
...@@ -109,5 +115,4 @@ module QA ...@@ -109,5 +115,4 @@ module QA
end end
end end
end end
end
end end
...@@ -68,10 +68,10 @@ module QA ...@@ -68,10 +68,10 @@ module QA
another_project.remove_via_api! another_project.remove_via_api!
end end
where(:authentication_token_type, :token_name) do where(:case_name, :authentication_token_type, :token_name, :testcase) do
:personal_access_token | 'Personal Access Token' 'using personal access token' | :personal_access_token | 'Personal Access Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347600'
:ci_job_token | 'CI Job Token' 'using ci job token' | :ci_job_token | 'CI Job Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347599'
:project_deploy_token | 'Deploy Token' 'using project deploy token' | :project_deploy_token | 'Deploy Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347598'
end end
with_them do with_them do
...@@ -86,7 +86,7 @@ module QA ...@@ -86,7 +86,7 @@ module QA
end end
end end
it "push and pull a npm package via CI using a #{params[:token_name]}" do it 'push and pull a npm package via CI', testcase: params[:testcase] do
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
npm_upload_yaml = ERB.new(read_fixture('package_managers/npm', 'npm_upload_package_instance.yaml.erb')).result(binding) npm_upload_yaml = ERB.new(read_fixture('package_managers/npm', 'npm_upload_package_instance.yaml.erb')).result(binding)
package_json = ERB.new(read_fixture('package_managers/npm', 'package_instance.json.erb')).result(binding) package_json = ERB.new(read_fixture('package_managers/npm', 'package_instance.json.erb')).result(binding)
......
...@@ -59,10 +59,10 @@ module QA ...@@ -59,10 +59,10 @@ module QA
project.remove_via_api! project.remove_via_api!
end end
where(:authentication_token_type, :token_name) do where(:case_name, :authentication_token_type, :token_name, :testcase) do
:personal_access_token | 'Personal Access Token' 'using personal access token' | :personal_access_token | 'Personal Access Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347592'
:ci_job_token | 'CI Job Token' 'using ci job token' | :ci_job_token | 'CI Job Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347594'
:project_deploy_token | 'Deploy Token' 'using project deploy token' | :project_deploy_token | 'Deploy Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347593'
end end
with_them do with_them do
...@@ -77,7 +77,7 @@ module QA ...@@ -77,7 +77,7 @@ module QA
end end
end end
it "push and pull a npm package via CI using a #{params[:token_name]}" do it 'push and pull a npm package via CI', testcase: params[:testcase] do
Resource::Repository::Commit.fabricate_via_api! do |commit| Resource::Repository::Commit.fabricate_via_api! do |commit|
npm_upload_install_yaml = ERB.new(read_fixture('package_managers/npm', 'npm_upload_install_package_project.yaml.erb')).result(binding) npm_upload_install_yaml = ERB.new(read_fixture('package_managers/npm', 'npm_upload_install_package_project.yaml.erb')).result(binding)
package_json = ERB.new(read_fixture('package_managers/npm', 'package_project.json.erb')).result(binding) package_json = ERB.new(read_fixture('package_managers/npm', 'package_project.json.erb')).result(binding)
......
...@@ -63,10 +63,10 @@ module QA ...@@ -63,10 +63,10 @@ module QA
package.remove_via_api! package.remove_via_api!
end end
where(:authentication_token_type, :token_name) do where(:case_name, :authentication_token_type, :token_name, :testcase) do
:personal_access_token | 'Personal Access Token' 'using personal access token' | :personal_access_token | 'Personal Access Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347597'
:ci_job_token | 'CI Job Token' 'using ci job token' | :ci_job_token | 'CI Job Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347595'
:group_deploy_token | 'Deploy Token' 'using group deploy token' | :group_deploy_token | 'Deploy Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347596'
end end
with_them do with_them do
...@@ -92,7 +92,7 @@ module QA ...@@ -92,7 +92,7 @@ module QA
end end
end end
it "publishes a nuget package at the project level, installs and deletes it at the group level using a #{params[:token_name]}" do it 'publishes a nuget package at the project level, installs and deletes it at the group level', testcase: params[:testcase] do
Flow::Login.sign_in Flow::Login.sign_in
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
......
...@@ -24,6 +24,20 @@ describe('Settings Panels', () => { ...@@ -24,6 +24,20 @@ describe('Settings Panels', () => {
expect(isExpanded(panel)).toBe(true); expect(isExpanded(panel)).toBe(true);
}); });
it('should expand panel containing linked hash', () => {
window.location.hash = '#group_description';
const panel = document.querySelector('#js-general-settings');
// Our test environment automatically expands everything so we need to clear that out first
panel.classList.remove('expanded');
expect(isExpanded(panel)).toBe(false);
initSettingsPanels();
expect(isExpanded(panel)).toBe(true);
});
}); });
it('does not change the text content of triggers', () => { it('does not change the text content of triggers', () => {
......
...@@ -5,22 +5,29 @@ require 'spec_helper' ...@@ -5,22 +5,29 @@ require 'spec_helper'
RSpec.describe Projects::ClusterAgentsHelper do RSpec.describe Projects::ClusterAgentsHelper do
describe '#js_cluster_agent_details_data' do describe '#js_cluster_agent_details_data' do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:current_user) { create(:user) }
let(:user_can_admin_vulerability) { true }
let(:agent_name) { 'agent-name' } let(:agent_name) { 'agent-name' }
subject { helper.js_cluster_agent_details_data(agent_name, project) } before do
allow(helper).to receive(:current_user).and_return(current_user)
it 'returns name' do allow(helper)
expect(subject[:agent_name]).to eq(agent_name) .to receive(:can?)
.with(current_user, :admin_vulnerability, project)
.and_return(user_can_admin_vulerability)
end end
it 'returns project path' do subject { helper.js_cluster_agent_details_data(agent_name, project) }
expect(subject[:project_path]).to eq(project.full_path)
end
it 'returns string contants' do it {
expect(subject[:activity_empty_state_image]).to be_kind_of(String) is_expected.to match({
expect(subject[:empty_state_svg_path]).to be_kind_of(String) agent_name: agent_name,
end project_path: project.full_path,
activity_empty_state_image: kind_of(String),
empty_state_svg_path: kind_of(String),
can_admin_vulnerability: "true"
})
}
end end
end end
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