Commit 920afc5c authored by Illya Klymov's avatar Illya Klymov

Replace usage of find/findAll in misc ee components (3/5)

* migrate to proper use of findComponent/findAllComponents
parent 68755b38
...@@ -47,6 +47,6 @@ describe('RelatedIssuableItem', () => { ...@@ -47,6 +47,6 @@ describe('RelatedIssuableItem', () => {
}); });
it('renders weight component with correct weight', () => { it('renders weight component with correct weight', () => {
expect(wrapper.find(IssueWeight).props('weight')).toBe(props.weight); expect(wrapper.findComponent(IssueWeight).props('weight')).toBe(props.weight);
}); });
}); });
...@@ -29,7 +29,7 @@ describe('RelatedIssuesList', () => { ...@@ -29,7 +29,7 @@ describe('RelatedIssuesList', () => {
}); });
it('shows weight', () => { it('shows weight', () => {
expect(wrapper.find(IssueWeight).find('.board-card-info-text').text()).toBe( expect(wrapper.findComponent(IssueWeight).find('.board-card-info-text').text()).toBe(
issuable1.weight.toString(), issuable1.weight.toString(),
); );
}); });
......
...@@ -33,7 +33,7 @@ describe('Incident SLA', () => { ...@@ -33,7 +33,7 @@ describe('Incident SLA', () => {
} }
}); });
const findSLA = () => wrapper.find(ServiceLevelAgreement); const findSLA = () => wrapper.findComponent(ServiceLevelAgreement);
it('renders a blank component when there is no data', () => { it('renders a blank component when there is no data', () => {
mountComponent({ mountComponent({
......
...@@ -47,10 +47,10 @@ describe('Metrics upload item', () => { ...@@ -47,10 +47,10 @@ describe('Metrics upload item', () => {
} }
}); });
const findImageLink = () => wrapper.find(GlLink); const findImageLink = () => wrapper.findComponent(GlLink);
const findCollapseButton = () => wrapper.find('[data-testid="collapse-button"]'); const findCollapseButton = () => wrapper.find('[data-testid="collapse-button"]');
const findMetricImageBody = () => wrapper.find('[data-testid="metric-image-body"]'); const findMetricImageBody = () => wrapper.find('[data-testid="metric-image-body"]');
const findModal = () => wrapper.find(GlModal); const findModal = () => wrapper.findComponent(GlModal);
const findDeleteButton = () => wrapper.find('[data-testid="delete-button"]'); const findDeleteButton = () => wrapper.find('[data-testid="delete-button"]');
const closeModal = () => findModal().vm.$emit('hidden'); const closeModal = () => findModal().vm.$emit('hidden');
......
...@@ -54,9 +54,9 @@ describe('Metrics tab', () => { ...@@ -54,9 +54,9 @@ describe('Metrics tab', () => {
} }
}); });
const findUploadDropzone = () => wrapper.find(UploadDropzone); const findUploadDropzone = () => wrapper.findComponent(UploadDropzone);
const findImages = () => wrapper.findAll(MetricsImage); const findImages = () => wrapper.findAllComponents(MetricsImage);
const findModal = () => wrapper.find(GlModal); const findModal = () => wrapper.findComponent(GlModal);
const submitModal = () => findModal().vm.$emit('primary', mockEvent); const submitModal = () => findModal().vm.$emit('primary', mockEvent);
const cancelModal = () => findModal().vm.$emit('hidden'); const cancelModal = () => findModal().vm.$emit('hidden');
...@@ -145,7 +145,7 @@ describe('Metrics tab', () => { ...@@ -145,7 +145,7 @@ describe('Metrics tab', () => {
}); });
it('should display the url field', () => { it('should display the url field', () => {
expect(wrapper.find(GlFormInput).attributes('value')).toBe(testUrl); expect(wrapper.findComponent(GlFormInput).attributes('value')).toBe(testUrl);
}); });
it('should clear url when cancelled', async () => { it('should clear url when cancelled', async () => {
...@@ -153,7 +153,7 @@ describe('Metrics tab', () => { ...@@ -153,7 +153,7 @@ describe('Metrics tab', () => {
await waitForPromises(); await waitForPromises();
expect(wrapper.find(GlFormInput).attributes('value')).toBe(''); expect(wrapper.findComponent(GlFormInput).attributes('value')).toBe('');
}); });
it('should clear url when submitted', async () => { it('should clear url when submitted', async () => {
...@@ -161,7 +161,7 @@ describe('Metrics tab', () => { ...@@ -161,7 +161,7 @@ describe('Metrics tab', () => {
await waitForPromises(); await waitForPromises();
expect(wrapper.find(GlFormInput).attributes('value')).toBe(''); expect(wrapper.findComponent(GlFormInput).attributes('value')).toBe('');
}); });
}); });
}); });
......
...@@ -59,9 +59,9 @@ describe('Issue Analytics component', () => { ...@@ -59,9 +59,9 @@ describe('Issue Analytics component', () => {
axiosMock.restore(); axiosMock.restore();
}); });
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
const findChartContainer = () => wrapper.find('.issues-analytics-chart'); const findChartContainer = () => wrapper.find('.issues-analytics-chart');
const findEmptyState = () => wrapper.find(GlEmptyState); const findEmptyState = () => wrapper.findComponent(GlEmptyState);
it('fetches chart data when mounted', () => { it('fetches chart data when mounted', () => {
expect(store.dispatch).toHaveBeenCalledWith('issueAnalytics/fetchChartData', TEST_HOST); expect(store.dispatch).toHaveBeenCalledWith('issueAnalytics/fetchChartData', TEST_HOST);
...@@ -113,6 +113,6 @@ describe('Issue Analytics component', () => { ...@@ -113,6 +113,6 @@ describe('Issue Analytics component', () => {
}); });
it('renders the issues table', () => { it('renders the issues table', () => {
expect(wrapper.find(IssuesAnalyticsTable).exists()).toBe(true); expect(wrapper.findComponent(IssuesAnalyticsTable).exists()).toBe(true);
}); });
}); });
...@@ -54,7 +54,7 @@ describe('IssuesAnalyticsTable', () => { ...@@ -54,7 +54,7 @@ describe('IssuesAnalyticsTable', () => {
}); });
it('displays a loading icon', () => { it('displays a loading icon', () => {
expect(wrapper.find(GlLoadingIcon).exists()).toBe(true); expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(true);
}); });
it('does not display the table', () => { it('does not display the table', () => {
...@@ -64,7 +64,7 @@ describe('IssuesAnalyticsTable', () => { ...@@ -64,7 +64,7 @@ describe('IssuesAnalyticsTable', () => {
describe('fetching data completed', () => { describe('fetching data completed', () => {
it('hides the loading state', () => { it('hides the loading state', () => {
expect(wrapper.find(GlLoadingIcon).exists()).toBe(false); expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(false);
}); });
it('displays the table', () => { it('displays the table', () => {
......
...@@ -39,7 +39,7 @@ describe('Shared Runner Limit Block', () => { ...@@ -39,7 +39,7 @@ describe('Shared Runner Limit Block', () => {
}); });
it('renders call to action gl-button with the right href', () => { it('renders call to action gl-button with the right href', () => {
const glButton = wrapper.find(GlButton); const glButton = wrapper.findComponent(GlButton);
expect(glButton.isVisible()).toBe(true); expect(glButton.isVisible()).toBe(true);
expect(glButton.attributes('variant')).toBe('danger'); expect(glButton.attributes('variant')).toBe('danger');
......
...@@ -114,24 +114,24 @@ describe('Project Licenses', () => { ...@@ -114,24 +114,24 @@ describe('Project Licenses', () => {
}); });
it('shows the loading component', () => { it('shows the loading component', () => {
expect(wrapper.find(GlLoadingIcon).exists()).toBe(true); expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(true);
}); });
it('does not show the empty state component', () => { it('does not show the empty state component', () => {
expect(wrapper.find(GlEmptyState).exists()).toBe(false); expect(wrapper.findComponent(GlEmptyState).exists()).toBe(false);
}); });
it('does not show the list of detected in project licenses', () => { it('does not show the list of detected in project licenses', () => {
expect(wrapper.find(DetectedLicensesTable).exists()).toBe(false); expect(wrapper.findComponent(DetectedLicensesTable).exists()).toBe(false);
}); });
it('does not show the list of license policies', () => { it('does not show the list of license policies', () => {
expect(wrapper.find(LicenseManagement).exists()).toBe(false); expect(wrapper.findComponent(LicenseManagement).exists()).toBe(false);
}); });
it('does not render any tabs', () => { it('does not render any tabs', () => {
expect(wrapper.find(GlTabs).exists()).toBe(false); expect(wrapper.findComponent(GlTabs).exists()).toBe(false);
expect(wrapper.find(GlTab).exists()).toBe(false); expect(wrapper.findComponent(GlTab).exists()).toBe(false);
}); });
}); });
...@@ -150,24 +150,24 @@ describe('Project Licenses', () => { ...@@ -150,24 +150,24 @@ describe('Project Licenses', () => {
}); });
it('shows the empty state component', () => { it('shows the empty state component', () => {
expect(wrapper.find(GlEmptyState).exists()).toBe(true); expect(wrapper.findComponent(GlEmptyState).exists()).toBe(true);
}); });
it('does not show the loading component', () => { it('does not show the loading component', () => {
expect(wrapper.find(GlLoadingIcon).exists()).toBe(false); expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(false);
}); });
it('does not show the list of detected in project licenses', () => { it('does not show the list of detected in project licenses', () => {
expect(wrapper.find(DetectedLicensesTable).exists()).toBe(false); expect(wrapper.findComponent(DetectedLicensesTable).exists()).toBe(false);
}); });
it('does not show the list of license policies', () => { it('does not show the list of license policies', () => {
expect(wrapper.find(LicenseManagement).exists()).toBe(false); expect(wrapper.findComponent(LicenseManagement).exists()).toBe(false);
}); });
it('does not render any tabs', () => { it('does not render any tabs', () => {
expect(wrapper.find(GlTabs).exists()).toBe(false); expect(wrapper.findComponent(GlTabs).exists()).toBe(false);
expect(wrapper.find(GlTab).exists()).toBe(false); expect(wrapper.findComponent(GlTab).exists()).toBe(false);
}); });
}); });
...@@ -186,7 +186,7 @@ describe('Project Licenses', () => { ...@@ -186,7 +186,7 @@ describe('Project Licenses', () => {
}); });
it('does not render a policy violations alert', () => { it('does not render a policy violations alert', () => {
expect(wrapper.find(GlAlert).exists()).toBe(false); expect(wrapper.findComponent(GlAlert).exists()).toBe(false);
}); });
it('renders the SbomBannercomponent with the right props', () => { it('renders the SbomBannercomponent with the right props', () => {
...@@ -196,21 +196,21 @@ describe('Project Licenses', () => { ...@@ -196,21 +196,21 @@ describe('Project Licenses', () => {
}); });
it('renders a "Detected in project" tab and a "Policies" tab', () => { it('renders a "Detected in project" tab and a "Policies" tab', () => {
expect(wrapper.find(GlTabs).exists()).toBe(true); expect(wrapper.findComponent(GlTabs).exists()).toBe(true);
expect(wrapper.find(GlTab).exists()).toBe(true); expect(wrapper.findComponent(GlTab).exists()).toBe(true);
expect(wrapper.findAllComponents(GlTab)).toHaveLength(2); expect(wrapper.findAllComponents(GlTab)).toHaveLength(2);
}); });
it('it renders the "Detected in project" table', () => { it('it renders the "Detected in project" table', () => {
expect(wrapper.find(DetectedLicensesTable).exists()).toBe(true); expect(wrapper.findComponent(DetectedLicensesTable).exists()).toBe(true);
}); });
it('it renders the "Policies" table', () => { it('it renders the "Policies" table', () => {
expect(wrapper.find(LicenseManagement).exists()).toBe(true); expect(wrapper.findComponent(LicenseManagement).exists()).toBe(true);
}); });
it('renders the pipeline info', () => { it('renders the pipeline info', () => {
expect(wrapper.find(PipelineInfo).exists()).toBe(true); expect(wrapper.findComponent(PipelineInfo).exists()).toBe(true);
}); });
describe.each` describe.each`
...@@ -329,8 +329,8 @@ describe('Project Licenses', () => { ...@@ -329,8 +329,8 @@ describe('Project Licenses', () => {
}); });
it('renders a policy violations alert', () => { it('renders a policy violations alert', () => {
expect(wrapper.find(GlAlert).exists()).toBe(true); expect(wrapper.findComponent(GlAlert).exists()).toBe(true);
expect(wrapper.find(GlAlert).text()).toContain( expect(wrapper.findComponent(GlAlert).text()).toContain(
"Detected licenses that are out-of-compliance with the project's assigned policies", "Detected licenses that are out-of-compliance with the project's assigned policies",
); );
}); });
......
...@@ -24,7 +24,7 @@ describe('DetectedLicenesTable component', () => { ...@@ -24,7 +24,7 @@ describe('DetectedLicenesTable component', () => {
}; };
const expectComponentWithProps = (Component, props = {}) => { const expectComponentWithProps = (Component, props = {}) => {
const componentWrapper = wrapper.find(Component); const componentWrapper = wrapper.findComponent(Component);
expect(componentWrapper.isVisible()).toBe(true); expect(componentWrapper.isVisible()).toBe(true);
expect(componentWrapper.props()).toEqual(expect.objectContaining(props)); expect(componentWrapper.props()).toEqual(expect.objectContaining(props));
}; };
...@@ -102,7 +102,7 @@ describe('DetectedLicenesTable component', () => { ...@@ -102,7 +102,7 @@ describe('DetectedLicenesTable component', () => {
}); });
it('does not render pagination', () => { it('does not render pagination', () => {
expect(wrapper.find(Pagination).exists()).toBe(false); expect(wrapper.findComponent(Pagination).exists()).toBe(false);
}); });
}); });
}); });
...@@ -35,7 +35,7 @@ describe('LicenseComponentLinks component', () => { ...@@ -35,7 +35,7 @@ describe('LicenseComponentLinks component', () => {
// query helpers // query helpers
const findComponentsList = () => wrapper.find('.js-component-links-component-list'); const findComponentsList = () => wrapper.find('.js-component-links-component-list');
const findComponentListItems = () => wrapper.findAll('.js-component-links-component-list-item'); const findComponentListItems = () => wrapper.findAll('.js-component-links-component-list-item');
const findModal = () => wrapper.find(GlModal); const findModal = () => wrapper.findComponent(GlModal);
const findModalItem = () => wrapper.findAll('.js-component-links-modal-item'); const findModalItem = () => wrapper.findAll('.js-component-links-modal-item');
const findModalTrigger = () => wrapper.find('.js-component-links-modal-trigger'); const findModalTrigger = () => wrapper.find('.js-component-links-modal-trigger');
...@@ -55,7 +55,7 @@ describe('LicenseComponentLinks component', () => { ...@@ -55,7 +55,7 @@ describe('LicenseComponentLinks component', () => {
it('intersperses the list of licenses correctly', () => { it('intersperses the list of licenses correctly', () => {
factory(); factory();
const intersperseInstance = wrapper.find(GlIntersperse); const intersperseInstance = wrapper.findComponent(GlIntersperse);
expect(intersperseInstance.exists()).toBe(true); expect(intersperseInstance.exists()).toBe(true);
expect(intersperseInstance.attributes('lastseparator')).toBe(' and '); expect(intersperseInstance.attributes('lastseparator')).toBe(' and ');
...@@ -80,11 +80,11 @@ describe('LicenseComponentLinks component', () => { ...@@ -80,11 +80,11 @@ describe('LicenseComponentLinks component', () => {
({ numComponents, numComponentsWithUrl, expectedNumVisibleLinks, expectedNumModalLinks }) => { ({ numComponents, numComponentsWithUrl, expectedNumVisibleLinks, expectedNumModalLinks }) => {
factory({ numComponents, numComponentsWithUrl }); factory({ numComponents, numComponentsWithUrl });
expect(findComponentsList().findAll(GlLink)).toHaveLength(expectedNumVisibleLinks); expect(findComponentsList().findAllComponents(GlLink)).toHaveLength(expectedNumVisibleLinks);
// findModal() is an empty wrapper if we have less than VISIBLE_COMPONENT_COUNT // findModal() is an empty wrapper if we have less than VISIBLE_COMPONENT_COUNT
if (numComponents > VISIBLE_COMPONENT_COUNT) { if (numComponents > VISIBLE_COMPONENT_COUNT) {
expect(findModal().findAll(GlLink)).toHaveLength(expectedNumModalLinks); expect(findModal().findAllComponents(GlLink)).toHaveLength(expectedNumModalLinks);
} else { } else {
expect(findModal().exists()).toBe(false); expect(findModal().exists()).toBe(false);
} }
...@@ -94,7 +94,7 @@ describe('LicenseComponentLinks component', () => { ...@@ -94,7 +94,7 @@ describe('LicenseComponentLinks component', () => {
it('sets all links to open in new windows/tabs', () => { it('sets all links to open in new windows/tabs', () => {
factory({ numComponents: 8, numComponentsWithUrl: 8 }); factory({ numComponents: 8, numComponentsWithUrl: 8 });
const links = wrapper.findAll(GlLink); const links = wrapper.findAllComponents(GlLink);
links.wrappers.forEach((link) => { links.wrappers.forEach((link) => {
expect(link.attributes('target')).toBe('_blank'); expect(link.attributes('target')).toBe('_blank');
...@@ -128,13 +128,13 @@ describe('LicenseComponentLinks component', () => { ...@@ -128,13 +128,13 @@ describe('LicenseComponentLinks component', () => {
({ numComponents, expectedNumModals }) => { ({ numComponents, expectedNumModals }) => {
factory({ numComponents, expectedNumModals }); factory({ numComponents, expectedNumModals });
expect(wrapper.findAll(GlModal)).toHaveLength(expectedNumModals); expect(wrapper.findAllComponents(GlModal)).toHaveLength(expectedNumModals);
}, },
); );
it('opens the modal when the trigger gets clicked', () => { it('opens the modal when the trigger gets clicked', () => {
factory({ numComponents: 3 }); factory({ numComponents: 3 });
const modalId = wrapper.find(GlModal).props('modalId'); const modalId = wrapper.findComponent(GlModal).props('modalId');
const modalTrigger = findModalTrigger(); const modalTrigger = findModalTrigger();
const rootEmit = jest.spyOn(wrapper.vm.$root, '$emit'); const rootEmit = jest.spyOn(wrapper.vm.$root, '$emit');
...@@ -149,7 +149,7 @@ describe('LicenseComponentLinks component', () => { ...@@ -149,7 +149,7 @@ describe('LicenseComponentLinks component', () => {
while (usedModalIds.length < 10) { while (usedModalIds.length < 10) {
factory({ numComponents }); factory({ numComponents });
const modalId = wrapper.find(GlModal).props('modalId'); const modalId = wrapper.findComponent(GlModal).props('modalId');
expect(usedModalIds).not.toContain(modalId); expect(usedModalIds).not.toContain(modalId);
usedModalIds.push(modalId); usedModalIds.push(modalId);
...@@ -160,13 +160,13 @@ describe('LicenseComponentLinks component', () => { ...@@ -160,13 +160,13 @@ describe('LicenseComponentLinks component', () => {
const title = 'test-component'; const title = 'test-component';
factory({ numComponents: 3, title }); factory({ numComponents: 3, title });
expect(wrapper.find(GlModal).attributes('title')).toEqual(title); expect(wrapper.findComponent(GlModal).attributes('title')).toEqual(title);
}); });
it('assigns the correct action button text to the modal', () => { it('assigns the correct action button text to the modal', () => {
factory({ numComponents: 3 }); factory({ numComponents: 3 });
expect(wrapper.find(GlModal).attributes('ok-title')).toEqual('Close'); expect(wrapper.findComponent(GlModal).attributes('ok-title')).toEqual('Close');
}); });
it.each` it.each`
......
...@@ -20,7 +20,7 @@ describe('LicensesTableRow component', () => { ...@@ -20,7 +20,7 @@ describe('LicensesTableRow component', () => {
}); });
}; };
const findLoading = () => wrapper.find(GlSkeletonLoading); const findLoading = () => wrapper.findComponent(GlSkeletonLoading);
const findContent = () => wrapper.find('.js-license-row'); const findContent = () => wrapper.find('.js-license-row');
const findNameSection = () => findContent().find('.section-30'); const findNameSection = () => findContent().find('.section-30');
const findComponentSection = () => findContent().find('.section-70'); const findComponentSection = () => findContent().find('.section-70');
...@@ -66,7 +66,7 @@ describe('LicensesTableRow component', () => { ...@@ -66,7 +66,7 @@ describe('LicensesTableRow component', () => {
}); });
it('shows name', () => { it('shows name', () => {
const nameLink = findNameSection().find(GlLink); const nameLink = findNameSection().findComponent(GlLink);
expect(nameLink.exists()).toBe(true); expect(nameLink.exists()).toBe(true);
expect(nameLink.attributes('href')).toEqual(license.url); expect(nameLink.attributes('href')).toEqual(license.url);
...@@ -74,7 +74,7 @@ describe('LicensesTableRow component', () => { ...@@ -74,7 +74,7 @@ describe('LicensesTableRow component', () => {
}); });
it('shows components', () => { it('shows components', () => {
const componentLinks = findComponentSection().find(LicenseComponentLinks); const componentLinks = findComponentSection().findComponent(LicenseComponentLinks);
expect(componentLinks.exists()).toBe(true); expect(componentLinks.exists()).toBe(true);
expect(componentLinks.props()).toEqual( expect(componentLinks.props()).toEqual(
...@@ -100,9 +100,9 @@ describe('LicensesTableRow component', () => { ...@@ -100,9 +100,9 @@ describe('LicensesTableRow component', () => {
it('renders the GlFriendlyWrap and GlLink components', () => { it('renders the GlFriendlyWrap and GlLink components', () => {
const nameSection = findNameSection(); const nameSection = findNameSection();
expect(nameSection.find(GlLink).exists()).toBe(true); expect(nameSection.findComponent(GlLink).exists()).toBe(true);
expect(nameSection.find(GlFriendlyWrap).exists()).toBe(true); expect(nameSection.findComponent(GlFriendlyWrap).exists()).toBe(true);
expect(nameSection.find(GlFriendlyWrap).attributes().text).toBe(license.name); expect(nameSection.findComponent(GlFriendlyWrap).attributes().text).toBe(license.name);
}); });
}); });
...@@ -120,7 +120,7 @@ describe('LicensesTableRow component', () => { ...@@ -120,7 +120,7 @@ describe('LicensesTableRow component', () => {
const nameSection = findNameSection(); const nameSection = findNameSection();
expect(nameSection.text()).toContain(license.name); expect(nameSection.text()).toContain(license.name);
expect(nameSection.find(GlLink).exists()).toBe(false); expect(nameSection.findComponent(GlLink).exists()).toBe(false);
}); });
}); });
...@@ -135,8 +135,8 @@ describe('LicensesTableRow component', () => { ...@@ -135,8 +135,8 @@ describe('LicensesTableRow component', () => {
}); });
it('shows the policy violation badge', () => { it('shows the policy violation badge', () => {
expect(wrapper.find(GlBadge).exists()).toBe(true); expect(wrapper.findComponent(GlBadge).exists()).toBe(true);
expect(wrapper.find(GlBadge).text()).toContain('Policy violation: denied'); expect(wrapper.findComponent(GlBadge).text()).toContain('Policy violation: denied');
}); });
}); });
...@@ -151,7 +151,7 @@ describe('LicensesTableRow component', () => { ...@@ -151,7 +151,7 @@ describe('LicensesTableRow component', () => {
}); });
it('does not show the policy violation badge', () => { it('does not show the policy violation badge', () => {
expect(wrapper.find(GlBadge).exists()).toBe(false); expect(wrapper.findComponent(GlBadge).exists()).toBe(false);
}); });
}); });
}); });
...@@ -13,7 +13,7 @@ describe('LicensesTable component', () => { ...@@ -13,7 +13,7 @@ describe('LicensesTable component', () => {
}; };
const findTableRowHeader = () => wrapper.find('.table-row-header'); const findTableRowHeader = () => wrapper.find('.table-row-header');
const findRows = () => wrapper.findAll(LicensesTableRow); const findRows = () => wrapper.findAllComponents(LicensesTableRow);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
...@@ -36,10 +36,10 @@ describe('MaintenanceModeSettingsApp', () => { ...@@ -36,10 +36,10 @@ describe('MaintenanceModeSettingsApp', () => {
wrapper = null; wrapper = null;
}); });
const findMaintenanceModeSettingsForm = () => wrapper.find(GlForm); const findMaintenanceModeSettingsForm = () => wrapper.findComponent(GlForm);
const findGlLoadingIcon = () => wrapper.find(GlLoadingIcon); const findGlLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
const findGlToggle = () => wrapper.find(GlToggle); const findGlToggle = () => wrapper.findComponent(GlToggle);
const findGlFormTextarea = () => wrapper.find(GlFormTextarea); const findGlFormTextarea = () => wrapper.findComponent(GlFormTextarea);
const findSubmitButton = () => findMaintenanceModeSettingsForm().find('[type="submit"]'); const findSubmitButton = () => findMaintenanceModeSettingsForm().find('[type="submit"]');
describe('template', () => { describe('template', () => {
......
...@@ -43,7 +43,7 @@ describe('NoteHeader component', () => { ...@@ -43,7 +43,7 @@ describe('NoteHeader component', () => {
// Wait for dynamic imports to resolve // Wait for dynamic imports to resolve
return new Promise(setImmediate).then(() => { return new Promise(setImmediate).then(() => {
expect(wrapper.find(GitlabTeamMemberBadge).exists()).toBe(expected); expect(wrapper.findComponent(GitlabTeamMemberBadge).exists()).toBe(expected);
}); });
}, },
); );
......
...@@ -6,7 +6,7 @@ describe('EmptyState', () => { ...@@ -6,7 +6,7 @@ describe('EmptyState', () => {
let wrapper; let wrapper;
// Finders // Finders
const findGlEmptyState = () => wrapper.find(GlEmptyState); const findGlEmptyState = () => wrapper.findComponent(GlEmptyState);
// Helpers // Helpers
const defaultGlEmptyStateProp = (prop) => GlEmptyState.props[prop].default; const defaultGlEmptyStateProp = (prop) => GlEmptyState.props[prop].default;
......
...@@ -134,7 +134,7 @@ describe('Scheduled tab', () => { ...@@ -134,7 +134,7 @@ describe('Scheduled tab', () => {
it('renders the schedule cell', () => { it('renders the schedule cell', () => {
const scheduleCell = findCellAt(5); const scheduleCell = findCellAt(5);
const dastScanScheduleComponent = scheduleCell.find(DastScanSchedule); const dastScanScheduleComponent = scheduleCell.findComponent(DastScanSchedule);
expect(dastScanScheduleComponent.exists()).toBe(true); expect(dastScanScheduleComponent.exists()).toBe(true);
expect(dastScanScheduleComponent.props('schedule')).toEqual(firstProfile.dastProfileSchedule); expect(dastScanScheduleComponent.props('schedule')).toEqual(firstProfile.dastProfileSchedule);
......
...@@ -70,7 +70,7 @@ describe('OnDemandScansForm', () => { ...@@ -70,7 +70,7 @@ describe('OnDemandScansForm', () => {
template: '<input />', template: '<input />',
}); });
const findForm = () => wrapper.find(GlForm); const findForm = () => wrapper.findComponent(GlForm);
const findByTestId = (testId) => wrapper.find(`[data-testid="${testId}"]`); const findByTestId = (testId) => wrapper.find(`[data-testid="${testId}"]`);
const findHelpPageLink = () => findByTestId('help-page-link'); const findHelpPageLink = () => findByTestId('help-page-link');
const findNameInput = () => findByTestId('dast-scan-name-input'); const findNameInput = () => findByTestId('dast-scan-name-input');
...@@ -111,7 +111,7 @@ describe('OnDemandScansForm', () => { ...@@ -111,7 +111,7 @@ describe('OnDemandScansForm', () => {
return setValidFormData(); return setValidFormData();
}; };
const selectProfile = (component) => async (profile) => { const selectProfile = (component) => async (profile) => {
wrapper.find(component).vm.$emit('input', profile.id); wrapper.findComponent(component).vm.$emit('input', profile.id);
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
}; };
const selectScannerProfile = selectProfile(ScannerProfileSelector); const selectScannerProfile = selectProfile(ScannerProfileSelector);
...@@ -248,7 +248,7 @@ describe('OnDemandScansForm', () => { ...@@ -248,7 +248,7 @@ describe('OnDemandScansForm', () => {
}, },
}); });
expect(wrapper.find(GlSkeletonLoader).exists()).toBe(isLoading); expect(wrapper.findComponent(GlSkeletonLoader).exists()).toBe(isLoading);
}, },
); );
}); });
...@@ -577,7 +577,7 @@ describe('OnDemandScansForm', () => { ...@@ -577,7 +577,7 @@ describe('OnDemandScansForm', () => {
}); });
it('automatically selects the only available profile', () => { it('automatically selects the only available profile', () => {
expect(wrapper.find(selector).attributes('value')).toBe(profile.id); expect(wrapper.findComponent(selector).attributes('value')).toBe(profile.id);
}); });
}); });
......
...@@ -126,7 +126,7 @@ describe('EE - DAST Profiles Selector', () => { ...@@ -126,7 +126,7 @@ describe('EE - DAST Profiles Selector', () => {
}, },
}); });
expect(wrapper.find(GlSkeletonLoader).exists()).toBe(isLoading); expect(wrapper.findComponent(GlSkeletonLoader).exists()).toBe(isLoading);
}, },
); );
}); });
...@@ -179,7 +179,7 @@ describe('EE - DAST Profiles Selector', () => { ...@@ -179,7 +179,7 @@ describe('EE - DAST Profiles Selector', () => {
}); });
it('automatically selects the only available profile', () => { it('automatically selects the only available profile', () => {
expect(wrapper.find(selector).attributes('value')).toBe(profile.id); expect(wrapper.findComponent(selector).attributes('value')).toBe(profile.id);
}); });
}); });
...@@ -209,8 +209,10 @@ describe('EE - DAST Profiles Selector', () => { ...@@ -209,8 +209,10 @@ describe('EE - DAST Profiles Selector', () => {
); );
createComponent(); createComponent();
expect(wrapper.find(SiteProfileSelector).attributes('value')).toBe(siteProfile.id); expect(wrapper.findComponent(SiteProfileSelector).attributes('value')).toBe(siteProfile.id);
expect(wrapper.find(ScannerProfileSelector).attributes('value')).toBe(scannerProfile.id); expect(wrapper.findComponent(ScannerProfileSelector).attributes('value')).toBe(
scannerProfile.id,
);
}); });
}); });
}); });
...@@ -40,13 +40,13 @@ describe('OnDemandScansProfileSelector', () => { ...@@ -40,13 +40,13 @@ describe('OnDemandScansProfileSelector', () => {
// Helpers // Helpers
const parseDropdownItems = () => const parseDropdownItems = () =>
findProfilesDropdown() findProfilesDropdown()
.findAll(GlDropdownItem) .findAllComponents(GlDropdownItem)
.wrappers.map((x) => ({ .wrappers.map((x) => ({
text: x.text(), text: x.text(),
isChecked: x.props('isChecked'), isChecked: x.props('isChecked'),
})); }));
const selectFirstProfile = () => { const selectFirstProfile = () => {
return findProfilesDropdown().find(GlDropdownItem).vm.$emit('click'); return findProfilesDropdown().findComponent(GlDropdownItem).vm.$emit('click');
}; };
const createFullComponent = (options = {}) => { const createFullComponent = (options = {}) => {
......
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