BigW Consortium Gitlab

dashboard_issues_spec.rb 1.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
require 'spec_helper'

describe "Dashboard Issues filtering", feature: true, js: true do
  let(:user)      { create(:user) }
  let(:project)   { create(:project) }
  let(:milestone) { create(:milestone, project: project) }

  context 'filtering by milestone' do
    before do
      project.team << [user, :master]
      login_as(user)

      create(:issue, project: project, author: user, assignee: user)
      create(:issue, project: project, author: user, assignee: user, milestone: milestone)

      visit_issues
    end

19
    it 'shows all issues with no milestone' do
20 21 22 23
      show_milestone_dropdown

      click_link 'No Milestone'

24
      expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
25 26 27
      expect(page).to have_selector('.issue', count: 1)
    end

28
    it 'shows all issues with any milestone' do
29 30 31 32
      show_milestone_dropdown

      click_link 'Any Milestone'

33
      expect(page).to have_issuable_counts(open: 2, closed: 0, all: 2)
34 35 36
      expect(page).to have_selector('.issue', count: 2)
    end

37
    it 'shows all issues with the selected milestone' do
38 39 40 41 42 43
      show_milestone_dropdown

      page.within '.dropdown-content' do
        click_link milestone.title
      end

44
      expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
45 46 47 48 49 50 51 52 53 54 55 56 57
      expect(page).to have_selector('.issue', count: 1)
    end
  end

  def show_milestone_dropdown
    click_button 'Milestone'
    expect(page).to have_selector('.dropdown-content', visible: true)
  end

  def visit_issues
    visit issues_dashboard_path
  end
end