From 7c68cf8774c2cf28d416f08fbf6b63b80425f0f9 Mon Sep 17 00:00:00 2001 From: Maksim Sorokin <60688343+askonev@users.noreply.github.com> Date: Thu, 17 Oct 2024 22:18:42 +0300 Subject: [PATCH] release: v8.2 (#1231) * skip: python via web * skip: bug 63370 * fix: 70602 * bug: 71029 * fix: page size preset 63370 * fix: correct object types * ref: add semver * [update] 8.2 tests fix (#1230) * tests fix * tests fix * ref: semver --------- Co-authored-by: Olga Petrova <58073620+lemonowl@users.noreply.github.com> --- Rakefile | 2 +- .../cross_reference/add_bookmark_cross_ref.js | 2 +- js/docx/sections/page_size_for_section.js | 19 +++++++++++-------- js/docx/smoke/api_document_content/to_json.js | 2 +- js/docx/smoke/api_range/to_json.js | 2 +- spec/docx/conversion/docx_conversion_spec.rb | 1 + spec/docx/negative/api_range_spec.rb | 2 ++ .../check_cross_reference_spec.rb | 7 ++++++- spec/docx/sections/add_section_spec.rb | 4 ++-- spec/docx/smoke/api_document_content_spec.rb | 6 +++++- spec/docx/smoke/api_document_spec.rb | 1 + spec/docx/smoke/api_range_spec.rb | 17 +++++++++++++---- spec/pptx/conversion/pptx_convesion_spec.rb | 1 + spec/pptx/smoke/api_master_spec.rb | 6 +++++- spec/xlsx/conversion/xlsx_conversion_spec.rb | 1 + .../worksheet_page_orientation_in_pdf_spec.rb | 2 ++ 16 files changed, 54 insertions(+), 21 deletions(-) diff --git a/Rakefile b/Rakefile index bb77c527..7e05e111 100644 --- a/Rakefile +++ b/Rakefile @@ -13,7 +13,7 @@ end desc 'run parallel_rspec on builder in documentserver' task :web do ENV['BUILDER_PLATFORM'] = 'WEB' - sh 'bundle exec parallel_rspec spec' + sh 'bundle exec parallel_rspec --exclude-pattern "spec/python_wrapper/**" spec' end desc 'run only critical tests' diff --git a/js/docx/paragraph/cross_reference/add_bookmark_cross_ref.js b/js/docx/paragraph/cross_reference/add_bookmark_cross_ref.js index c97eb31c..9c7561b0 100644 --- a/js/docx/paragraph/cross_reference/add_bookmark_cross_ref.js +++ b/js/docx/paragraph/cross_reference/add_bookmark_cross_ref.js @@ -2,7 +2,7 @@ builder.CreateFile("docx"); let oDocument = Api.GetDocument(); let oParagraph = oDocument.GetElement(0); oParagraph.AddText("Paragraph with bookmark"); -let oRange = oDocument.GetRange(0, 9); +let oRange = oDocument.GetRange(0, 10); oRange.AddBookmark("Bookmark"); let oParagraph1 = Api.CreateParagraph(); diff --git a/js/docx/sections/page_size_for_section.js b/js/docx/sections/page_size_for_section.js index e530e140..d8e579e3 100644 --- a/js/docx/sections/page_size_for_section.js +++ b/js/docx/sections/page_size_for_section.js @@ -1,11 +1,14 @@ builder.CreateFile("docx"); -var oDocument = Api.GetDocument(); -oDocument.CreateNewHistoryPoint(); -var oParagraph1, oFinalSection; -oParagraph = Api.CreateParagraph(); -oDocument.Push(oParagraph); -oSection = oDocument.CreateSection(oParagraph); -oFinalSection = oDocument.GetFinalSection(); -oFinalSection.SetPageSize(12240, 15840); + var oDocument = Api.GetDocument(); + oDocument.CreateNewHistoryPoint(); + var oParagraph, oFinalSection, oSection; + oFinalSection = oDocument.GetFinalSection(); + oFinalSection.SetPageSize(11904.8, 16838); // 'A4' + + oParagraph = Api.CreateParagraph(); + oParagraph.AddText('section'); + oDocument.Push(oParagraph); + oSection = oDocument.CreateSection(oParagraph); + oSection.SetPageSize(12240, 15840); // 'US Letter' builder.SaveFile("docx", "page_size_for_section.docx"); builder.CloseFile(); diff --git a/js/docx/smoke/api_document_content/to_json.js b/js/docx/smoke/api_document_content/to_json.js index ff9b2e76..bd51a559 100644 --- a/js/docx/smoke/api_document_content/to_json.js +++ b/js/docx/smoke/api_document_content/to_json.js @@ -9,7 +9,7 @@ builder.CreateFile("docx"); // Add Hyperlink oParagraph = oDocContent.GetElement(0); oParagraph.AddText('Hyperlink'); - var oRange = oParagraph.GetRange(0, 8); + var oRange = oParagraph.GetRange(0, 10); oRange.AddHyperlink('https://api.onlyoffice.com') // Add BlockLvlSdt var oBlockLvlSdt = Api.CreateBlockLvlSdt(); diff --git a/js/docx/smoke/api_range/to_json.js b/js/docx/smoke/api_range/to_json.js index 418430f1..2d23a26d 100644 --- a/js/docx/smoke/api_range/to_json.js +++ b/js/docx/smoke/api_range/to_json.js @@ -2,7 +2,7 @@ builder.CreateFile("docx"); var oDocument = Api.GetDocument(); var oParagraph = oDocument.GetElement(0); oParagraph.AddText("ONLYOFFICE Document Builder"); - var oRange = Api.CreateRange(oParagraph, 0, 10); + var oRange = Api.CreateRange(oParagraph, 0, 11); var json = oRange.ToJSON(true, true); GlobalVariable["JSON"] = json; builder.CloseFile(); diff --git a/spec/docx/conversion/docx_conversion_spec.rb b/spec/docx/conversion/docx_conversion_spec.rb index 4b2bc075..17aea8cc 100644 --- a/spec/docx/conversion/docx_conversion_spec.rb +++ b/spec/docx/conversion/docx_conversion_spec.rb @@ -13,6 +13,7 @@ end it 'Conversion | Docx to Pdf', :critical do + skip 'https://bugzilla.onlyoffice.com/show_bug.cgi?id=71025' if builder.semver >= Semantic::Version.new('8.2.0') output_file = builder.build_file('js/conversion/docx/docx_to_pdf.js') expect(builder).not_to be_file_empty(output_file) end diff --git a/spec/docx/negative/api_range_spec.rb b/spec/docx/negative/api_range_spec.rb index 5c73ddbb..ee188088 100644 --- a/spec/docx/negative/api_range_spec.rb +++ b/spec/docx/negative/api_range_spec.rb @@ -6,6 +6,8 @@ let(:style) { OoxmlParser::FontStyle.new } let(:file_path) { 'js/docx/smoke/api_range/get_range_with_params.js' } + before { skip('Fix after moving to sending the script as a static file') } + it 'Check method with wrong parameters 0, -1' do docx = builder.build_and_parse(file_path, start_pos: 0, end_pos: -1) expect(docx.elements.size).to eq(1) diff --git a/spec/docx/paragraph/cross-reference/check_cross_reference_spec.rb b/spec/docx/paragraph/cross-reference/check_cross_reference_spec.rb index fd1b75bf..5b31da32 100644 --- a/spec/docx/paragraph/cross-reference/check_cross_reference_spec.rb +++ b/spec/docx/paragraph/cross-reference/check_cross_reference_spec.rb @@ -34,7 +34,12 @@ it 'Cross-reference to bookmarks' do docx = builder.build_and_parse('js/docx/paragraph/cross_reference/add_bookmark_cross_ref.js') - expect(docx.elements[1].nonempty_runs[1].text).to eq('Paragraph') + # TODO: 'check after release' + if builder.semver >= Semantic::Version.new('8.2.0') + expect(docx.elements[1].nonempty_runs[1].text).to eq('Paragraph') + else + expect(docx.elements[1].nonempty_runs[1].text).to eq('Paragraph ') + end expect(docx.elements[1].runs[2].instruction_text.value).to eq(' REF Bookmark \\h') # TODO: bug 'https://bugzilla.onlyoffice.com/show_bug.cgi?id=58898' # expect(docx.elements[2].nonempty_runs[1].text).to eq('1') diff --git a/spec/docx/sections/add_section_spec.rb b/spec/docx/sections/add_section_spec.rb index 5600c028..3fbc830f 100644 --- a/spec/docx/sections/add_section_spec.rb +++ b/spec/docx/sections/add_section_spec.rb @@ -19,7 +19,7 @@ it 'Page size for Section' do docx = builder.build_and_parse('js/docx/sections/page_size_for_section.js') - expect(docx.page_properties.size.name).to eq('US Letter') - expect(docx.elements[1].sector_properties.size.name).to eq('A4') + expect(docx.page_properties.size.name).to eq('A4') + expect(docx.elements[1].sector_properties.size.name).to eq('US Letter') end end diff --git a/spec/docx/smoke/api_document_content_spec.rb b/spec/docx/smoke/api_document_content_spec.rb index a2acf323..b33f981d 100644 --- a/spec/docx/smoke/api_document_content_spec.rb +++ b/spec/docx/smoke/api_document_content_spec.rb @@ -61,7 +61,11 @@ expect(docx.elements[2].properties.table_style.name).to eq('CustomTableStyle') json = JSON.parse(docx.elements[5].nonempty_runs.first.text) expect(json['type']).to eq('docContent') - expect(json['content'][0]['content'][2]['type']).to eq('hyperlink') + if builder.semver >= Semantic::Version.new('8.2.0') + expect(json['content'][0]['content'][1]['type']).to eq('hyperlink') + else + expect(json['content'][0]['content'][2]['type']).to eq('hyperlink') + end expect(json['content'][1]['type']).to eq('blockLvlSdt') expect(json['content'][2]['type']).to eq('table') end diff --git a/spec/docx/smoke/api_document_spec.rb b/spec/docx/smoke/api_document_spec.rb index 74c313ce..e93a4cd0 100644 --- a/spec/docx/smoke/api_document_spec.rb +++ b/spec/docx/smoke/api_document_spec.rb @@ -96,6 +96,7 @@ end it 'ApiDocument | GetReviewReport method' do + skip 'https://bugzilla.onlyoffice.com/show_bug.cgi?id=71029' skip('Cannot use OpenFile in web version') if web_builder? docx = builder.build_and_parse('js/docx/smoke/api_document/get_review_report.js') expect(docx.elements[3].rows[1].cells[2].elements diff --git a/spec/docx/smoke/api_range_spec.rb b/spec/docx/smoke/api_range_spec.rb index 6a3533ce..3f4706d8 100644 --- a/spec/docx/smoke/api_range_spec.rb +++ b/spec/docx/smoke/api_range_spec.rb @@ -4,14 +4,21 @@ describe 'ApiRange section tests' do it 'ApiRange | ToJSON method' do docx = builder.build_and_parse('js/docx/smoke/api_range/to_json.js') - expect(docx.elements[1].nonempty_runs.first.text).to eq('ONLYOFFICE') json = JSON.parse(docx.elements[0].nonempty_runs.first.text) expect(json['type']).to eq('document') - expect(json['content'][0]['content'][0]['content'][0]).to eq('ONLYOFFICE') + # TODO: 'check after release' + if builder.semver >= Semantic::Version.new('8.2.0') + expect(docx.elements[1].nonempty_runs.first.text).to eq('ONLYOFFICE') + expect(json['content'][0]['content'][1]['content'][0]).to eq('ONLYOFFICE') + else + expect(docx.elements[1].nonempty_runs.first.text).to eq('ONLYOFFICE ') + expect(json['content'][0]['content'][0]['content'][0]).to eq('ONLYOFFICE ') + end end describe 'ApiRange | GetRange method' do let(:style) { OoxmlParser::FontStyle.new(true, true) } + let(:file_path) { 'js/docx/smoke/api_range/get_range_with_params.js' } let(:docx) { builder.build_and_parse('js/docx/smoke/api_range/get_range.js') } it 'Check document structure' do @@ -47,7 +54,8 @@ end it 'Check method with parameters 0, 17' do - docx = builder.build_and_parse('js/docx/smoke/api_range/get_range_with_params.js', start_pos: 0, end_pos: 17) + skip('Fix after moving to sending the script as a static file') + docx = builder.build_and_parse(file_path, start_pos: 0, end_pos: 17) expect(docx.elements.size).to eq(1) expect(docx.elements[0].nonempty_runs.size).to eq(2) @@ -64,7 +72,8 @@ end it 'Check method with parameters 10, 24' do - docx = builder.build_and_parse('js/docx/smoke/api_range/get_range_with_params.js', start_pos: 10, end_pos: 24) + skip('Fix after moving to sending the script as a static file') + docx = builder.build_and_parse(file_path, start_pos: 10, end_pos: 24) expect(docx.elements.size).to eq(1) expect(docx.elements[0].nonempty_runs.size).to eq(3) diff --git a/spec/pptx/conversion/pptx_convesion_spec.rb b/spec/pptx/conversion/pptx_convesion_spec.rb index 1a4218d2..c19fd4d4 100644 --- a/spec/pptx/conversion/pptx_convesion_spec.rb +++ b/spec/pptx/conversion/pptx_convesion_spec.rb @@ -13,6 +13,7 @@ end it 'Conversion | Pptx to Pdf', :critical do + skip 'https://bugzilla.onlyoffice.com/show_bug.cgi?id=71025' if builder.semver >= Semantic::Version.new('8.2.0') output_file = builder.build_file('js/conversion/pptx/pptx_to_pdf.js') expect(builder).not_to be_file_empty(output_file) end diff --git a/spec/pptx/smoke/api_master_spec.rb b/spec/pptx/smoke/api_master_spec.rb index 4f31e653..82e961da 100644 --- a/spec/pptx/smoke/api_master_spec.rb +++ b/spec/pptx/smoke/api_master_spec.rb @@ -69,7 +69,11 @@ expect(pptx.slide_masters[1].common_slide_data.shape_tree.elements[1].class).to eq(OoxmlParser::GraphicFrame) slide_elements = pptx.slides.first.common_slide_data.shape_tree.elements expect(slide_elements.first.text_body.paragraphs.first.runs[0].text).to eq('Drawings count: 2') - expect(slide_elements.first.text_body.paragraphs.first.runs[1].text).to eq('Types: drawing, drawing') + if builder.semver >= Semantic::Version.new('8.2.0') + expect(slide_elements.first.text_body.paragraphs.first.runs[1].text).to eq('Types: image, oleObject') + else + expect(slide_elements.first.text_body.paragraphs.first.runs[1].text).to eq('Types: drawing, drawing') + end end it 'ApiMaster | GetAllImages method' do diff --git a/spec/xlsx/conversion/xlsx_conversion_spec.rb b/spec/xlsx/conversion/xlsx_conversion_spec.rb index 125f748d..6fceb220 100644 --- a/spec/xlsx/conversion/xlsx_conversion_spec.rb +++ b/spec/xlsx/conversion/xlsx_conversion_spec.rb @@ -13,6 +13,7 @@ end it 'Conversion | Xlsx to Pdf' do + skip 'https://bugzilla.onlyoffice.com/show_bug.cgi?id=71025' if builder.semver >= Semantic::Version.new('8.2.0') output_file = builder.build_file('js/conversion/xlsx/xlsx_to_pdf.js') expect(builder).not_to be_file_empty(output_file) end diff --git a/spec/xlsx/smoke/api_worksheet/worksheet_page_orientation_in_pdf_spec.rb b/spec/xlsx/smoke/api_worksheet/worksheet_page_orientation_in_pdf_spec.rb index 1a6d2cd4..f42ca7eb 100644 --- a/spec/xlsx/smoke/api_worksheet/worksheet_page_orientation_in_pdf_spec.rb +++ b/spec/xlsx/smoke/api_worksheet/worksheet_page_orientation_in_pdf_spec.rb @@ -7,11 +7,13 @@ end it 'ApiWorksheet | SetPageOrientation method' do + skip 'https://bugzilla.onlyoffice.com/show_bug.cgi?id=71025' pdf = builder.build_and_parse('js/xlsx/smoke/api_worksheet/set_page_orientation.js') expect(pdf.page_size).to eq('Landscape A4') end it 'ApiWorksheet | PageOrientation property' do + skip 'https://bugzilla.onlyoffice.com/show_bug.cgi?id=71025' if builder.semver >= Semantic::Version.new('8.2.0') pdf = builder.build_and_parse('js/xlsx/smoke/api_worksheet/page_orientation_property.js') expect(pdf.page_size).to eq('Landscape A4') end