Add spec for showing viewpoint

pull/8115/head
Oliver Günther 5 years ago
parent 75acd6712b
commit b70830483c
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 47
      modules/bim/spec/features/viewer/show_viewpoint_spec.rb
  2. 16
      modules/bim/spec/support/pages/ifc_models/bcf_details_page.rb

@ -29,6 +29,7 @@
require 'spec_helper'
require_relative '../../support/pages/ifc_models/show_default'
require_relative '../../support/pages/ifc_models/bcf_details_page'
describe 'Show viewpoint in model viewer', type: :feature, js: true do
let(:project) { FactoryBot.create :project, enabled_module_names: [:bim, :work_package_tracking] }
@ -47,30 +48,46 @@ describe 'Show viewpoint in model viewer', type: :feature, js: true do
let(:show_model_page) { Pages::IfcModels::ShowDefault.new(project) }
let(:card_view) { ::Pages::WorkPackageCards.new(project) }
let(:bcf_details) { ::Pages::BcfDetailsPage.new(work_package, project) }
shared_examples 'has the minimal viewpoint shown' do
it 'loads the minimal viewpoint in the viewer' do
show_model_page.select_sidebar_tab 'Objects'
show_model_page.expand_tree
show_model_page.expect_checked 'minimal'
show_model_page.all_checkboxes.each do |label, checkbox|
if label.text == 'minimal' || label.text == 'LUB_Segment_new:S_WHG_Ess:7243035'
expect(checkbox.checked?).to eq(true)
else
expect(checkbox.checked?).to eq(false)
end
end
end
end
before do
login_as(user)
show_model_page.visit!
show_model_page.finished_loading
card_view.expect_work_package_listed work_package
end
it 'loads the viewpoint in the viewer when clicking on the wp card' do
card_view.expect_work_package_listed work_package
card_view.select_work_package work_package
context 'clicking on the card' do
before do
card_view.select_work_package work_package
card_view.expect_work_package_selected work_package, true
end
card_view.expect_work_package_selected work_package, true
it_behaves_like 'has the minimal viewpoint shown'
end
# Idea: Check whether the storeys are correctly set and thus the viewpoint correctly loaded
# For convenience only, our viewpoint selected nothing, so no Storey should be selected
show_model_page.select_sidebar_tab 'Objects'
show_model_page.expand_tree
show_model_page.expect_checked 'minimal'
show_model_page.all_checkboxes.each do |label, checkbox|
if label.text == 'minimal' || label.text == 'LUB_Segment_new:S_WHG_Ess:7243035'
expect(checkbox.checked?).to eq(true)
else
expect(checkbox.checked?).to eq(false)
end
context 'when in details view' do
before do
card_view.open_full_screen_by_details work_package
bcf_details.expect_viewpoint_count 1
bcf_details.show_current_viewpoint
end
it_behaves_like 'has the minimal viewpoint shown'
end
end

@ -30,6 +30,22 @@ require 'support/pages/work_packages/split_work_package'
module Pages
class BcfDetailsPage < Pages::SplitWorkPackage
def expect_viewpoint_count(number)
expect(page).to have_selector('.ngx-gallery-thumbnail', count: number, wait: 10)
end
def next_viewpoint
page.find('.icon-arrow-right2.ngx-gallery-icon-content').click
end
def previous_viewpoint
page.find('.icon-arrow-left2.ngx-gallery-icon-content').click
end
def show_current_viewpoint
page.find('.icon-watched.ngx-gallery-icon-content').click
end
protected
def path(tab = 'overview')

Loading…
Cancel
Save