OpenProject is the leading open source project management software.
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.
openproject/modules/bim/spec/features/bim_navigation_spec.rb

175 lines
5.9 KiB

5 years ago
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2021 the OpenProject GmbH
5 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:
# Copyright (C) 2006-2013 Jean-Philippe Lang
5 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.
#
# See docs/COPYRIGHT.rdoc for more details.
#++
require_relative '../spec_helper'
5 years ago
describe 'BIM navigation spec',
type: :feature,
with_config: { edition: 'bim' },
js: true do
let(:project) { FactoryBot.create :project, enabled_module_names: %i[bim work_package_tracking] }
5 years ago
let!(:work_package) { FactoryBot.create(:work_package, project: project) }
let(:role) do
FactoryBot.create(:role, permissions: %i[view_ifc_models manage_ifc_models view_work_packages delete_work_packages])
end
5 years ago
let(:user) do
FactoryBot.create :user,
member_in_project: project,
member_through_role: role
end
let(:model) do
FactoryBot.create(:ifc_model_minimal_converted,
5 years ago
project: project,
uploader: user)
end
let(:card_view) { ::Pages::WorkPackageCards.new(project) }
let(:details_view) { ::Pages::BcfDetailsPage.new(work_package, project) }
let(:full_view) { Pages::FullWorkPackage.new(work_package) }
let(:model_tree) { ::Components::XeokitModelTree.new }
let(:destroy_modal) { Components::WorkPackages::DestroyModal.new }
5 years ago
before do
login_as user
model
end
5 years ago
shared_examples 'can switch from split to viewer to list-only' do
before do
model_page.visit!
model_page.finished_loading
end
context 'deep link on the page' do
before do
model_page.visit!
model_page.finished_loading
# Should be at split view
model_page.model_viewer_visible true
model_page.model_viewer_shows_a_toolbar true
model_page.page_shows_a_toolbar true
model_tree.sidebar_shows_viewer_menu true
5 years ago
expect(page).to have_selector('.wp-cards-container')
card_view.expect_work_package_listed work_package
end
5 years ago
it 'can switch between the different view modes' do
# Go to single view
card_view.open_full_screen_by_details(work_package)
details_view.ensure_page_loaded
details_view.expect_subject
details_view.switch_to_tab tab: 'Activity'
details_view.expect_tab 'Activity'
# Going to full screen and back again
details_view.switch_to_fullscreen
full_view.expect_tab 'Activity'
full_view.go_back
details_view.ensure_page_loaded
details_view.expect_subject
details_view.go_back
details_view.expect_closed
card_view.expect_work_package_listed work_package
5 years ago
# Go to viewer only
model_page.switch_view 'Viewer'
5 years ago
model_page.model_viewer_visible true
expect(page).to have_no_selector('.wp-cards-container')
# Go to list only
model_page.switch_view 'Cards'
5 years ago
model_page.model_viewer_visible false
expect(page).to have_selector('.wp-cards-container')
card_view.expect_work_package_listed work_package
# Go to single view
card_view.open_full_screen_by_details(work_package)
details_view.ensure_page_loaded
details_view.expect_subject
details_view.switch_to_tab tab: 'Activity'
details_view.expect_tab 'Activity'
details_view.close
details_view.expect_closed
5 years ago
end
it 'after deleting an WP in full view it returns to the model and list view (see #33317)' do
# Go to full single view
card_view.open_full_screen_by_details(work_package)
details_view.switch_to_fullscreen
full_view.expect_tab 'Activity'
# Delete via the context menu
find('#action-show-more-dropdown-menu .button').click
find('.menu-item', text: 'Delete').click
destroy_modal.expect_listed(work_package)
destroy_modal.confirm_deletion
# Expect to return to the start page with closed details view and delete WP
model_page.model_viewer_visible true
details_view.expect_closed
card_view.expect_work_package_not_listed work_package
end
it 'after going to the full view with a selected tab,
the same tab shoud be opened in full screen view and after going back to details view(see #33747)' do
card_view.open_full_screen_by_details(work_package)
details_view.ensure_page_loaded
details_view.expect_subject
details_view.switch_to_tab tab: 'Relations'
details_view.switch_to_fullscreen
full_view.expect_tab 'Relations'
full_view.go_back
details_view.expect_tab 'Relations'
end
5 years ago
end
end
context 'on default page' do
let(:model_page) { ::Pages::IfcModels::ShowDefault.new project }
it_behaves_like 'can switch from split to viewer to list-only'
end
context 'on show page' do
let(:model_page) { ::Pages::IfcModels::Show.new project, model.id }
it_behaves_like 'can switch from split to viewer to list-only'
end
end