kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
3.3 KiB
111 lines
3.3 KiB
11 years ago
|
#-- copyright
|
||
|
# OpenProject is a project management system.
|
||
7 years ago
|
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
|
||
11 years ago
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License version 3.
|
||
|
#
|
||
|
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||
8 years ago
|
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||
11 years ago
|
# Copyright (C) 2010-2013 the ChiliProject Team
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
#
|
||
7 years ago
|
# See docs/COPYRIGHT.rdoc for more details.
|
||
11 years ago
|
#++
|
||
11 years ago
|
|
||
|
require 'spec_helper'
|
||
|
require 'features/work_packages/work_packages_page'
|
||
|
|
||
10 years ago
|
describe 'Query selection', type: :feature do
|
||
7 years ago
|
let(:project) { FactoryBot.create :project, identifier: 'test_project', is_public: false }
|
||
|
let(:role) { FactoryBot.create :role, permissions: [:view_work_packages] }
|
||
8 years ago
|
let(:current_user) do
|
||
7 years ago
|
FactoryBot.create :user, member_in_project: project,
|
||
10 years ago
|
member_through_role: role
|
||
8 years ago
|
end
|
||
11 years ago
|
|
||
7 years ago
|
let(:default_status) { FactoryBot.create(:default_status) }
|
||
6 years ago
|
let(:wp_page) { ::Pages::WorkPackagesTable.new project }
|
||
6 years ago
|
let(:filters) { ::Components::WorkPackages::Filters.new }
|
||
6 years ago
|
|
||
10 years ago
|
|
||
8 years ago
|
let(:query) do
|
||
7 years ago
|
FactoryBot.build(:query, project: project, is_public: true).tap do |query|
|
||
8 years ago
|
query.filters.clear
|
||
|
query.add_filter('assigned_to_id', '=', ['me'])
|
||
|
query.add_filter('done_ratio', '>=', [10])
|
||
9 years ago
|
query.save!
|
||
10 years ago
|
end
|
||
11 years ago
|
end
|
||
|
|
||
|
let(:work_packages_page) { WorkPackagesPage.new(project) }
|
||
|
|
||
8 years ago
|
before do
|
||
|
default_status
|
||
|
|
||
7 years ago
|
login_as(current_user)
|
||
8 years ago
|
end
|
||
|
|
||
10 years ago
|
context 'default view, without a query selected' do
|
||
|
before do
|
||
|
work_packages_page.visit_index
|
||
6 years ago
|
filters.open
|
||
10 years ago
|
end
|
||
|
|
||
|
it 'shows the default (status) filter', js: true do
|
||
6 years ago
|
filters.expect_filter_count 1
|
||
|
filters.expect_filter_by 'Status', 'open', nil
|
||
10 years ago
|
end
|
||
|
end
|
||
|
|
||
11 years ago
|
context 'when a query is selected' do
|
||
|
before do
|
||
8 years ago
|
query
|
||
|
|
||
11 years ago
|
work_packages_page.select_query query
|
||
|
end
|
||
|
|
||
10 years ago
|
it 'shows the saved filters', js: true do
|
||
6 years ago
|
filters.open
|
||
|
filters.expect_filter_by 'Assignee', 'is', ['me']
|
||
|
filters.expect_filter_by 'Progress (%)', '>=', ['10'], 'percentageDone'
|
||
10 years ago
|
end
|
||
|
|
||
|
it 'shows filter count within toggle button', js: true do
|
||
|
expect(find_button('Activate Filter')).to have_text /2$/
|
||
11 years ago
|
end
|
||
|
end
|
||
9 years ago
|
|
||
|
context 'when the selected query is changed' do
|
||
8 years ago
|
let(:query2) do
|
||
7 years ago
|
FactoryBot.create(:query, project: project, is_public: true)
|
||
9 years ago
|
end
|
||
|
|
||
|
before do
|
||
8 years ago
|
query
|
||
|
query2
|
||
|
|
||
9 years ago
|
work_packages_page.select_query query
|
||
|
end
|
||
|
|
||
|
it 'updates the page upon query switching', js: true do
|
||
6 years ago
|
wp_page.expect_title query.name, editable: false
|
||
|
|
||
|
find('.wp-query-menu--item-link', text: query2.name).click
|
||
9 years ago
|
end
|
||
|
end
|
||
11 years ago
|
end
|