diff --git a/qa/qa/ee/resource/work_item_epic.rb b/qa/qa/ee/resource/work_item_epic.rb index ff14c3281b02da6e30bafc67399e254d45ab2730..b458bf434fb8185ffcb3d9cb131b1b7dbdefa400 100644 --- a/qa/qa/ee/resource/work_item_epic.rb +++ b/qa/qa/ee/resource/work_item_epic.rb @@ -17,10 +17,7 @@ class WorkItemEpic < QA::Resource::Base :title, :description, :labels, - :start_date_is_fixed, - :start_date_fixed, - :due_date_is_fixed, - :due_date_fixed, + :is_fixed, :confidential, :author, :start_date, @@ -30,8 +27,7 @@ def initialize @title = "WI-Epic-#{SecureRandom.hex(8)}" @description = "This is a work item epic description." @confidential = false - @start_date_is_fixed = false - @due_date_is_fixed = false + @is_fixed = false end def fabricate! @@ -76,6 +72,26 @@ def gql_attributes title webUrl widgets { + ... on WorkItemWidgetStartAndDueDate + { + type + dueDate + dueDateSourcingMilestone + { + id + title + dueDate + } + isFixed + rollUp + startDate + startDateSourcingMilestone + { + id + title + startDate + } + } ... on WorkItemWidgetRolledupDates { type @@ -162,6 +178,11 @@ def api_post_body description: "#{@description}" } confidential: #{@confidential} + startAndDueDateWidget: { + dueDate: "#{@due_date}" + isFixed: #{@is_fixed} + startDate: "#{@start_date}" + } workItemTypeId: "#{get_work_item_type_id}" }) { workItem { diff --git a/qa/qa/specs/features/ee/browser_ui/2_plan/epic/epics_management_spec.rb b/qa/qa/specs/features/ee/browser_ui/2_plan/epic/epics_management_spec.rb index 47f282b487d0583226ce284c45c31aa178650641..80359107173293f9c33c423e7f45b4df7911189d 100644 --- a/qa/qa/specs/features/ee/browser_ui/2_plan/epic/epics_management_spec.rb +++ b/qa/qa/specs/features/ee/browser_ui/2_plan/epic/epics_management_spec.rb @@ -160,21 +160,10 @@ def create_epic_resource(group) rescue ArgumentError, NotImplementedError epic = create(:epic, group: group, title: 'Epic created via API') else - # work item epics have a web url containing /-/work_items/ but depending on FF status, it may not be - # accessible and would be rerouted to /-/epics/ - epic.web_url = "#{group.web_url}/-/epics/#{epic.iid}" unless resource_accessable?(epic.web_url) + update_web_url(group, epic) end epic end - - def resource_accessable?(resource_web_url) - return unless Runtime::Address.valid?(resource_web_url) - - Support::Retrier.retry_until(sleep_interval: 3, max_attempts: 5, raise_on_failure: false) do - response_check = Support::API.get(resource_web_url) - response_check.code == 200 - end - end end end end diff --git a/qa/qa/specs/features/ee/browser_ui/2_plan/epic/roadmap_spec.rb b/qa/qa/specs/features/ee/browser_ui/2_plan/epic/roadmap_spec.rb index f02a8d55f2280c073cc3ab56d60457fb3c12dc75..199888b921976cc6afc689f5082a1f4a1d5e4649 100644 --- a/qa/qa/specs/features/ee/browser_ui/2_plan/epic/roadmap_spec.rb +++ b/qa/qa/specs/features/ee/browser_ui/2_plan/epic/roadmap_spec.rb @@ -3,16 +3,11 @@ module QA RSpec.describe 'Plan', product_group: :product_planning do describe 'Epics roadmap' do + include_context 'work item epics migration' include Support::Dates - let(:epic) do - create(:epic, - title: 'Epic created via API to test roadmap', - start_date_is_fixed: true, - start_date_fixed: current_date_yyyy_mm_dd, - due_date_is_fixed: true, - due_date_fixed: next_month_yyyy_mm_dd) - end + let(:group) { create(:group, name: "group-to-test-epic-roadmap-#{SecureRandom.hex(4)}") } + let!(:epic) { create_epic_resource(group) } before do Flow::Login.sign_in @@ -20,12 +15,34 @@ module QA it 'presents epic on roadmap', :blocking, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347992' do - page.visit("#{epic.group.web_url}/-/roadmap") + page.visit("#{group.web_url}/-/roadmap") EE::Page::Group::Roadmap.perform do |roadmap| expect(roadmap).to have_epic(epic) end end + + def create_epic_resource(group) + begin + epic = create(:work_item_epic, + group: group, + title: 'Work Item Epic created via API to test roadmap', + is_fixed: true, + start_date: current_date_yyyy_mm_dd_iso, + due_date: next_month_yyyy_mm_dd_iso) + rescue ArgumentError, NotImplementedError + epic = create(:epic, + group: group, + title: 'Epic created via API to test roadmap', + start_date_is_fixed: true, + start_date_fixed: current_date_yyyy_mm_dd, + due_date_is_fixed: true, + due_date_fixed: next_month_yyyy_mm_dd) + else + update_web_url(group, epic) + end + epic + end end end end diff --git a/qa/qa/specs/features/shared_contexts/work_item_epics_shared_context.rb b/qa/qa/specs/features/shared_contexts/work_item_epics_shared_context.rb index d24b5f9ab3a054ab32609a64f0fb004939963b97..2d92aac5f29798aece91183363ad01dd96402e90 100644 --- a/qa/qa/specs/features/shared_contexts/work_item_epics_shared_context.rb +++ b/qa/qa/specs/features/shared_contexts/work_item_epics_shared_context.rb @@ -7,5 +7,20 @@ def work_item_epics_enabled_for_group?(group) QA::Page::Group::Menu.perform(&:go_to_epics) EE::Page::Group::WorkItem::Epic::Index.perform(&:work_item_epics_enabled?) end + + def resource_accessable?(resource_web_url) + return unless Runtime::Address.valid?(resource_web_url) + + Support::Retrier.retry_until(sleep_interval: 3, max_attempts: 5, raise_on_failure: false) do + response_check = Support::API.get(resource_web_url) + response_check.code == 200 + end + end + + def update_web_url(group, epic) + # work item epics have a web url containing /-/work_items/ but depending on FF status, it may not be + # accessible and would be rerouted to /-/epics/ + epic.web_url = "#{group.web_url}/-/epics/#{epic.iid}" unless resource_accessable?(epic.web_url) + end end end diff --git a/qa/qa/support/dates.rb b/qa/qa/support/dates.rb index 6b1fc6be53827d97b35a108b2dd642571eb007a9..708616ead4d061087f7d4f1d3db66f7ae6eee838 100644 --- a/qa/qa/support/dates.rb +++ b/qa/qa/support/dates.rb @@ -11,6 +11,14 @@ def next_month_yyyy_mm_dd current_date.next_month.strftime("%Y/%m/%d") end + def current_date_yyyy_mm_dd_iso + current_date.to_date.iso8601 + end + + def next_month_yyyy_mm_dd_iso + current_date.next_month.to_date.iso8601 + end + def thirteen_days_from_now_yyyy_mm_dd (current_date + 13).strftime("%Y/%m/%d") end