diff options
Diffstat (limited to 'spec/support/shared_examples/features/multiple_assignees_widget_mr_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/features/multiple_assignees_widget_mr_shared_examples.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/support/shared_examples/features/multiple_assignees_widget_mr_shared_examples.rb b/spec/support/shared_examples/features/multiple_assignees_widget_mr_shared_examples.rb new file mode 100644 index 00000000000..bbde448a1a1 --- /dev/null +++ b/spec/support/shared_examples/features/multiple_assignees_widget_mr_shared_examples.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +RSpec.shared_examples 'multiple assignees widget merge request' do |action, save_button_title| + it "#{action} a MR with multiple assignees", :js do + find('.js-assignee-search').click + page.within '.dropdown-menu-user' do + click_link user.name + click_link user2.name + end + + # Extra click needed in order to toggle the dropdown + find('.js-assignee-search').click + + expect(all('input[name="merge_request[assignee_ids][]"]', visible: false).map(&:value)) + .to match_array([user.id.to_s, user2.id.to_s]) + + page.within '.js-assignee-search' do + expect(page).to have_content "#{user2.name} + 1 more" + end + + click_button save_button_title + + page.within '.issuable-sidebar' do + page.within '.assignee' do + expect(page).to have_content '2 Assignees' + + click_button('Edit') + + expect(page).to have_content user.name + expect(page).to have_content user2.name + end + end + + page.within '.dropdown-menu-user' do + click_link user.name + end + + page.within '.issuable-sidebar' do + page.within '.assignee' do + # Closing dropdown to persist + click_button('Apply') + + expect(page).to have_content user2.name + end + end + end +end |