Commit 10238ef1 authored by Illya Klymov's avatar Illya Klymov

Replace deprecated usage of find/findAll in Vue-related specs

* migrate ee/spec/frontend/vue_shared
parent 948a862c
...@@ -36,10 +36,10 @@ describe('AccordionItem component', () => { ...@@ -36,10 +36,10 @@ describe('AccordionItem component', () => {
}); });
}; };
const loadingIndicator = () => wrapper.find({ ref: 'loadingIndicator' }); const loadingIndicator = () => wrapper.findComponent({ ref: 'loadingIndicator' });
const expansionTrigger = () => wrapper.find({ ref: 'expansionTrigger' }); const expansionTrigger = () => wrapper.findComponent({ ref: 'expansionTrigger' });
const contentContainer = () => wrapper.find({ ref: 'contentContainer' }); const contentContainer = () => wrapper.findComponent({ ref: 'contentContainer' });
const content = () => wrapper.find({ ref: 'content' }); const content = () => wrapper.findComponent({ ref: 'content' });
const namespacedCloseOtherAccordionItemsEvent = `${accordionId}.closeOtherAccordionItems`; const namespacedCloseOtherAccordionItemsEvent = `${accordionId}.closeOtherAccordionItems`;
afterEach(() => { afterEach(() => {
......
...@@ -146,7 +146,7 @@ describe('EpicToken', () => { ...@@ -146,7 +146,7 @@ describe('EpicToken', () => {
}); });
it('renders token item when value is selected', () => { it('renders token item when value is selected', () => {
const tokenSegments = wrapper.findAll(GlFilteredSearchTokenSegment); const tokenSegments = wrapper.findAllComponents(GlFilteredSearchTokenSegment);
expect(tokenSegments).toHaveLength(3); expect(tokenSegments).toHaveLength(3);
expect(tokenSegments.at(2).text()).toBe(`${mockEpics[0].title}::&${mockEpics[0].iid}`); expect(tokenSegments.at(2).text()).toBe(`${mockEpics[0].title}::&${mockEpics[0].iid}`);
......
...@@ -61,7 +61,7 @@ describe('IterationToken', () => { ...@@ -61,7 +61,7 @@ describe('IterationToken', () => {
}); });
it('renders iteration start date and due date', () => { it('renders iteration start date and due date', () => {
const suggestions = wrapper.findAll(GlFilteredSearchSuggestion); const suggestions = wrapper.findAllComponents(GlFilteredSearchSuggestion);
expect(suggestions.at(3).text()).toContain('Nov 5, 2021 - Nov 10, 2021'); expect(suggestions.at(3).text()).toContain('Nov 5, 2021 - Nov 10, 2021');
}); });
......
...@@ -26,7 +26,7 @@ describe('Severity Badge', () => { ...@@ -26,7 +26,7 @@ describe('Severity Badge', () => {
wrapper = null; wrapper = null;
}); });
const findIcon = () => wrapper.find(GlIcon); const findIcon = () => wrapper.findComponent(GlIcon);
const findTooltip = () => getBinding(findIcon().element, 'tooltip').value; const findTooltip = () => getBinding(findIcon().element, 'tooltip').value;
describe.each(SEVERITY_LEVELS)('given a valid severity "%s"', (severity) => { describe.each(SEVERITY_LEVELS)('given a valid severity "%s"', (severity) => {
......
...@@ -201,11 +201,11 @@ describe('EpicsSelect', () => { ...@@ -201,11 +201,11 @@ describe('EpicsSelect', () => {
}); });
it('should render DropdownValueCollapsed component', () => { it('should render DropdownValueCollapsed component', () => {
expect(wrapper.find(DropdownValueCollapsed).exists()).toBe(true); expect(wrapper.findComponent(DropdownValueCollapsed).exists()).toBe(true);
}); });
it('should not render DropdownValueCollapsed component when variant is "standalone"', () => { it('should not render DropdownValueCollapsed component when variant is "standalone"', () => {
expect(wrapperStandalone.find(DropdownValueCollapsed).exists()).toBe(false); expect(wrapperStandalone.findComponent(DropdownValueCollapsed).exists()).toBe(false);
}); });
it('should render a dropdown title component', () => { it('should render a dropdown title component', () => {
...@@ -220,11 +220,11 @@ describe('EpicsSelect', () => { ...@@ -220,11 +220,11 @@ describe('EpicsSelect', () => {
wrapper.vm.showDropdown = false; wrapper.vm.showDropdown = false;
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.find(DropdownValue).exists()).toBe(true); expect(wrapper.findComponent(DropdownValue).exists()).toBe(true);
}); });
it('should not render DropdownValue component when variant is "standalone"', () => { it('should not render DropdownValue component when variant is "standalone"', () => {
expect(wrapperStandalone.find(DropdownValue).exists()).toBe(false); expect(wrapperStandalone.findComponent(DropdownValue).exists()).toBe(false);
}); });
it('should render dropdown container element when props `canEdit` & `showDropdown` are true', async () => { it('should render dropdown container element when props `canEdit` & `showDropdown` are true', async () => {
......
...@@ -31,7 +31,7 @@ describe('EpicsSelect', () => { ...@@ -31,7 +31,7 @@ describe('EpicsSelect', () => {
}); });
it('should render Icon component', () => { it('should render Icon component', () => {
const iconEl = wrapper.find(GlIcon); const iconEl = wrapper.findComponent(GlIcon);
expect(iconEl.exists()).toBe(true); expect(iconEl.exists()).toBe(true);
expect(iconEl.attributes('name')).toBe('epic'); expect(iconEl.attributes('name')).toBe('epic');
......
...@@ -50,7 +50,7 @@ describe('EpicsSelect', () => { ...@@ -50,7 +50,7 @@ describe('EpicsSelect', () => {
}); });
it('should render epic title link element when `hasEpic` is true', () => { it('should render epic title link element when `hasEpic` is true', () => {
const titleEl = wrapper.find(GlLink); const titleEl = wrapper.findComponent(GlLink);
expect(titleEl.exists()).toBe(true); expect(titleEl.exists()).toBe(true);
expect(titleEl.attributes('href')).toBe(mockEpic1.url); expect(titleEl.attributes('href')).toBe(mockEpic1.url);
......
...@@ -49,7 +49,7 @@ describe('Card security discover app', () => { ...@@ -49,7 +49,7 @@ describe('Card security discover app', () => {
}); });
it('renders component properly', () => { it('renders component properly', () => {
expect(wrapper.find(CardSecurityDiscoverApp).exists()).toBe(true); expect(wrapper.findComponent(CardSecurityDiscoverApp).exists()).toBe(true);
}); });
it('renders discover title properly', () => { it('renders discover title properly', () => {
......
...@@ -17,7 +17,8 @@ const createComponent = (props = {}, mountFn = shallowMount) => { ...@@ -17,7 +17,8 @@ const createComponent = (props = {}, mountFn = shallowMount) => {
describe('AddLicenseForm', () => { describe('AddLicenseForm', () => {
const findSubmitButton = () => wrapper.find('.js-submit'); const findSubmitButton = () => wrapper.find('.js-submit');
const findCancelButton = () => wrapper.find('.js-cancel'); const findCancelButton = () => wrapper.find('.js-cancel');
const findRadioInputs = () => wrapper.find(GlFormRadioGroup).findAll(GlFormRadio); const findRadioInputs = () =>
wrapper.findComponent(GlFormRadioGroup).findAllComponents(GlFormRadio);
beforeEach(() => { beforeEach(() => {
createComponent(); createComponent();
......
...@@ -44,7 +44,7 @@ describe('DeleteConfirmationModal', () => { ...@@ -44,7 +44,7 @@ describe('DeleteConfirmationModal', () => {
}); });
}; };
const findModal = () => wrapper.find(GlModal); const findModal = () => wrapper.findComponent(GlModal);
beforeEach(() => { beforeEach(() => {
createComponent(); createComponent();
......
...@@ -12,7 +12,7 @@ describe('LicenseIssueBody', () => { ...@@ -12,7 +12,7 @@ describe('LicenseIssueBody', () => {
const findLicenseIssueBody = () => wrapper.findComponent(LicenseIssueBody); const findLicenseIssueBody = () => wrapper.findComponent(LicenseIssueBody);
const findLicensePackages = () => wrapper.findComponent(LicensePackages); const findLicensePackages = () => wrapper.findComponent(LicensePackages);
const findGlLink = () => wrapper.find(GlLink); const findGlLink = () => wrapper.findComponent(GlLink);
const findText = () => wrapper.find('[data-testid="license-copy"]'); const findText = () => wrapper.find('[data-testid="license-copy"]');
const createComponent = (props = {}) => { const createComponent = (props = {}) => {
......
...@@ -28,8 +28,8 @@ const PaginatedList = { ...@@ -28,8 +28,8 @@ const PaginatedList = {
}; };
const noop = () => {}; const noop = () => {};
const findIcon = () => wrapper.find(GlIcon); const findIcon = () => wrapper.findComponent(GlIcon);
const findPopover = () => wrapper.find(GlPopover); const findPopover = () => wrapper.findComponent(GlPopover);
const createComponent = ({ state, getters, props, actionMocks, isAdmin, options, provide }) => { const createComponent = ({ state, getters, props, actionMocks, isAdmin, options, provide }) => {
const fakeStore = new Vuex.Store({ const fakeStore = new Vuex.Store({
...@@ -87,7 +87,7 @@ describe('License Management', () => { ...@@ -87,7 +87,7 @@ describe('License Management', () => {
`('$desc', ({ isAdmin }) => { `('$desc', ({ isAdmin }) => {
it('should render loading icon during initial loading', () => { it('should render loading icon during initial loading', () => {
createComponent({ state: { isLoadingManagedLicenses: true }, isAdmin }); createComponent({ state: { isLoadingManagedLicenses: true }, isAdmin });
expect(wrapper.find(GlLoadingIcon).exists()).toBe(true); expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(true);
}); });
it('should render list of managed licenses while updating a license', () => { it('should render list of managed licenses while updating a license', () => {
...@@ -96,7 +96,7 @@ describe('License Management', () => { ...@@ -96,7 +96,7 @@ describe('License Management', () => {
getters: { hasPendingLicenses: () => true }, getters: { hasPendingLicenses: () => true },
isAdmin, isAdmin,
}); });
expect(wrapper.find(PaginatedList).props('list')).toBe(managedLicenses); expect(wrapper.findComponent(PaginatedList).props('list')).toBe(managedLicenses);
}); });
describe('when not loading', () => { describe('when not loading', () => {
...@@ -105,7 +105,7 @@ describe('License Management', () => { ...@@ -105,7 +105,7 @@ describe('License Management', () => {
}); });
it('should render list of managed licenses', () => { it('should render list of managed licenses', () => {
expect(wrapper.find(PaginatedList).props('list')).toBe(managedLicenses); expect(wrapper.findComponent(PaginatedList).props('list')).toBe(managedLicenses);
}); });
}); });
...@@ -134,10 +134,10 @@ describe('License Management', () => { ...@@ -134,10 +134,10 @@ describe('License Management', () => {
actionMocks: { setLicenseApproval: setLicenseApprovalMock }, actionMocks: { setLicenseApproval: setLicenseApprovalMock },
isAdmin: true, isAdmin: true,
}); });
wrapper.find(GlButton).vm.$emit('click'); wrapper.findComponent(GlButton).vm.$emit('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
wrapper.find(AddLicenseForm).vm.$emit('addLicense'); wrapper.findComponent(AddLicenseForm).vm.$emit('addLicense');
expect(setLicenseApprovalMock).toHaveBeenCalled(); expect(setLicenseApprovalMock).toHaveBeenCalled();
}); });
}); });
...@@ -148,30 +148,30 @@ describe('License Management', () => { ...@@ -148,30 +148,30 @@ describe('License Management', () => {
}); });
it('should render the license-approvals section accordingly', () => { it('should render the license-approvals section accordingly', () => {
expect(wrapper.find(LicenseComplianceApprovals).exists()).toBe(true); expect(wrapper.findComponent(LicenseComplianceApprovals).exists()).toBe(true);
}); });
it('should render the form if the form is open and disable the form button', () => { it('should render the form if the form is open and disable the form button', () => {
wrapper.find(GlButton).vm.$emit('click'); wrapper.findComponent(GlButton).vm.$emit('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.find(AddLicenseForm).exists()).toBe(true); expect(wrapper.findComponent(AddLicenseForm).exists()).toBe(true);
expect(wrapper.find(GlButton).attributes('disabled')).toBe('true'); expect(wrapper.findComponent(GlButton).attributes('disabled')).toBe('true');
}); });
}); });
it('should not render the form if the form is closed and have active button', () => { it('should not render the form if the form is closed and have active button', () => {
expect(wrapper.find(AddLicenseForm).exists()).toBe(false); expect(wrapper.findComponent(AddLicenseForm).exists()).toBe(false);
expect(wrapper.find(GlButton).attributes('disabled')).not.toBe('true'); expect(wrapper.findComponent(GlButton).attributes('disabled')).not.toBe('true');
}); });
it('should render delete confirmation modal', () => { it('should render delete confirmation modal', () => {
expect(wrapper.find(DeleteConfirmationModal).exists()).toBe(true); expect(wrapper.findComponent(DeleteConfirmationModal).exists()).toBe(true);
}); });
it('renders the admin row', () => { it('renders the admin row', () => {
expect(wrapper.find(LicenseManagementRow).exists()).toBe(false); expect(wrapper.findComponent(LicenseManagementRow).exists()).toBe(false);
expect(wrapper.find(AdminLicenseManagementRow).exists()).toBe(true); expect(wrapper.findComponent(AdminLicenseManagementRow).exists()).toBe(true);
}); });
}); });
...@@ -194,8 +194,8 @@ describe('License Management', () => { ...@@ -194,8 +194,8 @@ describe('License Management', () => {
actionMocks: { setLicenseApproval: setLicenseApprovalMock }, actionMocks: { setLicenseApproval: setLicenseApprovalMock },
isAdmin: false, isAdmin: false,
}); });
expect(wrapper.find(GlButton).exists()).toBe(false); expect(wrapper.findComponent(GlButton).exists()).toBe(false);
expect(wrapper.find(AddLicenseForm).exists()).toBe(false); expect(wrapper.findComponent(AddLicenseForm).exists()).toBe(false);
expect(setLicenseApprovalMock).not.toHaveBeenCalled(); expect(setLicenseApprovalMock).not.toHaveBeenCalled();
}); });
...@@ -205,21 +205,21 @@ describe('License Management', () => { ...@@ -205,21 +205,21 @@ describe('License Management', () => {
}); });
it('should not render the approval section', () => { it('should not render the approval section', () => {
expect(wrapper.find(LicenseComplianceApprovals).exists()).toBe(false); expect(wrapper.findComponent(LicenseComplianceApprovals).exists()).toBe(false);
}); });
it('should not render the form', () => { it('should not render the form', () => {
expect(wrapper.find(AddLicenseForm).exists()).toBe(false); expect(wrapper.findComponent(AddLicenseForm).exists()).toBe(false);
expect(wrapper.find(GlButton).exists()).toBe(false); expect(wrapper.findComponent(GlButton).exists()).toBe(false);
}); });
it('should not render delete confirmation modal', () => { it('should not render delete confirmation modal', () => {
expect(wrapper.find(DeleteConfirmationModal).exists()).toBe(false); expect(wrapper.findComponent(DeleteConfirmationModal).exists()).toBe(false);
}); });
it('renders the read-only row', () => { it('renders the read-only row', () => {
expect(wrapper.find(LicenseManagementRow).exists()).toBe(true); expect(wrapper.findComponent(LicenseManagementRow).exists()).toBe(true);
expect(wrapper.find(AdminLicenseManagementRow).exists()).toBe(false); expect(wrapper.findComponent(AdminLicenseManagementRow).exists()).toBe(false);
}); });
}); });
......
...@@ -204,7 +204,7 @@ describe('Grouped metrics reports app', () => { ...@@ -204,7 +204,7 @@ describe('Grouped metrics reports app', () => {
}); });
it('renders custom metric issue body', () => { it('renders custom metric issue body', () => {
const issueBody = wrapper.find(MetricsReportsIssueBody); const issueBody = wrapper.findComponent(MetricsReportsIssueBody);
expect(issueBody.props('issue').name).toEqual('name'); expect(issueBody.props('issue').name).toEqual('name');
expect(issueBody.props('issue').value).toEqual('value'); expect(issueBody.props('issue').value).toEqual('value');
......
...@@ -50,7 +50,7 @@ describe('Pipeline artifact Download', () => { ...@@ -50,7 +50,7 @@ describe('Pipeline artifact Download', () => {
return createMockApollo(requestHandlers); return createMockApollo(requestHandlers);
}; };
const findDownloadDropdown = () => wrapper.find(SecurityReportDownloadDropdown); const findDownloadDropdown = () => wrapper.findComponent(SecurityReportDownloadDropdown);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
...@@ -45,7 +45,7 @@ describe('DAST Modal', () => { ...@@ -45,7 +45,7 @@ describe('DAST Modal', () => {
it('should contain the dynamic title', () => { it('should contain the dynamic title', () => {
createWrapper({ scannedResourcesCount: 20 }); createWrapper({ scannedResourcesCount: 20 });
expect(wrapper.find(GlModal).props('title')).toBe('20 Scanned URLs'); expect(wrapper.findComponent(GlModal).props('title')).toBe('20 Scanned URLs');
}); });
it('should not show download button when link is not present', () => { it('should not show download button when link is not present', () => {
......
...@@ -22,7 +22,7 @@ describe('DismissalButton', () => { ...@@ -22,7 +22,7 @@ describe('DismissalButton', () => {
}); });
it('should emit dismiss vulnerability when clicked', () => { it('should emit dismiss vulnerability when clicked', () => {
wrapper.find(GlButton).trigger('click'); wrapper.findComponent(GlButton).trigger('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().dismissVulnerability).toBeTruthy(); expect(wrapper.emitted().dismissVulnerability).toBeTruthy();
}); });
...@@ -53,7 +53,7 @@ describe('DismissalButton', () => { ...@@ -53,7 +53,7 @@ describe('DismissalButton', () => {
}); });
it('should emit revertDismissVulnerability when clicked', () => { it('should emit revertDismissVulnerability when clicked', () => {
wrapper.find(GlButton).trigger('click'); wrapper.findComponent(GlButton).trigger('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().revertDismissVulnerability).toBeTruthy(); expect(wrapper.emitted().revertDismissVulnerability).toBeTruthy();
}); });
......
...@@ -19,7 +19,7 @@ describe('DismissalCommentBox', () => { ...@@ -19,7 +19,7 @@ describe('DismissalCommentBox', () => {
}); });
it('should submit the comment when cmd+enter is pressed', () => { it('should submit the comment when cmd+enter is pressed', () => {
wrapper.find(GlFormTextarea).trigger('keydown.enter', { wrapper.findComponent(GlFormTextarea).trigger('keydown.enter', {
metaKey: true, metaKey: true,
}); });
...@@ -42,7 +42,7 @@ describe('DismissalCommentBox', () => { ...@@ -42,7 +42,7 @@ describe('DismissalCommentBox', () => {
wrapper.setProps({ placeholder }); wrapper.setProps({ placeholder });
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(wrapper.find(GlFormTextarea).attributes('placeholder')).toBe(placeholder); expect(wrapper.findComponent(GlFormTextarea).attributes('placeholder')).toBe(placeholder);
}); });
}); });
}); });
...@@ -15,7 +15,7 @@ describe('DismissalCommentBox', () => { ...@@ -15,7 +15,7 @@ describe('DismissalCommentBox', () => {
}); });
it('should not render the dismissal comment box', () => { it('should not render the dismissal comment box', () => {
expect(wrapper.find(DismissalCommentBox).exists()).toBeFalsy(); expect(wrapper.findComponent(DismissalCommentBox).exists()).toBeFalsy();
}); });
}); });
...@@ -29,7 +29,7 @@ describe('DismissalCommentBox', () => { ...@@ -29,7 +29,7 @@ describe('DismissalCommentBox', () => {
}); });
it('should render the dismissal comment box', () => { it('should render the dismissal comment box', () => {
expect(wrapper.find(DismissalCommentBox).exists()).toBeTruthy(); expect(wrapper.findComponent(DismissalCommentBox).exists()).toBeTruthy();
}); });
it('should not render the placeholder text box', () => { it('should not render the placeholder text box', () => {
......
...@@ -34,11 +34,11 @@ describe('dismissal note', () => { ...@@ -34,11 +34,11 @@ describe('dismissal note', () => {
}); });
it('should pass the author to the event item', () => { it('should pass the author to the event item', () => {
expect(wrapper.find(EventItem).props('author')).toBe(feedback.author); expect(wrapper.findComponent(EventItem).props('author')).toBe(feedback.author);
}); });
it('should pass the created date to the event item', () => { it('should pass the created date to the event item', () => {
expect(wrapper.find(EventItem).props('createdAt')).toBe(feedback.created_at); expect(wrapper.findComponent(EventItem).props('createdAt')).toBe(feedback.created_at);
}); });
it('should return the event text with no project data', () => { it('should return the event text with no project data', () => {
...@@ -125,7 +125,7 @@ describe('dismissal note', () => { ...@@ -125,7 +125,7 @@ describe('dismissal note', () => {
project, project,
}, },
}); });
commentItem = wrapper.findAll(EventItem).at(1); commentItem = wrapper.findAllComponents(EventItem).at(1);
}); });
it('should render the comment', () => { it('should render the comment', () => {
...@@ -156,7 +156,7 @@ describe('dismissal note', () => { ...@@ -156,7 +156,7 @@ describe('dismissal note', () => {
}, },
mount, mount,
); );
commentItem = wrapper.findAll(EventItem).at(1); commentItem = wrapper.findAllComponents(EventItem).at(1);
}); });
it('should render deletion buttons slot', () => { it('should render deletion buttons slot', () => {
......
...@@ -11,7 +11,7 @@ describe('Event Item', () => { ...@@ -11,7 +11,7 @@ describe('Event Item', () => {
wrapper = mountFn(Component, options); wrapper = mountFn(Component, options);
}; };
const noteHeader = () => wrapper.find(NoteHeader); const noteHeader = () => wrapper.findComponent(NoteHeader);
describe('initial state', () => { describe('initial state', () => {
const propsData = { const propsData = {
...@@ -92,12 +92,12 @@ describe('Event Item', () => { ...@@ -92,12 +92,12 @@ describe('Event Item', () => {
}); });
it('renders the action buttons', () => { it('renders the action buttons', () => {
expect(wrapper.findAll(GlButton)).toHaveLength(2); expect(wrapper.findAllComponents(GlButton)).toHaveLength(2);
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
it('emits the button events when clicked', () => { it('emits the button events when clicked', () => {
const buttons = wrapper.findAll(GlButton); const buttons = wrapper.findAllComponents(GlButton);
buttons.at(0).trigger('click'); buttons.at(0).trigger('click');
return wrapper.vm return wrapper.vm
.$nextTick() .$nextTick()
......
...@@ -30,11 +30,11 @@ describe('Issue note', () => { ...@@ -30,11 +30,11 @@ describe('Issue note', () => {
}); });
it('should pass the author to the event item', () => { it('should pass the author to the event item', () => {
expect(wrapper.find(EventItem).props('author')).toBe(feedback.author); expect(wrapper.findComponent(EventItem).props('author')).toBe(feedback.author);
}); });
it('should pass the created date to the event item', () => { it('should pass the created date to the event item', () => {
expect(wrapper.find(EventItem).props('createdAt')).toBe(feedback.created_at); expect(wrapper.findComponent(EventItem).props('createdAt')).toBe(feedback.created_at);
}); });
it('should return the event text with no project data', () => { it('should return the event text with no project data', () => {
......
...@@ -30,11 +30,11 @@ describe('Merge request note', () => { ...@@ -30,11 +30,11 @@ describe('Merge request note', () => {
}); });
it('should pass the author to the event item', () => { it('should pass the author to the event item', () => {
expect(wrapper.find(EventItem).props('author')).toBe(feedback.author); expect(wrapper.findComponent(EventItem).props('author')).toBe(feedback.author);
}); });
it('should pass the created date to the event item', () => { it('should pass the created date to the event item', () => {
expect(wrapper.find(EventItem).props('createdAt')).toBe(feedback.created_at); expect(wrapper.findComponent(EventItem).props('createdAt')).toBe(feedback.created_at);
}); });
it('should return the event text with no project data', () => { it('should return the event text with no project data', () => {
......
...@@ -77,7 +77,7 @@ describe('Security Reports modal footer', () => { ...@@ -77,7 +77,7 @@ describe('Security Reports modal footer', () => {
}); });
it('has the external-link icon', () => { it('has the external-link icon', () => {
expect(findActionButton().find(GlIcon).props('name')).toBe('external-link'); expect(findActionButton().findComponent(GlIcon).props('name')).toBe('external-link');
}); });
}); });
...@@ -140,7 +140,7 @@ describe('Security Reports modal footer', () => { ...@@ -140,7 +140,7 @@ describe('Security Reports modal footer', () => {
it('renders create merge request and issue button as a split button', () => { it('renders create merge request and issue button as a split button', () => {
expect(wrapper.find('.js-split-button').exists()).toBe(true); expect(wrapper.find('.js-split-button').exists()).toBe(true);
expect(wrapper.vm.actionButtons).toHaveLength(2); expect(wrapper.vm.actionButtons).toHaveLength(2);
expect(wrapper.find(SplitButton).exists()).toBe(true); expect(wrapper.findComponent(SplitButton).exists()).toBe(true);
expect(wrapper.find('.js-split-button').text()).toContain('Resolve with merge request'); expect(wrapper.find('.js-split-button').text()).toContain('Resolve with merge request');
expect(wrapper.find('.js-split-button').text()).toContain('Create issue'); expect(wrapper.find('.js-split-button').text()).toContain('Create issue');
}); });
...@@ -159,7 +159,7 @@ describe('Security Reports modal footer', () => { ...@@ -159,7 +159,7 @@ describe('Security Reports modal footer', () => {
it('renders the split button', () => { it('renders the split button', () => {
expect(wrapper.vm.actionButtons).toHaveLength(3); expect(wrapper.vm.actionButtons).toHaveLength(3);
expect(wrapper.find(SplitButton).exists()).toBe(true); expect(wrapper.findComponent(SplitButton).exists()).toBe(true);
expect(wrapper.find('.js-split-button').text()).toContain('Resolve with merge request'); expect(wrapper.find('.js-split-button').text()).toContain('Resolve with merge request');
expect(wrapper.find('.js-split-button').text()).toContain('Create issue'); expect(wrapper.find('.js-split-button').text()).toContain('Create issue');
expect(wrapper.find('.js-split-button').text()).toContain('Download patch to resolve'); expect(wrapper.find('.js-split-button').text()).toContain('Download patch to resolve');
...@@ -176,7 +176,7 @@ describe('Security Reports modal footer', () => { ...@@ -176,7 +176,7 @@ describe('Security Reports modal footer', () => {
}); });
it('should render the dismiss button', () => { it('should render the dismiss button', () => {
expect(wrapper.find(DismissButton).exists()).toBe(true); expect(wrapper.findComponent(DismissButton).exists()).toBe(true);
}); });
}); });
}); });
...@@ -24,7 +24,7 @@ describe('Security Reports modal', () => { ...@@ -24,7 +24,7 @@ describe('Security Reports modal', () => {
...propsData, ...propsData,
}, },
}); });
modal = wrapper.find(GlModal); modal = wrapper.findComponent(GlModal);
}; };
describe('modal', () => { describe('modal', () => {
...@@ -106,7 +106,9 @@ describe('Security Reports modal', () => { ...@@ -106,7 +106,9 @@ describe('Security Reports modal', () => {
}); });
it('allows the vulnerability to be dismissed', () => { it('allows the vulnerability to be dismissed', () => {
expect(wrapper.find({ ref: 'footer' }).props('canDismissVulnerability')).toBe(true); expect(wrapper.findComponent({ ref: 'footer' }).props('canDismissVulnerability')).toBe(
true,
);
}); });
}); });
...@@ -184,7 +186,7 @@ describe('Security Reports modal', () => { ...@@ -184,7 +186,7 @@ describe('Security Reports modal', () => {
}); });
it('disallows any actions in the footer', () => { it('disallows any actions in the footer', () => {
expect(wrapper.find({ ref: 'footer' }).props()).toMatchObject({ expect(wrapper.findComponent({ ref: 'footer' }).props()).toMatchObject({
canCreateIssue: false, canCreateIssue: false,
canCreateMergeRequest: false, canCreateMergeRequest: false,
canDownloadPatch: false, canDownloadPatch: false,
...@@ -203,7 +205,7 @@ describe('Security Reports modal', () => { ...@@ -203,7 +205,7 @@ describe('Security Reports modal', () => {
}); });
it('disallows any actions in the footer', () => { it('disallows any actions in the footer', () => {
expect(wrapper.find({ ref: 'footer' }).props()).toMatchObject({ expect(wrapper.findComponent({ ref: 'footer' }).props()).toMatchObject({
canCreateIssue: false, canCreateIssue: false,
canCreateMergeRequest: false, canCreateMergeRequest: false,
canDownloadPatch: false, canDownloadPatch: false,
...@@ -226,7 +228,7 @@ describe('Security Reports modal', () => { ...@@ -226,7 +228,7 @@ describe('Security Reports modal', () => {
}); });
it('displays a link to the issue', () => { it('displays a link to the issue', () => {
expect(wrapper.find(IssueNote).exists()).toBe(true); expect(wrapper.findComponent(IssueNote).exists()).toBe(true);
}); });
}); });
...@@ -243,7 +245,7 @@ describe('Security Reports modal', () => { ...@@ -243,7 +245,7 @@ describe('Security Reports modal', () => {
}); });
it('hides the link to the issue', () => { it('hides the link to the issue', () => {
const note = wrapper.find(IssueNote); const note = wrapper.findComponent(IssueNote);
expect(note.exists()).toBe(false); expect(note.exists()).toBe(false);
}); });
}); });
...@@ -263,7 +265,7 @@ describe('Security Reports modal', () => { ...@@ -263,7 +265,7 @@ describe('Security Reports modal', () => {
}); });
it('displays a link to the merge request', () => { it('displays a link to the merge request', () => {
expect(wrapper.find(MergeRequestNote).exists()).toBe(true); expect(wrapper.findComponent(MergeRequestNote).exists()).toBe(true);
}); });
}); });
...@@ -280,7 +282,7 @@ describe('Security Reports modal', () => { ...@@ -280,7 +282,7 @@ describe('Security Reports modal', () => {
}); });
it('hides the link to the merge request', () => { it('hides the link to the merge request', () => {
const note = wrapper.find(MergeRequestNote); const note = wrapper.findComponent(MergeRequestNote);
expect(note.exists()).toBe(false); expect(note.exists()).toBe(false);
}); });
}); });
...@@ -296,7 +298,7 @@ describe('Security Reports modal', () => { ...@@ -296,7 +298,7 @@ describe('Security Reports modal', () => {
}); });
it('disallows any actions in the footer', () => { it('disallows any actions in the footer', () => {
expect(wrapper.find({ ref: 'footer' }).props()).toMatchObject({ expect(wrapper.findComponent({ ref: 'footer' }).props()).toMatchObject({
canCreateIssue: false, canCreateIssue: false,
canCreateMergeRequest: false, canCreateMergeRequest: false,
canDownloadPatch: false, canDownloadPatch: false,
...@@ -342,7 +344,7 @@ describe('Security Reports modal', () => { ...@@ -342,7 +344,7 @@ describe('Security Reports modal', () => {
mountComponent(propsData, mount); mountComponent(propsData, mount);
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
const solutionCard = modal.find(SolutionCard); const solutionCard = modal.findComponent(SolutionCard);
expect(solutionCard.exists()).toBe(true); expect(solutionCard.exists()).toBe(true);
expect(solutionCard.text()).toContain(solution); expect(solutionCard.text()).toContain(solution);
...@@ -359,7 +361,7 @@ describe('Security Reports modal', () => { ...@@ -359,7 +361,7 @@ describe('Security Reports modal', () => {
mountComponent(propsData, mount); mountComponent(propsData, mount);
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
const solutionCard = wrapper.find(SolutionCard); const solutionCard = wrapper.findComponent(SolutionCard);
expect(solutionCard.exists()).toBe(true); expect(solutionCard.exists()).toBe(true);
expect(solutionCard.text()).toContain(summary); expect(solutionCard.text()).toContain(summary);
...@@ -374,7 +376,7 @@ describe('Security Reports modal', () => { ...@@ -374,7 +376,7 @@ describe('Security Reports modal', () => {
mountComponent(propsData, mount); mountComponent(propsData, mount);
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
const solutionCard = wrapper.find(SolutionCard); const solutionCard = wrapper.findComponent(SolutionCard);
expect(solutionCard.exists()).toBe(true); expect(solutionCard.exists()).toBe(true);
expect(wrapper.find('hr').exists()).toBe(false); expect(wrapper.find('hr').exists()).toBe(false);
......
...@@ -21,7 +21,7 @@ import { ...@@ -21,7 +21,7 @@ import {
describe('Security Issue Body', () => { describe('Security Issue Body', () => {
let wrapper; let wrapper;
const findReportLink = () => wrapper.find(ReportLink); const findReportLink = () => wrapper.findComponent(ReportLink);
const createComponent = (issue) => { const createComponent = (issue) => {
wrapper = extendedWrapper( wrapper = extendedWrapper(
...@@ -52,11 +52,11 @@ describe('Security Issue Body', () => { ...@@ -52,11 +52,11 @@ describe('Security Issue Body', () => {
if (severity) { if (severity) {
it(`shows SeverityBadge if severity is present`, () => { it(`shows SeverityBadge if severity is present`, () => {
expect(wrapper.find(SeverityBadge).props('severity')).toBe(severity); expect(wrapper.findComponent(SeverityBadge).props('severity')).toBe(severity);
}); });
} else { } else {
it(`does not show SeverityBadge if severity is not present`, () => { it(`does not show SeverityBadge if severity is not present`, () => {
expect(wrapper.find(SeverityBadge).exists()).toBe(false); expect(wrapper.findComponent(SeverityBadge).exists()).toBe(false);
}); });
} }
......
...@@ -8,7 +8,7 @@ describe('Solution Card', () => { ...@@ -8,7 +8,7 @@ describe('Solution Card', () => {
let wrapper; let wrapper;
const findSolutionText = () => wrapper.find({ ref: 'solution-text' }); const findSolutionText = () => wrapper.findComponent({ ref: 'solution-text' });
const findSolutionTitle = () => wrapper.find('h3'); const findSolutionTitle = () => wrapper.find('h3');
const createComponent = ({ propsData } = {}) => { const createComponent = ({ propsData } = {}) => {
......
...@@ -21,8 +21,8 @@ const buttons = [ ...@@ -21,8 +21,8 @@ const buttons = [
describe('Split Button', () => { describe('Split Button', () => {
let wrapper; let wrapper;
const findDropdown = () => wrapper.find(GlDropdown); const findDropdown = () => wrapper.findComponent(GlDropdown);
const findDropdownItems = () => wrapper.findAll(GlDropdownItem); const findDropdownItems = () => wrapper.findAllComponents(GlDropdownItem);
const createComponent = (props) => { const createComponent = (props) => {
wrapper = shallowMount(SplitButton, { wrapper = shallowMount(SplitButton, {
......
...@@ -8,9 +8,9 @@ import CodeBlock from '~/vue_shared/components/code_block.vue'; ...@@ -8,9 +8,9 @@ import CodeBlock from '~/vue_shared/components/code_block.vue';
describe('VulnerabilityDetails component', () => { describe('VulnerabilityDetails component', () => {
let wrapper; let wrapper;
const findHeading = () => wrapper.find('h3'); const findHeading = () => wrapper.find('h3');
const findIcon = () => wrapper.find(GlIcon); const findIcon = () => wrapper.findComponent(GlIcon);
const findCodeBlock = () => wrapper.find(CodeBlock); const findCodeBlock = () => wrapper.findComponent(CodeBlock);
const findDetailItem = () => wrapper.find(DetailItem); const findDetailItem = () => wrapper.findComponent(DetailItem);
const findPlainContent = () => wrapper.findByTestId('detail-item-content-template'); const findPlainContent = () => wrapper.findByTestId('detail-item-content-template');
const createComponent = ( const createComponent = (
......
...@@ -35,14 +35,14 @@ describe('VulnerabilityDetails component', () => { ...@@ -35,14 +35,14 @@ describe('VulnerabilityDetails component', () => {
} }
}; };
const findLink = (name) => wrapper.find({ ref: `${name}Link` }); const findLink = (name) => wrapper.findComponent({ ref: `${name}Link` });
const findRequest = () => wrapper.find({ ref: 'request' }); const findRequest = () => wrapper.findComponent({ ref: 'request' });
const findRecordedResponse = () => wrapper.find({ ref: 'recordedResponse' }); const findRecordedResponse = () => wrapper.findComponent({ ref: 'recordedResponse' });
const findUnmodifiedResponse = () => wrapper.find({ ref: 'unmodifiedResponse' }); const findUnmodifiedResponse = () => wrapper.findComponent({ ref: 'unmodifiedResponse' });
const findCrashAddress = () => wrapper.find({ ref: 'crashAddress' }); const findCrashAddress = () => wrapper.findComponent({ ref: 'crashAddress' });
const findCrashState = () => wrapper.find({ ref: 'crashState' }); const findCrashState = () => wrapper.findComponent({ ref: 'crashState' });
const findCrashType = () => wrapper.find({ ref: 'crashType' }); const findCrashType = () => wrapper.findComponent({ ref: 'crashType' });
const findStacktraceSnippet = () => wrapper.find({ ref: 'stacktraceSnippet' }); const findStacktraceSnippet = () => wrapper.findComponent({ ref: 'stacktraceSnippet' });
const findGenericReportSection = () => wrapper.findComponent(GenericReportSection); const findGenericReportSection = () => wrapper.findComponent(GenericReportSection);
const findAlert = () => wrapper.findComponent(FalsePositiveAlert); const findAlert = () => wrapper.findComponent(FalsePositiveAlert);
const findDescription = () => wrapper.findByTestId('description'); const findDescription = () => wrapper.findByTestId('description');
...@@ -82,7 +82,7 @@ describe('VulnerabilityDetails component', () => { ...@@ -82,7 +82,7 @@ describe('VulnerabilityDetails component', () => {
it('renders severity with a badge', () => { it('renders severity with a badge', () => {
const vulnerability = makeVulnerability({ severity: 'critical' }); const vulnerability = makeVulnerability({ severity: 'critical' });
componentFactory(vulnerability); componentFactory(vulnerability);
const badge = wrapper.find(SeverityBadge); const badge = wrapper.findComponent(SeverityBadge);
expect(badge.props('severity')).toBe(vulnerability.severity); expect(badge.props('severity')).toBe(vulnerability.severity);
}); });
...@@ -90,7 +90,7 @@ describe('VulnerabilityDetails component', () => { ...@@ -90,7 +90,7 @@ describe('VulnerabilityDetails component', () => {
it('renders status with a badge', () => { it('renders status with a badge', () => {
const vulnerability = makeVulnerability({ state: 'detected' }); const vulnerability = makeVulnerability({ state: 'detected' });
componentFactory(vulnerability); componentFactory(vulnerability);
const badge = wrapper.find(GlBadge); const badge = wrapper.findComponent(GlBadge);
expect(badge.text()).toContain(vulnerability.state); expect(badge.text()).toContain(vulnerability.state);
}); });
......
...@@ -41,7 +41,7 @@ describe('Grouped security reports app', () => { ...@@ -41,7 +41,7 @@ describe('Grouped security reports app', () => {
let wrapper; let wrapper;
let mock; let mock;
const findReportSection = () => wrapper.find(ReportSection); const findReportSection = () => wrapper.findComponent(ReportSection);
const findReportSummary = () => wrapper.find('[data-testid="report-section-code-text"]'); const findReportSummary = () => wrapper.find('[data-testid="report-section-code-text"]');
const findCollapseButton = () => wrapper.find('.js-collapse-btn'); const findCollapseButton = () => wrapper.find('.js-collapse-btn');
const findSpinner = () => wrapper.find('.gl-spinner'); const findSpinner = () => wrapper.find('.gl-spinner');
......
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