diff --git a/qa/qa/page/issuable/sidebar.rb b/qa/qa/page/issuable/sidebar.rb index dec2ce1eab345234aaf1fff6ddec1662595cbff5..f207264e24fa544cd675893c78e782a03a6d284d 100644 --- a/qa/qa/page/issuable/sidebar.rb +++ b/qa/qa/page/issuable/sidebar.rb @@ -4,6 +4,7 @@ module QA class Sidebar < Page::Base view 'app/views/shared/issuable/_sidebar.html.haml' do element :labels_block, ".issuable-show-labels" + element :milestones_block, '.block.milestone' end def has_label?(label) @@ -11,6 +12,12 @@ module QA !!find('span', text: label) end end + + def has_milestone?(milestone) + page.within('.block.milestone') do + !!find("[href*='/milestones/']", text: milestone) + end + end end end end diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index f3200160a7890de503058f0684877467431c7b5d..c200f14f4fb030368d3526fb38e42bd15a7c8da9 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -79,12 +79,6 @@ module QA click_element :squash_checkbox end - - def has_milestone?(milestone_title) - page.within('.issuable-sidebar') do - !!find("[href*='/milestones/']", text: milestone_title, wait: 1) - end - end end end end diff --git a/qa/qa/specs/features/merge_request/create_spec.rb b/qa/qa/specs/features/merge_request/create_spec.rb index 5807e5396997cadf2ca9a9d9e49c383b90cbc227..36d7efb02e169c6bed8123a9453c00f0417db55a 100644 --- a/qa/qa/specs/features/merge_request/create_spec.rb +++ b/qa/qa/specs/features/merge_request/create_spec.rb @@ -20,11 +20,12 @@ module QA merge_request.milestone = current_milestone end - Page::MergeRequest::Show.perform do |merge_request| - expect(page).to have_content('This is a merge request with a milestone') - expect(page).to have_content('Great feature with milestone') - expect(page).to have_content(/Opened [\w\s]+ ago/) - expect(merge_request).to have_milestone(current_milestone.title) + expect(page).to have_content('This is a merge request with a milestone') + expect(page).to have_content('Great feature with milestone') + expect(page).to have_content(/Opened [\w\s]+ ago/) + + Page::Issuable::Sidebar.perform do |sidebar| + expect(sidebar).to have_milestone(current_milestone.title) end end end