Commit 51634ee0 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'find-migrate-ee-analytics' into 'master'

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

See merge request gitlab-org/gitlab!78631
parents ad30c69e dc53131d
...@@ -56,10 +56,10 @@ describe('DevopsAdoptionDeleteModal', () => { ...@@ -56,10 +56,10 @@ describe('DevopsAdoptionDeleteModal', () => {
}); });
}; };
const findModal = () => wrapper.find(GlModal); const findModal = () => wrapper.findComponent(GlModal);
const cancelButtonDisabledState = () => findModal().props('actionCancel').attributes[0].disabled; const cancelButtonDisabledState = () => findModal().props('actionCancel').attributes[0].disabled;
const actionButtonLoadingState = () => findModal().props('actionPrimary').attributes[0].loading; const actionButtonLoadingState = () => findModal().props('actionPrimary').attributes[0].loading;
const findAlert = () => findModal().find(GlAlert); const findAlert = () => findModal().findComponent(GlAlert);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
...@@ -26,7 +26,7 @@ describe('DevopsAdoptionEmptyState', () => { ...@@ -26,7 +26,7 @@ describe('DevopsAdoptionEmptyState', () => {
}); });
}; };
const findEmptyState = () => wrapper.find(GlEmptyState); const findEmptyState = () => wrapper.findComponent(GlEmptyState);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
...@@ -42,15 +42,16 @@ describe('DevopsAdoptionOverviewTable', () => { ...@@ -42,15 +42,16 @@ describe('DevopsAdoptionOverviewTable', () => {
const findCol = (testId) => wrapper.findByTestId(testId); const findCol = (testId) => wrapper.findByTestId(testId);
const findColRowChild = (col, row, child) => wrapper.findAllByTestId(col).at(row).find(child); const findColRowChild = (col, row, child) =>
wrapper.findAllByTestId(col).at(row).findComponent(child);
const findColSubComponent = (colTestId, childComponent) => const findColSubComponent = (colTestId, childComponent) =>
findCol(colTestId).find(childComponent); findCol(colTestId).findComponent(childComponent);
const findDeleteModal = () => wrapper.findComponent(DevopsAdoptionDeleteModal); const findDeleteModal = () => wrapper.findComponent(DevopsAdoptionDeleteModal);
const findSortByLocalStorageSync = () => wrapper.findAll(LocalStorageSync).at(0); const findSortByLocalStorageSync = () => wrapper.findAllComponents(LocalStorageSync).at(0);
const findSortDescLocalStorageSync = () => wrapper.findAll(LocalStorageSync).at(1); const findSortDescLocalStorageSync = () => wrapper.findAllComponents(LocalStorageSync).at(1);
describe('table headings', () => { describe('table headings', () => {
beforeEach(() => { beforeEach(() => {
......
...@@ -39,20 +39,20 @@ describe('DevopsAdoptionTable', () => { ...@@ -39,20 +39,20 @@ describe('DevopsAdoptionTable', () => {
wrapper.destroy(); wrapper.destroy();
}); });
const findTable = () => wrapper.find(GlTable); const findTable = () => wrapper.findComponent(GlTable);
const findCol = (testId) => findTable().find(`[data-testid="${testId}"]`); const findCol = (testId) => findTable().find(`[data-testid="${testId}"]`);
const findColRowChild = (col, row, child) => const findColRowChild = (col, row, child) =>
findTable().findAll(`[data-testid="${col}"]`).at(row).find(child); findTable().findAll(`[data-testid="${col}"]`).at(row).findComponent(child);
const findColSubComponent = (colTestId, childComponent) => const findColSubComponent = (colTestId, childComponent) =>
findCol(colTestId).find(childComponent); findCol(colTestId).findComponent(childComponent);
const findSortByLocalStorageSync = () => wrapper.findAll(LocalStorageSync).at(0); const findSortByLocalStorageSync = () => wrapper.findAllComponents(LocalStorageSync).at(0);
const findSortDescLocalStorageSync = () => wrapper.findAll(LocalStorageSync).at(1); const findSortDescLocalStorageSync = () => wrapper.findAllComponents(LocalStorageSync).at(1);
const findDeleteModal = () => wrapper.find(DevopsAdoptionDeleteModal); const findDeleteModal = () => wrapper.findComponent(DevopsAdoptionDeleteModal);
describe('table headings', () => { describe('table headings', () => {
let headers; let headers;
...@@ -83,12 +83,12 @@ describe('DevopsAdoptionTable', () => { ...@@ -83,12 +83,12 @@ describe('DevopsAdoptionTable', () => {
const expected = Boolean(tooltipText); const expected = Boolean(tooltipText);
it(`${expected ? 'displays' : "doesn't display"} an information icon`, () => { it(`${expected ? 'displays' : "doesn't display"} an information icon`, () => {
expect(headerWrapper.find(GlIcon).exists()).toBe(expected); expect(headerWrapper.findComponent(GlIcon).exists()).toBe(expected);
}); });
if (expected) { if (expected) {
it('includes a tooltip', () => { it('includes a tooltip', () => {
const icon = headerWrapper.find(GlIcon); const icon = headerWrapper.findComponent(GlIcon);
const tooltip = getBinding(icon.element, 'gl-tooltip'); const tooltip = getBinding(icon.element, 'gl-tooltip');
expect(tooltip).toBeDefined(); expect(tooltip).toBeDefined();
......
...@@ -27,7 +27,7 @@ describe('Release stats card', () => { ...@@ -27,7 +27,7 @@ describe('Release stats card', () => {
wrapper = null; wrapper = null;
}); });
const findLoadingIndicators = () => wrapper.findAll(GlSkeletonLoader); const findLoadingIndicators = () => wrapper.findAllComponents(GlSkeletonLoader);
const findStats = () => wrapper.find('[data-testid="stats-container"]'); const findStats = () => wrapper.find('[data-testid="stats-container"]');
const expectLoadingIndicators = () => { const expectLoadingIndicators = () => {
......
...@@ -53,7 +53,7 @@ describe('Shared runner usage tab', () => { ...@@ -53,7 +53,7 @@ describe('Shared runner usage tab', () => {
wrapper.destroy(); wrapper.destroy();
}); });
const findAreaChart = () => wrapper.find(GlAreaChart); const findAreaChart = () => wrapper.findComponent(GlAreaChart);
describe('when the data has successfully loaded', () => { describe('when the data has successfully loaded', () => {
beforeEach(() => { beforeEach(() => {
......
...@@ -34,28 +34,28 @@ describe('MergeRequestAnalyticsApp', () => { ...@@ -34,28 +34,28 @@ describe('MergeRequestAnalyticsApp', () => {
}); });
it('displays the filter bar component', () => { it('displays the filter bar component', () => {
expect(wrapper.find(FilterBar).exists()).toBe(true); expect(wrapper.findComponent(FilterBar).exists()).toBe(true);
}); });
it('displays the date range component', () => { it('displays the date range component', () => {
expect(wrapper.find(DateRange).exists()).toBe(true); expect(wrapper.findComponent(DateRange).exists()).toBe(true);
}); });
it('displays the throughput chart component', () => { it('displays the throughput chart component', () => {
expect(wrapper.find(ThroughputChart).exists()).toBe(true); expect(wrapper.findComponent(ThroughputChart).exists()).toBe(true);
}); });
it('displays the throughput table component', () => { it('displays the throughput table component', () => {
expect(wrapper.find(ThroughputTable).exists()).toBe(true); expect(wrapper.findComponent(ThroughputTable).exists()).toBe(true);
}); });
describe('url sync', () => { describe('url sync', () => {
it('includes the url sync component', () => { it('includes the url sync component', () => {
expect(wrapper.find(UrlSync).exists()).toBe(true); expect(wrapper.findComponent(UrlSync).exists()).toBe(true);
}); });
it('has the start and end date params', () => { it('has the start and end date params', () => {
const urlSync = wrapper.find(UrlSync); const urlSync = wrapper.findComponent(UrlSync);
expect(urlSync.props('query')).toMatchObject({ expect(urlSync.props('query')).toMatchObject({
start_date: '2020-05-01', start_date: '2020-05-01',
......
...@@ -123,7 +123,7 @@ describe('Filter bar', () => { ...@@ -123,7 +123,7 @@ describe('Filter bar', () => {
mock.restore(); mock.restore();
}); });
const findFilteredSearch = () => wrapper.find(FilteredSearchBar); const findFilteredSearch = () => wrapper.findComponent(FilteredSearchBar);
const getSearchToken = (type) => const getSearchToken = (type) =>
findFilteredSearch() findFilteredSearch()
.props('tokens') .props('tokens')
......
...@@ -37,7 +37,7 @@ describe('ThroughputChart', () => { ...@@ -37,7 +37,7 @@ describe('ThroughputChart', () => {
let wrapper; let wrapper;
function displaysComponent(component, visible) { function displaysComponent(component, visible) {
const element = wrapper.find(component); const element = wrapper.findComponent(component);
expect(element.exists()).toBe(visible); expect(element.exists()).toBe(visible);
} }
...@@ -68,7 +68,7 @@ describe('ThroughputChart', () => { ...@@ -68,7 +68,7 @@ describe('ThroughputChart', () => {
}); });
it('displays the throughput stats component', () => { it('displays the throughput stats component', () => {
expect(wrapper.find(ThroughputStats).exists()).toBe(true); expect(wrapper.findComponent(ThroughputStats).exists()).toBe(true);
}); });
it('displays the chart title', () => { it('displays the chart title', () => {
...@@ -84,7 +84,7 @@ describe('ThroughputChart', () => { ...@@ -84,7 +84,7 @@ describe('ThroughputChart', () => {
}); });
it('displays an empty state message when there is no data', () => { it('displays an empty state message when there is no data', () => {
const alert = wrapper.find(GlAlert); const alert = wrapper.findComponent(GlAlert);
expect(alert.exists()).toBe(true); expect(alert.exists()).toBe(true);
expect(alert.text()).toBe(THROUGHPUT_CHART_STRINGS.NO_DATA); expect(alert.text()).toBe(THROUGHPUT_CHART_STRINGS.NO_DATA);
...@@ -163,7 +163,7 @@ describe('ThroughputChart', () => { ...@@ -163,7 +163,7 @@ describe('ThroughputChart', () => {
}); });
it('displays an empty state message when there is no data', () => { it('displays an empty state message when there is no data', () => {
const alert = wrapper.find(GlAlert); const alert = wrapper.findComponent(GlAlert);
expect(alert.exists()).toBe(true); expect(alert.exists()).toBe(true);
expect(alert.text()).toBe(THROUGHPUT_CHART_STRINGS.NO_DATA); expect(alert.text()).toBe(THROUGHPUT_CHART_STRINGS.NO_DATA);
...@@ -187,7 +187,7 @@ describe('ThroughputChart', () => { ...@@ -187,7 +187,7 @@ describe('ThroughputChart', () => {
}); });
it('displays an error message', () => { it('displays an error message', () => {
const alert = wrapper.find(GlAlert); const alert = wrapper.findComponent(GlAlert);
expect(alert.exists()).toBe(true); expect(alert.exists()).toBe(true);
expect(alert.text()).toBe(THROUGHPUT_CHART_STRINGS.ERROR_FETCHING_DATA); expect(alert.text()).toBe(THROUGHPUT_CHART_STRINGS.ERROR_FETCHING_DATA);
......
...@@ -60,7 +60,7 @@ describe('ThroughputTable', () => { ...@@ -60,7 +60,7 @@ describe('ThroughputTable', () => {
} }
const displaysComponent = (component, visible) => { const displaysComponent = (component, visible) => {
expect(wrapper.find(component).exists()).toBe(visible); expect(wrapper.findComponent(component).exists()).toBe(visible);
}; };
const additionalData = (data) => { const additionalData = (data) => {
...@@ -74,7 +74,7 @@ describe('ThroughputTable', () => { ...@@ -74,7 +74,7 @@ describe('ThroughputTable', () => {
}); });
}; };
const findTable = () => wrapper.find(GlTableLite); const findTable = () => wrapper.findComponent(GlTableLite);
const findCol = (testId) => findTable().find(`[data-testid="${testId}"]`); const findCol = (testId) => findTable().find(`[data-testid="${testId}"]`);
...@@ -82,9 +82,9 @@ describe('ThroughputTable', () => { ...@@ -82,9 +82,9 @@ describe('ThroughputTable', () => {
findCol(colTestId).find(`[data-testid="${childTetestId}"]`); findCol(colTestId).find(`[data-testid="${childTetestId}"]`);
const findColSubComponent = (colTestId, childComponent) => const findColSubComponent = (colTestId, childComponent) =>
findCol(colTestId).find(childComponent); findCol(colTestId).findComponent(childComponent);
const findPagination = () => wrapper.find(GlPagination); const findPagination = () => wrapper.findComponent(GlPagination);
const findPrevious = () => findPagination().findAll('.page-item').at(0); const findPrevious = () => findPagination().findAll('.page-item').at(0);
...@@ -101,7 +101,7 @@ describe('ThroughputTable', () => { ...@@ -101,7 +101,7 @@ describe('ThroughputTable', () => {
}); });
it('displays an empty state message when there is no data', () => { it('displays an empty state message when there is no data', () => {
const alert = wrapper.find(GlAlert); const alert = wrapper.findComponent(GlAlert);
expect(alert.exists()).toBe(true); expect(alert.exists()).toBe(true);
expect(alert.text()).toBe(THROUGHPUT_TABLE_STRINGS.NO_DATA); expect(alert.text()).toBe(THROUGHPUT_TABLE_STRINGS.NO_DATA);
...@@ -195,7 +195,7 @@ describe('ThroughputTable', () => { ...@@ -195,7 +195,7 @@ describe('ThroughputTable', () => {
it('includes an inactive label icon by default', () => { it('includes an inactive label icon by default', () => {
const labels = findColSubItem(TEST_IDS.MERGE_REQUEST_DETAILS, TEST_IDS.LABEL_DETAILS); const labels = findColSubItem(TEST_IDS.MERGE_REQUEST_DETAILS, TEST_IDS.LABEL_DETAILS);
const icon = labels.find(GlIcon); const icon = labels.findComponent(GlIcon);
expect(labels.text()).toBe('0'); expect(labels.text()).toBe('0');
expect(labels.classes()).toContain('gl-opacity-5'); expect(labels.classes()).toContain('gl-opacity-5');
...@@ -208,7 +208,7 @@ describe('ThroughputTable', () => { ...@@ -208,7 +208,7 @@ describe('ThroughputTable', () => {
TEST_IDS.MERGE_REQUEST_DETAILS, TEST_IDS.MERGE_REQUEST_DETAILS,
TEST_IDS.COMMENT_COUNT, TEST_IDS.COMMENT_COUNT,
); );
const icon = commentCount.find(GlIcon); const icon = commentCount.findComponent(GlIcon);
expect(commentCount.text()).toBe('0'); expect(commentCount.text()).toBe('0');
expect(commentCount.classes()).toContain('gl-opacity-5'); expect(commentCount.classes()).toContain('gl-opacity-5');
...@@ -229,7 +229,7 @@ describe('ThroughputTable', () => { ...@@ -229,7 +229,7 @@ describe('ThroughputTable', () => {
TEST_IDS.MERGE_REQUEST_DETAILS, TEST_IDS.MERGE_REQUEST_DETAILS,
TEST_IDS.LABEL_DETAILS, TEST_IDS.LABEL_DETAILS,
); );
const icon = labelDetails.find(GlIcon); const icon = labelDetails.findComponent(GlIcon);
expect(labelDetails.text()).toBe('1'); expect(labelDetails.text()).toBe('1');
expect(labelDetails.classes()).not.toContain('gl-opacity-5'); expect(labelDetails.classes()).not.toContain('gl-opacity-5');
...@@ -248,7 +248,7 @@ describe('ThroughputTable', () => { ...@@ -248,7 +248,7 @@ describe('ThroughputTable', () => {
TEST_IDS.MERGE_REQUEST_DETAILS, TEST_IDS.MERGE_REQUEST_DETAILS,
TEST_IDS.COMMENT_COUNT, TEST_IDS.COMMENT_COUNT,
); );
const icon = commentCount.find(GlIcon); const icon = commentCount.findComponent(GlIcon);
expect(commentCount.text()).toBe('2'); expect(commentCount.text()).toBe('2');
expect(commentCount.classes()).not.toContain('gl-opacity-5'); expect(commentCount.classes()).not.toContain('gl-opacity-5');
...@@ -273,7 +273,7 @@ describe('ThroughputTable', () => { ...@@ -273,7 +273,7 @@ describe('ThroughputTable', () => {
const icon = findColSubComponent(TEST_IDS.MERGE_REQUEST_DETAILS, GlIcon); const icon = findColSubComponent(TEST_IDS.MERGE_REQUEST_DETAILS, GlIcon);
expect(icon.find(GlIcon).exists()).toBe(true); expect(icon.findComponent(GlIcon).exists()).toBe(true);
expect(icon.props('name')).toBe(iconName); expect(icon.props('name')).toBe(iconName);
}); });
...@@ -300,7 +300,7 @@ describe('ThroughputTable', () => { ...@@ -300,7 +300,7 @@ describe('ThroughputTable', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
const approved = findColSubItem(TEST_IDS.MERGE_REQUEST_DETAILS, TEST_IDS.APPROVED); const approved = findColSubItem(TEST_IDS.MERGE_REQUEST_DETAILS, TEST_IDS.APPROVED);
const icon = approved.find(GlIcon); const icon = approved.findComponent(GlIcon);
expect(approved.text()).toBe('1 Approval'); expect(approved.text()).toBe('1 Approval');
expect(icon.exists()).toBe(true); expect(icon.exists()).toBe(true);
...@@ -324,7 +324,7 @@ describe('ThroughputTable', () => { ...@@ -324,7 +324,7 @@ describe('ThroughputTable', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
const approved = findColSubItem(TEST_IDS.MERGE_REQUEST_DETAILS, TEST_IDS.APPROVED); const approved = findColSubItem(TEST_IDS.MERGE_REQUEST_DETAILS, TEST_IDS.APPROVED);
const icon = approved.find(GlIcon); const icon = approved.findComponent(GlIcon);
expect(approved.text()).toBe('2 Approvals'); expect(approved.text()).toBe('2 Approvals');
expect(icon.exists()).toBe(true); expect(icon.exists()).toBe(true);
...@@ -455,7 +455,7 @@ describe('ThroughputTable', () => { ...@@ -455,7 +455,7 @@ describe('ThroughputTable', () => {
}); });
it('displays an error message', () => { it('displays an error message', () => {
const alert = wrapper.find(GlAlert); const alert = wrapper.findComponent(GlAlert);
expect(alert.exists()).toBe(true); expect(alert.exists()).toBe(true);
expect(alert.text()).toBe(THROUGHPUT_TABLE_STRINGS.ERROR_FETCHING_DATA); expect(alert.text()).toBe(THROUGHPUT_TABLE_STRINGS.ERROR_FETCHING_DATA);
......
...@@ -97,23 +97,23 @@ describe('ProductivityApp component', () => { ...@@ -97,23 +97,23 @@ describe('ProductivityApp component', () => {
mock.restore(); mock.restore();
}); });
const findMainMetricChart = () => wrapper.find({ ref: 'mainChart' }); const findMainMetricChart = () => wrapper.findComponent({ ref: 'mainChart' });
const findClearFilterButton = () => wrapper.find({ ref: 'clearChartFiltersBtn' }); const findClearFilterButton = () => wrapper.findComponent({ ref: 'clearChartFiltersBtn' });
const findSecondaryChartsSection = () => wrapper.find({ ref: 'secondaryCharts' }); const findSecondaryChartsSection = () => wrapper.findComponent({ ref: 'secondaryCharts' });
const findTimeBasedMetricChart = () => wrapper.find({ ref: 'timeBasedChart' }); const findTimeBasedMetricChart = () => wrapper.findComponent({ ref: 'timeBasedChart' });
const findCommitBasedMetricChart = () => wrapper.find({ ref: 'commitBasedChart' }); const findCommitBasedMetricChart = () => wrapper.findComponent({ ref: 'commitBasedChart' });
const findScatterplotMetricChart = () => wrapper.find({ ref: 'scatterplot' }); const findScatterplotMetricChart = () => wrapper.findComponent({ ref: 'scatterplot' });
const findMrTableSortSection = () => wrapper.find('.js-mr-table-sort'); const findMrTableSortSection = () => wrapper.find('.js-mr-table-sort');
const findSortFieldDropdown = () => findMrTableSortSection().find(GlDropdown); const findSortFieldDropdown = () => findMrTableSortSection().findComponent(GlDropdown);
const findSortOrderToggle = () => findMrTableSortSection().find(GlButton); const findSortOrderToggle = () => findMrTableSortSection().findComponent(GlButton);
const findMrTableSection = () => wrapper.find('.js-mr-table'); const findMrTableSection = () => wrapper.find('.js-mr-table');
const findMrTable = () => findMrTableSection().find(MergeRequestTable); const findMrTable = () => findMrTableSection().findComponent(MergeRequestTable);
describe('template', () => { describe('template', () => {
describe('without a group being selected', () => { describe('without a group being selected', () => {
it('renders the empty state illustration', () => { it('renders the empty state illustration', () => {
createComponent(); createComponent();
const emptyState = wrapper.find(GlEmptyState); const emptyState = wrapper.findComponent(GlEmptyState);
expect(emptyState.exists()).toBe(true); expect(emptyState.exists()).toBe(true);
expect(emptyState.props('svgPath')).toBe(propsData.emptyStateSvgPath); expect(emptyState.props('svgPath')).toBe(propsData.emptyStateSvgPath);
...@@ -145,7 +145,7 @@ describe('ProductivityApp component', () => { ...@@ -145,7 +145,7 @@ describe('ProductivityApp component', () => {
}); });
it('renders the no access illustration', () => { it('renders the no access illustration', () => {
const emptyState = wrapper.find(GlEmptyState); const emptyState = wrapper.findComponent(GlEmptyState);
expect(emptyState.exists()).toBe(true); expect(emptyState.exists()).toBe(true);
expect(emptyState.props('svgPath')).toBe(propsData.noAccessSvgPath); expect(emptyState.props('svgPath')).toBe(propsData.noAccessSvgPath);
...@@ -214,7 +214,9 @@ describe('ProductivityApp component', () => { ...@@ -214,7 +214,9 @@ describe('ProductivityApp component', () => {
}, },
}; };
findMainMetricChart().find(GlColumnChart).vm.$emit('chartItemClicked', data); findMainMetricChart()
.findComponent(GlColumnChart)
.vm.$emit('chartItemClicked', data);
}); });
it('dispatches updateSelectedItems action', () => { it('dispatches updateSelectedItems action', () => {
...@@ -317,7 +319,7 @@ describe('ProductivityApp component', () => { ...@@ -317,7 +319,7 @@ describe('ProductivityApp component', () => {
}); });
it("should update the chart's x axis label", () => { it("should update the chart's x axis label", () => {
const columnChart = findCommitBasedMetricChart().find(GlColumnChart); const columnChart = findCommitBasedMetricChart().findComponent(GlColumnChart);
expect(columnChart.props('xAxisTitle')).toBe('Number of LOCs per commit'); expect(columnChart.props('xAxisTitle')).toBe('Number of LOCs per commit');
}); });
}); });
...@@ -369,7 +371,7 @@ describe('ProductivityApp component', () => { ...@@ -369,7 +371,7 @@ describe('ProductivityApp component', () => {
}); });
it("should update the chart's y axis label", () => { it("should update the chart's y axis label", () => {
const scatterplot = findScatterplotMetricChart().find(Scatterplot); const scatterplot = findScatterplotMetricChart().findComponent(Scatterplot);
expect(scatterplot.props('yAxisTitle')).toBe('Number of LOCs per commit'); expect(scatterplot.props('yAxisTitle')).toBe('Number of LOCs per commit');
}); });
}); });
...@@ -384,7 +386,7 @@ describe('ProductivityApp component', () => { ...@@ -384,7 +386,7 @@ describe('ProductivityApp component', () => {
}); });
it('renders a loading indicator', () => { it('renders a loading indicator', () => {
expect(findMrTableSection().find(GlLoadingIcon).exists()).toBe(true); expect(findMrTableSection().findComponent(GlLoadingIcon).exists()).toBe(true);
}); });
}); });
...@@ -402,7 +404,7 @@ describe('ProductivityApp component', () => { ...@@ -402,7 +404,7 @@ describe('ProductivityApp component', () => {
}); });
it('doesn’t render a "no data" message', () => { it('doesn’t render a "no data" message', () => {
expect(findMrTableSection().find(GlAlert).exists()).toBe(false); expect(findMrTableSection().findComponent(GlAlert).exists()).toBe(false);
}); });
it('should change the column metric', async () => { it('should change the column metric', async () => {
...@@ -425,7 +427,10 @@ describe('ProductivityApp component', () => { ...@@ -425,7 +427,10 @@ describe('ProductivityApp component', () => {
}); });
it('should change the sort field', () => { it('should change the sort field', () => {
findSortFieldDropdown().findAll(GlDropdownItem).at(0).vm.$emit('click'); findSortFieldDropdown()
.findAllComponents(GlDropdownItem)
.at(0)
.vm.$emit('click');
expect(tableActionSpies.setSortField).toHaveBeenCalled(); expect(tableActionSpies.setSortField).toHaveBeenCalled();
}); });
...@@ -446,7 +451,7 @@ describe('ProductivityApp component', () => { ...@@ -446,7 +451,7 @@ describe('ProductivityApp component', () => {
}); });
it('renders a "no data" message', () => { it('renders a "no data" message', () => {
expect(findMrTableSection().find(GlAlert).exists()).toBe(true); expect(findMrTableSection().findComponent(GlAlert).exists()).toBe(true);
}); });
it('doesn`t render the MR table', () => { it('doesn`t render the MR table', () => {
......
...@@ -55,7 +55,7 @@ describe('FilterDropdowns component', () => { ...@@ -55,7 +55,7 @@ describe('FilterDropdowns component', () => {
describe('template', () => { describe('template', () => {
it('renders the groups dropdown', () => { it('renders the groups dropdown', () => {
expect(wrapper.find(GroupsDropdownFilter).exists()).toBe(true); expect(wrapper.findComponent(GroupsDropdownFilter).exists()).toBe(true);
}); });
describe('without a group selected', () => { describe('without a group selected', () => {
...@@ -64,7 +64,7 @@ describe('FilterDropdowns component', () => { ...@@ -64,7 +64,7 @@ describe('FilterDropdowns component', () => {
}); });
it('does not render the projects dropdown', () => { it('does not render the projects dropdown', () => {
expect(wrapper.find(ProjectsDropdownFilter).exists()).toBe(false); expect(wrapper.findComponent(ProjectsDropdownFilter).exists()).toBe(false);
}); });
}); });
...@@ -75,7 +75,7 @@ describe('FilterDropdowns component', () => { ...@@ -75,7 +75,7 @@ describe('FilterDropdowns component', () => {
}); });
it('renders the projects dropdown', () => { it('renders the projects dropdown', () => {
expect(wrapper.find(ProjectsDropdownFilter).exists()).toBe(true); expect(wrapper.findComponent(ProjectsDropdownFilter).exists()).toBe(true);
}); });
}); });
}); });
......
...@@ -36,11 +36,11 @@ describe('MetricChart component', () => { ...@@ -36,11 +36,11 @@ describe('MetricChart component', () => {
wrapper.destroy(); wrapper.destroy();
}); });
const findLoadingIndicator = () => wrapper.find(GlLoadingIcon); const findLoadingIndicator = () => wrapper.findComponent(GlLoadingIcon);
const findInfoMessage = () => wrapper.find(GlAlert); const findInfoMessage = () => wrapper.findComponent(GlAlert);
const findMetricDropdown = () => wrapper.find(GlDropdown); const findMetricDropdown = () => wrapper.findComponent(GlDropdown);
const findMetricDropdownItems = () => findMetricDropdown().findAll(GlDropdownItem); const findMetricDropdownItems = () => findMetricDropdown().findAllComponents(GlDropdownItem);
const findChartSlot = () => wrapper.find({ ref: 'chart' }); const findChartSlot = () => wrapper.findComponent({ ref: 'chart' });
describe('template', () => { describe('template', () => {
describe('when title exists', () => { describe('when title exists', () => {
...@@ -149,7 +149,9 @@ describe('MetricChart component', () => { ...@@ -149,7 +149,9 @@ describe('MetricChart component', () => {
wrapper.setProps({ selectedMetric: 'time_to_last_commit' }); wrapper.setProps({ selectedMetric: 'time_to_last_commit' });
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(findMetricDropdownItems().at(0).find(GlIcon).classes()).toContain('invisible'); expect(findMetricDropdownItems().at(0).findComponent(GlIcon).classes()).toContain(
'invisible',
);
}); });
}); });
}); });
......
...@@ -21,7 +21,7 @@ describe('MergeRequestTableRow component', () => { ...@@ -21,7 +21,7 @@ describe('MergeRequestTableRow component', () => {
const findMrDetails = () => wrapper.find('.js-mr-details'); const findMrDetails = () => wrapper.find('.js-mr-details');
const findMrMetrics = () => wrapper.find('.js-mr-metrics'); const findMrMetrics = () => wrapper.find('.js-mr-metrics');
const findMetricColumns = () => findMrMetrics().findAll(MetricColumn); const findMetricColumns = () => findMrMetrics().findAllComponents(MetricColumn);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -43,7 +43,7 @@ describe('MergeRequestTableRow component', () => { ...@@ -43,7 +43,7 @@ describe('MergeRequestTableRow component', () => {
}); });
it('renders the avatar with correct URL', () => { it('renders the avatar with correct URL', () => {
const avatar = wrapper.find(GlAvatar); const avatar = wrapper.findComponent(GlAvatar);
expect(avatar.exists()).toBe(true); expect(avatar.exists()).toBe(true);
expect(avatar.props('src')).toEqual(defaultProps.mergeRequest.author_avatar_url); expect(avatar.props('src')).toEqual(defaultProps.mergeRequest.author_avatar_url);
...@@ -72,7 +72,7 @@ describe('MergeRequestTableRow component', () => { ...@@ -72,7 +72,7 @@ describe('MergeRequestTableRow component', () => {
}, },
}; };
factory(props); factory(props);
expect(wrapper.find({ ref: selector }).exists()).toBe(false); expect(wrapper.findComponent({ ref: selector }).exists()).toBe(false);
}); });
}); });
......
...@@ -25,10 +25,10 @@ describe('MergeRequestTable component', () => { ...@@ -25,10 +25,10 @@ describe('MergeRequestTable component', () => {
}); });
}; };
const findMergeRequestTableRows = () => wrapper.findAll(MergeRequestTableRow); const findMergeRequestTableRows = () => wrapper.findAllComponents(MergeRequestTableRow);
const findTableHeader = () => wrapper.find('.table-row-header'); const findTableHeader = () => wrapper.find('.table-row-header');
const findDropdown = () => wrapper.find(GlDropdown); const findDropdown = () => wrapper.findComponent(GlDropdown);
const findDropdownItems = () => wrapper.findAll(GlDropdownItem); const findDropdownItems = () => wrapper.findAllComponents(GlDropdownItem);
const findFirstDropdownItem = () => findDropdownItems().at(0); const findFirstDropdownItem = () => findDropdownItems().at(0);
beforeEach(() => { beforeEach(() => {
......
...@@ -17,7 +17,7 @@ describe('Download test coverage component', () => { ...@@ -17,7 +17,7 @@ describe('Download test coverage component', () => {
wrapper wrapper
.find('[data-testid="group-code-coverage-select-all-projects-button"]') .find('[data-testid="group-code-coverage-select-all-projects-button"]')
.vm.$emit('click'); .vm.$emit('click');
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.findComponent(GlAlert);
const injectedProperties = { const injectedProperties = {
groupAnalyticsCoverageReportsPath: '/coverage.csv', groupAnalyticsCoverageReportsPath: '/coverage.csv',
......
...@@ -31,7 +31,7 @@ describe('Group repository analytics app', () => { ...@@ -31,7 +31,7 @@ describe('Group repository analytics app', () => {
}); });
it('renders the download test coverage component', () => { it('renders the download test coverage component', () => {
expect(wrapper.find(DownloadTestCoverage).exists()).toBe(true); expect(wrapper.findComponent(DownloadTestCoverage).exists()).toBe(true);
}); });
}); });
......
...@@ -15,8 +15,8 @@ describe('Select projects dropdown component', () => { ...@@ -15,8 +15,8 @@ describe('Select projects dropdown component', () => {
const findProjectById = (id) => wrapper.find(`[data-testid="select-project-${id}"]`); const findProjectById = (id) => wrapper.find(`[data-testid="select-project-${id}"]`);
const selectAllProjects = () => findSelectAllProjects().trigger('click'); const selectAllProjects = () => findSelectAllProjects().trigger('click');
const selectProjectById = (id) => findProjectById(id).trigger('click'); const selectProjectById = (id) => findProjectById(id).trigger('click');
const findIntersectionObserver = () => wrapper.find(GlIntersectionObserver); const findIntersectionObserver = () => wrapper.findComponent(GlIntersectionObserver);
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
const createComponent = ({ data = {}, apolloGroupProjects = {} } = {}) => { const createComponent = ({ data = {}, apolloGroupProjects = {} } = {}) => {
wrapper = shallowMount(SelectProjectsDropdown, { wrapper = shallowMount(SelectProjectsDropdown, {
...@@ -66,9 +66,9 @@ describe('Select projects dropdown component', () => { ...@@ -66,9 +66,9 @@ describe('Select projects dropdown component', () => {
selectAllProjects(); selectAllProjects();
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(findProjectById(initialData.groupProjects[0].id).find(GlIcon).classes()).toContain( expect(
'gl-visibility-hidden', findProjectById(initialData.groupProjects[0].id).findComponent(GlIcon).classes(),
); ).toContain('gl-visibility-hidden');
}); });
}); });
...@@ -99,7 +99,7 @@ describe('Select projects dropdown component', () => { ...@@ -99,7 +99,7 @@ describe('Select projects dropdown component', () => {
selectProjectById(project.id); selectProjectById(project.id);
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(findProjectById(project.id).find(GlIcon).classes()).not.toContain( expect(findProjectById(project.id).findComponent(GlIcon).classes()).not.toContain(
'gl-visibility-hidden', 'gl-visibility-hidden',
); );
}); });
...@@ -109,7 +109,9 @@ describe('Select projects dropdown component', () => { ...@@ -109,7 +109,9 @@ describe('Select projects dropdown component', () => {
selectProjectById(initialData.groupProjects[0].id); selectProjectById(initialData.groupProjects[0].id);
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(findSelectAllProjects().find(GlIcon).classes()).toContain('gl-visibility-hidden'); expect(findSelectAllProjects().findComponent(GlIcon).classes()).toContain(
'gl-visibility-hidden',
);
}); });
}); });
......
...@@ -14,7 +14,7 @@ describe('Test coverage table component', () => { ...@@ -14,7 +14,7 @@ describe('Test coverage table component', () => {
const findGroupCoverageChart = () => wrapper.findByTestId('group-coverage-chart'); const findGroupCoverageChart = () => wrapper.findByTestId('group-coverage-chart');
const findChartLoadingState = () => wrapper.findByTestId('group-coverage-chart-loading'); const findChartLoadingState = () => wrapper.findByTestId('group-coverage-chart-loading');
const findChartEmptyState = () => wrapper.findByTestId('group-coverage-chart-empty'); const findChartEmptyState = () => wrapper.findByTestId('group-coverage-chart-empty');
const findLoadingState = () => wrapper.find(GlSkeletonLoading); const findLoadingState = () => wrapper.findComponent(GlSkeletonLoading);
const createComponent = ({ data = {} } = {}) => { const createComponent = ({ data = {} } = {}) => {
wrapper = extendedWrapper( wrapper = extendedWrapper(
......
...@@ -42,11 +42,11 @@ describe('GroupsDropdownFilter component', () => { ...@@ -42,11 +42,11 @@ describe('GroupsDropdownFilter component', () => {
Api.groups.mockImplementation(() => Promise.resolve(groups)); Api.groups.mockImplementation(() => Promise.resolve(groups));
}); });
const findDropdown = () => wrapper.find(GlDropdown); const findDropdown = () => wrapper.findComponent(GlDropdown);
const findDropdownItems = () => const findDropdownItems = () =>
findDropdown() findDropdown()
.findAll(GlDropdownItem) .findAllComponents(GlDropdownItem)
.filter((w) => w.text() !== 'No matching results'); .filter((w) => w.text() !== 'No matching results');
const findDropdownAtIndex = (index) => findDropdownItems().at(index); const findDropdownAtIndex = (index) => findDropdownItems().at(index);
......
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