Skip to content
Snippets Groups Projects
Commit b87d37e6 authored by 🤖 GitLab Bot 🤖's avatar 🤖 GitLab Bot 🤖
Browse files

Automatic merge of gitlab-org/gitlab master

parents ec06e1f0 6215e5ff
No related branches found
No related tags found
1 merge request!170053Security patch upgrade alert: Only expose to admins 17-4
......@@ -68,7 +68,7 @@ $avatar-sizes: (
.avatar-container {
float: left;
margin-right: $gl-padding;
border-radius: $avatar-radius;
border-radius: 50%;
@each $size, $size-config in $avatar-sizes {
&.s#{$size} {
......
......@@ -301,12 +301,6 @@ $calendar-user-contrib-text: #959494;
*/
$issue-boards-card-shadow: rgba(0, 0, 0, 0.1);
/*
* Avatar
*/
$avatar-radius: 50%;
$gl-avatar-border-opacity: 0.1;
/*
* Blame
*/
......
......@@ -179,7 +179,7 @@
.avatar {
color: var(--ide-text-color, $gl-text-color);
background-color: var(--ide-highlight-background, $white);
border-color: var(--ide-highlight-background, rgba($black, $gl-avatar-border-opacity));
border-color: var(--ide-highlight-background, var(--gl-avatar-border-color-default));
}
}
}
......
......@@ -64,17 +64,6 @@
border-color: $gray-800;
}
.gl-avatar:not(.gl-avatar-identicon),
.avatar-container,
.avatar {
background: rgba($gray-950, 0.04);
}
.gl-avatar {
border-style: none;
box-shadow: inset 0 0 0 1px rgba($gray-950, $gl-avatar-border-opacity);
}
aside.right-sidebar:not(.right-sidebar-merge-requests) {
background-color: $gray-10;
}
......
import { mountExtended } from 'helpers/vue_test_utils_helper';
import createMockApollo from 'helpers/mock_apollo_helper';
import waitForPromises from 'helpers/wait_for_promises';
import {
projectScanExecutionPolicies,
groupScanExecutionPolicies,
projectScanResultPolicies,
groupScanResultPolicies,
projectPipelineResultPolicies,
groupPipelineResultPolicies,
mockLinkedSppItemsResponse,
} from 'ee_jest/security_orchestration/mocks/mock_apollo';
import { mockScanExecutionPoliciesResponse } from 'ee_jest/security_orchestration/mocks/mock_scan_execution_policy_data';
import { mockScanResultPoliciesResponse } from 'ee_jest/security_orchestration/mocks/mock_scan_result_policy_data';
import { mockPipelineExecutionPoliciesResponse } from 'ee_jest/security_orchestration/mocks/mock_pipeline_execution_policy_data';
import { NAMESPACE_TYPES } from 'ee/security_orchestration/constants';
import App from 'ee/security_orchestration/components/policies/app.vue';
import projectScanExecutionPoliciesQuery from 'ee/security_orchestration/graphql/queries/project_scan_execution_policies.query.graphql';
import groupScanExecutionPoliciesQuery from 'ee/security_orchestration/graphql/queries/group_scan_execution_policies.query.graphql';
import projectScanResultPoliciesQuery from 'ee/security_orchestration/graphql/queries/project_scan_result_policies.query.graphql';
import groupScanResultPoliciesQuery from 'ee/security_orchestration/graphql/queries/group_scan_result_policies.query.graphql';
import projectPipelineExecutionPoliciesQuery from 'ee/security_orchestration/graphql/queries/project_pipeline_execution_policies.query.graphql';
import groupPipelineExecutionPoliciesQuery from 'ee/security_orchestration/graphql/queries/group_pipeline_execution_policies.query.graphql';
import getSppLinkedProjectsGroups from 'ee/security_orchestration/graphql/queries/get_spp_linked_projects_groups.graphql';
import ScopeInfoRow from 'ee/security_orchestration/components/policy_drawer/scope_info_row.vue';
import ListComponentScope from 'ee/security_orchestration/components/policies/list_component_scope.vue';
import { DEFAULT_PROVIDE } from '../mocks';
import { groups as includingGroups, openDrawer } from './utils';
const projectScanExecutionPoliciesSpy = projectScanExecutionPolicies(
mockScanExecutionPoliciesResponse,
);
const groupScanExecutionPoliciesSpy = groupScanExecutionPolicies(mockScanExecutionPoliciesResponse);
const projectScanResultPoliciesSpy = projectScanResultPolicies(mockScanResultPoliciesResponse);
const groupScanResultPoliciesSpy = groupScanResultPolicies(mockScanResultPoliciesResponse);
const projectPipelineExecutionPoliciesSpy = projectPipelineResultPolicies(
mockPipelineExecutionPoliciesResponse,
);
const groupPipelineExecutionPoliciesSpy = groupPipelineResultPolicies(
mockPipelineExecutionPoliciesResponse,
);
const linkedSppItemsResponseSpy = mockLinkedSppItemsResponse();
const defaultRequestHandlers = {
projectScanExecutionPolicies: projectScanExecutionPoliciesSpy,
groupScanExecutionPolicies: groupScanExecutionPoliciesSpy,
projectScanResultPolicies: projectScanResultPoliciesSpy,
groupScanResultPolicies: groupScanResultPoliciesSpy,
projectPipelineExecutionPolicies: projectPipelineExecutionPoliciesSpy,
groupPipelineExecutionPolicies: groupPipelineExecutionPoliciesSpy,
linkedSppItemsResponse: linkedSppItemsResponseSpy,
};
describe('Policy list all projects scope', () => {
let wrapper;
let requestHandlers;
const createWrapper = ({ handlers = [], provide = {} } = {}) => {
requestHandlers = {
...defaultRequestHandlers,
...handlers,
};
wrapper = mountExtended(App, {
provide: {
...DEFAULT_PROVIDE,
...provide,
},
apolloProvider: createMockApollo([
[projectScanExecutionPoliciesQuery, requestHandlers.projectScanExecutionPolicies],
[groupScanExecutionPoliciesQuery, requestHandlers.groupScanExecutionPolicies],
[projectScanResultPoliciesQuery, requestHandlers.projectScanResultPolicies],
[groupScanResultPoliciesQuery, requestHandlers.groupScanResultPolicies],
[projectPipelineExecutionPoliciesQuery, requestHandlers.projectPipelineExecutionPolicies],
[groupPipelineExecutionPoliciesQuery, requestHandlers.groupPipelineExecutionPolicies],
[getSppLinkedProjectsGroups, requestHandlers.linkedSppItemsResponse],
]),
});
};
const findTable = () => wrapper.findByTestId('policies-list');
const findScopeInfoRow = () => wrapper.findComponent(ScopeInfoRow);
const findAllListComponentScope = () => wrapper.findAllComponents(ListComponentScope);
describe('project level', () => {
describe('default mode policy scope for $policyType', () => {
it.each`
policyType | policyScopeRowIndex | selectedRow
${'Pipeline execution'} | ${4} | ${mockPipelineExecutionPoliciesResponse[0]}
${'Scan execution'} | ${1} | ${mockScanExecutionPoliciesResponse[0]}
${'Scan Result'} | ${2} | ${mockScanResultPoliciesResponse[0]}
`(
'scoped to itself when project is not SPP for $policyType',
async ({ policyScopeRowIndex, selectedRow }) => {
createWrapper();
await waitForPromises();
expect(findAllListComponentScope().at(policyScopeRowIndex).text()).toBe('This project');
await openDrawer(findTable(), [selectedRow]);
expect(findScopeInfoRow().text()).toContain('This policy is applied to current project.');
},
);
it.each`
policyType | policyScopeRowIndex | selectedRow | expectedResult
${'Pipeline execution'} | ${4} | ${mockPipelineExecutionPoliciesResponse[0]} | ${'All projects linked to security policy project.'}
${'Scan execution'} | ${1} | ${mockScanExecutionPoliciesResponse[0]} | ${'All projects linked to security policy project.'}
${'Scan Result'} | ${2} | ${mockScanResultPoliciesResponse[0]} | ${'All projects linked to security policy project.'}
`(
'default mode when project is an SPP for $policyType',
async ({ policyScopeRowIndex, selectedRow, expectedResult }) => {
createWrapper({
handlers: {
linkedSppItemsResponse: mockLinkedSppItemsResponse({
groups: includingGroups,
namespaces: includingGroups,
}),
},
});
await waitForPromises();
expect(findAllListComponentScope().at(policyScopeRowIndex).text()).toContain(
expectedResult,
);
await openDrawer(findTable(), [selectedRow]);
expect(findScopeInfoRow().text()).toContain(expectedResult);
},
);
});
});
describe('group level', () => {
it.each`
policyType | policyScopeRowIndex | selectedRow | expectedResult
${'Pipeline execution'} | ${4} | ${mockPipelineExecutionPoliciesResponse[1]} | ${'Default mode'}
${'Scan execution'} | ${1} | ${mockScanExecutionPoliciesResponse[1]} | ${'Default mode'}
${'Scan Result'} | ${2} | ${mockScanResultPoliciesResponse[1]} | ${'Default mode'}
`(
'scoped to linked groups on a group level for $policyType',
async ({ policyScopeRowIndex, selectedRow, expectedResult }) => {
createWrapper({
provide: {
namespaceType: NAMESPACE_TYPES.GROUP,
glFeatures: {
policyGroupScope: true,
},
},
});
await waitForPromises();
expect(findAllListComponentScope().at(policyScopeRowIndex).text()).toBe(expectedResult);
await openDrawer(findTable(), [selectedRow]);
expect(findScopeInfoRow().text()).toContain(expectedResult);
},
);
});
});
import Vue, { nextTick } from 'vue';
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import createMockApollo from 'helpers/mock_apollo_helper';
......@@ -28,71 +28,58 @@ import ScopeInfoRow from 'ee/security_orchestration/components/policy_drawer/sco
import ListComponentScope from 'ee/security_orchestration/components/policies/list_component_scope.vue';
import GroupsToggleList from 'ee/security_orchestration/components/policy_drawer/groups_toggle_list.vue';
import { DEFAULT_PROVIDE } from '../mocks';
import {
groups as includingGroups,
projects as excludingProjects,
generateMockResponse,
openDrawer,
} from './utils';
Vue.use(VueApollo);
const includingGroups = [
{
__typename: 'Group',
id: 'gid://gitlab/Group/98',
name: 'gitlab-policies-sub',
fullPath: 'gitlab-policies/gitlab-policies-sub',
},
{
__typename: 'Group',
id: 'gid://gitlab/Group/99',
name: 'gitlab-policies-sub-2',
fullPath: 'gitlab-policies/gitlab-policies-sub-2',
},
];
const excludingProjects = [
{
__typename: 'Project',
fullPath: 'gitlab-policies/test',
id: 'gid://gitlab/Project/37',
name: 'test',
const policyGroupScope = {
includingGroups: {
nodes: includingGroups,
pageInfo: {},
},
];
const generateMockResponse = (index, basis) => ({
...basis[index],
policyScope: {
...basis[index].policyScope,
includingGroups: {
nodes: includingGroups,
pageInfo: {},
},
excludingProjects: {
nodes: excludingProjects,
pageInfo: {},
},
excludingProjects: {
nodes: excludingProjects,
pageInfo: {},
},
});
};
const mockPipelineExecutionPoliciesProjectResponse = generateMockResponse(
0,
mockPipelineExecutionPoliciesResponse,
policyGroupScope,
);
const mockPipelineExecutionPoliciesGroupResponse = generateMockResponse(
1,
mockPipelineExecutionPoliciesResponse,
policyGroupScope,
);
const mockScanExecutionPoliciesProjectResponse = generateMockResponse(
0,
mockScanExecutionPoliciesResponse,
policyGroupScope,
);
const mockScanExecutionPoliciesGroupResponse = generateMockResponse(
1,
mockScanExecutionPoliciesResponse,
policyGroupScope,
);
const mockScanResultPoliciesProjectResponse = generateMockResponse(
0,
mockScanResultPoliciesResponse,
policyGroupScope,
);
const mockScanResultPoliciesGroupResponse = generateMockResponse(
1,
mockScanResultPoliciesResponse,
policyGroupScope,
);
const mockScanResultPoliciesGroupResponse = generateMockResponse(1, mockScanResultPoliciesResponse);
/**
* New mocks for policy scope including linked groups on project level
......@@ -172,12 +159,6 @@ describe('Policies List policy scope', () => {
const findAllListComponentScope = () => wrapper.findAllComponents(ListComponentScope);
const findGroupsToggleList = () => wrapper.findComponent(GroupsToggleList);
const openDrawer = async (rows) => {
findTable().vm.$emit('row-selected', rows);
await nextTick();
await waitForPromises();
};
const expectDrawerScopeInfoRow = () => {
expect(findGroupsToggleList().exists()).toBe(true);
expect(findGroupsToggleList().props('groups')).toEqual(includingGroups);
......@@ -205,7 +186,7 @@ describe('Policies List policy scope', () => {
await waitForPromises();
expect(findAllListComponentScope().at(policyScopeRowIndex).text()).toBe('This project');
await openDrawer([selectedRow]);
await openDrawer(findTable(), [selectedRow]);
expect(findScopeInfoRow().text()).toContain('This policy is applied to current project.');
},
......@@ -237,7 +218,7 @@ describe('Policies List policy scope', () => {
expect(findAllListComponentScope().at(policyScopeRowIndex).text()).toBe(expectedResult);
await openDrawer([selectedRow]);
await openDrawer(findTable(), [selectedRow]);
expectDrawerScopeInfoRow();
},
......@@ -267,7 +248,7 @@ describe('Policies List policy scope', () => {
expect(findAllListComponentScope().at(policyScopeRowIndex).text()).toBe(expectedResult);
await openDrawer([selectedRow]);
await openDrawer(findTable(), [selectedRow]);
expectDrawerScopeInfoRow();
},
......
import { nextTick } from 'vue';
import waitForPromises from 'helpers/wait_for_promises';
export const groups = [
{
__typename: 'Group',
id: 'gid://gitlab/Group/98',
name: 'gitlab-policies-sub',
fullPath: 'gitlab-policies/gitlab-policies-sub',
},
{
__typename: 'Group',
id: 'gid://gitlab/Group/99',
name: 'gitlab-policies-sub-2',
fullPath: 'gitlab-policies/gitlab-policies-sub-2',
},
];
export const projects = [
{
__typename: 'Project',
fullPath: 'gitlab-policies/test',
id: 'gid://gitlab/Project/37',
name: 'test',
},
];
export const generateMockResponse = (index, basis, newPayload) => ({
...basis[index],
policyScope: {
...basis[index].policyScope,
...newPayload,
},
});
export const openDrawer = async (element, rows) => {
element.vm.$emit('row-selected', rows);
await nextTick();
await waitForPromises();
};
......@@ -21,7 +21,8 @@ module QA
let(:session) { SecureRandom.hex(5) }
let(:tag_name) { SecureRandom.hex(5) }
it 'sends a push event', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348945' do
it 'sends a push event',
:blocking, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348945' do
Resource::ProjectWebHook.setup(session: session, push: true) do |webhook, smocker|
Resource::Repository::ProjectPush.fabricate! do |project_push|
project_push.project = webhook.project
......@@ -31,7 +32,8 @@ module QA
end
end
it 'sends a merge request event', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349720' do
it 'sends a merge request event',
:blocking, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349720' do
Resource::ProjectWebHook.setup(session: session, merge_requests: true) do |webhook, smocker|
create(:merge_request, project: webhook.project)
......@@ -39,7 +41,8 @@ module QA
end
end
it 'sends a wiki page event', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349722' do
it 'sends a wiki page event',
:blocking, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349722' do
Resource::ProjectWebHook.setup(session: session, wiki_page: true) do |webhook, smocker|
create(:project_wiki_page, project: webhook.project)
......@@ -47,7 +50,7 @@ module QA
end
end
it 'sends an issues and note event',
it 'sends an issues and note event', :blocking,
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349723' do
Resource::ProjectWebHook.setup(session: session, issues: true, note: true) do |webhook, smocker|
issue = create(:issue, project: webhook.project)
......@@ -69,7 +72,7 @@ module QA
end
end
it 'sends a tag event',
it 'sends a tag event', :blocking,
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/383577' do
Resource::ProjectWebHook.setup(session: session, tag_push: true) do |webhook, smocker|
project_push = Resource::Repository::ProjectPush.fabricate! do |project_push|
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment