From 6ce6d20cf0b81275bad7bf8e95cf49bd475c5c4f Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 12 Apr 2023 18:17:07 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- spec/factories/notes.rb | 4 ++ .../components/import_details_table_spec.js | 33 ++++++++++++ .../components/source_branch_dropdown_spec.js | 4 +- .../components/jira_import_form_spec.js | 4 +- .../components/job/manual_variables_form_spec.js | 4 +- .../jobs/components/job/sidebar_header_spec.js | 2 +- spec/frontend/jobs/components/job/sidebar_spec.js | 4 +- .../components/table/cells/actions_cell_spec.js | 2 +- spec/frontend/lib/apollo/persist_link_spec.js | 4 +- spec/frontend/lib/utils/color_utils_spec.js | 2 +- .../lib/utils/intersection_observer_spec.js | 2 +- spec/frontend/lib/utils/poll_spec.js | 2 +- .../components/table/expiration_datepicker_spec.js | 2 +- spec/frontend/members/utils_spec.js | 2 +- .../components/delete_button_spec.js | 2 +- .../experiments/show/ml_experiments_show_spec.js | 2 +- .../components/variables/dropdown_field_spec.js | 2 +- .../note_actions/timeline_event_button_spec.js | 2 +- spec/frontend/notes/components/note_form_spec.js | 10 ++-- spec/frontend/notes/components/notes_app_spec.js | 2 +- spec/frontend/notes/deprecated_notes_spec.js | 2 +- spec/frontend/notes/stores/actions_spec.js | 6 +-- .../components/custom_notifications_modal_spec.js | 2 +- spec/frontend/observability/index_spec.js | 2 +- .../harbor_registry/pages/list_spec.js | 4 +- .../components/list/package_list_row_spec.js | 2 +- .../components/list/packages_search_spec.js | 2 +- .../package_registry/pages/details_spec.js | 6 +-- .../package_registry/pages/list_spec.js | 2 +- .../group/components/package_settings_spec.js | 4 +- .../container_expiration_policy_form_spec.js | 2 +- .../packages_cleanup_policy_form_spec.js | 2 +- .../shared/components/persisted_search_spec.js | 2 +- .../shared/components/registry_list_spec.js | 2 +- .../projects/components/namespace_select_spec.js | 4 +- .../bitbucket_server_status_table_spec.js | 2 +- .../components/bulk_imports_history_app_spec.js | 2 +- .../history/components/import_history_app_spec.js | 2 +- .../shared/wikis/components/wiki_form_spec.js | 4 +- .../components/performance_bar_app_spec.js | 61 +++++++++++++--------- .../pipeline_wizard/components/commit_spec.js | 8 +-- .../pipeline_wizard/components/step_nav_spec.js | 6 +-- .../pipeline_wizard/components/step_spec.js | 2 +- .../components/widgets/list_spec.js | 4 +- .../components/widgets/text_spec.js | 2 +- .../pipeline_wizard/components/wrapper_spec.js | 8 +-- spec/frontend/pipelines/components/dag/dag_spec.js | 12 ++--- .../pipeline_mini_graph/pipeline_stage_spec.js | 2 +- .../pipelines/graph/linked_pipeline_spec.js | 2 +- .../pipelines/pipelines_manual_actions_spec.js | 2 +- spec/frontend/pipelines/pipelines_spec.js | 14 ++--- .../account/components/update_username_spec.js | 2 +- .../commit/components/branches_dropdown_spec.js | 2 +- .../projects/commit/components/form_modal_spec.js | 2 +- .../new/components/new_project_url_select_spec.js | 2 +- .../components/transfer_project_form_spec.js | 6 +-- .../components/topics_token_selector_spec.js | 2 +- .../components/service_desk_root_spec.js | 2 +- .../protected_branch_edit_spec.js | 2 +- .../mr_widget_options_spec.js | 6 +-- .../components/user_popover/user_popover_spec.js | 7 ++- spec/helpers/merge_requests_helper_spec.rb | 26 ++++++++- spec/lib/gitlab/favicon_spec.rb | 12 ++++- spec/models/ci/pipeline_spec.rb | 10 ++++ spec/requests/api/ci/pipelines_spec.rb | 53 ++++++++++++++++++- ...merge_request_poll_cached_widget_entity_spec.rb | 37 ++++++++++++- spec/services/ci/retry_job_service_spec.rb | 31 ++--------- spec/support/rspec_order_todo.yml | 1 - 68 files changed, 310 insertions(+), 161 deletions(-) create mode 100644 spec/frontend/import/details/components/import_details_table_spec.js (limited to 'spec') diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb index 2a21bde5436..c58e7bb2e79 100644 --- a/spec/factories/notes.rb +++ b/spec/factories/notes.rb @@ -196,6 +196,10 @@ FactoryBot.define do confidential { true } end + trait :internal do + internal { true } + end + trait :with_review do review end diff --git a/spec/frontend/import/details/components/import_details_table_spec.js b/spec/frontend/import/details/components/import_details_table_spec.js new file mode 100644 index 00000000000..43c9a66c00a --- /dev/null +++ b/spec/frontend/import/details/components/import_details_table_spec.js @@ -0,0 +1,33 @@ +import { mount, shallowMount } from '@vue/test-utils'; +import { GlEmptyState, GlTable } from '@gitlab/ui'; + +import PaginationBar from '~/vue_shared/components/pagination_bar/pagination_bar.vue'; +import ImportDetailsTable from '~/import/details/components/import_details_table.vue'; + +describe('Import details table', () => { + let wrapper; + + const createComponent = ({ mountFn = shallowMount } = {}) => { + wrapper = mountFn(ImportDetailsTable); + }; + + const findGlTable = () => wrapper.findComponent(GlTable); + const findGlEmptyState = () => findGlTable().findComponent(GlEmptyState); + const findPaginationBar = () => wrapper.findComponent(PaginationBar); + + describe('template', () => { + describe('when no items are available', () => { + it('renders table with empty state', () => { + createComponent({ mountFn: mount }); + + expect(findGlEmptyState().exists()).toBe(true); + }); + + it('does not render pagination', () => { + createComponent(); + + expect(findPaginationBar().exists()).toBe(false); + }); + }); + }); +}); diff --git a/spec/frontend/jira_connect/branches/components/source_branch_dropdown_spec.js b/spec/frontend/jira_connect/branches/components/source_branch_dropdown_spec.js index 701512953df..a3bc8e861b2 100644 --- a/spec/frontend/jira_connect/branches/components/source_branch_dropdown_spec.js +++ b/spec/frontend/jira_connect/branches/components/source_branch_dropdown_spec.js @@ -147,7 +147,7 @@ describe('SourceBranchDropdown', () => { }); describe('when selecting a listbox item', () => { - it('emits `change` event with the selected branch name', async () => { + it('emits `change` event with the selected branch name', () => { const mockBranchName = mockProject.repository.branchNames[1]; findListbox().vm.$emit('select', mockBranchName); expect(wrapper.emitted('change')[1]).toEqual([mockBranchName]); @@ -157,7 +157,7 @@ describe('SourceBranchDropdown', () => { describe('when `selectedBranchName` prop is specified', () => { const mockBranchName = mockProject.repository.branchNames[2]; - beforeEach(async () => { + beforeEach(() => { wrapper.setProps({ selectedBranchName: mockBranchName, }); diff --git a/spec/frontend/jira_import/components/jira_import_form_spec.js b/spec/frontend/jira_import/components/jira_import_form_spec.js index c7db9f429de..7fd6398aaa4 100644 --- a/spec/frontend/jira_import/components/jira_import_form_spec.js +++ b/spec/frontend/jira_import/components/jira_import_form_spec.js @@ -304,7 +304,7 @@ describe('JiraImportForm', () => { expect(getContinueButton().text()).toBe('Continue'); }); - it('is in loading state when the form is submitting', async () => { + it('is in loading state when the form is submitting', () => { wrapper = mountComponent({ isSubmitting: true }); expect(getContinueButton().props('loading')).toBe(true); @@ -416,7 +416,7 @@ describe('JiraImportForm', () => { wrapper = mountComponent({ hasMoreUsers: true }); }); - it('calls the GraphQL user mapping mutation', async () => { + it('calls the GraphQL user mapping mutation', () => { const mutationArguments = { mutation: getJiraUserMappingMutation, variables: { diff --git a/spec/frontend/jobs/components/job/manual_variables_form_spec.js b/spec/frontend/jobs/components/job/manual_variables_form_spec.js index 98b9ca78a45..c8c865dd28e 100644 --- a/spec/frontend/jobs/components/job/manual_variables_form_spec.js +++ b/spec/frontend/jobs/components/job/manual_variables_form_spec.js @@ -54,7 +54,7 @@ describe('Manual Variables Form', () => { }); }; - const createComponentWithApollo = async ({ props = {} } = {}) => { + const createComponentWithApollo = ({ props = {} } = {}) => { const requestHandlers = [[getJobQuery, getJobQueryResponse]]; mockApollo = createMockApollo(requestHandlers); @@ -309,7 +309,7 @@ describe('Manual Variables Form', () => { await createComponentWithApollo(); }); - it('delete variable button placeholder should only exist when a user cannot remove', async () => { + it('delete variable button placeholder should only exist when a user cannot remove', () => { expect(findDeleteVarBtnPlaceholder().exists()).toBe(true); }); diff --git a/spec/frontend/jobs/components/job/sidebar_header_spec.js b/spec/frontend/jobs/components/job/sidebar_header_spec.js index da97945f9bf..cf182330578 100644 --- a/spec/frontend/jobs/components/job/sidebar_header_spec.js +++ b/spec/frontend/jobs/components/job/sidebar_header_spec.js @@ -31,7 +31,7 @@ describe('Sidebar Header', () => { }); }; - const createComponentWithApollo = async ({ props = {}, restJob = {} } = {}) => { + const createComponentWithApollo = ({ props = {}, restJob = {} } = {}) => { const getJobQueryResponse = jest.fn().mockResolvedValue(mockJobResponse); const requestHandlers = [[getJobQuery, getJobQueryResponse]]; diff --git a/spec/frontend/jobs/components/job/sidebar_spec.js b/spec/frontend/jobs/components/job/sidebar_spec.js index cefa4582c15..fbff64b4d78 100644 --- a/spec/frontend/jobs/components/job/sidebar_spec.js +++ b/spec/frontend/jobs/components/job/sidebar_spec.js @@ -139,7 +139,7 @@ describe('Sidebar details block', () => { return store.dispatch('receiveJobsForStageSuccess', jobsInStage.latest_statuses); }); - it('renders list of jobs', async () => { + it('renders list of jobs', () => { expect(findJobsContainer().exists()).toBe(true); }); }); @@ -147,7 +147,7 @@ describe('Sidebar details block', () => { describe('when job data changes', () => { const stageArg = job.pipeline.details.stages.find((stage) => stage.name === job.stage); - beforeEach(async () => { + beforeEach(() => { jest.spyOn(store, 'dispatch'); }); diff --git a/spec/frontend/jobs/components/table/cells/actions_cell_spec.js b/spec/frontend/jobs/components/table/cells/actions_cell_spec.js index 55fe534aa3b..79bc765f181 100644 --- a/spec/frontend/jobs/components/table/cells/actions_cell_spec.js +++ b/spec/frontend/jobs/components/table/cells/actions_cell_spec.js @@ -122,7 +122,7 @@ describe('Job actions cell', () => { ${findPlayButton} | ${'play'} | ${playableJob} | ${JobPlayMutation} | ${playMutationHandler} | ${playableJob.id} ${findRetryButton} | ${'retry'} | ${retryableJob} | ${JobRetryMutation} | ${retryMutationHandler} | ${retryableJob.id} ${findCancelButton} | ${'cancel'} | ${cancelableJob} | ${JobCancelMutation} | ${cancelMutationHandler} | ${cancelableJob.id} - `('performs the $action mutation', async ({ button, jobType, mutationFile, handler, jobId }) => { + `('performs the $action mutation', ({ button, jobType, mutationFile, handler, jobId }) => { createComponent(jobType, [[mutationFile, handler]]); button().vm.$emit('click'); diff --git a/spec/frontend/lib/apollo/persist_link_spec.js b/spec/frontend/lib/apollo/persist_link_spec.js index ddb861bcee0..f3afc4ba8cd 100644 --- a/spec/frontend/lib/apollo/persist_link_spec.js +++ b/spec/frontend/lib/apollo/persist_link_spec.js @@ -56,7 +56,7 @@ describe('~/lib/apollo/persist_link', () => { expect(childFields.some((field) => field.name.value === '__persist')).toBe(false); }); - it('decorates the response with `__persist: true` is there is `__persist` field in the query', async () => { + it('decorates the response with `__persist: true` is there is `__persist` field in the query', () => { const link = getPersistLink().concat(terminatingLink); subscription = execute(link, { query: QUERY_WITH_PERSIST_FIELD }).subscribe(({ data }) => { @@ -64,7 +64,7 @@ describe('~/lib/apollo/persist_link', () => { }); }); - it('does not decorate the response with `__persist: true` is there if query is not persistent', async () => { + it('does not decorate the response with `__persist: true` is there if query is not persistent', () => { const link = getPersistLink().concat(terminatingLink); subscription = execute(link, { query: DEFAULT_QUERY }).subscribe(({ data }) => { diff --git a/spec/frontend/lib/utils/color_utils_spec.js b/spec/frontend/lib/utils/color_utils_spec.js index 87966cf9fba..a5580a3d8d6 100644 --- a/spec/frontend/lib/utils/color_utils_spec.js +++ b/spec/frontend/lib/utils/color_utils_spec.js @@ -63,7 +63,7 @@ describe('Color utils', () => { ${'groups:issues:index'} | ${'gl-dark'} | ${'monokai-light'} | ${true} `( 'is $expected on $page with $bodyClass body class and $ideTheme IDE theme', - async ({ page, bodyClass, ideTheme, expected }) => { + ({ page, bodyClass, ideTheme, expected }) => { document.body.outerHTML = ``; window.gon = { user_color_scheme: ideTheme, diff --git a/spec/frontend/lib/utils/intersection_observer_spec.js b/spec/frontend/lib/utils/intersection_observer_spec.js index 71b1daffe0d..8eef403f0ae 100644 --- a/spec/frontend/lib/utils/intersection_observer_spec.js +++ b/spec/frontend/lib/utils/intersection_observer_spec.js @@ -57,7 +57,7 @@ describe('IntersectionObserver Utility', () => { ${true} | ${'IntersectionAppear'} `( 'should emit the correct event on the entry target based on the computed Intersection', - async ({ isIntersecting, event }) => { + ({ isIntersecting, event }) => { const target = document.createElement('div'); observer.addEntry({ target, isIntersecting }); diff --git a/spec/frontend/lib/utils/poll_spec.js b/spec/frontend/lib/utils/poll_spec.js index 63eeb54e850..096a92305dc 100644 --- a/spec/frontend/lib/utils/poll_spec.js +++ b/spec/frontend/lib/utils/poll_spec.js @@ -121,7 +121,7 @@ describe('Poll', () => { }); describe('with delayed initial request', () => { - it('delays the first request', async () => { + it('delays the first request', () => { mockServiceCall({ status: HTTP_STATUS_OK, headers: { 'poll-interval': 1 } }); const Polling = new Poll({ diff --git a/spec/frontend/members/components/table/expiration_datepicker_spec.js b/spec/frontend/members/components/table/expiration_datepicker_spec.js index 15812ee6572..9176a02a447 100644 --- a/spec/frontend/members/components/table/expiration_datepicker_spec.js +++ b/spec/frontend/members/components/table/expiration_datepicker_spec.js @@ -93,7 +93,7 @@ describe('ExpirationDatepicker', () => { }); describe('when datepicker is changed', () => { - beforeEach(async () => { + beforeEach(() => { createComponent(); findDatepicker().vm.$emit('input', new Date('2020-03-17')); diff --git a/spec/frontend/members/utils_spec.js b/spec/frontend/members/utils_spec.js index 4f276e8c9df..c4357e9c1f0 100644 --- a/spec/frontend/members/utils_spec.js +++ b/spec/frontend/members/utils_spec.js @@ -213,7 +213,7 @@ describe('Members Utils', () => { ${'recent_sign_in'} | ${{ sortByKey: 'lastSignIn', sortDesc: false }} ${'oldest_sign_in'} | ${{ sortByKey: 'lastSignIn', sortDesc: true }} `('when `sort` query string param is `$sortParam`', ({ sortParam, expected }) => { - it(`returns ${JSON.stringify(expected)}`, async () => { + it(`returns ${JSON.stringify(expected)}`, () => { setWindowLocation(`?sort=${sortParam}`); expect(parseSortParam(['account', 'granted', 'expires', 'maxRole', 'lastSignIn'])).toEqual( diff --git a/spec/frontend/ml/experiment_tracking/components/delete_button_spec.js b/spec/frontend/ml/experiment_tracking/components/delete_button_spec.js index b8b2aadf2c6..0243cbeb7bf 100644 --- a/spec/frontend/ml/experiment_tracking/components/delete_button_spec.js +++ b/spec/frontend/ml/experiment_tracking/components/delete_button_spec.js @@ -49,7 +49,7 @@ describe('DeleteButton', () => { expect(findModalText().exists()).toBe(true); }); - it('submits the form when primary action is clicked', async () => { + it('submits the form when primary action is clicked', () => { const submitSpy = jest.spyOn(findForm().element, 'submit'); findModal().vm.$emit('primary'); diff --git a/spec/frontend/ml/experiment_tracking/routes/experiments/show/ml_experiments_show_spec.js b/spec/frontend/ml/experiment_tracking/routes/experiments/show/ml_experiments_show_spec.js index 21e1fba95f9..da011feee66 100644 --- a/spec/frontend/ml/experiment_tracking/routes/experiments/show/ml_experiments_show_spec.js +++ b/spec/frontend/ml/experiment_tracking/routes/experiments/show/ml_experiments_show_spec.js @@ -48,7 +48,7 @@ describe('MlExperimentsShow', () => { }); describe('default inputs', () => { - beforeEach(async () => { + beforeEach(() => { createWrapper(); }); diff --git a/spec/frontend/monitoring/components/variables/dropdown_field_spec.js b/spec/frontend/monitoring/components/variables/dropdown_field_spec.js index 96b228fd3b2..e6c5569fa19 100644 --- a/spec/frontend/monitoring/components/variables/dropdown_field_spec.js +++ b/spec/frontend/monitoring/components/variables/dropdown_field_spec.js @@ -53,7 +53,7 @@ describe('Custom variable component', () => { expect(findDropdown().exists()).toBe(true); }); - it('changing dropdown items triggers update', async () => { + it('changing dropdown items triggers update', () => { createShallowWrapper(); findDropdownItems().at(1).vm.$emit('click'); diff --git a/spec/frontend/notes/components/note_actions/timeline_event_button_spec.js b/spec/frontend/notes/components/note_actions/timeline_event_button_spec.js index bee08ee0605..7860e9d45da 100644 --- a/spec/frontend/notes/components/note_actions/timeline_event_button_spec.js +++ b/spec/frontend/notes/components/note_actions/timeline_event_button_spec.js @@ -22,7 +22,7 @@ describe('NoteTimelineEventButton', () => { const findTimelineButton = () => wrapper.findComponent(GlButton); - it('emits click-promote-comment-to-event', async () => { + it('emits click-promote-comment-to-event', () => { findTimelineButton().vm.$emit('click'); expect(wrapper.emitted('click-promote-comment-to-event')).toEqual([[emitData]]); diff --git a/spec/frontend/notes/components/note_form_spec.js b/spec/frontend/notes/components/note_form_spec.js index e385c478dd6..d6413d33c99 100644 --- a/spec/frontend/notes/components/note_form_spec.js +++ b/spec/frontend/notes/components/note_form_spec.js @@ -54,7 +54,7 @@ describe('issue_note_form component', () => { expect(wrapper.vm.noteHash).toBe(`#note_${props.noteId}`); }); - it('return note hash as `#` when `noteId` is empty', async () => { + it('return note hash as `#` when `noteId` is empty', () => { createComponentWrapper({ noteId: '', }); @@ -203,7 +203,7 @@ describe('issue_note_form component', () => { expect(wrapper.emitted('cancelForm')).toBeUndefined(); }); - it('should be possible to update the note', async () => { + it('should be possible to update the note', () => { createComponentWrapper(); const textarea = wrapper.find('textarea'); @@ -227,7 +227,7 @@ describe('issue_note_form component', () => { }); }); - it('should be possible to cancel', async () => { + it('should be possible to cancel', () => { findCancelCommentButton().vm.$emit('click'); expect(wrapper.emitted('cancelForm')).toEqual([[true, false]]); @@ -237,7 +237,7 @@ describe('issue_note_form component', () => { expect(wrapper.findComponent(GlFormCheckbox).exists()).toBe(true); }); - it('hides resolve checkbox', async () => { + it('hides resolve checkbox', () => { createComponentWrapper({ isDraft: false, discussion: { @@ -256,7 +256,7 @@ describe('issue_note_form component', () => { expect(wrapper.findComponent(GlFormCheckbox).exists()).toBe(false); }); - it('hides actions for commits', async () => { + it('hides actions for commits', () => { createComponentWrapper({ discussion: { for_commit: true } }); expect(wrapper.find('.note-form-actions').text()).not.toContain('Start a review'); diff --git a/spec/frontend/notes/components/notes_app_spec.js b/spec/frontend/notes/components/notes_app_spec.js index 832264aa7d3..3fe31506223 100644 --- a/spec/frontend/notes/components/notes_app_spec.js +++ b/spec/frontend/notes/components/notes_app_spec.js @@ -174,7 +174,7 @@ describe('note_app', () => { }); describe('while fetching data', () => { - beforeEach(async () => { + beforeEach(() => { wrapper = mountComponent(); }); diff --git a/spec/frontend/notes/deprecated_notes_spec.js b/spec/frontend/notes/deprecated_notes_spec.js index c4a488282a6..355ecb78187 100644 --- a/spec/frontend/notes/deprecated_notes_spec.js +++ b/spec/frontend/notes/deprecated_notes_spec.js @@ -1,9 +1,9 @@ /* eslint-disable import/no-commonjs, no-new */ +import $ from 'jquery'; import MockAdapter from 'axios-mock-adapter'; import htmlPipelineSchedulesEditSnippets from 'test_fixtures/snippets/show.html'; import htmlPipelineSchedulesEditCommit from 'test_fixtures/commit/show.html'; -import $ from 'jquery'; import '~/behaviors/markdown/render_gfm'; import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; import { TEST_HOST } from 'helpers/test_constants'; diff --git a/spec/frontend/notes/stores/actions_spec.js b/spec/frontend/notes/stores/actions_spec.js index 0d3ebea7af2..97249d232dc 100644 --- a/spec/frontend/notes/stores/actions_spec.js +++ b/spec/frontend/notes/stores/actions_spec.js @@ -257,14 +257,14 @@ describe('Actions Notes Store', () => { axiosMock.onGet(notesDataMock.notesPath).reply(HTTP_STATUS_OK, pollResponse, pollHeaders); const failureMock = () => axiosMock.onGet(notesDataMock.notesPath).reply(HTTP_STATUS_INTERNAL_SERVER_ERROR); - const advanceAndRAF = async (time) => { + const advanceAndRAF = (time) => { if (time) { jest.advanceTimersByTime(time); } return waitForPromises(); }; - const advanceXMoreIntervals = async (number) => { + const advanceXMoreIntervals = (number) => { const timeoutLength = pollInterval * number; return advanceAndRAF(timeoutLength); @@ -273,7 +273,7 @@ describe('Actions Notes Store', () => { await store.dispatch('poll'); await advanceAndRAF(2); }; - const cleanUp = async () => { + const cleanUp = () => { jest.clearAllTimers(); return store.dispatch('stopPolling'); diff --git a/spec/frontend/notifications/components/custom_notifications_modal_spec.js b/spec/frontend/notifications/components/custom_notifications_modal_spec.js index 0fbd073191e..480d617fcb2 100644 --- a/spec/frontend/notifications/components/custom_notifications_modal_spec.js +++ b/spec/frontend/notifications/components/custom_notifications_modal_spec.js @@ -103,7 +103,7 @@ describe('CustomNotificationsModal', () => { ${1} | ${'new_note'} | ${'New note'} | ${false} | ${false} `( 'renders a checkbox for "$eventName" with checked=$enabled', - async ({ index, eventName, enabled, loading }) => { + ({ index, eventName, enabled, loading }) => { const checkbox = findCheckboxAt(index); expect(checkbox.text()).toContain(eventName); expect(checkbox.vm.$attrs.checked).toBe(enabled); diff --git a/spec/frontend/observability/index_spec.js b/spec/frontend/observability/index_spec.js index 83f72ff72b5..25eb048c62b 100644 --- a/spec/frontend/observability/index_spec.js +++ b/spec/frontend/observability/index_spec.js @@ -52,7 +52,7 @@ describe('renderObservability', () => { ); }); - it('handle route-update events', async () => { + it('handle route-update events', () => { component.vm.$router.push('/something?foo=bar'); component.vm.$emit('route-update', { url: '/some_path' }); expect(component.vm.$router.currentRoute.path).toBe('/something'); diff --git a/spec/frontend/packages_and_registries/harbor_registry/pages/list_spec.js b/spec/frontend/packages_and_registries/harbor_registry/pages/list_spec.js index 63ea8feb1e7..1bc2657822e 100644 --- a/spec/frontend/packages_and_registries/harbor_registry/pages/list_spec.js +++ b/spec/frontend/packages_and_registries/harbor_registry/pages/list_spec.js @@ -74,7 +74,7 @@ describe('Harbor List Page', () => { }); describe('isLoading is true', () => { - it('shows the skeleton loader', async () => { + it('shows the skeleton loader', () => { mountComponent(); fireFirstSortUpdate(); @@ -93,7 +93,7 @@ describe('Harbor List Page', () => { expect(findCliCommands().exists()).toBe(false); }); - it('title has the metadataLoading props set to true', async () => { + it('title has the metadataLoading props set to true', () => { mountComponent(); fireFirstSortUpdate(); diff --git a/spec/frontend/packages_and_registries/package_registry/components/list/package_list_row_spec.js b/spec/frontend/packages_and_registries/package_registry/components/list/package_list_row_spec.js index 91417d2fc9f..52d222ed07b 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/list/package_list_row_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/components/list/package_list_row_spec.js @@ -132,7 +132,7 @@ describe('packages_list_row', () => { }); }); - it('emits the delete event when the delete button is clicked', async () => { + it('emits the delete event when the delete button is clicked', () => { mountComponent({ packageEntity: packageWithoutTags }); findDeleteDropdown().vm.$emit('click'); diff --git a/spec/frontend/packages_and_registries/package_registry/components/list/packages_search_spec.js b/spec/frontend/packages_and_registries/package_registry/components/list/packages_search_spec.js index 1250ecaf61f..82fa5b76367 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/list/packages_search_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/components/list/packages_search_spec.js @@ -54,7 +54,7 @@ describe('Package Search', () => { expect(findRegistrySearch().exists()).toBe(true); }); - it('registry search is mounted after mount', async () => { + it('registry search is mounted after mount', () => { mountComponent(); expect(findRegistrySearch().exists()).toBe(false); diff --git a/spec/frontend/packages_and_registries/package_registry/pages/details_spec.js b/spec/frontend/packages_and_registries/package_registry/pages/details_spec.js index ecc82b73fed..e1765917035 100644 --- a/spec/frontend/packages_and_registries/package_registry/pages/details_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/pages/details_spec.js @@ -313,7 +313,7 @@ describe('PackagesApp', () => { describe('deleting a file', () => { const [fileToDelete] = packageFiles(); - const doDeleteFile = async () => { + const doDeleteFile = () => { findPackageFiles().vm.$emit('delete-files', [fileToDelete]); findDeleteFileModal().vm.$emit('primary'); @@ -433,7 +433,7 @@ describe('PackagesApp', () => { }); describe('deleting multiple files', () => { - const doDeleteFiles = async () => { + const doDeleteFiles = () => { findPackageFiles().vm.$emit('delete-files', packageFiles()); findDeleteFilesModal().vm.$emit('primary'); @@ -636,7 +636,7 @@ describe('PackagesApp', () => { }); describe('dependency links', () => { - it('does not show the dependency links for a non nuget package', async () => { + it('does not show the dependency links for a non nuget package', () => { createComponent(); expect(findDependenciesCountBadge().exists()).toBe(false); diff --git a/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js b/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js index 6cfc80966b5..d2996bad97c 100644 --- a/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js @@ -85,7 +85,7 @@ describe('PackagesListApp', () => { }); }; - const waitForFirstRequest = async () => { + const waitForFirstRequest = () => { // emit a search update so the query is executed findSearch().vm.$emit('update', { sort: 'NAME_DESC', filters: [] }); return waitForPromises(); diff --git a/spec/frontend/packages_and_registries/settings/group/components/package_settings_spec.js b/spec/frontend/packages_and_registries/settings/group/components/package_settings_spec.js index 22e42f8c0ab..49e76cfbae0 100644 --- a/spec/frontend/packages_and_registries/settings/group/components/package_settings_spec.js +++ b/spec/frontend/packages_and_registries/settings/group/components/package_settings_spec.js @@ -177,7 +177,7 @@ describe('Packages Settings', () => { }); }); - it('renders ExceptionsInput and assigns duplication allowness and exception props', async () => { + it('renders ExceptionsInput and assigns duplication allowness and exception props', () => { mountComponent({ mountFn: mountExtended }); const { genericDuplicatesAllowed, genericDuplicateExceptionRegex } = packageSettings; @@ -192,7 +192,7 @@ describe('Packages Settings', () => { }); }); - it('on update event calls the mutation', async () => { + it('on update event calls the mutation', () => { const mutationResolver = jest.fn().mockResolvedValue(groupPackageSettingsMutationMock()); mountComponent({ mountFn: mountExtended, mutationResolver }); diff --git a/spec/frontend/packages_and_registries/settings/project/settings/components/container_expiration_policy_form_spec.js b/spec/frontend/packages_and_registries/settings/project/settings/components/container_expiration_policy_form_spec.js index 57b48407174..a68087f7f57 100644 --- a/spec/frontend/packages_and_registries/settings/project/settings/components/container_expiration_policy_form_spec.js +++ b/spec/frontend/packages_and_registries/settings/project/settings/components/container_expiration_policy_form_spec.js @@ -46,7 +46,7 @@ describe('Container Expiration Policy Settings Form', () => { const findOlderThanDropdown = () => wrapper.find('[data-testid="older-than-dropdown"]'); const findRemoveRegexInput = () => wrapper.find('[data-testid="remove-regex-input"]'); - const submitForm = async () => { + const submitForm = () => { findForm().trigger('submit'); return waitForPromises(); }; diff --git a/spec/frontend/packages_and_registries/settings/project/settings/components/packages_cleanup_policy_form_spec.js b/spec/frontend/packages_and_registries/settings/project/settings/components/packages_cleanup_policy_form_spec.js index b9c0c38bf9e..50b72d3ad72 100644 --- a/spec/frontend/packages_and_registries/settings/project/settings/components/packages_cleanup_policy_form_spec.js +++ b/spec/frontend/packages_and_registries/settings/project/settings/components/packages_cleanup_policy_form_spec.js @@ -48,7 +48,7 @@ describe('Packages Cleanup Policy Settings Form', () => { wrapper.findByTestId('keep-n-duplicated-package-files-dropdown'); const findNextRunAt = () => wrapper.findByTestId('next-run-at'); - const submitForm = async () => { + const submitForm = () => { findForm().trigger('submit'); return waitForPromises(); }; diff --git a/spec/frontend/packages_and_registries/shared/components/persisted_search_spec.js b/spec/frontend/packages_and_registries/shared/components/persisted_search_spec.js index 1484377a475..c1e86080d29 100644 --- a/spec/frontend/packages_and_registries/shared/components/persisted_search_spec.js +++ b/spec/frontend/packages_and_registries/shared/components/persisted_search_spec.js @@ -51,7 +51,7 @@ describe('Persisted Search', () => { expect(findRegistrySearch().exists()).toBe(true); }); - it('registry search is mounted after mount', async () => { + it('registry search is mounted after mount', () => { mountComponent(); expect(findRegistrySearch().exists()).toBe(false); diff --git a/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js b/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js index a4e0d267023..85b4ca95d5d 100644 --- a/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js +++ b/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js @@ -116,7 +116,7 @@ describe('Registry List', () => { expect(findDeleteSelected().exists()).toBe(false); }); - it('populates the first slot prop correctly', async () => { + it('populates the first slot prop correctly', () => { expect(findScopedSlots().at(0).exists()).toBe(true); // it's the first slot diff --git a/spec/frontend/pages/admin/projects/components/namespace_select_spec.js b/spec/frontend/pages/admin/projects/components/namespace_select_spec.js index 834d14e0fb3..c00dbc0ec02 100644 --- a/spec/frontend/pages/admin/projects/components/namespace_select_spec.js +++ b/spec/frontend/pages/admin/projects/components/namespace_select_spec.js @@ -45,7 +45,7 @@ describe('NamespaceSelect', () => { expect(findNamespaceInput().exists()).toBe(false); }); - it('sets appropriate props', async () => { + it('sets appropriate props', () => { expect(findListbox().props()).toMatchObject({ items: [ { text: 'user: Administrator', value: '10' }, @@ -84,7 +84,7 @@ describe('NamespaceSelect', () => { expect(findNamespaceInput().attributes('value')).toBe(selectId); }); - it('updates the listbox value', async () => { + it('updates the listbox value', () => { expect(findListbox().props()).toMatchObject({ selected: selectId, toggleText: expectToggleText, diff --git a/spec/frontend/pages/import/bitbucket_server/components/bitbucket_server_status_table_spec.js b/spec/frontend/pages/import/bitbucket_server/components/bitbucket_server_status_table_spec.js index b020caa3010..8eab5061e97 100644 --- a/spec/frontend/pages/import/bitbucket_server/components/bitbucket_server_status_table_spec.js +++ b/spec/frontend/pages/import/bitbucket_server/components/bitbucket_server_status_table_spec.js @@ -39,7 +39,7 @@ describe('BitbucketServerStatusTable', () => { expect(wrapper.findComponent(BitbucketStatusTable).exists()).toBe(true); }); - it('renders Reconfigure button', async () => { + it('renders Reconfigure button', () => { createComponent(BitbucketStatusTableStub); expect(findReconfigureButton().attributes().href).toBe('/reconfigure'); expect(findReconfigureButton().text()).toBe('Reconfigure'); diff --git a/spec/frontend/pages/import/bulk_imports/history/components/bulk_imports_history_app_spec.js b/spec/frontend/pages/import/bulk_imports/history/components/bulk_imports_history_app_spec.js index 477511cde64..8a7fc57c409 100644 --- a/spec/frontend/pages/import/bulk_imports/history/components/bulk_imports_history_app_spec.js +++ b/spec/frontend/pages/import/bulk_imports/history/components/bulk_imports_history_app_spec.js @@ -192,7 +192,7 @@ describe('BulkImportsHistoryApp', () => { return axios.waitForAll(); }); - it('renders details button if relevant item has failures', async () => { + it('renders details button if relevant item has failures', () => { expect( extendedWrapper(wrapper.find('tbody').findAll('tr').at(1)).findByText('Details').exists(), ).toBe(true); diff --git a/spec/frontend/pages/import/history/components/import_history_app_spec.js b/spec/frontend/pages/import/history/components/import_history_app_spec.js index bc9762abf86..8e14b5a24f8 100644 --- a/spec/frontend/pages/import/history/components/import_history_app_spec.js +++ b/spec/frontend/pages/import/history/components/import_history_app_spec.js @@ -166,7 +166,7 @@ describe('ImportHistoryApp', () => { return axios.waitForAll(); }); - it('renders details button if relevant item has failed', async () => { + it('renders details button if relevant item has failed', () => { expect( extendedWrapper(wrapper.find('tbody').findAll('tr').at(1)).findByText('Details').exists(), ).toBe(true); diff --git a/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js b/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js index c6ca1b10dc9..ddaa3df71e8 100644 --- a/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js +++ b/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js @@ -304,7 +304,7 @@ describe('WikiForm', () => { expect(findFormat().element.getAttribute('disabled')).toBeDefined(); }); - it('sends tracking event when editor loads', async () => { + it('sends tracking event when editor loads', () => { expect(trackingSpy).toHaveBeenCalledWith(undefined, CONTENT_EDITOR_LOADED_ACTION, { label: WIKI_CONTENT_EDITOR_TRACKING_LABEL, }); @@ -318,7 +318,7 @@ describe('WikiForm', () => { await triggerFormSubmit(); }); - it('triggers tracking events on form submit', async () => { + it('triggers tracking events on form submit', () => { expect(trackingSpy).toHaveBeenCalledWith(undefined, SAVED_USING_CONTENT_EDITOR_ACTION, { label: WIKI_CONTENT_EDITOR_TRACKING_LABEL, }); diff --git a/spec/frontend/performance_bar/components/performance_bar_app_spec.js b/spec/frontend/performance_bar/components/performance_bar_app_spec.js index 0154ad052bd..7a018236314 100644 --- a/spec/frontend/performance_bar/components/performance_bar_app_spec.js +++ b/spec/frontend/performance_bar/components/performance_bar_app_spec.js @@ -4,39 +4,50 @@ import PerformanceBarApp from '~/performance_bar/components/performance_bar_app. import PerformanceBarStore from '~/performance_bar/stores/performance_bar_store'; describe('performance bar app', () => { + let wrapper; const store = new PerformanceBarStore(); store.addRequest('123', 'https://gitlab.com', '', {}, 'GET'); - const wrapper = mount(PerformanceBarApp, { - propsData: { - store, - env: 'development', - requestId: '123', - requestMethod: 'GET', - statsUrl: 'https://log.gprd.gitlab.net/app/dashboards#/view/', - peekUrl: '/-/peek/results', - }, + const createComponent = () => { + wrapper = mount(PerformanceBarApp, { + propsData: { + store, + env: 'development', + requestId: '123', + requestMethod: 'GET', + statsUrl: 'https://log.gprd.gitlab.net/app/dashboards#/view/', + peekUrl: '/-/peek/results', + }, + }); + }; + + beforeEach(() => { + createComponent(); }); - const flamegraphDiv = () => wrapper.find('#peek-flamegraph'); - const flamegrapLinks = () => flamegraphDiv().findAllComponents(GlLink); + describe('flamegraph buttons', () => { + const flamegraphDiv = () => wrapper.find('#peek-flamegraph'); + const flamegraphLinks = () => flamegraphDiv().findAllComponents(GlLink); + + it('creates three flamegraph buttons based on the path', () => { + expect(flamegraphLinks()).toHaveLength(3); + + ['wall', 'cpu', 'object'].forEach((path, index) => { + expect(flamegraphLinks().at(index).attributes('href')).toBe( + `https://gitlab.com?performance_bar=flamegraph&stackprof_mode=${path}`, + ); + }); + }); + }); - it('creates three flamegraph buttons based on the path', () => { - expect(flamegrapLinks()).toHaveLength(3); + describe('memory report button', () => { + const memoryReportDiv = () => wrapper.find('#peek-memory-report'); + const memoryReportLink = () => memoryReportDiv().findComponent(GlLink); - ['wall', 'cpu', 'object'].forEach((path, index) => { - expect(flamegrapLinks().at(index).attributes('href')).toBe( - `https://gitlab.com?performance_bar=flamegraph&stackprof_mode=${path}`, + it('creates memory report button', () => { + expect(memoryReportLink().attributes('href')).toEqual( + 'https://gitlab.com?performance_bar=memory', ); }); - expect(flamegrapLinks().at(0).attributes('href')).toEqual( - 'https://gitlab.com?performance_bar=flamegraph&stackprof_mode=wall', - ); - expect(flamegrapLinks().at(1).attributes('href')).toEqual( - 'https://gitlab.com?performance_bar=flamegraph&stackprof_mode=cpu', - ); - expect(flamegrapLinks().at(2).attributes('href')).toEqual( - 'https://gitlab.com?performance_bar=flamegraph&stackprof_mode=object', - ); }); it('sets the class to match the environment', () => { diff --git a/spec/frontend/pipeline_wizard/components/commit_spec.js b/spec/frontend/pipeline_wizard/components/commit_spec.js index 8f44a6c085b..7095525e948 100644 --- a/spec/frontend/pipeline_wizard/components/commit_spec.js +++ b/spec/frontend/pipeline_wizard/components/commit_spec.js @@ -128,7 +128,7 @@ describe('Pipeline Wizard - Commit Page', () => { await waitForPromises(); }); - it('will not show an error', async () => { + it('will not show an error', () => { expect(wrapper.findByTestId('commit-error').exists()).not.toBe(true); }); @@ -155,7 +155,7 @@ describe('Pipeline Wizard - Commit Page', () => { await waitForPromises(); }); - it('will show an error', async () => { + it('will show an error', () => { expect(wrapper.findByTestId('commit-error').exists()).toBe(true); expect(wrapper.findByTestId('commit-error').text()).toBe(i18n.errors.commitError); }); @@ -236,11 +236,11 @@ describe('Pipeline Wizard - Commit Page', () => { await waitForPromises(); }); - it('sets up without error', async () => { + it('sets up without error', () => { expect(consoleSpy).not.toHaveBeenCalled(); }); - it('does not show a load error', async () => { + it('does not show a load error', () => { expect(wrapper.findByTestId('load-error').exists()).not.toBe(true); }); diff --git a/spec/frontend/pipeline_wizard/components/step_nav_spec.js b/spec/frontend/pipeline_wizard/components/step_nav_spec.js index 8e2f0ab0281..e80eb01ea7a 100644 --- a/spec/frontend/pipeline_wizard/components/step_nav_spec.js +++ b/spec/frontend/pipeline_wizard/components/step_nav_spec.js @@ -25,7 +25,7 @@ describe('Pipeline Wizard - Step Navigation Component', () => { ${'has prev, but not next'} | ${true} | ${false} ${'has next, but not prev'} | ${false} | ${true} ${'has both next and prev'} | ${true} | ${true} - `('$scenario', async ({ showBackButton, showNextButton }) => { + `('$scenario', ({ showBackButton, showNextButton }) => { createComponent({ showBackButton, showNextButton }); expect(prevButton.exists()).toBe(showBackButton); @@ -53,13 +53,13 @@ describe('Pipeline Wizard - Step Navigation Component', () => { expect(wrapper.emitted().next.length).toBe(1); }); - it('enables the next button if nextButtonEnabled ist set to true', async () => { + it('enables the next button if nextButtonEnabled ist set to true', () => { createComponent({ nextButtonEnabled: true }); expect(nextButton.attributes('disabled')).not.toBe('disabled'); }); - it('disables the next button if nextButtonEnabled ist set to false', async () => { + it('disables the next button if nextButtonEnabled ist set to false', () => { createComponent({ nextButtonEnabled: false }); expect(nextButton.attributes('disabled')).toBe('disabled'); diff --git a/spec/frontend/pipeline_wizard/components/step_spec.js b/spec/frontend/pipeline_wizard/components/step_spec.js index 00b57f95ccc..4d5f563228c 100644 --- a/spec/frontend/pipeline_wizard/components/step_spec.js +++ b/spec/frontend/pipeline_wizard/components/step_spec.js @@ -207,7 +207,7 @@ describe('Pipeline Wizard - Step Page', () => { findInputWrappers(); }); - it('injects the template when an input wrapper emits a beforeUpdate:compiled event', async () => { + it('injects the template when an input wrapper emits a beforeUpdate:compiled event', () => { input1.vm.$emit('beforeUpdate:compiled'); expect(wrapper.vm.compiled.toString()).toBe(compiledYamlAfterInitialLoad); diff --git a/spec/frontend/pipeline_wizard/components/widgets/list_spec.js b/spec/frontend/pipeline_wizard/components/widgets/list_spec.js index b0eb7279a94..df8841e6ad3 100644 --- a/spec/frontend/pipeline_wizard/components/widgets/list_spec.js +++ b/spec/frontend/pipeline_wizard/components/widgets/list_spec.js @@ -51,7 +51,7 @@ describe('Pipeline Wizard - List Widget', () => { expect(findGlFormGroup().attributes('labeldescription')).toBe(defaultProps.description); }); - it('sets the input field type attribute to "text"', async () => { + it('sets the input field type attribute to "text"', () => { createComponent(); expect(findFirstGlFormInputGroup().attributes('type')).toBe('text'); @@ -164,7 +164,7 @@ describe('Pipeline Wizard - List Widget', () => { }); describe('form validation', () => { - it('does not show validation state when untouched', async () => { + it('does not show validation state when untouched', () => { createComponent({}, mountExtended); expect(findGlFormGroup().classes()).not.toContain('is-valid'); expect(findGlFormGroup().classes()).not.toContain('is-invalid'); diff --git a/spec/frontend/pipeline_wizard/components/widgets/text_spec.js b/spec/frontend/pipeline_wizard/components/widgets/text_spec.js index a11c0214d15..abfb4a33c0f 100644 --- a/spec/frontend/pipeline_wizard/components/widgets/text_spec.js +++ b/spec/frontend/pipeline_wizard/components/widgets/text_spec.js @@ -123,7 +123,7 @@ describe('Pipeline Wizard - Text Widget', () => { expect(findGlFormGroup().classes()).toContain('is-invalid'); }); - it('does not update validation if not required', async () => { + it('does not update validation if not required', () => { createComponent({ pattern: null, validate: true, diff --git a/spec/frontend/pipeline_wizard/components/wrapper_spec.js b/spec/frontend/pipeline_wizard/components/wrapper_spec.js index 1056602c912..2808fd0c7a5 100644 --- a/spec/frontend/pipeline_wizard/components/wrapper_spec.js +++ b/spec/frontend/pipeline_wizard/components/wrapper_spec.js @@ -82,7 +82,7 @@ describe('Pipeline Wizard - wrapper.vue', () => { expect(wrapper.findByTestId('editor-header').text()).toBe(expectedMessage); }); - it('shows the editor header with a custom filename', async () => { + it('shows the editor header with a custom filename', () => { const filename = 'my-file.yml'; createComponent({ filename, @@ -142,7 +142,7 @@ describe('Pipeline Wizard - wrapper.vue', () => { }); if (expectCommitStepShown) { - it('does not show the step wrapper', async () => { + it('does not show the step wrapper', () => { expect(wrapper.findComponent(WizardStep).isVisible()).toBe(false); }); @@ -150,7 +150,7 @@ describe('Pipeline Wizard - wrapper.vue', () => { expect(wrapper.findComponent(CommitStep).isVisible()).toBe(true); }); } else { - it('passes the correct step config to the step component', async () => { + it('passes the correct step config to the step component', () => { expect(getStepWrapper().props('inputs')).toMatchObject(expectStepDef.inputs); }); @@ -250,7 +250,7 @@ describe('Pipeline Wizard - wrapper.vue', () => { }); describe('integration test', () => { - beforeEach(async () => { + beforeEach(() => { createComponent({}, mountExtended); }); diff --git a/spec/frontend/pipelines/components/dag/dag_spec.js b/spec/frontend/pipelines/components/dag/dag_spec.js index e2dc8120309..5483c1c7b99 100644 --- a/spec/frontend/pipelines/components/dag/dag_spec.js +++ b/spec/frontend/pipelines/components/dag/dag_spec.js @@ -59,7 +59,7 @@ describe('Pipeline DAG graph wrapper', () => { }); }); - it('does not render the graph', async () => { + it('does not render the graph', () => { expect(getGraph().exists()).toBe(false); }); @@ -70,7 +70,7 @@ describe('Pipeline DAG graph wrapper', () => { describe('when all query variables are defined', () => { describe('but the parse fails', () => { - beforeEach(async () => { + beforeEach(() => { createComponent({ graphData: unparseableGraph, }); @@ -88,7 +88,7 @@ describe('Pipeline DAG graph wrapper', () => { }); describe('parse succeeds', () => { - beforeEach(async () => { + beforeEach(() => { createComponent({ method: mount }); }); @@ -102,7 +102,7 @@ describe('Pipeline DAG graph wrapper', () => { }); describe('parse succeeds, but the resulting graph is too small', () => { - beforeEach(async () => { + beforeEach(() => { createComponent({ graphData: tooSmallGraph, }); @@ -120,7 +120,7 @@ describe('Pipeline DAG graph wrapper', () => { }); describe('the returned data is empty', () => { - beforeEach(async () => { + beforeEach(() => { createComponent({ method: mount, graphData: graphWithoutDependencies, @@ -139,7 +139,7 @@ describe('Pipeline DAG graph wrapper', () => { }); describe('annotations', () => { - beforeEach(async () => { + beforeEach(() => { createComponent(); }); diff --git a/spec/frontend/pipelines/components/pipeline_mini_graph/pipeline_stage_spec.js b/spec/frontend/pipelines/components/pipeline_mini_graph/pipeline_stage_spec.js index 864f2d66f60..21d92fec9bf 100644 --- a/spec/frontend/pipelines/components/pipeline_mini_graph/pipeline_stage_spec.js +++ b/spec/frontend/pipelines/components/pipeline_mini_graph/pipeline_stage_spec.js @@ -129,7 +129,7 @@ describe('Pipelines stage component', () => { await axios.waitForAll(); }); - it('renders the received data and emits the correct events', async () => { + it('renders the received data and emits the correct events', () => { expect(findDropdownMenu().text()).toContain(stageReply.latest_statuses[0].name); expect(findDropdownMenuTitle().text()).toContain(stageReply.name); expect(eventHub.$emit).toHaveBeenCalledWith('clickedDropdown'); diff --git a/spec/frontend/pipelines/graph/linked_pipeline_spec.js b/spec/frontend/pipelines/graph/linked_pipeline_spec.js index efe891fa47f..bf92cd585d9 100644 --- a/spec/frontend/pipelines/graph/linked_pipeline_spec.js +++ b/spec/frontend/pipelines/graph/linked_pipeline_spec.js @@ -192,7 +192,7 @@ describe('Linked pipeline', () => { }; describe('when retryable', () => { - beforeEach(async () => { + beforeEach(() => { createComponent({ propsData: retryablePipeline }); }); diff --git a/spec/frontend/pipelines/pipelines_manual_actions_spec.js b/spec/frontend/pipelines/pipelines_manual_actions_spec.js index e9695d57f93..e47e57db887 100644 --- a/spec/frontend/pipelines/pipelines_manual_actions_spec.js +++ b/spec/frontend/pipelines/pipelines_manual_actions_spec.js @@ -73,7 +73,7 @@ describe('Pipeline manual actions', () => { findDropdown().vm.$emit('shown'); }); - it('display loading state while actions are being fetched', async () => { + it('display loading state while actions are being fetched', () => { expect(findAllDropdownItems().at(0).text()).toBe('Loading...'); expect(findLoadingIcon().exists()).toBe(true); expect(findAllDropdownItems()).toHaveLength(1); diff --git a/spec/frontend/pipelines/pipelines_spec.js b/spec/frontend/pipelines/pipelines_spec.js index 48539d84024..44f345fdf4e 100644 --- a/spec/frontend/pipelines/pipelines_spec.js +++ b/spec/frontend/pipelines/pipelines_spec.js @@ -245,7 +245,7 @@ describe('Pipelines', () => { await waitForPromises(); }); - it('should filter pipelines', async () => { + it('should filter pipelines', () => { expect(findPipelinesTable().exists()).toBe(true); expect(findPipelineUrlLinks()).toHaveLength(1); @@ -287,7 +287,7 @@ describe('Pipelines', () => { await waitForPromises(); }); - it('should filter pipelines', async () => { + it('should filter pipelines', () => { expect(findEmptyState().text()).toBe('There are currently no pipelines.'); }); @@ -330,11 +330,11 @@ describe('Pipelines', () => { await waitForPromises(); }); - it('requests data with query params on filter submit', async () => { + it('requests data with query params on filter submit', () => { expect(mock.history.get[1].params).toEqual(expectedParams); }); - it('renders filtered pipelines', async () => { + it('renders filtered pipelines', () => { expect(findPipelineUrlLinks()).toHaveLength(1); expect(findPipelineUrlLinks().at(0).text()).toBe(`#${mockFilteredPipeline.id}`); }); @@ -356,7 +356,7 @@ describe('Pipelines', () => { await waitForPromises(); }); - it('requests data with query params on filter submit', async () => { + it('requests data with query params on filter submit', () => { expect(mock.history.get[1].params).toEqual({ page: '1', scope: 'all' }); }); @@ -516,7 +516,7 @@ describe('Pipelines', () => { expect(findNavigationTabs().exists()).toBe(true); }); - it('is loading after a time', async () => { + it('is loading after a time', () => { expect(findPipelineUrlLinks()).toHaveLength(mockPipelinesIds.length); expect(findPipelineUrlLinks().at(0).text()).toBe(`#${mockPipelinesIds[0]}`); expect(findPipelineUrlLinks().at(1).text()).toBe(`#${mockPipelinesIds[1]}`); @@ -727,7 +727,7 @@ describe('Pipelines', () => { }); describe('when pipelines cannot be loaded', () => { - beforeEach(async () => { + beforeEach(() => { mock.onGet(mockPipelinesEndpoint).reply(HTTP_STATUS_INTERNAL_SERVER_ERROR, {}); }); diff --git a/spec/frontend/profile/account/components/update_username_spec.js b/spec/frontend/profile/account/components/update_username_spec.js index d922820601e..3cb9cf3622a 100644 --- a/spec/frontend/profile/account/components/update_username_spec.js +++ b/spec/frontend/profile/account/components/update_username_spec.js @@ -93,7 +93,7 @@ describe('UpdateUsername component', () => { await findNewUsernameInput().setValue(newUsername); }); - it('confirmation modal contains proper header and body', async () => { + it('confirmation modal contains proper header and body', () => { const { modal } = findElements(); expect(modal.props('title')).toBe('Change username?'); diff --git a/spec/frontend/projects/commit/components/branches_dropdown_spec.js b/spec/frontend/projects/commit/components/branches_dropdown_spec.js index 5210abe154d..bff40c2bc39 100644 --- a/spec/frontend/projects/commit/components/branches_dropdown_spec.js +++ b/spec/frontend/projects/commit/components/branches_dropdown_spec.js @@ -59,7 +59,7 @@ describe('BranchesDropdown', () => { }); describe('Selecting Dropdown Item', () => { - it('emits event', async () => { + it('emits event', () => { findDropdown().vm.$emit('select', '_anything_'); expect(wrapper.emitted()).toHaveProperty('input'); diff --git a/spec/frontend/projects/commit/components/form_modal_spec.js b/spec/frontend/projects/commit/components/form_modal_spec.js index ed57188dea2..d40e2d7a48c 100644 --- a/spec/frontend/projects/commit/components/form_modal_spec.js +++ b/spec/frontend/projects/commit/components/form_modal_spec.js @@ -148,7 +148,7 @@ describe('CommitFormModal', () => { createComponent({ method: mountExtended }); }); - it('Action primary button dispatches submit action', async () => { + it('Action primary button dispatches submit action', () => { getByText(mockData.modalPropsData.i18n.actionPrimaryText).trigger('click'); expect(wrapper.vm.$refs.form.$el.submit).toHaveBeenCalled(); diff --git a/spec/frontend/projects/new/components/new_project_url_select_spec.js b/spec/frontend/projects/new/components/new_project_url_select_spec.js index fa720f4487c..ceac4435282 100644 --- a/spec/frontend/projects/new/components/new_project_url_select_spec.js +++ b/spec/frontend/projects/new/components/new_project_url_select_spec.js @@ -247,7 +247,7 @@ describe('NewProjectUrlSelect component', () => { eventHub.$emit('select-template', getIdFromGraphQLId(id), fullPath); }); - it('filters the dropdown items to the selected group and children', async () => { + it('filters the dropdown items to the selected group and children', () => { const listItems = wrapper.findAll('li'); expect(listItems).toHaveLength(3); diff --git a/spec/frontend/projects/settings/components/transfer_project_form_spec.js b/spec/frontend/projects/settings/components/transfer_project_form_spec.js index d8c2cf83f38..a92ac1bed9d 100644 --- a/spec/frontend/projects/settings/components/transfer_project_form_spec.js +++ b/spec/frontend/projects/settings/components/transfer_project_form_spec.js @@ -64,17 +64,17 @@ describe('Transfer project form', () => { expect(findTransferLocations().props('value')).toEqual(selectedItem); }); - it('emits the `selectTransferLocation` event when a namespace is selected', async () => { + it('emits the `selectTransferLocation` event when a namespace is selected', () => { const args = [selectedItem.id]; expect(wrapper.emitted('selectTransferLocation')).toEqual([args]); }); - it('enables the confirm button', async () => { + it('enables the confirm button', () => { expect(findConfirmDanger().attributes('disabled')).toBeUndefined(); }); - it('clicking the confirm button emits the `confirm` event', async () => { + it('clicking the confirm button emits the `confirm` event', () => { findConfirmDanger().vm.$emit('confirm'); expect(wrapper.emitted('confirm')).toBeDefined(); diff --git a/spec/frontend/projects/settings/topics/components/topics_token_selector_spec.js b/spec/frontend/projects/settings/topics/components/topics_token_selector_spec.js index 4b94c179f74..b2c03352cdc 100644 --- a/spec/frontend/projects/settings/topics/components/topics_token_selector_spec.js +++ b/spec/frontend/projects/settings/topics/components/topics_token_selector_spec.js @@ -83,7 +83,7 @@ describe('TopicsTokenSelector', () => { }); }); - it('passes topic title to the avatar', async () => { + it('passes topic title to the avatar', () => { createComponent(); const avatars = findAllAvatars(); diff --git a/spec/frontend/projects/settings_service_desk/components/service_desk_root_spec.js b/spec/frontend/projects/settings_service_desk/components/service_desk_root_spec.js index 4d0d2191176..acf15fc5b11 100644 --- a/spec/frontend/projects/settings_service_desk/components/service_desk_root_spec.js +++ b/spec/frontend/projects/settings_service_desk/components/service_desk_root_spec.js @@ -147,7 +147,7 @@ describe('ServiceDeskRoot', () => { await waitForPromises(); }); - it('sends a request to update template', async () => { + it('sends a request to update template', () => { expect(spy).toHaveBeenCalledWith(provideData.endpoint, { issue_template_key: 'Bug', outgoing_name: 'GitLab Support Bot', diff --git a/spec/frontend/protected_branches/protected_branch_edit_spec.js b/spec/frontend/protected_branches/protected_branch_edit_spec.js index 4141d000a1c..e1966908452 100644 --- a/spec/frontend/protected_branches/protected_branch_edit_spec.js +++ b/spec/frontend/protected_branches/protected_branch_edit_spec.js @@ -115,7 +115,7 @@ describe('ProtectedBranchEdit', () => { }); describe('when clicked', () => { - beforeEach(async () => { + beforeEach(() => { mock .onPatch(TEST_URL, { protected_branch: { [patchParam]: true } }) .replyOnce(HTTP_STATUS_OK, {}); diff --git a/spec/frontend/vue_merge_request_widget/mr_widget_options_spec.js b/spec/frontend/vue_merge_request_widget/mr_widget_options_spec.js index dfc2ee8e13c..413ce0a930a 100644 --- a/spec/frontend/vue_merge_request_widget/mr_widget_options_spec.js +++ b/spec/frontend/vue_merge_request_widget/mr_widget_options_spec.js @@ -470,15 +470,15 @@ describe('MrWidgetOptions', () => { }); it('should call setFavicon method', async () => { - wrapper.vm.mr.ciStatusFaviconPath = overlayDataUrl; + wrapper.vm.mr.faviconOverlayPath = overlayDataUrl; await wrapper.vm.setFaviconHelper(); expect(setFaviconOverlay).toHaveBeenCalledWith(overlayDataUrl); }); - it('should not call setFavicon when there is no ciStatusFaviconPath', async () => { - wrapper.vm.mr.ciStatusFaviconPath = null; + it('should not call setFavicon when there is no faviconOverlayPath', async () => { + wrapper.vm.mr.faviconOverlayPath = null; await wrapper.vm.setFaviconHelper(); expect(faviconElement.getAttribute('href')).toEqual(null); }); diff --git a/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js b/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js index 8ecab5cc043..79ca6203459 100644 --- a/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js +++ b/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js @@ -1,5 +1,6 @@ import { GlSkeletonLoader, GlIcon } from '@gitlab/ui'; -import { loadHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; +import mrDiffCommentFixture from 'test_fixtures/merge_requests/diff_comment.html'; +import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; import { sprintf } from '~/locale'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import { AVAILABILITY_STATUS } from '~/set_status_modal/constants'; @@ -41,12 +42,10 @@ const DEFAULT_PROPS = { }; describe('User Popover Component', () => { - const fixtureTemplate = 'merge_requests/diff_comment.html'; - let wrapper; beforeEach(() => { - loadHTMLFixture(fixtureTemplate); + setHTMLFixture(mrDiffCommentFixture); gon.features = {}; }); diff --git a/spec/helpers/merge_requests_helper_spec.rb b/spec/helpers/merge_requests_helper_spec.rb index 6b43e97a0b4..3a06e7ad089 100644 --- a/spec/helpers/merge_requests_helper_spec.rb +++ b/spec/helpers/merge_requests_helper_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe MergeRequestsHelper, feature_category: :code_review_workflow do include ProjectForksHelper + include IconsHelper describe '#format_mr_branch_names' do describe 'within the same project' do @@ -28,7 +29,7 @@ RSpec.describe MergeRequestsHelper, feature_category: :code_review_workflow do end describe '#merge_path_description' do - let(:project) { create(:project) } + let_it_be(:project) { create(:project) } let(:forked_project) { fork_project(project) } let(:merge_request_forked) { create(:merge_request, source_project: forked_project, target_project: project) } let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } @@ -150,4 +151,27 @@ RSpec.describe MergeRequestsHelper, feature_category: :code_review_workflow do end end end + + describe '#merge_request_source_branch' do + let_it_be(:project) { create(:project) } + let(:forked_project) { fork_project(project) } + let(:merge_request_forked) { create(:merge_request, source_project: forked_project, target_project: project) } + let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + + context 'when merge request is a fork' do + subject { merge_request_source_branch(merge_request_forked) } + + it 'does show the fork icon' do + expect(subject).to match(/fork/) + end + end + + context 'when merge request is not a fork' do + subject { merge_request_source_branch(merge_request) } + + it 'does not show the fork icon' do + expect(subject).not_to match(/fork/) + end + end + end end diff --git a/spec/lib/gitlab/favicon_spec.rb b/spec/lib/gitlab/favicon_spec.rb index 884425dab3b..033fa5d1b42 100644 --- a/spec/lib/gitlab/favicon_spec.rb +++ b/spec/lib/gitlab/favicon_spec.rb @@ -40,14 +40,22 @@ RSpec.describe Gitlab::Favicon, :request_store do end end - describe '.status_overlay' do - subject { described_class.status_overlay('favicon_status_created') } + describe '.ci_status_overlay' do + subject { described_class.ci_status_overlay('favicon_status_created') } it 'returns the overlay for the status' do expect(subject).to match_asset_path '/assets/ci_favicons/favicon_status_created.png' end end + describe '.mr_status_overlay' do + subject { described_class.mr_status_overlay('favicon_status_merged') } + + it 'returns the overlay for the status' do + expect(subject).to match_asset_path '/assets/mr_favicons/favicon_status_merged.png' + end + end + describe '.available_status_names' do subject { described_class.available_status_names } diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 263db8e58c7..ee1410ade91 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -444,6 +444,16 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep, feature_category: end end + describe '.preload_pipeline_metadata' do + let_it_be(:pipeline) { create(:ci_empty_pipeline, project: project, user: user, name: 'Chatops pipeline') } + + it 'loads associations' do + result = described_class.preload_pipeline_metadata.first + + expect(result.association(:pipeline_metadata).loaded?).to be(true) + end + end + describe '.ci_sources' do subject { described_class.ci_sources } diff --git a/spec/requests/api/ci/pipelines_spec.rb b/spec/requests/api/ci/pipelines_spec.rb index 4e81a052ecf..9660778bc91 100644 --- a/spec/requests/api/ci/pipelines_spec.rb +++ b/spec/requests/api/ci/pipelines_spec.rb @@ -14,7 +14,7 @@ RSpec.describe API::Ci::Pipelines, feature_category: :continuous_integration do let_it_be(:pipeline) do create(:ci_empty_pipeline, project: project, sha: project.commit.id, - ref: project.default_branch, user: user) + ref: project.default_branch, user: user, name: 'Build pipeline') end before do @@ -41,10 +41,46 @@ RSpec.describe API::Ci::Pipelines, feature_category: :continuous_integration do it 'includes pipeline source' do get api("/projects/#{project.id}/pipelines", user) - expect(json_response.first.keys).to contain_exactly(*%w[id iid project_id sha ref status web_url created_at updated_at source]) + expect(json_response.first.keys).to contain_exactly(*%w[id iid project_id sha ref status web_url created_at updated_at source name]) + end + + context 'when pipeline_name_in_api feature flag is off' do + before do + stub_feature_flags(pipeline_name_in_api: false) + end + + it 'does not include pipeline name in response and ignores name parameter' do + get api("/projects/#{project.id}/pipelines", user), params: { name: 'Chatops pipeline' } + + expect(json_response.length).to eq(1) + expect(json_response.first.keys).not_to include('name') + end end end + it 'avoids N+1 queries' do + # Call to trigger any one time queries + get api("/projects/#{project.id}/pipelines", user), params: {} + + control = ActiveRecord::QueryRecorder.new(skip_cached: false) do + get api("/projects/#{project.id}/pipelines", user), params: {} + end + + 3.times do + create( + :ci_empty_pipeline, + project: project, + sha: project.commit.id, + ref: project.default_branch, + user: user, + name: 'Build pipeline') + end + + expect do + get api("/projects/#{project.id}/pipelines", user), params: {} + end.not_to exceed_all_query_limit(control) + end + context 'when parameter is passed' do %w[running pending].each do |target| context "when scope is #{target}" do @@ -303,6 +339,19 @@ RSpec.describe API::Ci::Pipelines, feature_category: :continuous_integration do end end end + + context 'when name is provided' do + let_it_be(:pipeline2) { create(:ci_empty_pipeline, project: project, user: user, name: 'Chatops pipeline') } + + it 'filters by name' do + get api("/projects/#{project.id}/pipelines", user), params: { name: 'Build pipeline' } + + expect(response).to have_gitlab_http_status(:ok) + expect(response).to include_pagination_headers + expect(json_response.length).to eq(1) + expect(json_response.first['name']).to eq('Build pipeline') + end + end end end diff --git a/spec/serializers/merge_request_poll_cached_widget_entity_spec.rb b/spec/serializers/merge_request_poll_cached_widget_entity_spec.rb index c81df90505d..458d9ecd916 100644 --- a/spec/serializers/merge_request_poll_cached_widget_entity_spec.rb +++ b/spec/serializers/merge_request_poll_cached_widget_entity_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MergeRequestPollCachedWidgetEntity do +RSpec.describe MergeRequestPollCachedWidgetEntity, feature_category: :code_review_workflow do using RSpec::Parameterized::TableSyntax let_it_be(:project, refind: true) { create :project, :repository } @@ -331,4 +331,39 @@ RSpec.describe MergeRequestPollCachedWidgetEntity do end end end + + describe 'favicon overlay path' do + context 'when merged' do + before do + resource.mark_as_merged! + resource.metrics.update!(merged_by: user) + end + + it 'returns merged favicon overlay' do + expect(subject[:favicon_overlay_path]).to match_asset_path('/assets/mr_favicons/favicon_status_merged.png') + end + + context 'with pipeline' do + let_it_be(:pipeline) { create(:ci_empty_pipeline, project: project, ref: resource.source_branch, sha: resource.source_branch_sha, head_pipeline_of: resource) } + + it 'returns merged favicon overlay' do + expect(subject[:favicon_overlay_path]).to match_asset_path('/assets/mr_favicons/favicon_status_merged.png') + end + end + end + + context 'when not merged' do + it 'returns no favicon overlay' do + expect(subject[:favicon_overlay_path]).to be_nil + end + + context 'with pipeline' do + let_it_be(:pipeline) { create(:ci_empty_pipeline, project: project, ref: resource.source_branch, sha: resource.source_branch_sha, head_pipeline_of: resource) } + + it 'returns pipeline favicon overlay' do + expect(subject[:favicon_overlay_path]).to match_asset_path('/assets/ci_favicons/favicon_status_pending.png') + end + end + end + end end diff --git a/spec/services/ci/retry_job_service_spec.rb b/spec/services/ci/retry_job_service_spec.rb index 398aa674555..fed66bc535d 100644 --- a/spec/services/ci/retry_job_service_spec.rb +++ b/spec/services/ci/retry_job_service_spec.rb @@ -354,17 +354,7 @@ RSpec.describe Ci::RetryJobService, feature_category: :continuous_integration do include_context 'retryable build' - context 'when retry_job_start_pipeline_after_commit is enabled' do - it_behaves_like 'retries the job' - end - - context 'when retry_job_start_pipeline_after_commit is disabled' do - before do - stub_feature_flags(retry_job_start_pipeline_after_commit: false) - end - - it_behaves_like 'retries the job' - end + it_behaves_like 'retries the job' context 'automatic retryable build' do let!(:auto_retryable_build) do @@ -375,22 +365,9 @@ RSpec.describe Ci::RetryJobService, feature_category: :continuous_integration do auto_retryable_build.drop_with_exit_code!('test failure', 1) end - context 'when retry_job_start_pipeline_after_commit is enabled' do - it 'creates a new build and enqueues BuildQueueWorker' do - expect { drop_build! }.to change { Ci::Build.count }.by(1) - .and change { BuildQueueWorker.jobs.count }.by(1) - end - end - - context 'when retry_job_start_pipeline_after_commit is disabled' do - before do - stub_feature_flags(retry_job_start_pipeline_after_commit: false) - end - - it 'creates a new build but does not enqueue BuildQueueWorker' do - expect { drop_build! }.to change { Ci::Build.count }.by(1) - .and change { BuildQueueWorker.jobs.count }.by(0) - end + it 'creates a new build and enqueues BuildQueueWorker' do + expect { drop_build! }.to change { Ci::Build.count }.by(1) + .and change { BuildQueueWorker.jobs.count }.by(1) end end diff --git a/spec/support/rspec_order_todo.yml b/spec/support/rspec_order_todo.yml index 03c35e5774d..393f084ee97 100644 --- a/spec/support/rspec_order_todo.yml +++ b/spec/support/rspec_order_todo.yml @@ -494,7 +494,6 @@ - './ee/spec/features/trial_registrations/company_information_spec.rb' - './ee/spec/features/trial_registrations/signin_spec.rb' - './ee/spec/features/trial_registrations/signup_spec.rb' -- './ee/spec/features/trials/select_namespace_spec.rb' - './ee/spec/features/trials/show_trial_banner_spec.rb' - './ee/spec/features/users/arkose_labs_csp_spec.rb' - './ee/spec/features/users/login_spec.rb' -- cgit v1.2.1