Commit 2ddd5096 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'find-migrate-ee-security-dashboard' into 'master'

Replace deprecated usage of find/findAll in ee/spec/frontend/security_dashboard

See merge request gitlab-org/gitlab!78633
parents f611e90a 8c2910b3
...@@ -26,11 +26,12 @@ describe('Group Security Dashboard component', () => { ...@@ -26,11 +26,12 @@ describe('Group Security Dashboard component', () => {
// To be consumed by SecurityDashboardLayout // To be consumed by SecurityDashboardLayout
const sbomSurveySvgPath = '/'; const sbomSurveySvgPath = '/';
const findSecurityChartsLayoutComponent = () => wrapper.find(SecurityDashboardLayout); const findSecurityChartsLayoutComponent = () => wrapper.findComponent(SecurityDashboardLayout);
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
const findVulnerabilitiesOverTimeChart = () => wrapper.find(VulnerabilitiesOverTimeChart); const findVulnerabilitiesOverTimeChart = () =>
const findVulnerabilitySeverities = () => wrapper.find(VulnerabilitySeverities); wrapper.findComponent(VulnerabilitiesOverTimeChart);
const findReportNotConfigured = () => wrapper.find(ReportNotConfiguredGroup); const findVulnerabilitySeverities = () => wrapper.findComponent(VulnerabilitySeverities);
const findReportNotConfigured = () => wrapper.findComponent(ReportNotConfiguredGroup);
const createWrapper = ({ loading = false } = {}) => { const createWrapper = ({ loading = false } = {}) => {
wrapper = shallowMount(GroupSecurityDashboard, { wrapper = shallowMount(GroupSecurityDashboard, {
......
...@@ -18,10 +18,10 @@ describe('Group Security Dashboard Vulnerabilities Component', () => { ...@@ -18,10 +18,10 @@ describe('Group Security Dashboard Vulnerabilities Component', () => {
const groupFullPath = 'group-full-path'; const groupFullPath = 'group-full-path';
const findIntersectionObserver = () => wrapper.find(GlIntersectionObserver); const findIntersectionObserver = () => wrapper.findComponent(GlIntersectionObserver);
const findVulnerabilities = () => wrapper.find(VulnerabilityList); const findVulnerabilities = () => wrapper.findComponent(VulnerabilityList);
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.findComponent(GlAlert);
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
const expectLoadingState = ({ initial = false, nextPage = false }) => { const expectLoadingState = ({ initial = false, nextPage = false }) => {
expect(findVulnerabilities().props('isLoading')).toBe(initial); expect(findVulnerabilities().props('isLoading')).toBe(initial);
......
...@@ -24,11 +24,12 @@ jest.mock( ...@@ -24,11 +24,12 @@ jest.mock(
describe('Instance Security Dashboard component', () => { describe('Instance Security Dashboard component', () => {
let wrapper; let wrapper;
const findSecurityChartsLayoutComponent = () => wrapper.find(SecurityDashboardLayout); const findSecurityChartsLayoutComponent = () => wrapper.findComponent(SecurityDashboardLayout);
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
const findVulnerabilitiesOverTimeChart = () => wrapper.find(VulnerabilitiesOverTimeChart); const findVulnerabilitiesOverTimeChart = () =>
const findVulnerabilitySeverities = () => wrapper.find(VulnerabilitySeverities); wrapper.findComponent(VulnerabilitiesOverTimeChart);
const findReportNotConfigured = () => wrapper.find(ReportNotConfiguredInstance); const findVulnerabilitySeverities = () => wrapper.findComponent(VulnerabilitySeverities);
const findReportNotConfigured = () => wrapper.findComponent(ReportNotConfiguredInstance);
const createWrapper = ({ loading = false } = {}) => { const createWrapper = ({ loading = false } = {}) => {
wrapper = shallowMount(InstanceSecurityDashboard, { wrapper = shallowMount(InstanceSecurityDashboard, {
......
...@@ -13,10 +13,10 @@ localVue.use(VueApollo); ...@@ -13,10 +13,10 @@ localVue.use(VueApollo);
describe('Instance Security Dashboard Vulnerabilities Component', () => { describe('Instance Security Dashboard Vulnerabilities Component', () => {
let wrapper; let wrapper;
const findIntersectionObserver = () => wrapper.find(GlIntersectionObserver); const findIntersectionObserver = () => wrapper.findComponent(GlIntersectionObserver);
const findVulnerabilities = () => wrapper.find(VulnerabilityList); const findVulnerabilities = () => wrapper.findComponent(VulnerabilityList);
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.findComponent(GlAlert);
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
const expectLoadingState = ({ initial = false, nextPage = false }) => { const expectLoadingState = ({ initial = false, nextPage = false }) => {
expect(findVulnerabilities().props('isLoading')).toBe(initial); expect(findVulnerabilities().props('isLoading')).toBe(initial);
......
...@@ -84,7 +84,7 @@ describe('Project List component', () => { ...@@ -84,7 +84,7 @@ describe('Project List component', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(getAllProjectItems()).toHaveLength(projectsCount); expect(getAllProjectItems()).toHaveLength(projectsCount);
expect(wrapper.find(GlBadge).text()).toBe(projectsCount.toString()); expect(wrapper.findComponent(GlBadge).text()).toBe(projectsCount.toString());
}, },
); );
...@@ -96,7 +96,7 @@ describe('Project List component', () => { ...@@ -96,7 +96,7 @@ describe('Project List component', () => {
}); });
it('renders a project item with an avatar', () => { it('renders a project item with an avatar', () => {
expect(getFirstProjectItem().find(ProjectAvatar).exists()).toBe(true); expect(getFirstProjectItem().findComponent(ProjectAvatar).exists()).toBe(true);
}); });
it('renders a project item with a project name', () => { it('renders a project item with a project name', () => {
......
...@@ -47,9 +47,9 @@ describe('Project Manager component', () => { ...@@ -47,9 +47,9 @@ describe('Project Manager component', () => {
}); });
}; };
const findAddProjectsButton = () => wrapper.find(GlButton); const findAddProjectsButton = () => wrapper.findComponent(GlButton);
const findProjectList = () => wrapper.find(ProjectList); const findProjectList = () => wrapper.findComponent(ProjectList);
const findProjectSelector = () => wrapper.find(ProjectSelector); const findProjectSelector = () => wrapper.findComponent(ProjectSelector);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
...@@ -30,11 +30,11 @@ describe('LoadingError component', () => { ...@@ -30,11 +30,11 @@ describe('LoadingError component', () => {
}); });
it('renders an empty state', () => { it('renders an empty state', () => {
expect(wrapper.find(GlEmptyState).exists()).toBe(true); expect(wrapper.findComponent(GlEmptyState).exists()).toBe(true);
}); });
it('empty state has correct props', () => { it('empty state has correct props', () => {
expect(wrapper.find(GlEmptyState).props()).toMatchSnapshot(); expect(wrapper.findComponent(GlEmptyState).props()).toMatchSnapshot();
}); });
}); });
}); });
...@@ -41,8 +41,8 @@ describe('Security Dashboard Table Row', () => { ...@@ -41,8 +41,8 @@ describe('Security Dashboard Table Row', () => {
const findContent = (i) => wrapper.findAll('.table-mobile-content').at(i); const findContent = (i) => wrapper.findAll('.table-mobile-content').at(i);
const findAllIssueCreated = () => wrapper.findAll('[data-testid="issues-icon"]'); const findAllIssueCreated = () => wrapper.findAll('[data-testid="issues-icon"]');
const hasSelectedClass = () => wrapper.classes('gl-bg-blue-50'); const hasSelectedClass = () => wrapper.classes('gl-bg-blue-50');
const findCheckbox = () => wrapper.find(GlFormCheckbox); const findCheckbox = () => wrapper.findComponent(GlFormCheckbox);
const findSeverityBadge = () => wrapper.find(SeverityBadge); const findSeverityBadge = () => wrapper.findComponent(SeverityBadge);
describe('when loading', () => { describe('when loading', () => {
beforeEach(() => { beforeEach(() => {
...@@ -111,7 +111,7 @@ describe('Security Dashboard Table Row', () => { ...@@ -111,7 +111,7 @@ describe('Security Dashboard Table Row', () => {
jest.spyOn(store, 'dispatch').mockImplementation(); jest.spyOn(store, 'dispatch').mockImplementation();
jest.spyOn(wrapper.vm.$root, '$emit'); jest.spyOn(wrapper.vm.$root, '$emit');
const el = wrapper.find({ ref: 'vulnerability-title' }); const el = wrapper.findComponent({ ref: 'vulnerability-title' });
el.trigger('click'); el.trigger('click');
expect(store.dispatch).toHaveBeenCalledWith('vulnerabilities/setModalData', { expect(store.dispatch).toHaveBeenCalledWith('vulnerabilities/setModalData', {
......
...@@ -32,7 +32,7 @@ describe('Security Dashboard Table', () => { ...@@ -32,7 +32,7 @@ describe('Security Dashboard Table', () => {
wrapper.destroy(); wrapper.destroy();
}); });
const findCheckbox = () => wrapper.find(GlFormCheckbox); const findCheckbox = () => wrapper.findComponent(GlFormCheckbox);
const findSelectionSummaryCollapse = () => wrapper.findByTestId('selection-summary-collapse'); const findSelectionSummaryCollapse = () => wrapper.findByTestId('selection-summary-collapse');
describe('while loading', () => { describe('while loading', () => {
...@@ -41,7 +41,7 @@ describe('Security Dashboard Table', () => { ...@@ -41,7 +41,7 @@ describe('Security Dashboard Table', () => {
}); });
it('should render 10 skeleton rows in the table', () => { it('should render 10 skeleton rows in the table', () => {
expect(wrapper.findAll(SecurityDashboardTableRow)).toHaveLength(10); expect(wrapper.findAllComponents(SecurityDashboardTableRow)).toHaveLength(10);
}); });
}); });
...@@ -54,7 +54,7 @@ describe('Security Dashboard Table', () => { ...@@ -54,7 +54,7 @@ describe('Security Dashboard Table', () => {
}); });
it('should render a row for each vulnerability', () => { it('should render a row for each vulnerability', () => {
expect(wrapper.findAll(SecurityDashboardTableRow)).toHaveLength( expect(wrapper.findAllComponents(SecurityDashboardTableRow)).toHaveLength(
mockDataVulnerabilities.length, mockDataVulnerabilities.length,
); );
}); });
...@@ -91,7 +91,7 @@ describe('Security Dashboard Table', () => { ...@@ -91,7 +91,7 @@ describe('Security Dashboard Table', () => {
}); });
it('should render the empty state', () => { it('should render the empty state', () => {
expect(wrapper.find(GlEmptyState).exists()).toBe(true); expect(wrapper.findComponent(GlEmptyState).exists()).toBe(true);
}); });
}); });
...@@ -101,7 +101,7 @@ describe('Security Dashboard Table', () => { ...@@ -101,7 +101,7 @@ describe('Security Dashboard Table', () => {
}); });
it('should not render the empty state', () => { it('should not render the empty state', () => {
expect(wrapper.find(GlEmptyState).exists()).toBe(false); expect(wrapper.findComponent(GlEmptyState).exists()).toBe(false);
}); });
it('should render the error alert', () => { it('should render the error alert', () => {
......
...@@ -73,7 +73,7 @@ describe('Security Dashboard component', () => { ...@@ -73,7 +73,7 @@ describe('Security Dashboard component', () => {
}); });
it('renders the security dashboard table ', () => { it('renders the security dashboard table ', () => {
expect(wrapper.find(SecurityDashboardTable).exists()).toBe(true); expect(wrapper.findComponent(SecurityDashboardTable).exists()).toBe(true);
}); });
it('sets the pipeline id', () => { it('sets the pipeline id', () => {
...@@ -85,7 +85,7 @@ describe('Security Dashboard component', () => { ...@@ -85,7 +85,7 @@ describe('Security Dashboard component', () => {
}); });
it('renders the issue modal', () => { it('renders the issue modal', () => {
expect(wrapper.find(IssueModal).exists()).toBe(true); expect(wrapper.findComponent(IssueModal).exists()).toBe(true);
}); });
it.each` it.each`
...@@ -108,7 +108,7 @@ describe('Security Dashboard component', () => { ...@@ -108,7 +108,7 @@ describe('Security Dashboard component', () => {
store.state.vulnerabilities.modal.vulnerability = 'bar'; store.state.vulnerabilities.modal.vulnerability = 'bar';
jest.spyOn(store, 'dispatch').mockImplementation(() => Promise.resolve()); jest.spyOn(store, 'dispatch').mockImplementation(() => Promise.resolve());
wrapper.find(IssueModal).vm.$emit(emittedModalEvent, eventPayload); wrapper.findComponent(IssueModal).vm.$emit(emittedModalEvent, eventPayload);
expect(store.dispatch).toHaveBeenCalledWith( expect(store.dispatch).toHaveBeenCalledWith(
expectedDispatchedAction, expectedDispatchedAction,
...@@ -142,7 +142,7 @@ describe('Security Dashboard component', () => { ...@@ -142,7 +142,7 @@ describe('Security Dashboard component', () => {
Object.assign(store.state.vulnerabilities, givenState); Object.assign(store.state.vulnerabilities, givenState);
await nextTick(); await nextTick();
expect(wrapper.find(IssueModal).props()).toStrictEqual(expectedProps); expect(wrapper.findComponent(IssueModal).props()).toStrictEqual(expectedProps);
}, },
); );
}); });
...@@ -164,13 +164,13 @@ describe('Security Dashboard component', () => { ...@@ -164,13 +164,13 @@ describe('Security Dashboard component', () => {
it.each([401, 403])('displays an error on error %s', async (errorCode) => { it.each([401, 403])('displays an error on error %s', async (errorCode) => {
store.dispatch('vulnerabilities/receiveVulnerabilitiesError', errorCode); store.dispatch('vulnerabilities/receiveVulnerabilitiesError', errorCode);
await nextTick(); await nextTick();
expect(wrapper.find(LoadingError).exists()).toBe(true); expect(wrapper.findComponent(LoadingError).exists()).toBe(true);
}); });
it.each([404, 500])('does not display an error on error %s', async (errorCode) => { it.each([404, 500])('does not display an error on error %s', async (errorCode) => {
store.dispatch('vulnerabilities/receiveVulnerabilitiesError', errorCode); store.dispatch('vulnerabilities/receiveVulnerabilitiesError', errorCode);
await nextTick(); await nextTick();
expect(wrapper.find(LoadingError).exists()).toBe(false); expect(wrapper.findComponent(LoadingError).exists()).toBe(false);
}); });
}); });
}); });
...@@ -222,7 +222,7 @@ describe('Security reports summary component', () => { ...@@ -222,7 +222,7 @@ describe('Security reports summary component', () => {
}); });
it('should have the modal with id dastUrl', () => { it('should have the modal with id dastUrl', () => {
const modal = wrapper.find(Modal); const modal = wrapper.findComponent(Modal);
expect(modal.exists()).toBe(true); expect(modal.exists()).toBe(true);
expect(modal.attributes('modalid')).toBe('dastUrl'); expect(modal.attributes('modalid')).toBe('dastUrl');
......
...@@ -45,9 +45,9 @@ describe('Selection Summary', () => { ...@@ -45,9 +45,9 @@ describe('Selection Summary', () => {
mock.restore(); mock.restore();
}); });
const formSelect = () => wrapper.find(GlFormSelect); const formSelect = () => wrapper.findComponent(GlFormSelect);
const dismissMessage = () => wrapper.find('[data-testid="dismiss-message"]'); const dismissMessage = () => wrapper.find('[data-testid="dismiss-message"]');
const dismissButton = () => wrapper.find(GlButton); const dismissButton = () => wrapper.findComponent(GlButton);
const selectByIndex = (index) => const selectByIndex = (index) =>
store.commit(`vulnerabilities/${SELECT_VULNERABILITY}`, mockDataVulnerabilities[index].id); store.commit(`vulnerabilities/${SELECT_VULNERABILITY}`, mockDataVulnerabilities[index].id);
......
...@@ -57,11 +57,11 @@ describe('Vulnerabilities app component', () => { ...@@ -57,11 +57,11 @@ describe('Vulnerabilities app component', () => {
}, },
}); });
const findIntersectionObserver = () => wrapper.find(GlIntersectionObserver); const findIntersectionObserver = () => wrapper.findComponent(GlIntersectionObserver);
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.findComponent(GlAlert);
const findSecurityScannerAlert = (root = wrapper) => root.findComponent(SecurityScannerAlert); const findSecurityScannerAlert = (root = wrapper) => root.findComponent(SecurityScannerAlert);
const findVulnerabilityList = () => wrapper.find(VulnerabilityList); const findVulnerabilityList = () => wrapper.findComponent(VulnerabilityList);
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
const expectLoadingState = ({ initial = false, nextPage = false }) => { const expectLoadingState = ({ initial = false, nextPage = false }) => {
expect(findVulnerabilityList().props('isLoading')).toBe(initial); expect(findVulnerabilityList().props('isLoading')).toBe(initial);
......
...@@ -61,7 +61,7 @@ describe('Project vulnerability report app component', () => { ...@@ -61,7 +61,7 @@ describe('Project vulnerability report app component', () => {
}); });
}; };
const findReportNotConfiguredProject = () => wrapper.find(ReportNotConfiguredProject); const findReportNotConfiguredProject = () => wrapper.findComponent(ReportNotConfiguredProject);
const findVulnerabilityReportTabs = () => wrapper.findComponent(VulnerabilityReportTabs); const findVulnerabilityReportTabs = () => wrapper.findComponent(VulnerabilityReportTabs);
const findAutoFixUserCallout = () => wrapper.findComponent(AutoFixUserCallout); const findAutoFixUserCallout = () => wrapper.findComponent(AutoFixUserCallout);
const findProjectPipelineStatus = () => wrapper.findComponent(ProjectPipelineStatus); const findProjectPipelineStatus = () => wrapper.findComponent(ProjectPipelineStatus);
......
...@@ -18,8 +18,8 @@ describe('AutoFixUserCallout', () => { ...@@ -18,8 +18,8 @@ describe('AutoFixUserCallout', () => {
it('renders properly', () => { it('renders properly', () => {
createWrapper(); createWrapper();
expect(wrapper.find(GlBanner).exists()).toBe(true); expect(wrapper.findComponent(GlBanner).exists()).toBe(true);
expect(wrapper.find(GlBanner).props()).toMatchObject({ expect(wrapper.findComponent(GlBanner).props()).toMatchObject({
title: 'Introducing GitLab auto-fix', title: 'Introducing GitLab auto-fix',
buttonText: 'Learn more', buttonText: 'Learn more',
buttonLink: helpPagePath, buttonLink: helpPagePath,
......
...@@ -26,10 +26,10 @@ describe('Csv Button Export', () => { ...@@ -26,10 +26,10 @@ describe('Csv Button Export', () => {
let wrapper; let wrapper;
const issueUrl = 'https://gitlab.com/gitlab-org/gitlab/issues/197111'; const issueUrl = 'https://gitlab.com/gitlab-org/gitlab/issues/197111';
const findPopoverExternalLink = () => wrapper.find({ ref: 'popoverExternalLink' }); const findPopoverExternalLink = () => wrapper.findComponent({ ref: 'popoverExternalLink' });
const findPopoverButton = () => wrapper.find({ ref: 'popoverButton' }); const findPopoverButton = () => wrapper.findComponent({ ref: 'popoverButton' });
const findPopover = () => wrapper.find({ ref: 'popover' }); const findPopover = () => wrapper.findComponent({ ref: 'popover' });
const findCsvExportButton = () => wrapper.find({ ref: 'csvExportButton' }); const findCsvExportButton = () => wrapper.findComponent({ ref: 'csvExportButton' });
const createComponent = () => { const createComponent = () => {
return shallowMount(CsvExportButton, { return shallowMount(CsvExportButton, {
......
...@@ -13,7 +13,7 @@ describe('filters produced no results empty state', () => { ...@@ -13,7 +13,7 @@ describe('filters produced no results empty state', () => {
}, },
}); });
const findGlEmptyState = () => wrapper.find(GlEmptyState); const findGlEmptyState = () => wrapper.findComponent(GlEmptyState);
beforeEach(() => { beforeEach(() => {
wrapper = createWrapper(); wrapper = createWrapper();
......
...@@ -113,7 +113,7 @@ describe('Filter Body component', () => { ...@@ -113,7 +113,7 @@ describe('Filter Body component', () => {
`('$phrase the loading icon when the loading prop is $loading', ({ loading }) => { `('$phrase the loading icon when the loading prop is $loading', ({ loading }) => {
createComponent({ loading }); createComponent({ loading });
expect(wrapper.find(GlLoadingIcon).exists()).toBe(loading); expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(loading);
}); });
}); });
}); });
...@@ -17,8 +17,8 @@ describe('Filter Item component', () => { ...@@ -17,8 +17,8 @@ describe('Filter Item component', () => {
}); });
}; };
const dropdownItem = () => wrapper.find(GlDropdownItem); const dropdownItem = () => wrapper.findComponent(GlDropdownItem);
const name = () => wrapper.find(GlTruncate); const name = () => wrapper.findComponent(GlTruncate);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
...@@ -51,7 +51,7 @@ describe('Scanner Filter component', () => { ...@@ -51,7 +51,7 @@ describe('Scanner Filter component', () => {
}; };
const getTestIds = (selector) => const getTestIds = (selector) =>
wrapper.findAll(selector).wrappers.map((x) => x.attributes('data-testid')); wrapper.findAllComponents(selector).wrappers.map((x) => x.attributes('data-testid'));
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -68,8 +68,8 @@ describe('Scanner Filter component', () => { ...@@ -68,8 +68,8 @@ describe('Scanner Filter component', () => {
const expectedOptions = ['all', ...filter.options.map((x) => x.id)]; const expectedOptions = ['all', ...filter.options.map((x) => x.id)];
expect(options).toEqual(expectedOptions); expect(options).toEqual(expectedOptions);
expect(wrapper.find(GlDropdownDivider).exists()).toBe(false); expect(wrapper.findComponent(GlDropdownDivider).exists()).toBe(false);
expect(wrapper.find(GlDropdownItem).exists()).toBe(false); expect(wrapper.findComponent(GlDropdownItem).exists()).toBe(false);
}); });
}); });
...@@ -96,7 +96,7 @@ describe('Scanner Filter component', () => { ...@@ -96,7 +96,7 @@ describe('Scanner Filter component', () => {
createWrapper(); createWrapper();
const expectSelectedItems = (items) => { const expectSelectedItems = (items) => {
const checkedItems = wrapper const checkedItems = wrapper
.findAll(FilterItem) .findAllComponents(FilterItem)
.wrappers.filter((x) => x.props('isChecked')) .wrappers.filter((x) => x.props('isChecked'))
.map((x) => x.attributes('data-testid')); .map((x) => x.attributes('data-testid'));
const expectedItems = items.map((x) => x.id); const expectedItems = items.map((x) => x.id);
......
...@@ -32,7 +32,7 @@ describe('Remediated badge component', () => { ...@@ -32,7 +32,7 @@ describe('Remediated badge component', () => {
}); });
it('links the badge and the popover', () => { it('links the badge and the popover', () => {
const popover = wrapper.find({ ref: 'popover' }); const popover = wrapper.findComponent({ ref: 'popover' });
expect(popover.props('target')()).toEqual(findIcon().element.parentNode); expect(popover.props('target')()).toEqual(findIcon().element.parentNode);
}); });
......
...@@ -8,7 +8,7 @@ describe('Pipeline status badge', () => { ...@@ -8,7 +8,7 @@ describe('Pipeline status badge', () => {
const securityBuildsFailedPath = '/some/path/to/failed/jobs'; const securityBuildsFailedPath = '/some/path/to/failed/jobs';
const findGlBadge = () => wrapper.find(GlBadge); const findGlBadge = () => wrapper.findComponent(GlBadge);
const createProps = (securityBuildsFailedCount) => ({ pipeline: { securityBuildsFailedCount } }); const createProps = (securityBuildsFailedCount) => ({ pipeline: { securityBuildsFailedCount } });
......
...@@ -17,9 +17,9 @@ describe('Project Pipeline Status Component', () => { ...@@ -17,9 +17,9 @@ describe('Project Pipeline Status Component', () => {
}, },
}; };
const findPipelineStatusBadge = () => wrapper.find(PipelineStatusBadge); const findPipelineStatusBadge = () => wrapper.findComponent(PipelineStatusBadge);
const findTimeAgoTooltip = () => wrapper.find(TimeAgoTooltip); const findTimeAgoTooltip = () => wrapper.findComponent(TimeAgoTooltip);
const findLink = () => wrapper.find(GlLink); const findLink = () => wrapper.findComponent(GlLink);
const findAutoFixMrsLink = () => wrapper.findByTestId('auto-fix-mrs-link'); const findAutoFixMrsLink = () => wrapper.findByTestId('auto-fix-mrs-link');
const createWrapper = (options = {}) => { const createWrapper = (options = {}) => {
...@@ -100,7 +100,7 @@ describe('Project Pipeline Status Component', () => { ...@@ -100,7 +100,7 @@ describe('Project Pipeline Status Component', () => {
}); });
it('renders a link to open auto-fix MRs if any', () => { it('renders a link to open auto-fix MRs if any', () => {
const link = findAutoFixMrsLink().find(GlLink); const link = findAutoFixMrsLink().findComponent(GlLink);
expect(link.exists()).toBe(true); expect(link.exists()).toBe(true);
expect(link.attributes('href')).toBe('/merge_requests?label_name=GitLab-auto-fix'); expect(link.attributes('href')).toBe('/merge_requests?label_name=GitLab-auto-fix');
}); });
......
...@@ -44,11 +44,12 @@ describe('Vulnerability Severity component', () => { ...@@ -44,11 +44,12 @@ describe('Vulnerability Severity component', () => {
}); });
}; };
const findHelpLink = () => wrapper.find(GlLink); const findHelpLink = () => wrapper.findComponent(GlLink);
const findHeader = () => wrapper.find('h4'); const findHeader = () => wrapper.find('h4');
const findDescription = () => wrapper.find('p'); const findDescription = () => wrapper.find('p');
const findAccordionItemByGrade = (grade) => wrapper.find({ ref: `accordionItem${grade}` }); const findAccordionItemByGrade = (grade) =>
const findProjectName = (accordion) => accordion.findAll(GlLink); wrapper.findComponent({ ref: `accordionItem${grade}` });
const findProjectName = (accordion) => accordion.findAllComponents(GlLink);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
...@@ -56,7 +56,7 @@ describe('Selection Summary component', () => { ...@@ -56,7 +56,7 @@ describe('Selection Summary component', () => {
describe('with selected state', () => { describe('with selected state', () => {
beforeEach(async () => { beforeEach(async () => {
wrapper.find(StatusDropdown).vm.$emit('change', { action: 'confirm' }); wrapper.findComponent(StatusDropdown).vm.$emit('change', { action: 'confirm' });
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
}); });
...@@ -71,7 +71,7 @@ describe('Selection Summary component', () => { ...@@ -71,7 +71,7 @@ describe('Selection Summary component', () => {
describe('with no selected state', () => { describe('with no selected state', () => {
beforeEach(async () => { beforeEach(async () => {
wrapper.find(StatusDropdown).vm.$emit('change', { action: null }); wrapper.findComponent(StatusDropdown).vm.$emit('change', { action: null });
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
}); });
...@@ -109,7 +109,7 @@ describe('Selection Summary component', () => { ...@@ -109,7 +109,7 @@ describe('Selection Summary component', () => {
]; ];
const submitForm = async () => { const submitForm = async () => {
wrapper.find(StatusDropdown).vm.$emit('change', { action, payload }); wrapper.findComponent(StatusDropdown).vm.$emit('change', { action, payload });
findForm().trigger('submit'); findForm().trigger('submit');
await waitForPromises(); await waitForPromises();
}; };
......
...@@ -6,8 +6,8 @@ import VulnerabilityCountListLayout from 'ee/security_dashboard/components/share ...@@ -6,8 +6,8 @@ import VulnerabilityCountListLayout from 'ee/security_dashboard/components/share
describe('Vulnerabilities count list component', () => { describe('Vulnerabilities count list component', () => {
let wrapper; let wrapper;
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.findComponent(GlAlert);
const findVulnerability = () => wrapper.findAll(VulnerabilityCount); const findVulnerability = () => wrapper.findAllComponents(VulnerabilityCount);
const createWrapper = ({ propsData } = {}) => { const createWrapper = ({ propsData } = {}) => {
return shallowMount(VulnerabilityCountListLayout, { return shallowMount(VulnerabilityCountListLayout, {
......
...@@ -7,8 +7,8 @@ describe('Vulnerability Count', () => { ...@@ -7,8 +7,8 @@ describe('Vulnerability Count', () => {
let wrapper; let wrapper;
const findCard = () => wrapper.findComponent(GlCard); const findCard = () => wrapper.findComponent(GlCard);
const findBadge = () => wrapper.find(SeverityBadge); const findBadge = () => wrapper.findComponent(SeverityBadge);
const findBody = () => wrapper.find({ ref: 'body' }); const findBody = () => wrapper.findComponent({ ref: 'body' });
function mountComponent({ props } = {}) { function mountComponent({ props } = {}) {
wrapper = shallowMount(VulnerabilityCount, { wrapper = shallowMount(VulnerabilityCount, {
......
...@@ -60,7 +60,7 @@ describe('Vulnerability list component', () => { ...@@ -60,7 +60,7 @@ describe('Vulnerability list component', () => {
const findDataCells = (label) => wrapper.findAll(`[data-testid="${label}"]`); const findDataCells = (label) => wrapper.findAll(`[data-testid="${label}"]`);
const findLocationCell = (id) => wrapper.findByTestId(`location-${id}`); const findLocationCell = (id) => wrapper.findByTestId(`location-${id}`);
const findTitleCell = (id) => wrapper.findByTestId(`title-${id}`); const findTitleCell = (id) => wrapper.findByTestId(`title-${id}`);
const findLocationTextWrapper = (cell) => cell.find(GlTruncate); const findLocationTextWrapper = (cell) => cell.findComponent(GlTruncate);
const findFiltersProducedNoResults = () => wrapper.findComponent(FiltersProducedNoResults); const findFiltersProducedNoResults = () => wrapper.findComponent(FiltersProducedNoResults);
const findDashboardHasNoVulnerabilities = () => const findDashboardHasNoVulnerabilities = () =>
wrapper.findComponent(DashboardHasNoVulnerabilities); wrapper.findComponent(DashboardHasNoVulnerabilities);
...@@ -510,14 +510,14 @@ describe('Vulnerability list component', () => { ...@@ -510,14 +510,14 @@ describe('Vulnerability list component', () => {
it('should render the remediated info badge on the first vulnerability', () => { it('should render the remediated info badge on the first vulnerability', () => {
const row = findRow(0); const row = findRow(0);
const badge = row.find(RemediatedBadge); const badge = row.findComponent(RemediatedBadge);
expect(badge.exists()).toEqual(true); expect(badge.exists()).toEqual(true);
}); });
it('should not render the remediated info badge on the second vulnerability', () => { it('should not render the remediated info badge on the second vulnerability', () => {
const row = findRow(1); const row = findRow(1);
const badge = row.find(RemediatedBadge); const badge = row.findComponent(RemediatedBadge);
expect(badge.exists()).toEqual(false); expect(badge.exists()).toEqual(false);
}); });
...@@ -530,7 +530,7 @@ describe('Vulnerability list component', () => { ...@@ -530,7 +530,7 @@ describe('Vulnerability list component', () => {
it('should show the loading state', () => { it('should show the loading state', () => {
expect(findCell('status').exists()).toEqual(false); expect(findCell('status').exists()).toEqual(false);
expect(wrapper.find(GlSkeletonLoading).exists()).toEqual(true); expect(wrapper.findComponent(GlSkeletonLoading).exists()).toEqual(true);
}); });
}); });
......
...@@ -67,7 +67,7 @@ describe('Vulnerability list component', () => { ...@@ -67,7 +67,7 @@ describe('Vulnerability list component', () => {
const findDataCells = (label) => wrapper.findAll(`[data-testid="${label}"]`); const findDataCells = (label) => wrapper.findAll(`[data-testid="${label}"]`);
const findLocationCell = (id) => wrapper.findByTestId(`location-${id}`); const findLocationCell = (id) => wrapper.findByTestId(`location-${id}`);
const findTitleCell = (id) => wrapper.findByTestId(`title-${id}`); const findTitleCell = (id) => wrapper.findByTestId(`title-${id}`);
const findLocationTextWrapper = (cell) => cell.find(GlTruncate); const findLocationTextWrapper = (cell) => cell.findComponent(GlTruncate);
const findFiltersProducedNoResults = () => wrapper.findComponent(FiltersProducedNoResults); const findFiltersProducedNoResults = () => wrapper.findComponent(FiltersProducedNoResults);
const findDashboardHasNoVulnerabilities = () => const findDashboardHasNoVulnerabilities = () =>
wrapper.findComponent(DashboardHasNoVulnerabilities); wrapper.findComponent(DashboardHasNoVulnerabilities);
...@@ -150,7 +150,7 @@ describe('Vulnerability list component', () => { ...@@ -150,7 +150,7 @@ describe('Vulnerability list component', () => {
}); });
it('should portal the selection summary to the expected portal', () => { it('should portal the selection summary to the expected portal', () => {
expect(wrapper.find(Portal).attributes('to')).toBe(portalName); expect(wrapper.findComponent(Portal).attributes('to')).toBe(portalName);
}); });
it('should not show the selection summary if no vulnerabilities are selected', () => { it('should not show the selection summary if no vulnerabilities are selected', () => {
...@@ -529,14 +529,14 @@ describe('Vulnerability list component', () => { ...@@ -529,14 +529,14 @@ describe('Vulnerability list component', () => {
it('should render the remediated info badge on the first vulnerability', () => { it('should render the remediated info badge on the first vulnerability', () => {
const row = findRow(0); const row = findRow(0);
const badge = row.find(RemediatedBadge); const badge = row.findComponent(RemediatedBadge);
expect(badge.exists()).toEqual(true); expect(badge.exists()).toEqual(true);
}); });
it('should not render the remediated info badge on the second vulnerability', () => { it('should not render the remediated info badge on the second vulnerability', () => {
const row = findRow(1); const row = findRow(1);
const badge = row.find(RemediatedBadge); const badge = row.findComponent(RemediatedBadge);
expect(badge.exists()).toEqual(false); expect(badge.exists()).toEqual(false);
}); });
...@@ -551,7 +551,7 @@ describe('Vulnerability list component', () => { ...@@ -551,7 +551,7 @@ describe('Vulnerability list component', () => {
createWrapper({ props: { isLoading, vulnerabilities } }); createWrapper({ props: { isLoading, vulnerabilities } });
expect(findCell('status').exists()).toEqual(!isLoading); expect(findCell('status').exists()).toEqual(!isLoading);
expect(wrapper.find(GlSkeletonLoading).exists()).toEqual(isLoading); expect(wrapper.findComponent(GlSkeletonLoading).exists()).toEqual(isLoading);
}); });
}); });
......
...@@ -26,7 +26,7 @@ describe('Vulnerability Report Layout component', () => { ...@@ -26,7 +26,7 @@ describe('Vulnerability Report Layout component', () => {
const findHeader = () => wrapper.find('header'); const findHeader = () => wrapper.find('header');
const findStickySection = () => wrapper.findByTestId('sticky-section'); const findStickySection = () => wrapper.findByTestId('sticky-section');
const findSummarySection = () => wrapper.findByTestId('summary-section'); const findSummarySection = () => wrapper.findByTestId('summary-section');
const findTabs = () => wrapper.find(GlTabs); const findTabs = () => wrapper.findComponent(GlTabs);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -55,7 +55,7 @@ describe('Vulnerability Report Layout component', () => { ...@@ -55,7 +55,7 @@ describe('Vulnerability Report Layout component', () => {
}, },
}); });
expect(findFn().find(DummyComponent).exists()).toBe(true); expect(findFn().findComponent(DummyComponent).exists()).toBe(true);
}); });
}); });
......
{ {
"critical": 2, "critical": 2,
"high": 4, "high": 4,
"low": 7, "low": 7,
"medium": 8, "medium": 8,
"unknown": 0 "unknown": 0
} }
\ No newline at end of file
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