Commit 5918b1fc authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'djadmin-fix-selected-profile-section' into 'master'

Fix DAST profile summary for invalid values

See merge request gitlab-org/gitlab!56753
parents 9cf1ee01 be19cd2c
......@@ -116,7 +116,7 @@ export default {
</gl-dropdown>
<div
v-if="value && $scopedSlots.summary"
v-if="selectedProfile && $scopedSlots.summary"
data-testid="selected-profile-summary"
class="gl-mt-6 gl-pt-6 gl-border-t-solid gl-border-gray-100 gl-border-t-1"
>
......
---
title: Fix DAST profiles summary for invalid profile ids
merge_request: 56753
author:
type: fixed
......@@ -82,6 +82,7 @@ describe('OnDemandScansForm', () => {
const findSubmitButton = () => findByTestId('on-demand-scan-submit-button');
const findSaveButton = () => findByTestId('on-demand-scan-save-button');
const findCancelButton = () => findByTestId('on-demand-scan-cancel-button');
const findProfileSummary = () => findByTestId('selected-profile-summary');
const setValidFormData = () => {
findNameInput().vm.$emit('input', 'My daily scan');
......@@ -102,6 +103,12 @@ describe('OnDemandScansForm', () => {
});
return setValidFormData();
};
const selectProfile = (component) => async (profile) => {
subject.find(component).vm.$emit('input', profile.id);
await subject.vm.$nextTick();
};
const selectScannerProfile = selectProfile(ScannerProfileSelector);
const selectSiteProfile = selectProfile(SiteProfileSelector);
const submitForm = () => findForm().vm.$emit('submit', { preventDefault: () => {} });
const saveScan = () => findSaveButton().vm.$emit('click');
......@@ -515,14 +522,27 @@ describe('OnDemandScansForm', () => {
});
});
describe('scanner profile summary', () => {
beforeEach(() => {
mountSubject({
provide: {
glFeatures: {
securityDastSiteProfilesAdditionalFields: true,
},
},
});
});
it('does not render the summary provided an invalid profile ID', async () => {
await selectScannerProfile({ id: 'gid://gitlab/DastScannerProfile/123' });
expect(findProfileSummary().exists()).toBe(false);
});
});
describe('site profile summary', () => {
const [authEnabledProfile] = siteProfiles;
const selectSiteProfile = async (profile) => {
subject.find(SiteProfileSelector).vm.$emit('input', profile.id);
await subject.vm.$nextTick();
};
beforeEach(() => {
mountSubject({
provide: {
......@@ -548,6 +568,12 @@ describe('OnDemandScansForm', () => {
expect(summary).toMatch(defaultPassword);
expect(summary).toMatch(defaultRequestHeaders);
});
it('does not render the summary provided an invalid profile ID', async () => {
await selectSiteProfile({ id: 'gid://gitlab/DastSiteProfile/123' });
expect(findProfileSummary().exists()).toBe(false);
});
});
describe('populate profiles from query params', () => {
......
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