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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
add specs & cleanup
as-opfe11496b32ef
diff --git a/spec/features/work_packages/export_spec.rb b/spec/features/work_packages/export_spec.rbindex ab138f97b67..524f127df56 100644--- a/spec/features/work_packages/export_spec.rb+++ b/spec/features/work_packages/export_spec.rb@@ -47,11 +47,11 @@ RSpec.describe "work package export", :js, :selenium do{ title: "My custom query title" }endlet(:expected_params) do- {}+ default_expected_paramsendlet(:expected_mime_type) { anything }let(:query) { create(:query, user: current_user, project:, name: "My custom query title") }- let(:expected_columns) { query.displayable_columns.map { |c| c.name.to_s } - ["bcf_thumbnail"] }+ let(:query_columns) { query.displayable_columns.map { |c| c.name.to_s } - ["bcf_thumbnail"] }let(:cf_text_a) docreate(:work_package_custom_field,@@ -88,7 +88,7 @@ RSpec.describe "work package export", :js, :selenium dowp3wp4- query.column_names = expected_columns+ query.column_names = query_columnsquery.save!login_as(current_user)@@ -107,13 +107,15 @@ RSpec.describe "work package export", :js, :selenium dowork_packages_page.ensure_loadedsettings_menu.open_and_choose I18n.t("js.toolbar.settings.export")click_on export_type+ sleep 0.1enddef export!click_on I18n.t("export.dialog.submit")+ expect(page).to have_no_button(I18n.t("export.dialog.submit"), wait: 1)end- context "with Query options", :js do+ context "with Query options" dolet(:export_type) { I18n.t("export.dialog.format.options.pdf.label") }let(:expected_mime_type) { :pdf }@@ -127,10 +129,10 @@ RSpec.describe "work package export", :js, :selenium dolet(:query) docreate(:query, id: 1234, user: current_user, project:,- display_sums: true,- include_subprojects: true,- show_hierarchies: true,- name: "My custom query title"+ display_sums: true,+ include_subprojects: true,+ show_hierarchies: true,+ name: "My custom query title")endlet(:expected_params) do@@ -157,14 +159,13 @@ RSpec.describe "work package export", :js, :selenium doendend- context "with CSV export", :js do+ context "with CSV export" dolet(:export_type) { I18n.t("export.dialog.format.options.csv.label") }let(:expected_mime_type) { :csv }let(:expected_params) { default_expected_params }before doopen_export_dialog!- sleep 1endcontext "with descriptions" do@@ -186,13 +187,12 @@ RSpec.describe "work package export", :js, :selenium doendend- context "with XLS export", :js do+ context "with XLS export" dolet(:export_type) { I18n.t("export.dialog.format.options.xls.label") }let(:expected_mime_type) { :xls }before doopen_export_dialog!- sleep 1endcontext "with relations" do@@ -232,7 +232,7 @@ RSpec.describe "work package export", :js, :selenium doendend- context "with PDF export", :js do+ context "with PDF export" dolet(:expected_mime_type) { :pdf }before do@@ -246,10 +246,23 @@ RSpec.describe "work package export", :js, :selenium dolet(:export_sub_type) { I18n.t("export.dialog.pdf.export_type.options.table.label") }let(:expected_params) { default_expected_params.merge({ pdf_export_type: "table" }) }- it "exports a pdf table" do+ before dochoose export_sub_type+ expect(page).to have_css("[data-pdf-export-type='table']", wait: 2)+ end++ it "exports a pdf table" doexport!end++ it "does not export a pdf with no columns" do+ page.within "[data-pdf-export-type='table']" do+ all(".op-draggable-autocomplete--remove-item").each(&:click)+ end+ expect(page).to have_text(I18n.t("export.dialog.columns.input_caption_required"))+ click_on I18n.t("export.dialog.submit")+ expect(page).to have_button(I18n.t("export.dialog.submit")) # form not submitted, button is still there+ endendcontext "as report" do@@ -257,11 +270,15 @@ RSpec.describe "work package export", :js, :selenium dolet(:export_sub_type) { I18n.t("export.dialog.pdf.export_type.options.report.label") }let(:default_params_report) { default_expected_params.merge({ pdf_export_type: "report" }) }+ before do+ choose export_sub_type+ expect(page).to have_css("[data-pdf-export-type='report']", wait: 2)+ end+context "with long text fields" dolet(:expected_params) { default_params_report.merge({ long_text_fields: "description 42 43" }) }it "exports a pdf report with all long text custom fields by default" do- choose export_sub_typeexport!endend@@ -270,7 +287,6 @@ RSpec.describe "work package export", :js, :selenium dolet(:expected_params) { default_params_report.merge({ long_text_fields: "description 43" }) }it "exports a pdf report with all remaining custom fields" do- choose export_sub_typefind("span.op-draggable-autocomplete--item-text", text: "Long text custom field").sibling(".op-draggable-autocomplete--remove-item").clickexport!@@ -281,12 +297,10 @@ RSpec.describe "work package export", :js, :selenium dolet(:expected_params) { default_params_report.merge({ show_images: "true" }) }it "exports a pdf report with image by default" do- choose export_sub_typeexport!endit "exports a pdf report with checked input" do- choose export_sub_typecheck I18n.t("export.dialog.pdf.include_images.label")export!end@@ -296,11 +310,24 @@ RSpec.describe "work package export", :js, :selenium dolet(:expected_params) { default_params_report.merge({ show_images: "false" }) }it "exports a pdf report with checked input" do- choose export_sub_typeuncheck I18n.t("export.dialog.pdf.include_images.label")export!endend++ context "with no columns" do+ let(:query_columns) { [] }+ let(:expected_params) do+ default_expected_params.merge({ columns: [""], pdf_export_type: "report" })+ end++ it "does export a pdf" do+ page.within "[data-pdf-export-type='report']" do+ all(".op-draggable-autocomplete--remove-item").each(&:click)+ end+ export!+ end+ endendcontext "as gantt" do@@ -318,6 +345,7 @@ RSpec.describe "work package export", :js, :selenium dobefore dochoose export_sub_type+ expect(page).to have_css("[data-pdf-export-type='gantt']", wait: 2)endit "exports a gantt chart pdf" do@@ -328,7 +356,7 @@ RSpec.describe "work package export", :js, :selenium dolet(:expected_params) { default_expected_params.merge({ pdf_export_type: "gantt", gantt_mode: "week" }) }it "exports a pdf gantt chart by weeks" do- select I18n.t("export.dialog.pdf.gantt_zoom_levels.options.weeks"), from: "gantt_mode"+ select I18n.t("export.dialog.pdf.gantt_zoom_levels.options.weeks"), from: "gantt_mode", wait: 2export!endend@@ -337,7 +365,7 @@ RSpec.describe "work package export", :js, :selenium dolet(:expected_params) { default_expected_params.merge({ pdf_export_type: "gantt", gantt_width: "very_wide" }) }it "exports a pdf gantt chart by column width" do- select I18n.t("export.dialog.pdf.column_width.options.very_wide"), from: "gantt_width"+ select I18n.t("export.dialog.pdf.column_width.options.very_wide"), from: "gantt_width", wait: 2export!endend