user_filters_by_multiple_criteria_spec.rb 1.41 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
require 'rails_helper'

describe 'Merge requests > User filters by multiple criteria', :js do
  include FilteredSearchHelpers

  let!(:project)   { create(:project, :public, :repository) }
  let(:user)       { project.creator }
  let!(:milestone) { create(:milestone, title: 'v1.1', project: project) }
  let!(:wontfix)   { create(:label, project: project, title: "Won't fix") }

  before do
    sign_in(user)
    mr = create(:merge_request, title: 'Bugfix2', author: user, assignee: user, source_project: project, target_project: project, milestone: milestone)
    mr.labels << wontfix

    visit project_merge_requests_path(project)
  end

  describe 'filtering by label:~"Won\'t fix" and assignee:~bug' do
    it 'applies the filters' do
      input_filtered_search("label:~\"Won't fix\" assignee:@#{user.username}")

      expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
      expect(page).to have_content 'Bugfix2'
      expect_filtered_search_input_empty
    end
  end

  describe 'filtering by text, author, assignee, milestone, and label' do
    it 'filters by text, author, assignee, milestone, and label' do
      input_filtered_search_keys("author:@#{user.username} assignee:@#{user.username} milestone:%\"v1.1\" label:~\"Won't fix\" Bug")

      expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
      expect(page).to have_content 'Bugfix2'
      expect_filtered_search_input('Bug')
    end
  end
end