regression test for #24114 (broken watcher filter)

pull/4965/head
Markus Kahl 8 years ago
parent af7495255c
commit e487d53abe
  1. 39
      spec/features/work_packages/table/filter_spec.rb
  2. 5
      spec/support/components/work_packages/filters.rb
  3. 6
      spec/support/pages/work_packages_table.rb

@ -0,0 +1,39 @@
require 'spec_helper'
describe 'filter by watcher', js: true do
let(:user) { FactoryGirl.create :admin }
let(:watcher) { FactoryGirl.create :user }
let(:project) { FactoryGirl.create :project }
let(:role) { FactoryGirl.create :existing_role, permissions: [:view_work_packages] }
let(:work_packages) { FactoryGirl.create_list :work_package, 10, project: project }
let(:watched_wps) { [work_packages[3], work_packages[5], work_packages[7]] }
let(:wp_table) { ::Pages::WorkPackagesTable.new }
let(:filters) { ::Components::WorkPackages::Filters.new }
before do
project.add_member! watcher, role
watched_wps.each_with_index do |wp, i|
wp.add_watcher watcher
wp.subject = "Watched WP ##{i}"
wp.save!
end
login_as(user)
wp_table.visit!
end
# Regression test for bug #24114 (broken watcher filter)
it 'should only filter work packages by watcher' do
filters.open
loading_indicator_saveguard
filters.filter_by_watcher watcher.name
loading_indicator_saveguard
expect(wp_table).to have_work_packages_listed watched_wps
expect(wp_table).not_to have_work_packages_listed (work_packages - watched_wps)
end
end

@ -49,6 +49,11 @@ module Components
expect(page).to have_selector(filters_selector, visible: :hidden)
end
def filter_by_watcher(name)
select "Watcher", from: "add_filter_select"
select name, from: "values-watcher"
end
def remove_filter(field)
page.within(filters_selector) do
find("#filter_#{field} .advanced-filters--remove-filter-icon").click

@ -43,10 +43,14 @@ module Pages
def expect_work_package_listed(work_package)
within(table_container) do
expect(page).to have_content(work_package.subject)
expect(page).to have_cont_nt(work_package.subject)
end
end
def has_work_packages_listed?(work_packages)
work_packages.all? { |wp| has_text? wp.subject }
end
def expect_no_work_package_listed
within(table_container) do
expect(page).to have_selector('#empty-row-notification')

Loading…
Cancel
Save