diff --git a/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb b/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb index 511d9f4cac..554081ac57 100644 --- a/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb +++ b/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb @@ -187,7 +187,8 @@ module Bim end def frontend_redirect(model_ids) - redirect_to bcf_project_frontend_path(models: JSON.dump(Array(model_ids))) + redirect_to bcf_project_frontend_path(models: JSON.dump(Array(model_ids)), + query_props: '{"t":"id:desc"}') end def find_all_ifc_models diff --git a/modules/bim/spec/features/show_default_spec.rb b/modules/bim/spec/features/show_default_spec.rb index 7bd4119fa5..42d51416d3 100644 --- a/modules/bim/spec/features/show_default_spec.rb +++ b/modules/bim/spec/features/show_default_spec.rb @@ -67,16 +67,27 @@ describe 'show default model', end context 'with everything ready' do + let(:old_work_package) { FactoryBot.create(:work_package, project: project) } + let(:new_work_package) { FactoryBot.create(:work_package, project: project) } + before do + old_work_package + new_work_package + show_default_page.visit! show_default_page.finished_loading end - it 'loads and shows the viewer correctly' do + it 'loads and shows the viewer and WPs correctly' do show_default_page.model_viewer_visible true show_default_page.model_viewer_shows_a_toolbar true show_default_page.page_shows_a_toolbar true model_tree.sidebar_shows_viewer_menu true + + # Check the order of work packages: Latest first + expect(show_default_page.find_all('.wp-card--id').map(&:text)).to( + eql(["##{new_work_package.id}", "##{old_work_package.id}"]) + ) end end