Commit 9808fa09 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'find-migrate-ee-misc-v5' into 'master'

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

See merge request gitlab-org/gitlab!78654
parents 4b423994 1406ac58
...@@ -41,7 +41,7 @@ describe('LockButton component', () => { ...@@ -41,7 +41,7 @@ describe('LockButton component', () => {
describe('lock button', () => { describe('lock button', () => {
let lockMutationMock; let lockMutationMock;
const mockEvent = { preventDefault: jest.fn() }; const mockEvent = { preventDefault: jest.fn() };
const findLockButton = () => wrapper.find(GlButton); const findLockButton = () => wrapper.findComponent(GlButton);
const findModal = () => wrapper.findComponent(GlModal); const findModal = () => wrapper.findComponent(GlModal);
const clickSubmit = () => findModal().vm.$emit('primary', mockEvent); const clickSubmit = () => findModal().vm.$emit('primary', mockEvent);
const clickHide = () => findModal().vm.$emit('hide', mockEvent); const clickHide = () => findModal().vm.$emit('hide', mockEvent);
......
...@@ -73,7 +73,7 @@ describe('Subscription Seats', () => { ...@@ -73,7 +73,7 @@ describe('Subscription Seats', () => {
const findPageHeading = () => wrapper.find('[data-testid="heading-info"]'); const findPageHeading = () => wrapper.find('[data-testid="heading-info"]');
const findPageHeadingText = () => findPageHeading().find('[data-testid="heading-info-text"]'); const findPageHeadingText = () => findPageHeading().find('[data-testid="heading-info-text"]');
const findPageHeadingBadge = () => findPageHeading().find(GlBadge); const findPageHeadingBadge = () => findPageHeading().findComponent(GlBadge);
const findExportButton = () => wrapper.findByTestId('export-button'); const findExportButton = () => wrapper.findByTestId('export-button');
...@@ -207,7 +207,7 @@ describe('Subscription Seats', () => { ...@@ -207,7 +207,7 @@ describe('Subscription Seats', () => {
); );
if (membershipType === currentMember.user.membership_type) { if (membershipType === currentMember.user.membership_type) {
expect(avatarLinkWrapper.find(GlBadge).text()).toBe(badgeText); expect(avatarLinkWrapper.findComponent(GlBadge).text()).toBe(badgeText);
} }
}); });
}, },
......
...@@ -45,7 +45,7 @@ describe('SidebarDropdownWidget', () => { ...@@ -45,7 +45,7 @@ describe('SidebarDropdownWidget', () => {
const findDropdown = () => wrapper.findComponent(GlDropdown); const findDropdown = () => wrapper.findComponent(GlDropdown);
const findDropdownText = () => wrapper.findComponent(GlDropdownText); const findDropdownText = () => wrapper.findComponent(GlDropdownText);
const findSearchBox = () => wrapper.findComponent(GlSearchBoxByType); const findSearchBox = () => wrapper.findComponent(GlSearchBoxByType);
const findAllDropdownItems = () => wrapper.findAll(GlDropdownItem); const findAllDropdownItems = () => wrapper.findAllComponents(GlDropdownItem);
const findDropdownItemWithText = (text) => const findDropdownItemWithText = (text) =>
findAllDropdownItems().wrappers.find((x) => x.text() === text); findAllDropdownItems().wrappers.find((x) => x.text() === text);
...@@ -79,7 +79,7 @@ describe('SidebarDropdownWidget', () => { ...@@ -79,7 +79,7 @@ describe('SidebarDropdownWidget', () => {
// Used with createComponent which shallow mounts components // Used with createComponent which shallow mounts components
const toggleDropdown = async () => { const toggleDropdown = async () => {
wrapper.find(SidebarEditableItem).vm.$emit('open'); wrapper.findComponent(SidebarEditableItem).vm.$emit('open');
await waitForDropdown(); await waitForDropdown();
}; };
...@@ -203,7 +203,7 @@ describe('SidebarDropdownWidget', () => { ...@@ -203,7 +203,7 @@ describe('SidebarDropdownWidget', () => {
}); });
it('focuses on the input when dropdown is shown', async () => { it('focuses on the input when dropdown is shown', async () => {
expect(document.activeElement).toEqual(wrapper.find(GlFormInput).element); expect(document.activeElement).toEqual(wrapper.findComponent(GlFormInput).element);
}); });
describe('when currentAttribute is not equal to attribute id', () => { describe('when currentAttribute is not equal to attribute id', () => {
......
...@@ -76,11 +76,11 @@ describe('SidebarStatus', () => { ...@@ -76,11 +76,11 @@ describe('SidebarStatus', () => {
beforeEach(() => {}); beforeEach(() => {});
it('renders Status component', () => { it('renders Status component', () => {
expect(wrapper.find(Status).exists()).toBe(true); expect(wrapper.findComponent(Status).exists()).toBe(true);
}); });
it('calls apollo mutate when receiving an onDropdownClick event from Status component', () => { it('calls apollo mutate when receiving an onDropdownClick event from Status component', () => {
wrapper.find(Status).vm.$emit('onDropdownClick', 'onTrack'); wrapper.findComponent(Status).vm.$emit('onDropdownClick', 'onTrack');
const variables = { const variables = {
projectPath: 'foo/bar', projectPath: 'foo/bar',
......
...@@ -9,18 +9,18 @@ const getStatusText = (wrapper) => wrapper.find('.value .text-plain').text(); ...@@ -9,18 +9,18 @@ const getStatusText = (wrapper) => wrapper.find('.value .text-plain').text();
const getStatusTitleText = (wrapper) => wrapper.find('[data-testid="statusTitle"]').text(); const getStatusTitleText = (wrapper) => wrapper.find('[data-testid="statusTitle"]').text();
const getStatusTooltipValue = (wrapper) => const getStatusTooltipValue = (wrapper) =>
getBinding(wrapper.find({ ref: 'status' }).element, 'gl-tooltip').value; getBinding(wrapper.findComponent({ ref: 'status' }).element, 'gl-tooltip').value;
const getEditButtonTooltipValue = (wrapper) => const getEditButtonTooltipValue = (wrapper) =>
getBinding(wrapper.find('[data-testid="editButtonTooltip"]').element, 'gl-tooltip').value; getBinding(wrapper.find('[data-testid="editButtonTooltip"]').element, 'gl-tooltip').value;
const getEditButton = (wrapper) => wrapper.find({ ref: 'editButton' }); const getEditButton = (wrapper) => wrapper.findComponent({ ref: 'editButton' });
const getDropdownClasses = (wrapper) => wrapper.find('[data-testid="dropdownWrapper"]').classes(); const getDropdownClasses = (wrapper) => wrapper.find('[data-testid="dropdownWrapper"]').classes();
const getDropdownElement = (wrapper) => wrapper.find(GlDropdown); const getDropdownElement = (wrapper) => wrapper.findComponent(GlDropdown);
const getRemoveStatusItem = (wrapper) => wrapper.find(GlDropdownItem); const getRemoveStatusItem = (wrapper) => wrapper.findComponent(GlDropdownItem);
describe('Status', () => { describe('Status', () => {
let wrapper; let wrapper;
...@@ -61,7 +61,7 @@ describe('Status', () => { ...@@ -61,7 +61,7 @@ describe('Status', () => {
shallowMountStatus(props); shallowMountStatus(props);
expect(wrapper.find(GlLoadingIcon).exists()).toBe(true); expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(true);
}); });
it('is hidden when not retrieving data', () => { it('is hidden when not retrieving data', () => {
...@@ -71,7 +71,7 @@ describe('Status', () => { ...@@ -71,7 +71,7 @@ describe('Status', () => {
shallowMountStatus(props); shallowMountStatus(props);
expect(wrapper.find(GlLoadingIcon).exists()).toBe(false); expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(false);
}); });
}); });
...@@ -273,7 +273,7 @@ describe('Status', () => { ...@@ -273,7 +273,7 @@ describe('Status', () => {
}); });
it('hides form when a dropdown item is clicked', async () => { it('hides form when a dropdown item is clicked', async () => {
const dropdownItem = wrapper.findAll(GlDropdownItem).at(1); const dropdownItem = wrapper.findAllComponents(GlDropdownItem).at(1);
dropdownItem.vm.$emit('click'); dropdownItem.vm.$emit('click');
...@@ -300,7 +300,7 @@ describe('Status', () => { ...@@ -300,7 +300,7 @@ describe('Status', () => {
}); });
it('shows 4 dropdown items', () => { it('shows 4 dropdown items', () => {
expect(wrapper.findAll(GlDropdownItem)).toHaveLength(4); expect(wrapper.findAllComponents(GlDropdownItem)).toHaveLength(4);
}); });
// Test that "On track", "Needs attention", and "At risk" are displayed // Test that "On track", "Needs attention", and "At risk" are displayed
...@@ -309,7 +309,7 @@ describe('Status', () => { ...@@ -309,7 +309,7 @@ describe('Status', () => {
(statusText, index) => { (statusText, index) => {
expect( expect(
wrapper wrapper
.findAll(GlDropdownItem) .findAllComponents(GlDropdownItem)
.at(index + 1) // +1 in index to account for 1st item as `No status` .at(index + 1) // +1 in index to account for 1st item as `No status`
.text(), .text(),
).toContain(statusText); ).toContain(statusText);
...@@ -321,7 +321,7 @@ describe('Status', () => { ...@@ -321,7 +321,7 @@ describe('Status', () => {
'emits onFormSubmit event with argument "%s" when user selects the option and submits form', 'emits onFormSubmit event with argument "%s" when user selects the option and submits form',
async (status, index) => { async (status, index) => {
wrapper wrapper
.findAll(GlDropdownItem) .findAllComponents(GlDropdownItem)
.at(index + 1) .at(index + 1)
.vm.$emit('click', { preventDefault: () => null }); .vm.$emit('click', { preventDefault: () => null });
......
...@@ -67,7 +67,7 @@ describe('AncestorsTreeContainer', () => { ...@@ -67,7 +67,7 @@ describe('AncestorsTreeContainer', () => {
isFetching: true, isFetching: true,
}); });
expect(wrapper.find(GlLoadingIcon).exists()).toBe(true); expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(true);
}); });
it('escapes html in the tooltip', () => { it('escapes html in the tooltip', () => {
......
...@@ -33,7 +33,7 @@ describe('Weight', () => { ...@@ -33,7 +33,7 @@ describe('Weight', () => {
const findCollapsedBlock = () => wrapper.find('.js-weight-collapsed-block'); const findCollapsedBlock = () => wrapper.find('.js-weight-collapsed-block');
const findEditLink = () => wrapper.find('.js-weight-edit-link'); const findEditLink = () => wrapper.find('.js-weight-edit-link');
const findRemoveLink = () => wrapper.find('.js-weight-remove-link'); const findRemoveLink = () => wrapper.find('.js-weight-remove-link');
const containsEditableField = () => wrapper.find({ ref: 'editableField' }).exists(); const containsEditableField = () => wrapper.findComponent({ ref: 'editableField' }).exists();
const containsInputError = () => wrapper.find('.gl-field-error').exists(); const containsInputError = () => wrapper.find('.gl-field-error').exists();
it('shows loading spinner when fetching', () => { it('shows loading spinner when fetching', () => {
......
...@@ -6,10 +6,10 @@ describe('Status Page settings form', () => { ...@@ -6,10 +6,10 @@ describe('Status Page settings form', () => {
let wrapper; let wrapper;
const store = createStore(); const store = createStore();
const findForm = () => wrapper.find({ ref: 'settingsForm' }); const findForm = () => wrapper.findComponent({ ref: 'settingsForm' });
const findToggleButton = () => wrapper.find({ ref: 'toggleBtn' }); const findToggleButton = () => wrapper.findComponent({ ref: 'toggleBtn' });
const findSectionHeader = () => wrapper.find({ ref: 'sectionHeader' }); const findSectionHeader = () => wrapper.findComponent({ ref: 'sectionHeader' });
const findSectionSubHeader = () => wrapper.find({ ref: 'sectionSubHeader' }); const findSectionSubHeader = () => wrapper.findComponent({ ref: 'sectionSubHeader' });
beforeEach(() => { beforeEach(() => {
wrapper = shallowMount(StatusPageSettingsForm, { store }); wrapper = shallowMount(StatusPageSettingsForm, { store });
......
...@@ -47,10 +47,10 @@ describe('Subscription Details', () => { ...@@ -47,10 +47,10 @@ describe('Subscription Details', () => {
}); });
} }
const organizationNameInput = () => wrapper.find({ ref: 'organization-name' }); const organizationNameInput = () => wrapper.findComponent({ ref: 'organization-name' });
const groupSelect = () => wrapper.find({ ref: 'group-select' }); const groupSelect = () => wrapper.findComponent({ ref: 'group-select' });
const numberOfUsersInput = () => wrapper.find({ ref: 'number-of-users' }); const numberOfUsersInput = () => wrapper.findComponent({ ref: 'number-of-users' });
const companyLink = () => wrapper.find({ ref: 'company-link' }); const companyLink = () => wrapper.findComponent({ ref: 'company-link' });
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -488,15 +488,17 @@ describe('Subscription Details', () => { ...@@ -488,15 +488,17 @@ describe('Subscription Details', () => {
}); });
it('should show the selected plan', () => { it('should show the selected plan', () => {
expect(wrapper.find({ ref: 'summary-line-1' }).text()).toEqual('Bronze plan'); expect(wrapper.findComponent({ ref: 'summary-line-1' }).text()).toEqual('Bronze plan');
}); });
it('should show the entered group name', () => { it('should show the entered group name', () => {
expect(wrapper.find({ ref: 'summary-line-2' }).text()).toEqual('Group: My Organization'); expect(wrapper.findComponent({ ref: 'summary-line-2' }).text()).toEqual(
'Group: My Organization',
);
}); });
it('should show the entered number of users', () => { it('should show the entered number of users', () => {
expect(wrapper.find({ ref: 'summary-line-3' }).text()).toEqual('Users: 25'); expect(wrapper.findComponent({ ref: 'summary-line-3' }).text()).toEqual('Users: 25');
}); });
describe('selecting an existing group', () => { describe('selecting an existing group', () => {
...@@ -505,7 +507,9 @@ describe('Subscription Details', () => { ...@@ -505,7 +507,9 @@ describe('Subscription Details', () => {
}); });
it('should show the selected group name', () => { it('should show the selected group name', () => {
expect(wrapper.find({ ref: 'summary-line-2' }).text()).toEqual('Group: My second group'); expect(wrapper.findComponent({ ref: 'summary-line-2' }).text()).toEqual(
'Group: My second group',
);
}); });
}); });
}); });
......
...@@ -151,8 +151,8 @@ describe('TestCaseCreateRoot', () => { ...@@ -151,8 +151,8 @@ describe('TestCaseCreateRoot', () => {
labelsManagePath, labelsManagePath,
} = mockProvide; } = mockProvide;
expect(wrapper.find(IssuableCreate).exists()).toBe(true); expect(wrapper.findComponent(IssuableCreate).exists()).toBe(true);
expect(wrapper.find(IssuableCreate).props()).toMatchObject({ expect(wrapper.findComponent(IssuableCreate).props()).toMatchObject({
descriptionPreviewPath, descriptionPreviewPath,
descriptionHelpPath, descriptionHelpPath,
labelsFetchPath, labelsFetchPath,
......
...@@ -97,11 +97,11 @@ describe('TestCaseListEmptyState', () => { ...@@ -97,11 +97,11 @@ describe('TestCaseListEmptyState', () => {
describe('template', () => { describe('template', () => {
it('renders gl-empty-state component', () => { it('renders gl-empty-state component', () => {
expect(wrapper.find(GlEmptyState).exists()).toBe(true); expect(wrapper.findComponent(GlEmptyState).exists()).toBe(true);
}); });
it('renders empty state description', () => { it('renders empty state description', () => {
const descriptionEl = wrapper.find(GlSprintf); const descriptionEl = wrapper.findComponent(GlSprintf);
expect(descriptionEl.exists()).toBe(true); expect(descriptionEl.exists()).toBe(true);
expect(descriptionEl.attributes('message')).toBe( expect(descriptionEl.attributes('message')).toBe(
...@@ -110,7 +110,7 @@ describe('TestCaseListEmptyState', () => { ...@@ -110,7 +110,7 @@ describe('TestCaseListEmptyState', () => {
}); });
it('renders "New test cases" button', () => { it('renders "New test cases" button', () => {
const buttonEl = wrapper.find(GlButton); const buttonEl = wrapper.findComponent(GlButton);
expect(buttonEl.exists()).toBe(true); expect(buttonEl.exists()).toBe(true);
expect(buttonEl.attributes('href')).toBe('/gitlab-org/gitlab-test/-/quality/test_cases/new'); expect(buttonEl.attributes('href')).toBe('/gitlab-org/gitlab-test/-/quality/test_cases/new');
......
...@@ -34,7 +34,7 @@ const mockPageInfo = { ...@@ -34,7 +34,7 @@ const mockPageInfo = {
describe('TestCaseListRoot', () => { describe('TestCaseListRoot', () => {
let wrapper; let wrapper;
const getIssuableList = () => wrapper.find(IssuableList); const getIssuableList = () => wrapper.findComponent(IssuableList);
const createComponent = ({ const createComponent = ({
provide = mockProvide, provide = mockProvide,
......
...@@ -276,13 +276,13 @@ describe('TestCaseShowRoot', () => { ...@@ -276,13 +276,13 @@ describe('TestCaseShowRoot', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.find(GlLoadingIcon).exists()).toBe(true); expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(true);
}); });
it('renders gl-alert when issuable-show component emits `task-list-update-failure` event', async () => { it('renders gl-alert when issuable-show component emits `task-list-update-failure` event', async () => {
await wrapper.find(IssuableShow).vm.$emit('task-list-update-failure'); await wrapper.findComponent(IssuableShow).vm.$emit('task-list-update-failure');
const alertEl = wrapper.find(GlAlert); const alertEl = wrapper.findComponent(GlAlert);
expect(alertEl.exists()).toBe(true); expect(alertEl.exists()).toBe(true);
expect(alertEl.text()).toBe( expect(alertEl.text()).toBe(
...@@ -299,7 +299,7 @@ describe('TestCaseShowRoot', () => { ...@@ -299,7 +299,7 @@ describe('TestCaseShowRoot', () => {
updatePath, updatePath,
lockVersion, lockVersion,
} = mockProvide; } = mockProvide;
const issuableShowEl = wrapper.find(IssuableShow); const issuableShowEl = wrapper.findComponent(IssuableShow);
expect(issuableShowEl.exists()).toBe(true); expect(issuableShowEl.exists()).toBe(true);
expect(issuableShowEl.props()).toMatchObject({ expect(issuableShowEl.props()).toMatchObject({
...@@ -319,7 +319,7 @@ describe('TestCaseShowRoot', () => { ...@@ -319,7 +319,7 @@ describe('TestCaseShowRoot', () => {
}); });
it('refetches taskCompletionStatus when issuable-show emits `task-list-update-success` event', async () => { it('refetches taskCompletionStatus when issuable-show emits `task-list-update-success` event', async () => {
await wrapper.find(IssuableShow).vm.$emit('task-list-update-success'); await wrapper.findComponent(IssuableShow).vm.$emit('task-list-update-success');
expect(wrapper.vm.$apollo.queries.taskCompletionStatus.refetch).toHaveBeenCalled(); expect(wrapper.vm.$apollo.queries.taskCompletionStatus.refetch).toHaveBeenCalled();
}); });
...@@ -334,7 +334,7 @@ describe('TestCaseShowRoot', () => { ...@@ -334,7 +334,7 @@ describe('TestCaseShowRoot', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.find(IssuableShow).exists()).toBe(false); expect(wrapper.findComponent(IssuableShow).exists()).toBe(false);
}); });
it('renders status-badge slot contents', () => { it('renders status-badge slot contents', () => {
...@@ -357,7 +357,7 @@ describe('TestCaseShowRoot', () => { ...@@ -357,7 +357,7 @@ describe('TestCaseShowRoot', () => {
const statusEl = wrapperMoved.find('[data-testid="status"]'); const statusEl = wrapperMoved.find('[data-testid="status"]');
expect(statusEl.text()).toContain('Archived'); expect(statusEl.text()).toContain('Archived');
expect(statusEl.find(GlLink).attributes('href')).toBe(movedTestCase.movedTo.webUrl); expect(statusEl.findComponent(GlLink).attributes('href')).toBe(movedTestCase.movedTo.webUrl);
wrapperMoved.destroy(); wrapperMoved.destroy();
}); });
......
...@@ -269,8 +269,8 @@ describe('TestCaseSidebar', () => { ...@@ -269,8 +269,8 @@ describe('TestCaseSidebar', () => {
expect(todoEl.exists()).toBe(true); expect(todoEl.exists()).toBe(true);
expect(todoEl.text()).toContain('To Do'); expect(todoEl.text()).toContain('To Do');
expect(todoEl.find(GlButton).exists()).toBe(true); expect(todoEl.findComponent(GlButton).exists()).toBe(true);
expect(todoEl.find(GlButton).text()).toBe('Add a to do'); expect(todoEl.findComponent(GlButton).text()).toBe('Add a to do');
wrapper.setProps({ wrapper.setProps({
sidebarExpanded: false, sidebarExpanded: false,
...@@ -282,13 +282,13 @@ describe('TestCaseSidebar', () => { ...@@ -282,13 +282,13 @@ describe('TestCaseSidebar', () => {
expect(todoEl.exists()).toBe(true); expect(todoEl.exists()).toBe(true);
expect(todoEl.attributes('title')).toBe('Add a to do'); expect(todoEl.attributes('title')).toBe('Add a to do');
expect(todoEl.find(GlIcon).exists()).toBe(true); expect(todoEl.findComponent(GlIcon).exists()).toBe(true);
}); });
it('renders label-select', async () => { it('renders label-select', async () => {
const { selectedLabels, testCaseLabelsSelectInProgress } = wrapper.vm; const { selectedLabels, testCaseLabelsSelectInProgress } = wrapper.vm;
const { canEditTestCase, labelsFetchPath, labelsManagePath } = mockProvide; const { canEditTestCase, labelsFetchPath, labelsManagePath } = mockProvide;
const labelSelectEl = wrapper.find(LabelsSelect); const labelSelectEl = wrapper.findComponent(LabelsSelect);
expect(labelSelectEl.exists()).toBe(true); expect(labelSelectEl.exists()).toBe(true);
expect(labelSelectEl.props()).toMatchObject({ expect(labelSelectEl.props()).toMatchObject({
...@@ -307,7 +307,7 @@ describe('TestCaseSidebar', () => { ...@@ -307,7 +307,7 @@ describe('TestCaseSidebar', () => {
it('renders project-select', async () => { it('renders project-select', async () => {
const { selectProjectDropdownButtonTitle, testCaseMoveInProgress } = wrapper.vm; const { selectProjectDropdownButtonTitle, testCaseMoveInProgress } = wrapper.vm;
const { projectsFetchPath } = mockProvide; const { projectsFetchPath } = mockProvide;
const projectSelectEl = wrapper.find(ProjectSelect); const projectSelectEl = wrapper.findComponent(ProjectSelect);
expect(projectSelectEl.exists()).toBe(true); expect(projectSelectEl.exists()).toBe(true);
expect(projectSelectEl.props()).toMatchObject({ expect(projectSelectEl.props()).toMatchObject({
......
...@@ -18,7 +18,7 @@ const createComponent = () => { ...@@ -18,7 +18,7 @@ const createComponent = () => {
}; };
const findTableRow = () => wrapper.find('[data-testid="projectTableRow"]'); const findTableRow = () => wrapper.find('[data-testid="projectTableRow"]');
const findProjectStorageDetail = () => wrapper.find(ProjectStorageDetail); const findProjectStorageDetail = () => wrapper.findComponent(ProjectStorageDetail);
describe('CollapsibleProjectStorageDetail', () => { describe('CollapsibleProjectStorageDetail', () => {
beforeEach(() => { beforeEach(() => {
...@@ -26,7 +26,7 @@ describe('CollapsibleProjectStorageDetail', () => { ...@@ -26,7 +26,7 @@ describe('CollapsibleProjectStorageDetail', () => {
}); });
it('renders project avatar', () => { it('renders project avatar', () => {
expect(wrapper.find(ProjectAvatar).exists()).toBe(true); expect(wrapper.findComponent(ProjectAvatar).exists()).toBe(true);
}); });
it('renders project name', () => { it('renders project name', () => {
......
...@@ -23,10 +23,10 @@ describe('NamespaceStorageApp', () => { ...@@ -23,10 +23,10 @@ describe('NamespaceStorageApp', () => {
const findPurchaseStorageLink = () => wrapper.find("[data-testid='purchase-storage-link']"); const findPurchaseStorageLink = () => wrapper.find("[data-testid='purchase-storage-link']");
const findTemporaryStorageIncreaseButton = () => const findTemporaryStorageIncreaseButton = () =>
wrapper.find("[data-testid='temporary-storage-increase-button']"); wrapper.find("[data-testid='temporary-storage-increase-button']");
const findUsageGraph = () => wrapper.find(UsageGraph); const findUsageGraph = () => wrapper.findComponent(UsageGraph);
const findUsageStatistics = () => wrapper.find(UsageStatistics); const findUsageStatistics = () => wrapper.findComponent(UsageStatistics);
const findStorageInlineAlert = () => wrapper.find(StorageInlineAlert); const findStorageInlineAlert = () => wrapper.findComponent(StorageInlineAlert);
const findProjectList = () => wrapper.find(ProjectList); const findProjectList = () => wrapper.findComponent(ProjectList);
const findPrevButton = () => wrapper.find('[data-testid="prevButton"]'); const findPrevButton = () => wrapper.find('[data-testid="prevButton"]');
const findNextButton = () => wrapper.find('[data-testid="nextButton"]'); const findNextButton = () => wrapper.find('[data-testid="nextButton"]');
...@@ -81,7 +81,7 @@ describe('NamespaceStorageApp', () => { ...@@ -81,7 +81,7 @@ describe('NamespaceStorageApp', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.findAll(CollapsibleProjectStorageDetail)).toHaveLength(3); expect(wrapper.findAllComponents(CollapsibleProjectStorageDetail)).toHaveLength(3);
}); });
describe('limit', () => { describe('limit', () => {
...@@ -229,7 +229,7 @@ describe('NamespaceStorageApp', () => { ...@@ -229,7 +229,7 @@ describe('NamespaceStorageApp', () => {
}); });
it('renders modal', () => { it('renders modal', () => {
expect(wrapper.find(TemporaryStorageIncreaseModal).props()).toEqual({ expect(wrapper.findComponent(TemporaryStorageIncreaseModal).props()).toEqual({
limit: formatUsageSize(TEST_LIMIT), limit: formatUsageSize(TEST_LIMIT),
modalId: NamespaceStorageApp.modalId, modalId: NamespaceStorageApp.modalId,
}); });
......
...@@ -19,7 +19,7 @@ const createComponent = ({ additionalRepoStorageByNamespace = false } = {}) => { ...@@ -19,7 +19,7 @@ const createComponent = ({ additionalRepoStorageByNamespace = false } = {}) => {
}); });
}; };
const findTableRows = () => wrapper.findAll(CollapsibleProjectStorageDetail); const findTableRows = () => wrapper.findAllComponents(CollapsibleProjectStorageDetail);
describe('ProjectList', () => { describe('ProjectList', () => {
beforeEach(() => { beforeEach(() => {
......
...@@ -17,7 +17,7 @@ describe('StorageInlineAlert', () => { ...@@ -17,7 +17,7 @@ describe('StorageInlineAlert', () => {
}); });
} }
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.findComponent(GlAlert);
describe('no excess storage and no purchase', () => { describe('no excess storage and no purchase', () => {
beforeEach(() => { beforeEach(() => {
......
...@@ -17,7 +17,7 @@ describe('Temporary storage increase modal', () => { ...@@ -17,7 +17,7 @@ describe('Temporary storage increase modal', () => {
}, },
}); });
}; };
const findModal = () => wrapper.find(GlModal); const findModal = () => wrapper.findComponent(GlModal);
const showModal = () => { const showModal = () => {
findModal().vm.show(); findModal().vm.show();
return wrapper.vm.$nextTick(); return wrapper.vm.$nextTick();
......
...@@ -36,10 +36,12 @@ describe('UsageStatistics', () => { ...@@ -36,10 +36,12 @@ describe('UsageStatistics', () => {
wrapper.destroy(); wrapper.destroy();
}); });
const getStatisticsCards = () => wrapper.findAll(UsageStatisticsCard); const getStatisticsCards = () => wrapper.findAllComponents(UsageStatisticsCard);
const getStatisticsCard = (testId) => wrapper.find(`[data-testid="${testId}"]`); const getStatisticsCard = (testId) => wrapper.find(`[data-testid="${testId}"]`);
const findGlLinkInCard = (cardName) => const findGlLinkInCard = (cardName) =>
getStatisticsCard(cardName).find('[data-testid="statistics-card-footer"]').find(GlLink); getStatisticsCard(cardName)
.find('[data-testid="statistics-card-footer"]')
.findComponent(GlLink);
const findPurchasedUsageButton = () => const findPurchasedUsageButton = () =>
getStatisticsCard('purchased-usage').findComponent(GlButton); getStatisticsCard('purchased-usage').findComponent(GlButton);
......
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