Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Adapt timeline tests to the fact that there is no viewSelector any more but a separate module

Henriette Darge47d86b9b1f0e
diff --git a/modules/bim/spec/features/card_view/baseline_rendering_spec.rb b/modules/bim/spec/features/card_view/baseline_rendering_spec.rb
deleted file mode 100644
index bfd35dc432b..00000000000
--- a/modules/bim/spec/features/card_view/baseline_rendering_spec.rb
+++ /dev/null
@@ -1,203 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2024 the OpenProject GmbH
-#
-# 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:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# 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.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-
-require 'spec_helper'
-require_relative '../../support/pages/ifc_models/show_default'
-
-RSpec.describe 'baseline rendering',
- :js,
- :with_cuprite,
- with_config: { edition: 'bim' },
- with_settings: { date_format: '%Y-%m-%d' } do
- shared_let(:type_bug) { create(:type_bug) }
- shared_let(:type_task) { create(:type_task) }
-
- shared_let(:project) do
- create(:project,
- types: [type_bug, type_task])
- end
-
- shared_let(:user) do
- create(:admin,
- firstname: 'Itsa',
- lastname: 'Me',
- member_with_permissions: { project => %i[view_work_packages edit_work_packages work_package_assigned
- assign_versions] })
- end
-
- shared_let(:assignee) do
- create(:user,
- firstname: 'Assigned',
- lastname: 'User',
- member_with_permissions: { project => %i[view_work_packages edit_work_packages work_package_assigned] })
- end
-
- shared_let(:display_representation) { Components::WorkPackages::DisplayRepresentation.new }
-
- shared_let(:wp_bug) do
- create(:work_package,
- project:,
- type: type_bug,
- subject: 'A bug',
- created_at: 5.days.ago,
- updated_at: 5.days.ago)
- end
-
- shared_let(:wp_task) do
- create(:work_package,
- project:,
- type: type_task,
- subject: 'A task',
-
- created_at: 5.days.ago,
- updated_at: 5.days.ago)
- end
-
- shared_let(:wp_task_changed) do
- wp = Timecop.travel(5.days.ago) do
- create(:work_package,
- project:,
- type: type_task,
- assigned_to: assignee,
- responsible: assignee,
- subject: 'Old subject',
- start_date: '2023-05-01',
- due_date: '2023-05-02')
- end
-
- Timecop.travel(1.day.ago) do
- WorkPackages::UpdateService
- .new(user:, model: wp)
- .call(
- subject: 'New subject',
- start_date: Time.zone.today - 1.day,
- due_date: Time.zone.today,
- assigned_to: user,
- responsible: user
- )
- .on_failure { |result| raise result.message }
- .result
- end
- end
-
- shared_let(:wp_task_assigned) do
- wp = Timecop.travel(5.days.ago) do
- create(:work_package,
- project:,
- type: type_task,
- assigned_to: nil)
- end
-
- Timecop.travel(1.day.ago) do
- WorkPackages::UpdateService
- .new(user:, model: wp)
- .call(assigned_to: user)
- .on_failure { |result| raise result.message }
- .result
- end
- end
-
- shared_let(:wp_task_was_bug) do
- wp = Timecop.travel(5.days.ago) do
- create(:work_package, project:, type: type_bug, subject: 'Bug changed to Task')
- end
-
- Timecop.travel(1.day.ago) do
- WorkPackages::UpdateService
- .new(user:, model: wp)
- .call(type: type_task)
- .on_failure { |result| raise result.message }
- .result
- end
- end
-
- shared_let(:wp_bug_was_task) do
- wp = Timecop.travel(5.days.ago) do
- create(:work_package, project:, type: type_task, subject: 'Task changed to Bug')
- end
-
- Timecop.travel(1.day.ago) do
- WorkPackages::UpdateService
- .new(user:, model: wp)
- .call(type: type_bug)
- .on_failure { |result| raise result.message }
- .result
- end
- end
-
- shared_let(:query) do
- query = create(:query,
- name: 'Timestamps Query',
- project:,
- user:)
-
- query.timestamps = ["P-2d", "PT0S"]
- query.add_filter('type_id', '=', [type_task.id])
- query.column_names =
- %w[id subject status type start_date due_date version priority assigned_to responsible]
- query.save!(validate: false)
-
- query
- end
-
- let(:wp_table) { Pages::IfcModels::ShowDefault.new(project) }
- let(:baseline) { Components::WorkPackages::Baseline.new }
-
- current_user { user }
-
- describe 'with EE', with_ee: %i[baseline_comparison] do
- it 'does show changes' do
- wp_table.visit_query(query)
- wp_table.expect_work_package_listed wp_task, wp_task_changed, wp_task_was_bug, wp_bug_was_task,
- wp_task_assigned
- wp_table.ensure_work_package_not_listed! wp_bug
-
- baseline.expect_active
- baseline.expect_added wp_task_was_bug
- baseline.expect_removed wp_bug_was_task
- baseline.expect_changed wp_task_changed
- baseline.expect_changed wp_task_assigned
- baseline.expect_unchanged wp_task
-
- # show icons on work package single card
- wp_table.switch_view 'Cards'
- within "wp-single-card[data-work-package-id='#{wp_bug_was_task.id}']" do
- expect(page).to have_css(".op-table-baseline--icon-removed")
- end
- within "wp-single-card[data-work-package-id='#{wp_task_was_bug.id}']" do
- expect(page).to have_css(".op-table-baseline--icon-added")
- end
- within "wp-single-card[data-work-package-id='#{wp_task_changed.id}']" do
- expect(page).to have_css(".op-table-baseline--icon-changed")
- end
- within "wp-single-card[data-work-package-id='#{wp_task.id}']" do
- expect(page).to have_no_css(".op-wp-single-card--content-baseline")
- end
- end
- end
-end
diff --git a/modules/bim/spec/features/card_view/bulk_actions_spec.rb b/modules/bim/spec/features/card_view/bulk_actions_spec.rb
index 4ac2ac176ff..21a38d67b9d 100644
--- a/modules/bim/spec/features/card_view/bulk_actions_spec.rb
+++ b/modules/bim/spec/features/card_view/bulk_actions_spec.rb
@@ -2,20 +2,22 @@ require 'spec_helper'
require_relative '../../support/pages/ifc_models/show_default'
RSpec.describe 'Copy work packages through Rails view', :js, :with_cuprite, with_config: { edition: 'bim' } do
- shared_let(:project) { create(:project, name: 'Source') }
+ shared_let(:project) { create(:project, name: 'Source', enabled_module_names: %i[bim work_package_tracking]) }
shared_let(:dev) do
create(:user,
firstname: 'Dev',
lastname: 'Guy',
- member_with_permissions: { project => %i[view_work_packages work_package_assigned] })
+ member_with_permissions: { project => %i[view_work_packages work_package_assigned
+ view_ifc_models view_linked_issues] })
end
shared_let(:mover) do
create(:user,
firstname: 'Manager',
lastname: 'Guy',
member_with_permissions: {
- project => %i[view_work_packages copy_work_packages move_work_packages manage_subtasks assign_versions
+ project => %i[view_work_packages view_ifc_models view_linked_issues
+ copy_work_packages move_work_packages manage_subtasks assign_versions edit_work_packages
add_work_packages]
})
end
@@ -48,7 +50,7 @@ RSpec.describe 'Copy work packages through Rails view', :js, :with_cuprite, with
let(:current_user) { mover }
it 'does allow to copy' do
- context_menu.open_for work_package
+ context_menu.open_for work_package, card_view: true
context_menu.expect_options 'Bulk copy'
end
end
@@ -57,7 +59,7 @@ RSpec.describe 'Copy work packages through Rails view', :js, :with_cuprite, with
let(:current_user) { dev }
it 'does not allow to copy' do
- context_menu.open_for work_package
+ context_menu.open_for work_package, card_view: true
context_menu.expect_no_options 'Bulk copy'
end
end
@@ -65,8 +67,10 @@ RSpec.describe 'Copy work packages through Rails view', :js, :with_cuprite, with
describe 'accessing the bulk move from the card view' do
context 'with permissions' do
+ let(:current_user) { mover }
+
it 'does allow to move' do
- context_menu.open_for work_package
+ context_menu.open_for work_package, card_view: true
context_menu.expect_options 'Bulk change of project'
end
end
@@ -75,7 +79,7 @@ RSpec.describe 'Copy work packages through Rails view', :js, :with_cuprite, with
let(:current_user) { dev }
it 'does not allow to move' do
- context_menu.open_for work_package
+ context_menu.open_for work_package, card_view: true
context_menu.expect_no_options 'Bulk change of project'
end
end
@@ -86,7 +90,7 @@ RSpec.describe 'Copy work packages through Rails view', :js, :with_cuprite, with
let(:current_user) { mover }
it 'does allow to edit' do
- context_menu.open_for work_package
+ context_menu.open_for work_package, card_view: true
context_menu.expect_options 'Bulk edit'
end
@@ -94,11 +98,13 @@ RSpec.describe 'Copy work packages through Rails view', :js, :with_cuprite, with
let!(:budget) { create(:budget, project:) }
it 'updates all the work packages' do
- context_menu.open_for work_package
+ context_menu.open_for work_package, card_view: true
context_menu.choose 'Bulk edit'
select budget.subject, from: 'work_package_budget_id'
click_on 'Submit'
+ wp_table.expect_and_dismiss_toaster message: 'Successful update.'
+
expect(work_package.reload.budget_id).to eq(budget.id)
expect(work_package2.reload.budget_id).to eq(budget.id)
end
@@ -109,7 +115,7 @@ RSpec.describe 'Copy work packages through Rails view', :js, :with_cuprite, with
let(:current_user) { dev }
it 'does not allow to edit' do
- context_menu.open_for work_package
+ context_menu.open_for work_package, card_view: true
context_menu.expect_no_options 'Bulk edit'
end
end
diff --git a/modules/bim/spec/features/card_view/context_menu_spec.rb b/modules/bim/spec/features/card_view/context_menu_spec.rb
index e108b659a34..e4613f35a0e 100644
--- a/modules/bim/spec/features/card_view/context_menu_spec.rb
+++ b/modules/bim/spec/features/card_view/context_menu_spec.rb
@@ -3,12 +3,12 @@ require_relative '../../../../../spec/features/work_packages/table/context_menu/
require_relative '../../support/pages/ifc_models/show_default'
RSpec.describe 'Work Package table hierarchy and sorting', :js, :with_cuprite, with_config: { edition: 'bim' } do
- shared_let(:project) { create(:project) }
+ shared_let(:project) { create(:project, enabled_module_names: %i[bim work_package_tracking costs]) }
let(:wp_table) { Pages::IfcModels::ShowDefault.new(project) }
let(:hierarchy) { Components::WorkPackages::Hierarchies.new }
- shared_let(:wp_root) do
+ shared_let(:work_package) do
create(:work_package,
project:,
subject: 'Parent')
@@ -17,31 +17,32 @@ RSpec.describe 'Work Package table hierarchy and sorting', :js, :with_cuprite, w
shared_let(:wp_child1) do
create(:work_package,
project:,
- parent: wp_root,
+ parent: work_package,
subject: 'WP child 1')
end
shared_let(:wp_child2) do
create(:work_package,
project:,
- parent: wp_root,
+ parent: work_package,
subject: 'WP child 2')
end
+ shared_let(:menu) { Components::WorkPackages::ContextMenu.new }
shared_current_user { create(:admin) }
it 'does not show indentation context in card view' do
wp_table.visit!
- wp_table.expect_work_package_listed(wp_root, wp_child1, wp_child2)
+ loading_indicator_saveguard
+ wp_table.expect_work_package_listed(work_package, wp_child1, wp_child2)
wp_table.switch_view 'Cards'
expect(page).to have_test_selector('op-wp-single-card', count: 3)
# Expect indent-able for none
- hierarchy.expect_indent(wp_root, indent: false, outdent: false)
- hierarchy.expect_indent(wp_child1, indent: false, outdent: false)
- hierarchy.expect_indent(wp_child2, indent: false, outdent: false)
- hierarchy.expect_indent(wp_child3, indent: false, outdent: false)
+ hierarchy.expect_indent(work_package, indent: false, outdent: false, card_view: true)
+ hierarchy.expect_indent(wp_child1, indent: false, outdent: false, card_view: true)
+ hierarchy.expect_indent(wp_child2, indent: false, outdent: false, card_view: true)
end
it_behaves_like 'provides a single WP context menu' do
@@ -49,14 +50,16 @@ RSpec.describe 'Work Package table hierarchy and sorting', :js, :with_cuprite, w
-> {
# Go to table
wp_table.visit!
- wp_table.expect_work_package_listed(wp_root)
+ loading_indicator_saveguard
+
+ wp_table.expect_work_package_listed(work_package)
wp_table.switch_view 'Cards'
loading_indicator_saveguard
# Open context menu
menu.expect_closed
- menu.open_for(wp_root)
+ menu.open_for(work_package, card_view: true)
}
end
end
diff --git a/modules/bim/spec/features/card_view/manual_sorting_spec.rb b/modules/bim/spec/features/card_view/manual_sorting_spec.rb
deleted file mode 100644
index 8ea38712ba0..00000000000
--- a/modules/bim/spec/features/card_view/manual_sorting_spec.rb
+++ /dev/null
@@ -1,103 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2024 the OpenProject GmbH
-#
-# 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:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# 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.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-
-require 'spec_helper'
-require 'features/work_packages/work_packages_page'
-require_relative '../../support/pages/ifc_models/show_default'
-
-RSpec.describe 'Manual sorting of WP table', :js, with_config: { edition: 'bim' } do
- let(:user) { create(:admin) }
- let(:wp_table) { Pages::IfcModels::ShowDefault.new(project) }
-
- let(:project) { create(:project, types: [type_task, type_bug]) }
- let(:work_package1) do
- create(:work_package, subject: 'WP1', project:, created_at: Time.zone.now)
- end
- let(:work_package2) do
- create(:work_package,
- subject: 'WP2',
- project:,
- parent: work_package1,
- created_at: 1.minute.ago)
- end
- let(:work_package3) do
- create(:work_package,
- subject: 'WP3',
- project:,
- parent: work_package2,
- created_at: 2.minutes.ago)
- end
-
- let(:sort_by) { Components::WorkPackages::SortBy.new }
- let(:hierarchies) { Components::WorkPackages::Hierarchies.new }
-
- def expect_query_order(query, expected)
- retry_block do
- query.reload
-
- # work_package4 was not positioned
- found = query.ordered_work_packages.pluck(:work_package_id)
-
- raise "Backend order is incorrect: #{found} != #{expected}" unless found == expected
- end
- end
-
- before do
- login_as(user)
-
- work_package1
- work_package2
- work_package3
- wp_table.visit!
- hierarchies.disable_via_header
- wp_table.expect_work_package_order work_package1, work_package2, work_package3
-
- wp_table.switch_view 'Cards'
- loading_indicator_saveguard
- end
-
- context 'when view is card' do
- let(:wp_card) { Pages::WorkPackageCards.new(project) }
-
- it 'can sort cards via DragNDrop' do
- wp_card.drag_and_drop_work_package from: 0, to: 3
-
- wp_card.expect_work_package_order work_package2, work_package3, work_package4, work_package1
-
- wp_card.expect_and_dismiss_toaster message: 'Successful creation.'
-
- query = Query.last
- expect(query.name).to eq 'New manually sorted query'
- expect_query_order(query, [work_package2.id, work_package3.id, work_package4.id, work_package1.id])
-
- wp_card.drag_and_drop_work_package from: 0, to: 2
-
- expect_query_order(query, [work_package3.id, work_package4.id, work_package1.id, work_package2.id])
- end
- end
-end
diff --git a/modules/bim/spec/features/card_view/select_card_spec.rb b/modules/bim/spec/features/card_view/select_card_spec.rb
index 7b21f7d4839..2f1033ba71c 100644
--- a/modules/bim/spec/features/card_view/select_card_spec.rb
+++ b/modules/bim/spec/features/card_view/select_card_spec.rb
@@ -31,7 +31,7 @@ require_relative '../../support/pages/ifc_models/show_default'
RSpec.describe 'Selecting cards in the card view (regression #31962)', :js, with_config: { edition: 'bim' } do
let(:user) { create(:admin) }
- let(:project) { create(:project) }
+ let(:project) { create(:project, enabled_module_names: %i[bim work_package_tracking]) }
let(:wp_table) { Pages::IfcModels::ShowDefault.new(project) }
let(:cards) { Pages::WorkPackageCards.new(project) }
let!(:work_package1) { create(:work_package, project:) }
diff --git a/modules/bim/spec/features/card_view/wp_card_status_spec.rb b/modules/bim/spec/features/card_view/wp_card_status_spec.rb
index 2e9ab55a3dd..b9aa237ff82 100644
--- a/modules/bim/spec/features/card_view/wp_card_status_spec.rb
+++ b/modules/bim/spec/features/card_view/wp_card_status_spec.rb
@@ -31,7 +31,7 @@ require_relative '../../support/pages/ifc_models/show_default'
RSpec.describe 'Update status from WP card', :js, :with_cuprite, with_config: { edition: 'bim' } do
let(:manager_role) do
- create(:project_role, permissions: %i[view_work_packages edit_work_packages])
+ create(:project_role, permissions: %i[view_work_packages edit_work_packages view_ifc_models view_linked_issues])
end
let(:manager) do
create(:user,
@@ -43,7 +43,7 @@ RSpec.describe 'Update status from WP card', :js, :with_cuprite, with_config: {
let(:status2) { create(:status) }
let(:type) { create(:type) }
- let!(:project) { create(:project, types: [type]) }
+ let!(:project) { create(:project, types: [type], enabled_module_names: %i[bim work_package_tracking]) }
let!(:work_package) do
create(:work_package,
project:,
@@ -67,6 +67,7 @@ RSpec.describe 'Update status from WP card', :js, :with_cuprite, with_config: {
login_as(manager)
wp_table.visit!
+ loading_indicator_saveguard
wp_table.expect_work_package_listed(work_package)
wp_table.switch_view 'Cards'
diff --git a/modules/bim/spec/features/display_representations/switch_display_representations_spec.rb b/modules/bim/spec/features/display_representations/switch_display_representations_spec.rb
index d0a35d27736..c227b5ef0bc 100644
--- a/modules/bim/spec/features/display_representations/switch_display_representations_spec.rb
+++ b/modules/bim/spec/features/display_representations/switch_display_representations_spec.rb
@@ -34,7 +34,7 @@ RSpec.describe 'Switching work package view',
with_ee: %i[conditional_highlighting],
with_config: { edition: 'bim' } do
let(:user) { create(:admin) }
- let(:project) { create(:project) }
+ let(:project) { create(:project, enabled_module_names: %i[bim work_package_tracking]) }
let(:wp_page) { Pages::IfcModels::ShowDefault.new(project) }
let(:highlighting) { Components::WorkPackages::Highlighting.new }
let(:cards) { Pages::WorkPackageCards.new(project) }
@@ -63,6 +63,7 @@ RSpec.describe 'Switching work package view',
login_as(user)
wp_page.visit!
+ loading_indicator_saveguard
wp_page.expect_work_package_listed wp_1, wp_2
end
@@ -70,58 +71,14 @@ RSpec.describe 'Switching work package view',
before do
# Enable card representation
wp_page.switch_view 'Cards'
+ loading_indicator_saveguard
cards.expect_work_package_listed wp_1, wp_2
end
- it 'can switch the representations and keep the configuration settings' do
- # Enable highlighting
- highlighting.switch_entire_row_highlight "Priority"
- within "wp-single-card[data-work-package-id='#{wp_1.id}']" do
- expect(page).to have_css(".op-wp-single-card--highlighting.__hl_background_priority_#{priority1.id}")
- end
- within "wp-single-card[data-work-package-id='#{wp_2.id}']" do
- expect(page).to have_css(".op-wp-single-card--highlighting.__hl_background_priority_#{priority2.id}")
- end
-
- # Switch back to list representation & Highlighting is kept
- wp_page.switch_view 'Table'
- wp_page.expect_work_package_listed wp_1, wp_2
- expect(page).to have_css("#{wp_page.row_selector(wp_1)}.__hl_background_priority_#{priority1.id}")
- expect(page).to have_css("#{wp_page.row_selector(wp_2)}.__hl_background_priority_#{priority2.id}")
-
- # Change attribute
- highlighting.switch_entire_row_highlight "Status"
- expect(page).to have_css("#{wp_page.row_selector(wp_1)}.__hl_background_status_#{status.id}")
- expect(page).to have_css("#{wp_page.row_selector(wp_2)}.__hl_background_status_#{status.id}")
-
- # Switch back to card representation & Highlighting is kept, too
- wp_page.switch_view 'Card'
- within "wp-single-card[data-work-package-id='#{wp_1.id}']" do
- expect(page).to have_css(".op-wp-single-card--highlighting.__hl_background_status_#{status.id}")
- end
- within "wp-single-card[data-work-package-id='#{wp_2.id}']" do
- expect(page).to have_css(".op-wp-single-card--highlighting.__hl_background_status_#{status.id}")
- end
- end
-
it 'saves the representation in the query' do
# After refresh the WP are still displayed as cards
page.driver.browser.navigate.refresh
cards.expect_work_package_listed wp_1, wp_2
end
end
-
- context 'when reordering an unsaved query' do
- it 'retains that order' do
- wp_page.expect_work_package_order wp_1, wp_2
-
- wp_page.drag_and_drop_work_package from: 1, to: 0
-
- wp_page.expect_work_package_order wp_2, wp_1
-
- wp_page.switch_view 'Cards'
-
- cards.expect_work_package_order wp_2, wp_1
- end
- end
end
diff --git a/modules/bim/spec/support/pages/ifc_models/show_default.rb b/modules/bim/spec/support/pages/ifc_models/show_default.rb
index 0b4fb31ba45..21f02b4719d 100644
--- a/modules/bim/spec/support/pages/ifc_models/show_default.rb
+++ b/modules/bim/spec/support/pages/ifc_models/show_default.rb
@@ -53,6 +53,13 @@ module Pages
finished_loading
end
+ # Visits the BCF module with the specified query.
+ #
+ # @param query [Query] The query object.
+ def visit_query(query)
+ visit "#{path}?query_id=#{query.id}"
+ end
+
def expect_details_path
expect(page).to have_current_path /\/bcf\/details/, ignore_query: true
end
diff --git a/spec/factories/query_factory.rb b/spec/factories/query_factory.rb
index 984e4cbdf62..0e262abfb29 100644
--- a/spec/factories/query_factory.rb
+++ b/spec/factories/query_factory.rb
@@ -83,6 +83,14 @@ FactoryBot.define do
end
end
+ factory :query_with_view_bim do
+ sequence(:name) { |n| "Bim query #{n}" }
+
+ callback(:after_create) do |query|
+ create(:view_bim, query:)
+ end
+ end
+
callback(:after_build) { |query| query.add_default_filter }
end
end
diff --git a/spec/factories/view_factory.rb b/spec/factories/view_factory.rb
index e7f9e631bc6..31c63b61b50 100644
--- a/spec/factories/view_factory.rb
+++ b/spec/factories/view_factory.rb
@@ -41,4 +41,8 @@ FactoryBot.define do
factory :view_gantt, parent: :view do
type { 'gantt' }
end
+
+ factory :view_bim, parent: :view do
+ type { 'bim' }
+ end
end
diff --git a/spec/features/work_packages/navigation_spec.rb b/spec/features/work_packages/navigation_spec.rb
index e4bbb6348e0..a5d04cc9754 100644
--- a/spec/features/work_packages/navigation_spec.rb
+++ b/spec/features/work_packages/navigation_spec.rb
@@ -34,7 +34,6 @@ RSpec.describe 'Work package navigation', :js, :selenium do
let(:work_package) { build(:work_package, project:) }
let(:global_html_title) { Components::HtmlTitle.new }
let(:project_html_title) { Components::HtmlTitle.new project }
- let(:wp_display) { Components::WorkPackages::DisplayRepresentation.new }
let(:wp_title_segment) do
"#{work_package.type.name}: #{work_package.subject} (##{work_package.id})"
end
@@ -193,25 +192,6 @@ RSpec.describe 'Work package navigation', :js, :selenium do
full_page.ensure_page_loaded
end
- it 'moving back from gantt to "All open" (Regression #30921)' do
- wp_table = Pages::WorkPackagesTable.new project
- wp_table.visit!
-
- # Switch to gantt view
- wp_display.expect_state 'Table'
- wp_display.switch_to_gantt_layout
- wp_display.expect_state 'Gantt'
-
- # Click on All open
- find('.op-sidemenu--item-action', text: 'All open').click
-
- if OpenProject::Configuration.bim?
- wp_display.expect_state 'Cards'
- else
- wp_display.expect_state 'Table'
- end
- end
-
describe 'moving back to filtered list after change' do
let!(:work_package) { create(:work_package, project:, subject: 'foo') }
let!(:query) do
diff --git a/spec/features/work_packages/sorting/manual_sorting_spec.rb b/spec/features/work_packages/sorting/manual_sorting_spec.rb
index 3e9b38a056e..02d5262226f 100644
--- a/spec/features/work_packages/sorting/manual_sorting_spec.rb
+++ b/spec/features/work_packages/sorting/manual_sorting_spec.rb
@@ -29,13 +29,13 @@
require 'spec_helper'
require 'features/work_packages/work_packages_page'
-RSpec.describe 'Manual sorting of WP table', :js do
+RSpec.describe 'Manual sorting of WP table', :js, with_flag: { show_separate_gantt_module: true } do
let(:user) { create(:admin) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
let(:type_task) { create(:type_task) }
let(:type_bug) { create(:type_bug) }
- let(:project) { create(:project, types: [type_task, type_bug]) }
+ let(:project) { create(:project, types: [type_task, type_bug], enabled_module_names: %i[work_package_tracking gantt]) }
let(:work_package1) do
create(:work_package, subject: 'WP1', project:, type: type_task, created_at: Time.zone.now)
end
@@ -392,17 +392,28 @@ RSpec.describe 'Manual sorting of WP table', :js do
context 'when view is gantt chart' do
let(:wp_timeline) { Pages::WorkPackagesTimeline.new(project) }
+ let!(:query_tl) do
+ query = build(:query_with_view_gantt, user:, project:)
+ query.filters.clear
+ query.timeline_visible = true
+ query.name = 'Query with Timeline'
+
+ query.save!
+
+ query
+ end
+
it 'reloads after drop' do
- wp_timeline.toggle_timeline
+ wp_timeline.visit_query(query_tl)
wp_timeline.expect_timeline!
wp_timeline.expect_row_count(4)
- wp_timeline.expect_work_package_order work_package1, work_package2, work_package3, work_package4
+ wp_timeline.expect_work_package_order work_package4, work_package3, work_package2, work_package1
wp_table.drag_and_drop_work_package from: 1, to: 3
- wp_table.expect_work_package_order work_package1, work_package3, work_package2, work_package4
- wp_timeline.expect_work_package_order work_package1, work_package3, work_package2, work_package4
+ wp_table.expect_work_package_order work_package4, work_package2, work_package3, work_package1
+ wp_timeline.expect_work_package_order work_package4, work_package2, work_package3, work_package1
end
end
end
diff --git a/spec/features/work_packages/table/context_menu/context_menu_spec.rb b/spec/features/work_packages/table/context_menu/context_menu_spec.rb
index 5686ec5e4b8..bc0e5b40f79 100644
--- a/spec/features/work_packages/table/context_menu/context_menu_spec.rb
+++ b/spec/features/work_packages/table/context_menu/context_menu_spec.rb
@@ -1,13 +1,28 @@
require 'spec_helper'
require_relative 'context_menu_shared_examples'
-RSpec.describe 'Work package table context menu', :js, :with_cuprite do
+RSpec.describe 'Work package table context menu',
+ :js,
+ :with_cuprite,
+ with_flag: { show_separate_gantt_module: true } do
shared_let(:user) { create(:admin) }
- shared_let(:work_package) { create(:work_package) }
+ shared_let(:project) { create(:project, enabled_module_names: %i[work_package_tracking gantt costs]) }
+ shared_let(:work_package) { create(:work_package, project:) }
- shared_let(:wp_table) { Pages::WorkPackagesTable.new(work_package.project) }
+ shared_let(:wp_table) { Pages::WorkPackagesTable.new(project) }
shared_let(:menu) { Components::WorkPackages::ContextMenu.new }
- let(:wp_timeline) { Pages::WorkPackagesTimeline.new(work_package.project) }
+ shared_let(:wp_timeline) { Pages::WorkPackagesTimeline.new(project) }
+
+ let!(:query_tl) do
+ query = build(:query_with_view_gantt, user:, project:)
+ query.filters.clear
+ query.timeline_visible = true
+ query.name = 'Query with Timeline'
+
+ query.save!
+
+ query
+ end
before do
login_as(user)
@@ -20,8 +35,8 @@ RSpec.describe 'Work package table context menu', :js, :with_cuprite do
-> {
# Go to table
wp_table.visit!
- wp_table.expect_work_package_listed(work_package)
loading_indicator_saveguard
+ wp_table.expect_work_package_listed(work_package)
# Open context menu
menu.expect_closed
@@ -29,32 +44,16 @@ RSpec.describe 'Work package table context menu', :js, :with_cuprite do
}
end
- it 'provides a context menu with timeline options' do
- open_context_menu.call
- # Open timeline
- wp_timeline.toggle_timeline
- wp_timeline.expect_timeline!(open: true)
-
- # Open context menu
- menu.expect_closed
- menu.open_for(work_package)
- menu.expect_options 'Add predecessor', 'Add follower', 'Show relations'
-
- # Show relations tab when selecting show-relations from menu
- menu.choose('Show relations')
- expect(page).to have_current_path /details\/#{work_package.id}\/relations/
- end
-
context 'for multiple selected WPs' do
let!(:work_package2) { create(:work_package, project: work_package.project) }
it 'provides a context menu with a subset of the available menu items' do
# Go to table
wp_table.visit!
- wp_table.expect_work_package_listed(work_package)
- wp_table.expect_work_package_listed(work_package2)
loading_indicator_saveguard
+ wp_table.expect_work_package_listed(work_package)
+ wp_table.expect_work_package_listed(work_package2)
# Select all WPs
find('body').send_keys [:control, 'a']
@@ -65,5 +64,24 @@ RSpec.describe 'Work package table context menu', :js, :with_cuprite do
end
end
end
+
+ context 'when in Gantt' do
+ it 'provides a context menu with timeline options' do
+ wp_timeline.visit_query(query_tl)
+ loading_indicator_saveguard
+ wp_timeline.expect_work_package_listed(work_package)
+ wp_timeline.expect_timeline!
+
+ # Open context menu
+ menu.expect_closed
+ menu.open_for(work_package)
+ menu.expect_options 'Open details view', 'Open fullscreen view', 'Add predecessor', 'Add follower', 'Show relations'
+ menu.expect_no_options 'Log time'
+
+ # Show relations tab when selecting show-relations from menu
+ menu.choose('Show relations')
+ expect(page).to have_current_path /details\/#{work_package.id}\/relations/
+ end
+ end
end
end
diff --git a/spec/features/work_packages/table/relations_spec.rb b/spec/features/work_packages/table/relations_spec.rb
index ac2311e4e9e..eb071852840 100644
--- a/spec/features/work_packages/table/relations_spec.rb
+++ b/spec/features/work_packages/table/relations_spec.rb
@@ -10,7 +10,6 @@ RSpec.describe 'Work Package table relations', :js, with_ee: %i[work_package_que
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
let(:relations) { Components::WorkPackages::Relations.new(relations) }
let(:columns) { Components::WorkPackages::Columns.new }
- let(:wp_timeline) { Pages::WorkPackagesTimeline.new(project) }
let!(:wp_from) { create(:work_package, project:, type: type2) }
let!(:wp_to) { create(:work_package, project:, type:) }
@@ -79,23 +78,6 @@ RSpec.describe 'Work Package table relations', :js, with_ee: %i[work_package_que
expect(page).to have_css(".__relations-expanded-from-#{wp_from.id}", count: 2)
related_row = page.first(".__relations-expanded-from-#{wp_from.id}")
expect(related_row).to have_css('.wp-table--relation-cell-td', text: wp_to.type)
-
- # Open Timeline
- # Should be initially closed
- wp_timeline.expect_timeline!(open: false)
-
- # Enable timeline
- wp_timeline.toggle_timeline
- wp_timeline.expect_timeline!(open: true)
-
- # 3 WPs + 2 expanded relations
- wp_timeline.expect_row_count(5)
-
- # Collapse
- wp_from_row.find(".#{type_column_follows} .wp-table--relation-indicator").click
- expect(page).to have_no_css(".__relations-expanded-from-#{wp_from.id}")
-
- wp_timeline.expect_row_count(3)
end
end
diff --git a/spec/features/work_packages/timeline/timeline_dates_spec.rb b/spec/features/work_packages/timeline/timeline_dates_spec.rb
index af4edd746d9..05d426ca0ac 100644
--- a/spec/features/work_packages/timeline/timeline_dates_spec.rb
+++ b/spec/features/work_packages/timeline/timeline_dates_spec.rb
@@ -28,9 +28,13 @@
require 'spec_helper'
-RSpec.describe 'Work package timeline date formatting', :js, :selenium, with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe 'Work package timeline date formatting',
+ :js,
+ :selenium,
+ with_flag: { show_separate_gantt_module: true },
+ with_settings: { date_format: '%Y-%m-%d' } do
shared_let(:type) { create(:type_bug, color: create(:color_green)) }
- shared_let(:project) { create(:project, types: [type]) }
+ shared_let(:project) { create(:project, types: [type], enabled_module_names: %i[work_package_tracking gantt]) }
shared_let(:start_date) { Date.parse('2020-12-31') }
shared_let(:due_date) { Date.parse('2021-01-01') }
shared_let(:duration) { due_date - start_date + 1 }
@@ -64,7 +68,7 @@ RSpec.describe 'Work package timeline date formatting', :js, :selenium, with_set
let(:wp_timeline) { Pages::WorkPackagesTimeline.new(project) }
let!(:query_tl) do
- query = build(:query, user: current_user, project:)
+ query = build(:query_with_view_gantt, user: current_user, project:)
query.column_names = ['id', 'type', 'subject']
query.filters.clear
query.timeline_visible = true
diff --git a/spec/features/work_packages/timeline/timeline_hierarchy_spec.rb b/spec/features/work_packages/timeline/timeline_hierarchy_spec.rb
index 80ced03b791..d6dfc337b71 100644
--- a/spec/features/work_packages/timeline/timeline_hierarchy_spec.rb
+++ b/spec/features/work_packages/timeline/timeline_hierarchy_spec.rb
@@ -28,7 +28,10 @@
require 'spec_helper'
-RSpec.describe 'Work package timeline hierarchies', :js, :selenium do
+RSpec.describe 'Work package timeline hierarchies',
+ :js,
+ :selenium,
+ with_flag: { show_separate_gantt_module: true } do
let(:user) { create(:admin) }
let!(:wp_root) do
create(:work_package,
@@ -42,7 +45,7 @@ RSpec.describe 'Work package timeline hierarchies', :js, :selenium do
due_date: 5.days.from_now)
end
let!(:query) do
- query = build(:query, user:, project:)
+ query = build(:query_with_view_gantt, user:, project:)
query.column_names = ['subject']
query.filters.clear
query.show_hierarchies = true
@@ -51,7 +54,7 @@ RSpec.describe 'Work package timeline hierarchies', :js, :selenium do
query.save!
query
end
- let(:project) { create(:project) }
+ let(:project) { create(:project, enabled_module_names: %i[work_package_tracking gantt]) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
let(:hierarchy) { Components::WorkPackages::Hierarchies.new }
diff --git a/spec/features/work_packages/timeline/timeline_labels_spec.rb b/spec/features/work_packages/timeline/timeline_labels_spec.rb
index 037a8d6e075..a99910fa061 100644
--- a/spec/features/work_packages/timeline/timeline_labels_spec.rb
+++ b/spec/features/work_packages/timeline/timeline_labels_spec.rb
@@ -28,7 +28,11 @@
require 'spec_helper'
-RSpec.describe 'Work package timeline labels', :js, :selenium, with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe 'Work package timeline labels',
+ :js,
+ :selenium,
+ with_flag: { show_separate_gantt_module: true },
+ with_settings: { date_format: '%Y-%m-%d' } do
let(:user) { create(:admin) }
let(:today) { Time.zone.today }
let(:tomorrow) { Time.zone.tomorrow }
@@ -54,7 +58,7 @@ RSpec.describe 'Work package timeline labels', :js, :selenium, with_settings: {
let(:type) { create(:type_bug) }
let(:milestone_type) { create(:type, is_milestone: true) }
- let(:project) { create(:project, types: [type, milestone_type]) }
+ let(:project) { create(:project, types: [type, milestone_type], enabled_module_names: %i[work_package_tracking gantt]) }
let(:settings_menu) { Components::WorkPackages::SettingsMenu.new }
let(:config_modal) { Components::Timelines::ConfigurationModal.new }
let(:wp_timeline) { Pages::WorkPackagesTimeline.new(project) }
@@ -70,6 +74,17 @@ RSpec.describe 'Work package timeline labels', :js, :selenium, with_settings: {
)
end
+ let!(:query_tl) do
+ query = build(:query_with_view_gantt, user:, project:)
+ query.filters.clear
+ query.timeline_visible = true
+ query.name = 'Query with Timeline'
+
+ query.save!
+
+ query
+ end
+
def custom_value_for(str)
custom_field.custom_options.find { |co| co.value == str }.try(:id)
end
@@ -80,9 +95,8 @@ RSpec.describe 'Work package timeline labels', :js, :selenium, with_settings: {
work_package
login_as(user)
- wp_timeline.visit!
- wp_timeline.expect_timeline! open: false
- wp_timeline.toggle_timeline
+ wp_timeline.visit_query(query_tl)
+ wp_timeline.expect_timeline!
end
it 'shows and allows to configure labels' do
@@ -124,7 +138,7 @@ RSpec.describe 'Work package timeline labels', :js, :selenium, with_settings: {
farRight: milestone_work_package.status.name
# Save the query
- settings_menu.open_and_save_query 'changed labels'
+ settings_menu.open_and_save_query_as 'changed labels'
wp_timeline.expect_title 'changed labels'
# Check the query
diff --git a/spec/features/work_packages/timeline/timeline_navigation_spec.rb b/spec/features/work_packages/timeline/timeline_navigation_spec.rb
index 3929fb18a3b..04641ed86a8 100644
--- a/spec/features/work_packages/timeline/timeline_navigation_spec.rb
+++ b/spec/features/work_packages/timeline/timeline_navigation_spec.rb
@@ -28,9 +28,12 @@
require 'spec_helper'
-RSpec.describe 'Work package timeline navigation', :js, :selenium do
+RSpec.describe 'Work package timeline navigation',
+ :js,
+ :selenium,
+ with_flag: { show_separate_gantt_module: true } do
let(:user) { create(:admin) }
- let(:project) { create(:project) }
+ let(:project) { create(:project, enabled_module_names: %i[work_package_tracking gantt]) }
let(:query_menu) { Components::WorkPackages::QueryMenu.new }
let(:wp_timeline) { Pages::WorkPackagesTimeline.new(project) }
let(:settings_menu) { Components::WorkPackages::SettingsMenu.new }
@@ -44,6 +47,19 @@ RSpec.describe 'Work package timeline navigation', :js, :selenium do
due_date: Date.current + 5.days)
end
+ let!(:query_tl) do
+ query = build(:query_with_view_gantt, user:, project:)
+ query.column_names = ['id', 'type', 'subject']
+ query.filters.clear
+ query.add_filter('type_id', '=', [type2.id])
+ query.timeline_visible = true
+ query.name = 'Query with Timeline'
+
+ query.save!
+
+ query
+ end
+
before do
work_package
login_as(user)
@@ -67,7 +83,7 @@ RSpec.describe 'Work package timeline navigation', :js, :selenium do
end
let!(:query) do
- query = build(:query, user:, project:)
+ query = build(:query_with_view_work_packages_table, user:, project:)
query.column_names = ['id', 'type', 'subject']
query.filters.clear
query.timeline_visible = false
@@ -81,21 +97,6 @@ RSpec.describe 'Work package timeline navigation', :js, :selenium do
query
end
- let!(:query_tl) do
- query = build(:query, user:, project:)
- query.column_names = ['id', 'type', 'subject']
- query.filters.clear
- query.add_filter('type_id', '=', [type2.id])
- query.timeline_visible = true
- query.name = 'Query with Timeline'
-
- query.save!
- create(:view_work_packages_table,
- query:)
-
- query
- end
-
it 'can move from and to the timeline query (Regression test #26086)' do
# Visit timeline query
wp_timeline.visit_query query_tl
@@ -104,12 +105,20 @@ RSpec.describe 'Work package timeline navigation', :js, :selenium do
wp_timeline.expect_work_package_listed work_package2
wp_timeline.ensure_work_package_not_listed! work_package
+ # Navigate to the WP module
+ find('.main-menu--arrow-left-to-project').click
+ find('#main-menu-work-packages-wrapper .main-menu-toggler').click
+
# Select other query
query_menu.select query
wp_timeline.expect_timeline!(open: false)
wp_timeline.expect_work_package_listed work_package
wp_timeline.ensure_work_package_not_listed! work_package2
+ # Navigate to the Gantt module agin
+ find('.main-menu--arrow-left-to-project').click
+ find('#main-menu-gantt-wrapper .main-menu-toggler').click
+
# Select first query again
query_menu.select query_tl
@@ -135,14 +144,10 @@ RSpec.describe 'Work package timeline navigation', :js, :selenium do
end
it 'can save the open state and zoom of timeline' do
- wp_timeline.visit!
+ wp_timeline.visit_query query_tl
wp_timeline.expect_work_package_listed(work_package)
- # Should be initially closed
- wp_timeline.expect_timeline!(open: false)
-
- # Enable timeline
- wp_timeline.toggle_timeline
+ # Should be initially open
wp_timeline.expect_timeline!(open: true)
# Should have an active element rendered
@@ -197,15 +202,11 @@ RSpec.describe 'Work package timeline navigation', :js, :selenium do
let(:hierarchy) { Components::WorkPackages::Hierarchies.new }
it 'toggles the hierarchy in both views' do
- wp_timeline.visit!
+ wp_timeline.visit_query query_tl
wp_timeline.expect_work_package_listed(work_package)
wp_timeline.expect_work_package_listed(child_work_package)
- # Should be initially closed
- wp_timeline.expect_timeline!(open: false)
-
- # Enable timeline
- wp_timeline.toggle_timeline
+ # Should be initially opened
wp_timeline.expect_timeline!(open: true)
# Should have an active element rendered
@@ -266,7 +267,7 @@ RSpec.describe 'Work package timeline navigation', :js, :selenium do
end
let!(:query) do
- query = build(:query, user:, project:)
+ query = build(:query_with_view_gantt, user:, project:)
query.column_names = ['id', 'subject', 'category']
query.show_hierarchies = false
query.timeline_visible = true
diff --git a/spec/lib/api/v3/queries/query_representer_rendering_spec.rb b/spec/lib/api/v3/queries/query_representer_rendering_spec.rb
index 6cadae70711..bdf1f40037e 100644
--- a/spec/lib/api/v3/queries/query_representer_rendering_spec.rb
+++ b/spec/lib/api/v3/queries/query_representer_rendering_spec.rb
@@ -884,7 +884,7 @@ RSpec.describe API::V3::Queries::QueryRepresenter do
describe 'when timeline is visible' do
let(:query) do
- build_stubbed(:query, project:).tap do |query|
+ build_stubbed(:query_with_view_gantt, project:).tap do |query|
query.timeline_visible = true
end
end
diff --git a/spec/support/components/work_packages/context_menu.rb b/spec/support/components/work_packages/context_menu.rb
index 58f5eaa2388..242533dd7fe 100644
--- a/spec/support/components/work_packages/context_menu.rb
+++ b/spec/support/components/work_packages/context_menu.rb
@@ -41,16 +41,6 @@ module Components
find('body').send_keys :escape
sleep 0.5 unless using_cuprite?
- if card_view.nil?
- view_toggle_button = find_by_id('wp-view-toggle-button', wait: 0)
- # DEBUG Remove me
- if view_toggle_button.nil?
- puts "DEBUG: #{self}#open_for called for a page without a view toggle button. " \
- "Example is #{RSpec.current_example.location} - #{RSpec.current_example.id}"
- end
- card_view = view_toggle_button&.text == 'Cards'
- end
-
if card_view
page.find(".op-wp-single-card-#{work_package.id}").right_click
else
diff --git a/spec/support/components/work_packages/display_representation.rb b/spec/support/components/work_packages/display_representation.rb
deleted file mode 100644
index ea9690a87e0..00000000000
--- a/spec/support/components/work_packages/display_representation.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2024 the OpenProject GmbH
-#
-# 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:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# 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.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-
-module Components
- module WorkPackages
- class DisplayRepresentation
- include Capybara::DSL
- include Capybara::RSpecMatchers
- include RSpec::Matchers
-
- def switch_to_card_layout
- expect_button 'Card'
- select_view 'Card'
- end
-
- def switch_to_list_layout
- expect_button 'Table'
- select_view 'Table'
- end
-
- def switch_to_gantt_layout
- expect_button 'Gantt'
- select_view 'Gantt'
- end
-
- def expect_state(text)
- expect(page).to have_css('#wp-view-toggle-button', text:, wait: 10)
- end
-
- private
-
- def expect_button(forbidden_text)
- expect(page).to have_button('wp-view-toggle-button', disabled: false)
- expect(page).to have_no_css('#wp-view-toggle-button', text: forbidden_text)
- end
-
- def select_view(view_name)
- page.find('wp-view-toggle-button').click
-
- within_view_context_menu do
- click_button(view_name)
- end
- end
-
- def within_view_context_menu(&)
- page.within('#wp-view-context-menu', &)
- end
- end
- end
-end
diff --git a/spec/support/components/work_packages/hierarchies.rb b/spec/support/components/work_packages/hierarchies.rb
index 1f9175abdab..59bbe02d72b 100644
--- a/spec/support/components/work_packages/hierarchies.rb
+++ b/spec/support/components/work_packages/hierarchies.rb
@@ -75,8 +75,8 @@ module Components
expect(page).to have_css('.wp-table--table-header .icon-no-hierarchy')
end
- def expect_indent(work_package, indent: true, outdent: true)
- context_menu.open_for work_package
+ def expect_indent(work_package, indent: true, outdent: true, card_view: false)
+ context_menu.open_for(work_package, card_view:)
if indent
context_menu.expect_options 'Indent hierarchy'
diff --git a/spec/support/pages/work_packages/work_packages_timeline.rb b/spec/support/pages/work_packages/work_packages_timeline.rb
index ef851ea56a7..2b75104bff1 100644
--- a/spec/support/pages/work_packages/work_packages_timeline.rb
+++ b/spec/support/pages/work_packages/work_packages_timeline.rb
@@ -31,8 +31,8 @@ require 'support/pages/work_packages/work_packages_table'
module Pages
class WorkPackagesTimeline < WorkPackagesTable
- def toggle_timeline
- ::Components::WorkPackages::DisplayRepresentation.new.switch_to_gantt_layout
+ def path
+ project ? project_gantt_index_path(project) : gantt_index_path
end
def timeline_row_selector(wp_id)
@@ -52,11 +52,9 @@ module Pages
def expect_work_package_listed(*work_packages)
super(*work_packages)
- if page.has_selector?('#wp-view-toggle-button', text: 'Gantt')
- within(timeline_container) do
- work_packages.each do |wp|
- expect(page).to have_css(".wp-row-#{wp.id}-timeline", visible: true)
- end
+ within(timeline_container) do
+ work_packages.each do |wp|
+ expect(page).to have_css(".wp-row-#{wp.id}-timeline", visible: true)
end
end
end
@@ -64,11 +62,9 @@ module Pages
def expect_work_package_not_listed(*work_packages)
super(*work_packages)
- if page.has_selector?('#wp-view-toggle-button', text: 'Gantt')
- within(timeline_container) do
- work_packages.each do |wp|
- expect(page).to have_no_css(".wp-row-#{wp.id}-timeline", visible: true)
- end
+ within(timeline_container) do
+ work_packages.each do |wp|
+ expect(page).to have_no_css(".wp-row-#{wp.id}-timeline", visible: true)
end
end
end
@@ -85,10 +81,8 @@ module Pages
def expect_timeline!(open: true)
if open
- expect(page).to have_css('#wp-view-toggle-button', text: 'Gantt')
expect(page).to have_css('.wp-table-timeline--container .wp-timeline-cell')
else
- expect(page).to have_no_css('#wp-view-toggle-button', text: 'Gantt')
expect(page).to have_no_css('.wp-table-timeline--container .wp-timeline-cell', visible: true)
end
end