diff --git a/app/assets/javascripts/work_items/components/work_item_attributes_wrapper.vue b/app/assets/javascripts/work_items/components/work_item_attributes_wrapper.vue index e5e42998efdb9c87842160b3e3891adb4bf90277..3c82a31d5aad9083923151447641bfbad76ca5f4 100644 --- a/app/assets/javascripts/work_items/components/work_item_attributes_wrapper.vue +++ b/app/assets/javascripts/work_items/components/work_item_attributes_wrapper.vue @@ -17,50 +17,30 @@ import { WIDGET_TYPE_COLOR, WORK_ITEM_TYPE_VALUE_EPIC, } from '../constants'; -import WorkItemAssigneesInline from './work_item_assignees_inline.vue'; import WorkItemAssigneesWithEdit from './work_item_assignees_with_edit.vue'; -import WorkItemDueDateInline from './work_item_due_date_inline.vue'; import WorkItemDueDateWithEdit from './work_item_due_date_with_edit.vue'; -import WorkItemLabelsInline from './work_item_labels_inline.vue'; import WorkItemLabelsWithEdit from './work_item_labels_with_edit.vue'; -import WorkItemMilestoneInline from './work_item_milestone_inline.vue'; import WorkItemMilestoneWithEdit from './work_item_milestone_with_edit.vue'; -import WorkItemParentInline from './work_item_parent_inline.vue'; import WorkItemParent from './work_item_parent_with_edit.vue'; import WorkItemTimeTracking from './work_item_time_tracking.vue'; export default { components: { Participants, - WorkItemLabelsInline, WorkItemLabelsWithEdit, - WorkItemMilestoneInline, WorkItemMilestoneWithEdit, - WorkItemAssigneesInline, WorkItemAssigneesWithEdit, - WorkItemDueDateInline, WorkItemDueDateWithEdit, WorkItemParent, - WorkItemParentInline, WorkItemTimeTracking, - WorkItemWeightInline: () => - import('ee_component/work_items/components/work_item_weight_inline.vue'), WorkItemWeight: () => import('ee_component/work_items/components/work_item_weight_with_edit.vue'), - WorkItemProgressInline: () => - import('ee_component/work_items/components/work_item_progress_inline.vue'), WorkItemProgressWithEdit: () => import('ee_component/work_items/components/work_item_progress_with_edit.vue'), - WorkItemIterationInline: () => - import('ee_component/work_items/components/work_item_iteration_inline.vue'), WorkItemIteration: () => import('ee_component/work_items/components/work_item_iteration_with_edit.vue'), WorkItemHealthStatus: () => import('ee_component/work_items/components/work_item_health_status_with_edit.vue'), - WorkItemHealthStatusInline: () => - import('ee_component/work_items/components/work_item_health_status_inline.vue'), - WorkItemColorInline: () => - import('ee_component/work_items/components/work_item_color_inline.vue'), WorkItemColorWithEdit: () => import('ee_component/work_items/components/work_item_color_with_edit.vue'), WorkItemRolledupDates: () => @@ -140,9 +120,6 @@ export default { workItemAuthor() { return this.workItem?.author; }, - workItemsBetaFeaturesEnabled() { - return this.glFeatures.workItemsBeta; - }, }, methods: { isWidgetPresent(type) { @@ -156,7 +133,6 @@ export default { <div class="work-item-attributes-wrapper"> <template v-if="workItemAssignees"> <work-item-assignees-with-edit - v-if="workItemsBetaFeaturesEnabled" class="gl-mb-5" :can-update="canUpdate" :full-path="fullPath" @@ -169,21 +145,9 @@ export default { :can-invite-members="workItemAssignees.canInviteMembers" @error="$emit('error', $event)" /> - <work-item-assignees-inline - v-else - :can-update="canUpdate" - :full-path="fullPath" - :work-item-id="workItem.id" - :assignees="workItemAssignees.assignees.nodes" - :allows-multiple-assignees="workItemAssignees.allowsMultipleAssignees" - :work-item-type="workItemType" - :can-invite-members="workItemAssignees.canInviteMembers" - @error="$emit('error', $event)" - /> </template> <template v-if="workItemLabels"> <work-item-labels-with-edit - v-if="workItemsBetaFeaturesEnabled" class="gl-mb-5" :can-update="canUpdate" :full-path="fullPath" @@ -192,28 +156,9 @@ export default { :work-item-type="workItemType" @error="$emit('error', $event)" /> - <work-item-labels-inline - v-else - :can-update="canUpdate" - :full-path="fullPath" - :work-item-id="workItem.id" - :work-item-iid="workItem.iid" - @error="$emit('error', $event)" - /> </template> <template v-if="workItemWeight"> <work-item-weight - v-if="workItemsBetaFeaturesEnabled" - class="gl-mb-5" - :can-update="canUpdate" - :weight="workItemWeight.weight" - :work-item-id="workItem.id" - :work-item-iid="workItem.iid" - :work-item-type="workItemType" - @error="$emit('error', $event)" - /> - <work-item-weight-inline - v-else class="gl-mb-5" :can-update="canUpdate" :weight="workItemWeight.weight" @@ -239,17 +184,6 @@ export default { </template> <template v-if="workItemMilestone"> <work-item-milestone-with-edit - v-if="workItemsBetaFeaturesEnabled" - class="gl-mb-5" - :full-path="fullPath" - :work-item-id="workItem.id" - :work-item-milestone="workItemMilestone.milestone" - :work-item-type="workItemType" - :can-update="canUpdate" - @error="$emit('error', $event)" - /> - <work-item-milestone-inline - v-else class="gl-mb-5" :full-path="fullPath" :work-item-id="workItem.id" @@ -261,18 +195,6 @@ export default { </template> <template v-if="workItemIteration"> <work-item-iteration - v-if="workItemsBetaFeaturesEnabled" - class="gl-mb-5" - :full-path="fullPath" - :iteration="workItemIteration.iteration" - :can-update="canUpdate" - :work-item-id="workItem.id" - :work-item-iid="workItem.iid" - :work-item-type="workItemType" - @error="$emit('error', $event)" - /> - <work-item-iteration-inline - v-else class="gl-mb-5" :full-path="fullPath" :iteration="workItemIteration.iteration" @@ -285,7 +207,6 @@ export default { </template> <template v-if="workItemDueDate && !showRolledupDates"> <work-item-due-date-with-edit - v-if="workItemsBetaFeaturesEnabled" :can-update="canUpdate" :due-date="workItemDueDate.dueDate" :start-date="workItemDueDate.startDate" @@ -293,28 +214,9 @@ export default { :work-item="workItem" @error="$emit('error', $event)" /> - <work-item-due-date-inline - v-else - :can-update="canUpdate" - :due-date="workItemDueDate.dueDate" - :start-date="workItemDueDate.startDate" - :work-item-id="workItem.id" - :work-item-type="workItemType" - @error="$emit('error', $event)" - /> </template> <template v-if="workItemProgress"> <work-item-progress-with-edit - v-if="workItemsBetaFeaturesEnabled" - class="gl-mb-5" - :can-update="canUpdate" - :progress="workItemProgress.progress" - :work-item-id="workItem.id" - :work-item-type="workItemType" - @error="$emit('error', $event)" - /> - <work-item-progress-inline - v-else class="gl-mb-5" :can-update="canUpdate" :progress="workItemProgress.progress" @@ -325,17 +227,6 @@ export default { </template> <template v-if="workItemHealthStatus"> <work-item-health-status - v-if="workItemsBetaFeaturesEnabled" - class="gl-mb-5" - :health-status="workItemHealthStatus.healthStatus" - :can-update="canUpdate" - :work-item-id="workItem.id" - :work-item-iid="workItem.iid" - :work-item-type="workItemType" - @error="$emit('error', $event)" - /> - <work-item-health-status-inline - v-else class="gl-mb-5" :health-status="workItemHealthStatus.healthStatus" :can-update="canUpdate" @@ -347,14 +238,6 @@ export default { </template> <template v-if="workItemColor"> <work-item-color-with-edit - v-if="workItemsBetaFeaturesEnabled" - class="gl-mb-5" - :work-item="workItem" - :can-update="canUpdate" - @error="$emit('error', $event)" - /> - <work-item-color-inline - v-else class="gl-mb-5" :work-item="workItem" :can-update="canUpdate" @@ -363,7 +246,6 @@ export default { </template> <template v-if="workItemHierarchy"> <work-item-parent - v-if="workItemsBetaFeaturesEnabled" class="gl-mb-5 gl-pt-5 gl-border-t gl-border-gray-50" :can-update="canUpdate" :work-item-id="workItem.id" @@ -371,24 +253,15 @@ export default { :parent="workItemParent" @error="$emit('error', $event)" /> - <work-item-parent-inline - v-else - class="gl-mb-5" - :can-update="canUpdate" - :work-item-id="workItem.id" - :work-item-type="workItemType" - :parent="workItemParent" - @error="$emit('error', $event)" - /> </template> <work-item-time-tracking - v-if="workItemTimeTracking && workItemsBetaFeaturesEnabled" + v-if="workItemTimeTracking" class="gl-mb-5 gl-pt-5 gl-border-t gl-border-gray-50" :time-estimate="workItemTimeTracking.timeEstimate" :total-time-spent="workItemTimeTracking.totalTimeSpent" /> <participants - v-if="workItemParticipants && workItemsBetaFeaturesEnabled" + v-if="workItemParticipants" class="gl-mb-5 gl-pt-5 gl-border-t gl-border-gray-50" :number-of-less-participants="10" :participants="workItemParticipants.participants.nodes" diff --git a/app/assets/javascripts/work_items/components/work_item_detail.vue b/app/assets/javascripts/work_items/components/work_item_detail.vue index 0f6b7cdb9fa2e6b284a42a3d1dfa1ec71d4f3eb6..6d081a74453f45cbc4e86b941a9a218eb3aeb76e 100644 --- a/app/assets/javascripts/work_items/components/work_item_detail.vue +++ b/app/assets/javascripts/work_items/components/work_item_detail.vue @@ -35,7 +35,6 @@ import WorkItemTree from './work_item_links/work_item_tree.vue'; import WorkItemActions from './work_item_actions.vue'; import WorkItemTodos from './work_item_todos.vue'; import WorkItemNotificationsWidget from './work_item_notifications_widget.vue'; -import WorkItemTitle from './work_item_title.vue'; import WorkItemAttributesWrapper from './work_item_attributes_wrapper.vue'; import WorkItemCreatedUpdated from './work_item_created_updated.vue'; import WorkItemDescription from './work_item_description.vue'; @@ -64,7 +63,6 @@ export default { WorkItemCreatedUpdated, WorkItemDescription, WorkItemAwardEmoji, - WorkItemTitle, WorkItemAttributesWrapper, WorkItemTree, WorkItemNotes, @@ -235,7 +233,7 @@ export default { }; }, showIntersectionObserver() { - return !this.isModal && this.workItemsBetaEnabled && !this.editMode; + return !this.isModal && !this.editMode; }, hasLinkedWorkItems() { return this.glFeatures.linkedWorkItems; @@ -267,10 +265,7 @@ export default { }; }, shouldShowEditButton() { - return this.workItemsBetaEnabled && !this.editMode && this.canUpdate; - }, - workItemsBetaEnabled() { - return this.glFeatures.workItemsBeta; + return !this.editMode && this.canUpdate; }, }, mounted() { @@ -429,9 +424,7 @@ export default { </gl-alert> </section> <section :class="workItemBodyClass"> - <div v-if="workItemLoading"> - <work-item-loading :two-column-view="workItemsBetaEnabled" /> - </div> + <work-item-loading v-if="workItemLoading" /> <template v-else> <div class="gl-sm-display-none! gl-display-flex"> <gl-button @@ -454,20 +447,12 @@ export default { data-testid="work-item-type" > <work-item-title-with-edit - v-if="workItem.title && workItemsBetaEnabled" + v-if="workItem.title" ref="title" :is-editing="editMode" :title="workItem.title" @updateWorkItem="updateWorkItem" @updateDraft="updateDraft('title', $event)" - /> - <work-item-title - v-else-if="workItem.title" - ref="title" - :work-item-id="workItem.id" - :work-item-title="workItem.title" - :work-item-type="workItemType" - :can-update="canUpdate" @error="updateError = $event" /> </div> @@ -531,25 +516,15 @@ export default { </div> <div> <work-item-title-with-edit - v-if="workItem.title && workItemsBetaEnabled && parentWorkItem" + v-if="workItem.title && parentWorkItem" ref="title" :is-editing="editMode" :class="titleClassComponent" :title="workItem.title" + @error="updateError = $event" @updateWorkItem="updateWorkItem" @updateDraft="updateDraft('title', $event)" /> - <work-item-title - v-else-if="workItem.title && parentWorkItem" - ref="title" - :class="titleClassComponent" - :work-item-id="workItem.id" - :work-item-title="workItem.title" - :work-item-type="workItemType" - :can-update="canUpdate" - :use-h1="!isModal" - @error="updateError = $event" - /> <work-item-created-updated v-if="!editMode" :full-path="fullPath" @@ -575,23 +550,11 @@ export default { @error="updateError = $event" @promotedToObjective="$emit('promotedToObjective', workItemIid)" /> - <div - data-testid="work-item-overview" - :class="{ 'work-item-overview': workItemsBetaEnabled }" - > + <div data-testid="work-item-overview" class="work-item-overview"> <section> - <work-item-attributes-wrapper - v-if="!workItemsBetaEnabled" - :class="{ 'gl-md-display-none!': workItemsBetaEnabled }" - class="gl-border-b" - :full-path="fullPath" - :work-item="workItem" - @error="updateError = $event" - /> <work-item-description v-if="hasDescriptionWidget" - :class="workItemsBetaEnabled ? '' : 'gl-pt-5'" - :disable-inline-editing="workItemsBetaEnabled" + disable-inline-editing :edit-mode="editMode" :full-path="fullPath" :work-item-id="workItem.id" @@ -613,7 +576,6 @@ export default { /> </section> <aside - v-if="workItemsBetaEnabled" data-testid="work-item-overview-right-sidebar" class="work-item-overview-right-sidebar" :class="{ 'is-modal': isModal }" diff --git a/app/assets/javascripts/work_items/components/work_item_loading.vue b/app/assets/javascripts/work_items/components/work_item_loading.vue index 23e24daf445637d7ff0f1f693346df5f0bf084d4..d14b654df70b4860350cbdd93746a538cc89af12 100644 --- a/app/assets/javascripts/work_items/components/work_item_loading.vue +++ b/app/assets/javascripts/work_items/components/work_item_loading.vue @@ -13,18 +13,11 @@ export default { components: { GlSkeletonLoader, }, - props: { - twoColumnView: { - type: Boolean, - required: false, - default: false, - }, - }, }; </script> <template> - <div v-if="twoColumnView" class="work-item-overview" data-testid="work-item-two-column-loading"> + <div class="work-item-overview" data-testid="work-item-two-column-loading"> <section> <gl-skeleton-loader :height="60" :width="600" data-testid="work-title-and-meta-loading"> <!--- START work item title --> @@ -124,12 +117,4 @@ export default { </aside> <!--- END work item attributes wrapper md/lg screens --> </div> - <div v-else data-testid="work-item-single-column-loading" class="gl-max-w-26 gl-py-5"> - <!--- START work item loading original loader --> - <gl-skeleton-loader :height="65" :width="240"> - <rect width="240" height="20" x="5" y="0" rx="4" /> - <rect width="100" height="20" x="5" y="45" rx="4" /> - </gl-skeleton-loader> - <!--- END work item loading original loader --> - </div> </template> diff --git a/ee/spec/features/projects/work_items/okr_spec.rb b/ee/spec/features/projects/work_items/okr_spec.rb index 4bc382f1744f977990c199c045a319de427ddb10..41fd7c19a771a8f6e5632f4b66853d36ddad7827 100644 --- a/ee/spec/features/projects/work_items/okr_spec.rb +++ b/ee/spec/features/projects/work_items/okr_spec.rb @@ -29,129 +29,71 @@ let(:form_selector) { '[data-testid="work-item-progress"]' } let(:input_selector) { '[data-testid="work-item-progress-input"]' } - context 'when the work_items_beta is enabled' do - it 'successfully sets the progress' do - within(progress_wrapper) do - click_button 'Edit' - end - - find(input_selector).fill_in(with: '30') - send_keys(:tab) # Simulate blur - - wait_for_requests - - expect(find(progress_wrapper)).to have_content "30%" - expect(work_item.reload.progress.progress).to eq 30 - end - - it 'prevents typing values outside min and max range', :aggregate_failures do - page_body = page.find('body') - - within(progress_wrapper) do - click_button 'Edit' - end - - page.within(form_selector) do - progress_input = find(input_selector) - progress_input.native.send_keys('101') - end - - page_body.click - expect(find(progress_wrapper)).to have_content "0%" + it 'successfully sets the progress' do + within(progress_wrapper) do + click_button 'Edit' end - it 'prevent typing special characters `+`, `-`, and `e`', :aggregate_failures do - page_body = page.find('body') - - within(progress_wrapper) do - click_button 'Edit' - end - - page.within(form_selector) do - find(input_selector).native.send_keys('+') - end - - page_body.click - expect(find(progress_wrapper)).to have_content "0%" + find(input_selector).fill_in(with: '30') + send_keys(:tab) # Simulate blur - within(progress_wrapper) do - click_button 'Edit' - end - - page.within(form_selector) do - find(input_selector).native.send_keys('-') - end + wait_for_requests - page_body.click - expect(find(progress_wrapper)).to have_content "0%" - - within(progress_wrapper) do - click_button 'Edit' - end + expect(find(progress_wrapper)).to have_content "30%" + expect(work_item.reload.progress.progress).to eq 30 + end - page.within(form_selector) do - find(input_selector).native.send_keys('e') - end + it 'prevents typing values outside min and max range', :aggregate_failures do + page_body = page.find('body') - page_body.click - expect(find(progress_wrapper)).to have_content "0%" + within(progress_wrapper) do + click_button 'Edit' end - end - context 'when the work_items_beta is disabled' do - before do - stub_feature_flags(work_items_beta: false) - - page.refresh - wait_for_all_requests + page.within(form_selector) do + progress_input = find(input_selector) + progress_input.native.send_keys('101') end - it 'successfully sets the progress' do - find(input_selector).fill_in(with: '30') - send_keys(:tab) # Simulate blur + page_body.click + expect(find(progress_wrapper)).to have_content "0%" + end - wait_for_requests + it 'prevent typing special characters `+`, `-`, and `e`', :aggregate_failures do + page_body = page.find('body') - expect(find(form_selector)).to have_content "30%" - expect(work_item.reload.progress.progress).to eq 30 + within(progress_wrapper) do + click_button 'Edit' end - it 'prevents typing values outside min and max range', :aggregate_failures do - page_body = page.find('body') - page.within(form_selector) do - progress_input = find(input_selector) - progress_input.native.send_keys('101') - page_body.click - - expect(progress_input.value).to eq('0') + page.within(form_selector) do + find(input_selector).native.send_keys('+') + end - # Clear input - progress_input.set('') - progress_input.native.send_keys('-') - page_body.click + page_body.click + expect(find(progress_wrapper)).to have_content "0%" - expect(progress_input.value).to eq('') - end + within(progress_wrapper) do + click_button 'Edit' end - it 'prevent typing special characters `+`, `-`, and `e`', :aggregate_failures do - page_body = page.find('body') - page.within(form_selector) do - progress_input = find(input_selector) + page.within(form_selector) do + find(input_selector).native.send_keys('-') + end - progress_input.native.send_keys('+') - page_body.click - expect(progress_input.value).to eq('0') + page_body.click + expect(find(progress_wrapper)).to have_content "0%" - progress_input.native.send_keys('-') - page_body.click - expect(progress_input.value).to eq('0') + within(progress_wrapper) do + click_button 'Edit' + end - progress_input.native.send_keys('e') - page_body.click - expect(progress_input.value).to eq('0') - end + page.within(form_selector) do + find(input_selector).native.send_keys('e') end + + page_body.click + expect(find(progress_wrapper)).to have_content "0%" end end @@ -202,34 +144,6 @@ visit work_items_path end - context 'when work_items_beta is disabled' do - before do - stub_feature_flags(work_items_beta: false) - - page.refresh - wait_for_all_requests - end - - it 'assigns to multiple users' do - find_by_testid('work-item-assignees-input').fill_in(with: user.username) - wait_for_requests - - send_keys(:enter) - find("body").click - wait_for_requests - - find_by_testid('work-item-assignees-input').fill_in(with: user2.username) - wait_for_requests - - send_keys(:enter) - find("body").click - wait_for_requests - - expect(work_item.reload.assignees).to include(user) - expect(work_item.reload.assignees).to include(user2) - end - end - it_behaves_like 'work items toggle status button' it_behaves_like 'work items assignees' it_behaves_like 'work items labels' @@ -453,34 +367,6 @@ visit work_items_path end - context 'when work_items_beta is disabled' do - before do - stub_feature_flags(work_items_beta: false) - - page.refresh - wait_for_all_requests - end - - it 'assigns to multiple users' do - find_by_testid('work-item-assignees-input').fill_in(with: user.username) - wait_for_requests - - send_keys(:enter) - find("body").click - wait_for_requests - - find_by_testid('work-item-assignees-input').fill_in(with: user2.username) - wait_for_requests - - send_keys(:enter) - find("body").click - wait_for_requests - - expect(work_item.reload.assignees).to include(user) - expect(work_item.reload.assignees).to include(user2) - end - end - it_behaves_like 'work items toggle status button' it_behaves_like 'work items assignees' it_behaves_like 'work items labels' diff --git a/ee/spec/frontend/work_items/components/work_item_attributes_wrapper_spec.js b/ee/spec/frontend/work_items/components/work_item_attributes_wrapper_spec.js index 31c1c81cb396386156ab65779d576e67a2b1e9ab..4b0f0552b7846d6208caffd1c2dd44cd699d1a11 100644 --- a/ee/spec/frontend/work_items/components/work_item_attributes_wrapper_spec.js +++ b/ee/spec/frontend/work_items/components/work_item_attributes_wrapper_spec.js @@ -1,14 +1,10 @@ import Vue, { nextTick } from 'vue'; import VueApollo from 'vue-apollo'; import { shallowMount } from '@vue/test-utils'; -import WorkItemProgressInline from 'ee/work_items/components/work_item_progress_inline.vue'; import WorkItemProgressWithEdit from 'ee/work_items/components/work_item_progress_with_edit.vue'; import WorkItemHealthStatus from 'ee/work_items/components/work_item_health_status_with_edit.vue'; -import WorkItemHealthStatusInline from 'ee/work_items/components/work_item_health_status_inline.vue'; import WorkItemWeight from 'ee/work_items/components/work_item_weight_with_edit.vue'; -import WorkItemWeightInline from 'ee/work_items/components/work_item_weight_inline.vue'; -import WorkItemIterationInline from 'ee/work_items/components/work_item_iteration_inline.vue'; -import WorkItemColorInline from 'ee/work_items/components/work_item_color_inline.vue'; +import WorkItemIteration from 'ee/work_items/components/work_item_iteration_with_edit.vue'; import WorkItemColorWithEdit from 'ee/work_items/components/work_item_color_with_edit.vue'; import WorkItemRolledupDates from 'ee/work_items/components/work_item_rolledup_dates.vue'; import waitForPromises from 'helpers/wait_for_promises'; @@ -31,15 +27,11 @@ describe('EE WorkItemAttributesWrapper component', () => { .fn() .mockResolvedValue({ data: { workItemUpdated: null } }); - const findWorkItemIterationInline = () => wrapper.findComponent(WorkItemIterationInline); + const findWorkItemIteration = () => wrapper.findComponent(WorkItemIteration); const findWorkItemWeight = () => wrapper.findComponent(WorkItemWeight); - const findWorkItemWeightInline = () => wrapper.findComponent(WorkItemWeightInline); - const findWorkItemProgressInline = () => wrapper.findComponent(WorkItemProgressInline); const findWorkItemProgressWithEdit = () => wrapper.findComponent(WorkItemProgressWithEdit); - const findWorkItemColorInline = () => wrapper.findComponent(WorkItemColorInline); const findWorkItemColorWithEdit = () => wrapper.findComponent(WorkItemColorWithEdit); const findWorkItemHealthStatus = () => wrapper.findComponent(WorkItemHealthStatus); - const findWorkItemHealthStatusInline = () => wrapper.findComponent(WorkItemHealthStatusInline); const findWorkItemRolledupDates = () => wrapper.findComponent(WorkItemRolledupDates); const createComponent = ({ @@ -85,7 +77,7 @@ describe('EE WorkItemAttributesWrapper component', () => { }); await waitForPromises(); - expect(findWorkItemIterationInline().exists()).toBe(exists); + expect(findWorkItemIteration().exists()).toBe(exists); }); }); @@ -93,7 +85,7 @@ describe('EE WorkItemAttributesWrapper component', () => { createComponent({ featureFlags: { workItemsBeta: false } }); const updateError = 'Failed to update'; - findWorkItemIterationInline().vm.$emit('error', updateError); + findWorkItemIteration().vm.$emit('error', updateError); await nextTick(); expect(wrapper.emitted('error')).toEqual([[updateError]]); @@ -116,22 +108,12 @@ describe('EE WorkItemAttributesWrapper component', () => { }); }); - it('renders WorkItemWeight when workItemsBeta enabled', async () => { + it('renders WorkItemWeight', async () => { createComponent(); await waitForPromises(); expect(findWorkItemWeight().exists()).toBe(true); - expect(findWorkItemWeightInline().exists()).toBe(false); - }); - - it('renders WorkItemWeightInline when workItemsBeta disabled', async () => { - createComponent({ featureFlags: { workItemsBeta: false } }); - - await waitForPromises(); - - expect(findWorkItemWeight().exists()).toBe(false); - expect(findWorkItemWeightInline().exists()).toBe(true); }); it('emits an error event to the wrapper', async () => { @@ -164,22 +146,12 @@ describe('EE WorkItemAttributesWrapper component', () => { }); }); - it('renders WorkItemHealthStatus when workItemsBeta enabled', async () => { + it('renders WorkItemHealthStatus', async () => { createComponent(); await waitForPromises(); expect(findWorkItemHealthStatus().exists()).toBe(true); - expect(findWorkItemHealthStatusInline().exists()).toBe(false); - }); - - it('renders WorkItemHealthStatusInline when workItemsBeta disabled', async () => { - createComponent({ featureFlags: { workItemsBeta: false } }); - - await waitForPromises(); - - expect(findWorkItemHealthStatus().exists()).toBe(false); - expect(findWorkItemHealthStatusInline().exists()).toBe(true); }); it('emits an error event to the wrapper', async () => { @@ -208,22 +180,12 @@ describe('EE WorkItemAttributesWrapper component', () => { }); }); - it('renders WorkItemProgressWithEdit when workItemsBeta enabled', async () => { + it('renders WorkItemProgressWithEdit', async () => { createComponent(); await waitForPromises(); expect(findWorkItemProgressWithEdit().exists()).toBe(true); - expect(findWorkItemProgressInline().exists()).toBe(false); - }); - - it('renders WorkItemProgressInline when workItemsBeta disabled', async () => { - createComponent({ featureFlags: { workItemsBeta: false } }); - - await waitForPromises(); - - expect(findWorkItemProgressWithEdit().exists()).toBe(false); - expect(findWorkItemProgressInline().exists()).toBe(true); }); it('emits an error event to the wrapper', async () => { @@ -253,22 +215,12 @@ describe('EE WorkItemAttributesWrapper component', () => { }); }); - it('renders WorkItemColorWithEdit when workItemsBeta enabled', async () => { + it('renders WorkItemColorWithEdit', async () => { createComponent(); await waitForPromises(); expect(findWorkItemColorWithEdit().exists()).toBe(true); - expect(findWorkItemColorInline().exists()).toBe(false); - }); - - it('renders WorkItemColorInline when workItemsBeta disabled', async () => { - createComponent({ featureFlags: { workItemsBeta: false } }); - - await waitForPromises(); - - expect(findWorkItemColorWithEdit().exists()).toBe(false); - expect(findWorkItemColorInline().exists()).toBe(true); }); it('emits an error event to the wrapper', async () => { diff --git a/spec/features/projects/work_items/work_item_spec.rb b/spec/features/projects/work_items/work_item_spec.rb index 8c0e00e5182ec66c196dcbdfb869e96034065f32..52668ac18121b29f1ddbcb650a322b07b5f9d06d 100644 --- a/spec/features/projects/work_items/work_item_spec.rb +++ b/spec/features/projects/work_items/work_item_spec.rb @@ -47,34 +47,6 @@ expect(page).to have_button _('More actions') end - context 'when work_items_beta is disabled' do - before do - stub_feature_flags(work_items_beta: false) - - page.refresh - wait_for_all_requests - end - - it 'reassigns to another user', - quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/413074' do - find_by_testid('work-item-assignees-input').fill_in(with: user.username) - wait_for_requests - - send_keys(:enter) - find("body").click - wait_for_requests - - find_by_testid('work-item-assignees-input').fill_in(with: user2.username) - wait_for_requests - - send_keys(:enter) - find("body").click - wait_for_requests - - expect(work_item.reload.assignees).to include(user2) - end - end - context 'when work_items_beta is enabled' do before do stub_feature_flags(work_items_beta: true) @@ -164,27 +136,6 @@ expect(page).to have_selector('[data-testid="award-button"].disabled') end - context 'when work_items_beta is disabled' do - before do - stub_feature_flags(work_items_beta: false) - - page.refresh - wait_for_all_requests - end - - it 'disabled the assignees input field' do - within_testid('work-item-assignees-input') do - expect(page).to have_field(type: 'text', disabled: true) - end - end - - it 'disables the labels input field' do - within_testid('work-item-labels-input') do - expect(page).to have_field(type: 'text', disabled: true) - end - end - end - context 'when work_items_beta is enabled' do before do stub_feature_flags(work_items_beta: true) diff --git a/spec/frontend/work_items/components/work_item_attributes_wrapper_spec.js b/spec/frontend/work_items/components/work_item_attributes_wrapper_spec.js index 272e8d66f1b06c894dce9488a500328281d842a0..57c60bd6c60e6973614d83d09e132f655a909555 100644 --- a/spec/frontend/work_items/components/work_item_attributes_wrapper_spec.js +++ b/spec/frontend/work_items/components/work_item_attributes_wrapper_spec.js @@ -2,13 +2,9 @@ import { nextTick } from 'vue'; import { shallowMount } from '@vue/test-utils'; import Participants from '~/sidebar/components/participants/participants.vue'; import WorkItemAssigneesWithEdit from '~/work_items/components/work_item_assignees_with_edit.vue'; -import WorkItemDueDateInline from '~/work_items/components/work_item_due_date_inline.vue'; import WorkItemDueDateWithEdit from '~/work_items/components/work_item_due_date_with_edit.vue'; -import WorkItemLabelsInline from '~/work_items/components/work_item_labels_inline.vue'; import WorkItemLabelsWithEdit from '~/work_items/components/work_item_labels_with_edit.vue'; -import WorkItemMilestoneInline from '~/work_items/components/work_item_milestone_inline.vue'; import WorkItemMilestoneWithEdit from '~/work_items/components/work_item_milestone_with_edit.vue'; -import WorkItemParentInline from '~/work_items/components/work_item_parent_inline.vue'; import WorkItemParent from '~/work_items/components/work_item_parent_with_edit.vue'; import WorkItemTimeTracking from '~/work_items/components/work_item_time_tracking.vue'; import waitForPromises from 'helpers/wait_for_promises'; @@ -29,12 +25,8 @@ describe('WorkItemAttributesWrapper component', () => { const findWorkItemAssignees = () => wrapper.findComponent(WorkItemAssigneesWithEdit); const findWorkItemDueDate = () => wrapper.findComponent(WorkItemDueDateWithEdit); - const findWorkItemDueDateInline = () => wrapper.findComponent(WorkItemDueDateInline); - const findWorkItemLabelsInline = () => wrapper.findComponent(WorkItemLabelsInline); const findWorkItemLabels = () => wrapper.findComponent(WorkItemLabelsWithEdit); const findWorkItemMilestone = () => wrapper.findComponent(WorkItemMilestoneWithEdit); - const findWorkItemMilestoneInline = () => wrapper.findComponent(WorkItemMilestoneInline); - const findWorkItemParentInline = () => wrapper.findComponent(WorkItemParentInline); const findWorkItemParent = () => wrapper.findComponent(WorkItemParent); const findWorkItemTimeTracking = () => wrapper.findComponent(WorkItemTimeTracking); const findWorkItemParticipants = () => wrapper.findComponent(Participants); @@ -94,25 +86,13 @@ describe('WorkItemAttributesWrapper component', () => { expect(findWorkItemLabels().exists()).toBe(exists); }); - it.each` - description | labelsWidgetInlinePresent | labelsWidgetWithEditPresent | workItemsBetaFlagEnabled - ${'renders WorkItemLabels when workItemsBeta enabled'} | ${false} | ${true} | ${true} - ${'renders WorkItemLabelsInline when workItemsBeta disabled'} | ${true} | ${false} | ${false} - `( - '$description', - async ({ - labelsWidgetInlinePresent, - labelsWidgetWithEditPresent, - workItemsBetaFlagEnabled, - }) => { - createComponent({ workItemsBeta: workItemsBetaFlagEnabled }); + it('renders WorkItemLabels', async () => { + createComponent(); - await waitForPromises(); + await waitForPromises(); - expect(findWorkItemLabels().exists()).toBe(labelsWidgetWithEditPresent); - expect(findWorkItemLabelsInline().exists()).toBe(labelsWidgetInlinePresent); - }, - ); + expect(findWorkItemLabels().exists()).toBe(true); + }); }); describe('dates widget', () => { @@ -129,25 +109,13 @@ describe('WorkItemAttributesWrapper component', () => { }); }); - it.each` - description | dueDateWidgetInlinePresent | dueDateWidgetWithEditPresent | workItemsBetaFlagEnabled - ${'renders WorkItemDueDateWithEdit when workItemsBeta enabled'} | ${false} | ${true} | ${true} - ${'renders WorkItemDueDateInline when workItemsBeta disabled'} | ${true} | ${false} | ${false} - `( - '$description', - async ({ - dueDateWidgetInlinePresent, - dueDateWidgetWithEditPresent, - workItemsBetaFlagEnabled, - }) => { - createComponent({ workItemsBeta: workItemsBetaFlagEnabled }); + it('renders WorkItemDueDateWithEdit', async () => { + createComponent(); - await waitForPromises(); + await waitForPromises(); - expect(findWorkItemDueDate().exists()).toBe(dueDateWidgetWithEditPresent); - expect(findWorkItemDueDateInline().exists()).toBe(dueDateWidgetInlinePresent); - }, - ); + expect(findWorkItemDueDate().exists()).toBe(true); + }); }); describe('milestone widget', () => { @@ -162,25 +130,13 @@ describe('WorkItemAttributesWrapper component', () => { expect(findWorkItemMilestone().exists()).toBe(exists); }); - it.each` - description | milestoneWidgetInlinePresent | milestoneWidgetWithEditPresent | workItemsBetaFlagEnabled - ${'renders WorkItemMilestone when workItemsBeta enabled'} | ${false} | ${true} | ${true} - ${'renders WorkItemMilestoneInline when workItemsBeta disabled'} | ${true} | ${false} | ${false} - `( - '$description', - async ({ - milestoneWidgetInlinePresent, - milestoneWidgetWithEditPresent, - workItemsBetaFlagEnabled, - }) => { - createComponent({ workItemsBeta: workItemsBetaFlagEnabled }); + it('renders WorkItemMilestone', async () => { + createComponent(); - await waitForPromises(); + await waitForPromises(); - expect(findWorkItemMilestone().exists()).toBe(milestoneWidgetWithEditPresent); - expect(findWorkItemMilestoneInline().exists()).toBe(milestoneWidgetInlinePresent); - }, - ); + expect(findWorkItemMilestone().exists()).toBe(true); + }); }); describe('parent widget', () => { @@ -208,16 +164,6 @@ describe('WorkItemAttributesWrapper component', () => { await waitForPromises(); expect(findWorkItemParent().exists()).toBe(true); - expect(findWorkItemParentInline().exists()).toBe(false); - }); - - it('renders WorkItemParentInline when workItemsBeta disabled', async () => { - createComponent({ workItemsBeta: false }); - - await waitForPromises(); - - expect(findWorkItemParent().exists()).toBe(false); - expect(findWorkItemParentInline().exists()).toBe(true); }); it('emits an error event to the wrapper', async () => { diff --git a/spec/frontend/work_items/components/work_item_detail_spec.js b/spec/frontend/work_items/components/work_item_detail_spec.js index 46c29ff237a7690fdd9fcfe81b67e8e073c8a703..a54c6e71d36e5d8d28ce1b1ffc5ade0ee59e2441 100644 --- a/spec/frontend/work_items/components/work_item_detail_spec.js +++ b/spec/frontend/work_items/components/work_item_detail_spec.js @@ -14,7 +14,6 @@ import WorkItemAncestors from '~/work_items/components/work_item_ancestors/work_ import WorkItemDescription from '~/work_items/components/work_item_description.vue'; import WorkItemCreatedUpdated from '~/work_items/components/work_item_created_updated.vue'; import WorkItemAttributesWrapper from '~/work_items/components/work_item_attributes_wrapper.vue'; -import WorkItemTitle from '~/work_items/components/work_item_title.vue'; import WorkItemTree from '~/work_items/components/work_item_links/work_item_tree.vue'; import WorkItemRelationships from '~/work_items/components/work_item_relationships/work_item_relationships.vue'; import WorkItemNotes from '~/work_items/components/work_item_notes.vue'; @@ -75,7 +74,7 @@ describe('WorkItemDetail component', () => { const findEmptyState = () => wrapper.findComponent(GlEmptyState); const findWorkItemLoading = () => wrapper.findComponent(WorkItemLoading); const findWorkItemActions = () => wrapper.findComponent(WorkItemActions); - const findWorkItemTitle = () => wrapper.findComponent(WorkItemTitle); + const findWorkItemTitle = () => wrapper.findComponent(WorkItemTitleWithEdit); const findCreatedUpdated = () => wrapper.findComponent(WorkItemCreatedUpdated); const findWorkItemDescription = () => wrapper.findComponent(WorkItemDescription); const findWorkItemAttributesWrapper = () => wrapper.findComponent(WorkItemAttributesWrapper); @@ -92,7 +91,6 @@ describe('WorkItemDetail component', () => { const findWorkItemTwoColumnViewContainer = () => wrapper.findByTestId('work-item-overview'); const findRightSidebar = () => wrapper.findByTestId('work-item-overview-right-sidebar'); const findEditButton = () => wrapper.findByTestId('work-item-edit-form-button'); - const findWorkItemTitleWithEdit = () => wrapper.findComponent(WorkItemTitleWithEdit); const createComponent = ({ isGroup = false, @@ -671,112 +669,66 @@ describe('WorkItemDetail component', () => { }); describe('work item two column view', () => { - describe('when `workItemsBeta` is false', () => { - beforeEach(async () => { - createComponent({ workItemsBeta: false }); - await waitForPromises(); - }); - - it('does not have the `work-item-overview` class', () => { - expect(findWorkItemTwoColumnViewContainer().classes()).not.toContain('work-item-overview'); - }); - - it('does not have sticky header component', () => { - expect(findStickyHeader().exists()).toBe(false); - }); - - it('does not have right sidebar', () => { - expect(findRightSidebar().exists()).toBe(false); - }); + beforeEach(async () => { + createComponent({ workItemsBeta: true }); + await waitForPromises(); }); - describe('when `workItemsBeta` is true', () => { - beforeEach(async () => { - createComponent({ workItemsBeta: true }); - await waitForPromises(); - }); - - it('has the `work-item-overview` class', () => { - expect(findWorkItemTwoColumnViewContainer().classes()).toContain('work-item-overview'); - }); + it('has the `work-item-overview` class', () => { + expect(findWorkItemTwoColumnViewContainer().classes()).toContain('work-item-overview'); + }); - it('renders the work item sticky header component', () => { - expect(findStickyHeader().exists()).toBe(true); - }); + it('renders the work item sticky header component', () => { + expect(findStickyHeader().exists()).toBe(true); + }); - it('has the right sidebar', () => { - expect(findRightSidebar().exists()).toBe(true); - }); + it('has the right sidebar', () => { + expect(findRightSidebar().exists()).toBe(true); }); }); describe('edit button for work item title and description', () => { - describe('when `workItemsBeta` is false', () => { + describe('with permissions to update', () => { beforeEach(async () => { - createComponent({ workItemsBeta: false }); + createComponent({ workItemsBeta: true }); await waitForPromises(); }); - it('does not show the edit button', () => { - expect(findEditButton().exists()).toBe(false); + it('shows the edit button', () => { + expect(findEditButton().exists()).toBe(true); }); - it('renders the work item title inline editable component', () => { + it('renders the work item title with edit component', () => { expect(findWorkItemTitle().exists()).toBe(true); + expect(findWorkItemTitle().props('isEditing')).toBe(false); }); - it('does not render the work item title with edit component', () => { - expect(findWorkItemTitleWithEdit().exists()).toBe(false); + it('work item description is not shown in edit mode by default', () => { + expect(findWorkItemDescription().props('editMode')).toBe(false); }); - }); - describe('when `workItemsBeta` is true', () => { - describe('with permissions to update', () => { + describe('when edit is clicked', () => { beforeEach(async () => { - createComponent({ workItemsBeta: true }); - await waitForPromises(); - }); - - it('shows the edit button', () => { - expect(findEditButton().exists()).toBe(true); - }); - - it('does not render the work item title inline editable component', () => { - expect(findWorkItemTitle().exists()).toBe(false); - }); - - it('renders the work item title with edit component', () => { - expect(findWorkItemTitleWithEdit().exists()).toBe(true); - expect(findWorkItemTitleWithEdit().props('isEditing')).toBe(false); + findEditButton().vm.$emit('click'); + await nextTick(); }); - it('work item description is not shown in edit mode by default', () => { - expect(findWorkItemDescription().props('editMode')).toBe(false); + it('work item title component shows in edit mode', () => { + expect(findWorkItemTitle().props('isEditing')).toBe(true); }); - describe('when edit is clicked', () => { - beforeEach(async () => { - findEditButton().vm.$emit('click'); - await nextTick(); - }); - - it('work item title component shows in edit mode', () => { - expect(findWorkItemTitleWithEdit().props('isEditing')).toBe(true); - }); - - it('work item description component shows in edit mode', () => { - expect(findWorkItemDescription().props('disableInlineEditing')).toBe(true); - expect(findWorkItemDescription().props('editMode')).toBe(true); - }); + it('work item description component shows in edit mode', () => { + expect(findWorkItemDescription().props('disableInlineEditing')).toBe(true); + expect(findWorkItemDescription().props('editMode')).toBe(true); }); }); + }); - describe('without permissions', () => { - it('does not show edit button when user does not have the permissions for it', async () => { - createComponent({ handler: successHandlerWithNoPermissions }); - await waitForPromises(); - expect(findEditButton().exists()).toBe(false); - }); + describe('without permissions', () => { + it('does not show edit button when user does not have the permissions for it', async () => { + createComponent({ handler: successHandlerWithNoPermissions }); + await waitForPromises(); + expect(findEditButton().exists()).toBe(false); }); }); }); diff --git a/spec/frontend/work_items/components/work_item_loading_spec.js b/spec/frontend/work_items/components/work_item_loading_spec.js index 4da372f6eb95d629066cf20f7306ecdbe7796636..d2c0d538405a143656b177afb5936bef569833be 100644 --- a/spec/frontend/work_items/components/work_item_loading_spec.js +++ b/spec/frontend/work_items/components/work_item_loading_spec.js @@ -6,8 +6,6 @@ describe('Work Item Loading spec', () => { let wrapper; const findWorkItemTwoColumnLoading = () => wrapper.findByTestId('work-item-two-column-loading'); - const findWorkItemSingleColumnLoading = () => - wrapper.findByTestId('work-item-single-column-loading'); const findWorkItemTitleMetaLoading = () => wrapper.findByTestId('work-title-and-meta-loading'); const findWorkItemDescriptionLoading = () => wrapper.findByTestId('work-item-description-loading'); @@ -20,28 +18,13 @@ describe('Work Item Loading spec', () => { const findWorkItemNotesLoading = () => wrapper.findByTestId('work-item-notes-loading'); const findLoaders = () => findWorkItemAttributesXsSmLoading().findAllComponents(GlSkeletonLoader); - const createComponent = ({ twoColumnView = false } = {}) => { - wrapper = shallowMountExtended(WorkItemLoading, { - propsData: { - twoColumnView, - }, - }); + const createComponent = () => { + wrapper = shallowMountExtended(WorkItemLoading); }; - describe('Work Item Single Column loading view', () => { - beforeEach(() => { - createComponent(); - }); - - it('renders the single column loading', () => { - expect(findWorkItemSingleColumnLoading().exists()).toBe(true); - expect(findWorkItemTwoColumnLoading().exists()).toBe(false); - }); - }); - describe('Work Item Two Column loading view', () => { beforeEach(() => { - createComponent({ twoColumnView: true }); + createComponent(); }); it('renders the two column loading', () => { diff --git a/spec/frontend/work_items/router_spec.js b/spec/frontend/work_items/router_spec.js index cb609fac882b04bbf6feea36592c9cd3d750639e..c44e72323b0d2f538d0fc8e6fae6de4d7be95896 100644 --- a/spec/frontend/work_items/router_spec.js +++ b/spec/frontend/work_items/router_spec.js @@ -55,6 +55,7 @@ describe('Work items router', () => { WorkItemHealthStatus: true, WorkItemNotes: true, WorkItemAwardEmoji: true, + WorkItemTimeTracking: true, }, }); }; diff --git a/spec/support/shared_examples/features/work_items_shared_examples.rb b/spec/support/shared_examples/features/work_items_shared_examples.rb index b398d0b705bd0ecca9faf82ebdc4500fb20eb180..68e2c9e8b8f2126b8a49593e829fc15c3fd6998f 100644 --- a/spec/support/shared_examples/features/work_items_shared_examples.rb +++ b/spec/support/shared_examples/features/work_items_shared_examples.rb @@ -14,33 +14,15 @@ let(:title_selector) { '[data-testid="work-item-title"]' } let(:title_with_edit_selector) { '[data-testid="work-item-title-with-edit"]' } - context 'when the work_items_beta FF is disabled' do - include_context 'with work_items_beta', false + it 'successfully shows and changes the title of the work item' do + expect(work_item.reload.title).to eq work_item.title - it 'successfully shows and changes the title of the work item' do - expect(work_item.reload.title).to eq work_item.title - - find(title_selector).set("Work item title") - find(title_selector).native.send_keys(:return) - wait_for_requests - - expect(work_item.reload.title).to eq 'Work item title' - end - end - - context 'when the work_items_beta FF is enabled' do - include_context 'with work_items_beta', true - - it 'successfully shows and changes the title of the work item' do - expect(work_item.reload.title).to eq work_item.title - - click_button 'Edit', match: :first - find(title_with_edit_selector).set("Work item title") - send_keys([:command, :enter]) - wait_for_requests + click_button 'Edit', match: :first + find(title_with_edit_selector).set("Work item title") + send_keys([:command, :enter]) + wait_for_requests - expect(work_item.reload.title).to eq 'Work item title' - end + expect(work_item.reload.title).to eq 'Work item title' end end @@ -168,125 +150,51 @@ def click_reply_and_enter_slash end RSpec.shared_examples 'work items assignees' do - context 'when the work_items_beta FF is disabled' do - include_context 'with work_items_beta', false + let(:work_item_assignees_selector) { '[data-testid="work-item-assignees-with-edit"]' } - it 'successfully assigns the current user by searching', - quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/413074' do - # The button is only when the mouse is over the input - find('[data-testid="work-item-assignees-input"]').fill_in(with: user.username) - wait_for_requests - # submit and simulate blur to save - send_keys(:enter) - find("body").click - wait_for_requests - - expect(work_item.reload.assignees).to include(user) - end + it 'successfully assigns the current user by searching', + quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/413074' do + # The button is only when the mouse is over the input + find_and_click_edit(work_item_assignees_selector) - it 'successfully assigns the current user by clicking `Assign myself` button' do - find('[data-testid="work-item-assignees-input"]').hover - click_button _('Assign yourself') + select_listbox_item(user.username) - expect(work_item.reload.assignees).to include(user) - end - - it 'successfully removes all users on clear all button click' do - find('[data-testid="work-item-assignees-input"]').hover - click_button _('Assign yourself') - - expect(work_item.reload.assignees).to include(user) - - find('[data-testid="work-item-assignees-input"]').click - click_button 'Clear all' - find("body").click - wait_for_requests - - expect(work_item.reload.assignees).not_to include(user) - end - - it 'successfully removes user on clicking badge cross button' do - find('[data-testid="work-item-assignees-input"]').hover - click_button _('Assign yourself') - - expect(work_item.reload.assignees).to include(user) - - within('[data-testid="work-item-assignees-input"]') do - click_button 'Close' - end - find("body").click - wait_for_requests - - expect(work_item.reload.assignees).not_to include(user) - end - - it 'updates the assignee in real-time' do - Capybara::Session.new(:other_session) - - using_session :other_session do - visit work_items_path - expect(work_item.reload.assignees).not_to include(user) - end - - find('[data-testid="work-item-assignees-input"]').hover - click_button _('Assign yourself') + find("body").click + wait_for_all_requests - expect(work_item.reload.assignees).to include(user) - using_session :other_session do - expect(work_item.reload.assignees).to include(user) - end - end + expect(work_item.assignees).to include(user) end - context 'when the work_items_beta FF is enabled' do - let(:work_item_assignees_selector) { '[data-testid="work-item-assignees-with-edit"]' } + it 'successfully removes all users on clear all button click' do + find_and_click_edit(work_item_assignees_selector) - include_context 'with work_items_beta', true + select_listbox_item(user.username) - it 'successfully assigns the current user by searching', - quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/413074' do - # The button is only when the mouse is over the input - find_and_click_edit(work_item_assignees_selector) - - select_listbox_item(user.username) - - find("body").click - wait_for_all_requests - - expect(work_item.assignees).to include(user) - end - - it 'successfully removes all users on clear all button click' do - find_and_click_edit(work_item_assignees_selector) + find("body").click + wait_for_requests - select_listbox_item(user.username) + find_and_click_edit(work_item_assignees_selector) - find("body").click - wait_for_requests + find_and_click_clear(work_item_assignees_selector) + wait_for_all_requests - find_and_click_edit(work_item_assignees_selector) + expect(work_item.assignees).not_to include(user) + end - find_and_click_clear(work_item_assignees_selector) - wait_for_all_requests + it 'updates the assignee in real-time' do + Capybara::Session.new(:other_session) - expect(work_item.assignees).not_to include(user) + using_session :other_session do + visit work_items_path + expect(work_item.reload.assignees).not_to include(user) end - it 'updates the assignee in real-time' do - Capybara::Session.new(:other_session) - - using_session :other_session do - visit work_items_path - expect(work_item.reload.assignees).not_to include(user) - end - - click_button 'assign yourself' - wait_for_all_requests + click_button 'assign yourself' + wait_for_all_requests + expect(work_item.reload.assignees).to include(user) + using_session :other_session do expect(work_item.reload.assignees).to include(user) - using_session :other_session do - expect(work_item.reload.assignees).to include(user) - end end end end @@ -294,225 +202,122 @@ def click_reply_and_enter_slash RSpec.shared_examples 'work items labels' do let(:label_title_selector) { '[data-testid="labels-title"]' } let(:labels_input_selector) { '[data-testid="work-item-labels-input"]' } + let(:work_item_labels_selector) { '[data-testid="work-item-labels-with-edit"]' } - context 'when work_items_beta is disabled' do - include_context 'with work_items_beta', false - - it 'successfully assigns a label' do - find(labels_input_selector).fill_in(with: label.title) - wait_for_requests - # submit and simulate blur to save - send_keys(:enter) - find(label_title_selector).click - wait_for_requests - - expect(work_item.labels).to include(label) - end - - it 'successfully assigns multiple labels' do - label2 = create(:label, project: project, title: "testing-label-2") - - find(labels_input_selector).fill_in(with: label.title) - wait_for_requests - send_keys(:enter) - - find(labels_input_selector).fill_in(with: label2.title) - wait_for_requests - send_keys(:enter) - - find(label_title_selector).click - wait_for_requests - - expect(work_item.labels).to include(label) - expect(work_item.labels).to include(label2) - end - - it 'removes all labels on clear all button click' do - find(labels_input_selector).fill_in(with: label.title) - wait_for_requests - send_keys(:enter) - find(label_title_selector).click - wait_for_requests - - expect(work_item.labels).to include(label) - - within(labels_input_selector) do - find('input').click - click_button 'Clear all' - end - find(label_title_selector).click - wait_for_requests - - expect(work_item.labels).not_to include(label) - end - - it 'removes label on clicking badge cross button' do - find(labels_input_selector).fill_in(with: label.title) - wait_for_requests - send_keys(:enter) - find(label_title_selector).click - wait_for_requests - - expect(page).to have_text(label.title) + it 'successfully applies the label by searching' do + expect(work_item.reload.labels).not_to include(label) - within(labels_input_selector) do - click_button 'Remove label' - end - find(label_title_selector).click - wait_for_requests - - expect(work_item.labels).not_to include(label) - end - - it 'updates the labels in real-time' do - Capybara::Session.new(:other_session) - - using_session :other_session do - visit work_items_path - expect(page).not_to have_text(label.title) - end + find_and_click_edit(work_item_labels_selector) - find(labels_input_selector).fill_in(with: label.title) - wait_for_requests - send_keys(:enter) - find(label_title_selector).click - wait_for_requests + select_listbox_item(label.title) - expect(page).to have_text(label.title) + find("body").click + wait_for_all_requests - using_session :other_session do - wait_for_requests - expect(page).to have_text(label.title) - end + expect(work_item.reload.labels).to include(label) + within(work_item_labels_selector) do + expect(page).to have_link(label.title) end end - context 'when work_items_beta is enabled' do - let(:work_item_labels_selector) { '[data-testid="work-item-labels-with-edit"]' } + it 'successfully removes all users on clear all button click' do + expect(work_item.reload.labels).not_to include(label) - include_context 'with work_items_beta', true + find_and_click_edit(work_item_labels_selector) - it 'successfully applies the label by searching' do - expect(work_item.reload.labels).not_to include(label) + select_listbox_item(label.title) - find_and_click_edit(work_item_labels_selector) - - select_listbox_item(label.title) - - find("body").click - wait_for_all_requests - - expect(work_item.reload.labels).to include(label) - within(work_item_labels_selector) do - expect(page).to have_link(label.title) - end - end - - it 'successfully removes all users on clear all button click' do - expect(work_item.reload.labels).not_to include(label) + find("body").click + wait_for_requests - find_and_click_edit(work_item_labels_selector) + expect(work_item.reload.labels).to include(label) - select_listbox_item(label.title) + find_and_click_edit(work_item_labels_selector) - find("body").click - wait_for_requests - - expect(work_item.reload.labels).to include(label) + find_and_click_clear(work_item_labels_selector) + wait_for_all_requests - find_and_click_edit(work_item_labels_selector) + expect(work_item.reload.labels).not_to include(label) + end - find_and_click_clear(work_item_labels_selector) - wait_for_all_requests + it 'updates the assignee in real-time' do + Capybara::Session.new(:other_session) + using_session :other_session do + visit work_items_path expect(work_item.reload.labels).not_to include(label) end - it 'updates the assignee in real-time' do - Capybara::Session.new(:other_session) + find_and_click_edit(work_item_labels_selector) - using_session :other_session do - visit work_items_path - expect(work_item.reload.labels).not_to include(label) - end + select_listbox_item(label.title) - find_and_click_edit(work_item_labels_selector) + find("body").click + wait_for_all_requests - select_listbox_item(label.title) - - find("body").click - wait_for_all_requests + expect(work_item.reload.labels).to include(label) + using_session :other_session do expect(work_item.reload.labels).to include(label) - - using_session :other_session do - expect(work_item.reload.labels).to include(label) - end end end end RSpec.shared_examples 'work items description' do - context 'for work_items_beta FF' do - [true, false].each do |work_items_beta_flag| # rubocop:disable RSpec/UselessDynamicDefinition -- check it for both off and on - let(:edit_button) { work_items_beta_flag ? 'Edit' : 'Edit description' } - - include_context 'with work_items_beta', work_items_beta_flag + let(:edit_button) { 'Edit' } - it 'shows GFM autocomplete', :aggregate_failures do - click_button edit_button, match: :first - fill_in _('Description'), with: "@#{user.username}" + it 'shows GFM autocomplete', :aggregate_failures do + click_button edit_button, match: :first + fill_in _('Description'), with: "@#{user.username}" - page.within('.atwho-container') do - expect(page).to have_text(user.name) - end - end + page.within('.atwho-container') do + expect(page).to have_text(user.name) + end + end - it 'autocompletes available quick actions', :aggregate_failures do - click_button edit_button, match: :first - fill_in _('Description'), with: '/' + it 'autocompletes available quick actions', :aggregate_failures do + click_button edit_button, match: :first + fill_in _('Description'), with: '/' - page.within('#at-view-commands') do - expect(page).to have_text("title") - expect(page).to have_text("shrug") - expect(page).to have_text("tableflip") - expect(page).to have_text("close") - expect(page).to have_text("cc") - end - end + page.within('#at-view-commands') do + expect(page).to have_text("title") + expect(page).to have_text("shrug") + expect(page).to have_text("tableflip") + expect(page).to have_text("close") + expect(page).to have_text("cc") + end + end - context 'on conflict' do - let_it_be(:other_user) { create(:user) } - let(:expected_warning) { 'Someone edited the description at the same time you did.' } + context 'on conflict' do + let_it_be(:other_user) { create(:user) } + let(:expected_warning) { 'Someone edited the description at the same time you did.' } - before do - project.add_developer(other_user) - stub_feature_flags(notifications_todos_buttons: false) - end + before do + project.add_developer(other_user) + stub_feature_flags(notifications_todos_buttons: false) + end - it 'shows conflict message when description changes', :aggregate_failures do - click_button edit_button, match: :first + it 'shows conflict message when description changes', :aggregate_failures do + click_button edit_button, match: :first - ::WorkItems::UpdateService.new( - container: work_item.project, - current_user: other_user, - params: { description: "oh no!" } - ).execute(work_item) + ::WorkItems::UpdateService.new( + container: work_item.project, + current_user: other_user, + params: { description: "oh no!" } + ).execute(work_item) - wait_for_requests + wait_for_requests - fill_in _('Description'), with: 'oh yeah!' + fill_in _('Description'), with: 'oh yeah!' - expect(page).to have_text(expected_warning) + expect(page).to have_text(expected_warning) - page.find('summary', text: 'View current version').click - expect(find_by_testid('conflicted-description').value).to eq('oh no!') + page.find('summary', text: 'View current version').click + expect(find_by_testid('conflicted-description').value).to eq('oh no!') - click_button s_('WorkItem|Save and overwrite') + click_button s_('WorkItem|Save and overwrite') - expect(page.find('[data-testid="work-item-description"]')).to have_text("oh yeah!") - end - end + expect(page.find('[data-testid="work-item-description"]')).to have_text("oh yeah!") end end end @@ -520,97 +325,56 @@ def click_reply_and_enter_slash RSpec.shared_examples 'work items invite members' do include Features::InviteMembersModalHelpers - context 'when the work_items_beta FF is disabled' do - include_context 'with work_items_beta', false - - it 'successfully assigns the current user by searching' do - # The button is only when the mouse is over the input - find('[data-testid="work-item-assignees-input"]').fill_in(with: 'Invite members') - wait_for_requests - - click_button('Invite members') + let(:work_item_assignees_selector) { '[data-testid="work-item-assignees-with-edit"]' } - page.within invite_modal_selector do - expect(page).to have_text("You're inviting members to the #{work_item.project.name} project") - end - end - end - - context 'when the work_items_beta FF is enabled' do - let(:work_item_assignees_selector) { '[data-testid="work-item-assignees-with-edit"]' } - - include_context 'with work_items_beta', true - - it 'successfully assigns the current user by searching' do - # The button is only when the mouse is over the input - find_and_click_edit(work_item_assignees_selector) - wait_for_requests + it 'successfully assigns the current user by searching' do + # The button is only when the mouse is over the input + find_and_click_edit(work_item_assignees_selector) + wait_for_requests - click_link('Invite members') + click_link('Invite members') - page.within invite_modal_selector do - expect(page).to have_text("You're inviting members to the #{work_item.project.name} project") - end + page.within invite_modal_selector do + expect(page).to have_text("You're inviting members to the #{work_item.project.name} project") end end end RSpec.shared_examples 'work items milestone' do - context 'on work_items_beta FF off' do - include_context 'with work_items_beta', false - - it 'searches and sets or removes milestone for the work item' do - click_button s_('WorkItem|Add to milestone') - send_keys "\"#{milestone.title}\"" - select_listbox_item(milestone.title, exact_text: true) - - expect(page).to have_button(milestone.title) + let(:work_item_milestone_selector) { '[data-testid="work-item-milestone-with-edit"]' } - click_button milestone.title - select_listbox_item(s_('WorkItem|No milestone'), exact_text: true) + it 'passes axe automated accessibility testing in closed state' do + find(work_item_milestone_selector) - expect(page).to have_button(s_('WorkItem|Add to milestone')) - end + expect(page).to be_axe_clean.within(work_item_milestone_selector) end - context 'on work_items_beta FF on' do - let(:work_item_milestone_selector) { '[data-testid="work-item-milestone-with-edit"]' } + context 'when edit is clicked' do + it 'selects and updates the right milestone', :aggregate_failures do + find_and_click_edit(work_item_milestone_selector) - include_context 'with work_items_beta', true + select_listbox_item(milestones[10].title) - it 'passes axe automated accessibility testing in closed state' do - find(work_item_milestone_selector) + wait_for_requests + within(work_item_milestone_selector) do + expect(page).to have_text(milestones[10].title) + end - expect(page).to be_axe_clean.within(work_item_milestone_selector) - end + find_and_click_edit(work_item_milestone_selector) - context 'when edit is clicked' do - it 'selects and updates the right milestone', :aggregate_failures do - find_and_click_edit(work_item_milestone_selector) + find_and_click_clear(work_item_milestone_selector) - select_listbox_item(milestones[10].title) + expect(find(work_item_milestone_selector)).to have_content('None') + end + it 'searches and sets or removes milestone for the work item' do + find_and_click_edit(work_item_milestone_selector) + within(work_item_milestone_selector) do + send_keys "\"#{milestones[11].title}\"" wait_for_requests - within(work_item_milestone_selector) do - expect(page).to have_text(milestones[10].title) - end - - find_and_click_edit(work_item_milestone_selector) - - find_and_click_clear(work_item_milestone_selector) - expect(find(work_item_milestone_selector)).to have_content('None') - end - - it 'searches and sets or removes milestone for the work item' do - find_and_click_edit(work_item_milestone_selector) - within(work_item_milestone_selector) do - send_keys "\"#{milestones[11].title}\"" - wait_for_requests - - select_listbox_item(milestones[11].title) - expect(page).to have_text(milestones[11].title) - end + select_listbox_item(milestones[11].title) + expect(page).to have_text(milestones[11].title) end end end @@ -801,8 +565,6 @@ def find_and_click_clear(selector) ) end - include_context 'with work_items_beta', true - context 'for accessibility' do it 'has the work item iteration with edit' do expect(page).to have_selector(work_item_iteration_selector)