From 45b0c8c9eb8f60f8451abb3828981ddff38282d9 Mon Sep 17 00:00:00 2001 From: Sorokin Maksim <60688343+askonev@users.noreply.github.com> Date: Wed, 25 Oct 2023 18:01:58 +0300 Subject: [PATCH] Feature/windows & check win builder libs (#972) * dafault path to builder * separate win tests * ref: rubocop auto gen * fix: run win tests on linux --- .gitignore | 3 +++ .rubocop_todo.yml | 6 +++--- README.md | 16 +++++++++++++++ Rakefile | 5 +++++ spec/doc_builder_wrapper_spec.rb | 19 +++++++++++++++--- spec/licensing_spec.rb | 2 +- spec/test_data.rb | 34 +++++++++++++++++++++++++++++--- spec/versioning_spec.rb | 2 +- 8 files changed, 76 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 352106a8..062294c8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ doc # bundler .bundle .idea + +# other +.vscode diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 3b3a15eb..56d4d64d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,15 +1,15 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-09-12 14:14:11 UTC using RuboCop version 1.56.2. +# on 2023-10-24 19:07:30 UTC using RuboCop version 1.57.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 1 +# Offense count: 2 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: - Max: 11 + Max: 16 # Offense count: 116 # Configuration parameters: CountAsOne. diff --git a/README.md b/README.md index 8874c390..4d325afc 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,19 @@ Framework for QA of `onlyoffice-documentbuilder` docbuilder-testing is released under an GNU AGPL v3.0 license. See the LICENSE file for more information. + +## install via windows + +* Install desktop builder to `C:\` + +* Install dependencies + +```shell + bundle install +``` + +* Run test + +```shell + rake run_test_on_win +``` diff --git a/Rakefile b/Rakefile index 4ba3cadc..5d63b7c9 100644 --- a/Rakefile +++ b/Rakefile @@ -40,3 +40,8 @@ task :resource_usage_report do csv << ['Total:', memory_sum, time_sum] end end + +desc 'run rspec via windows' +task :run_test_on_win do + system('rspec --tag win') +end diff --git a/spec/doc_builder_wrapper_spec.rb b/spec/doc_builder_wrapper_spec.rb index 81949822..05d46e00 100644 --- a/spec/doc_builder_wrapper_spec.rb +++ b/spec/doc_builder_wrapper_spec.rb @@ -3,11 +3,15 @@ require 'spec_helper' describe 'My behaviour' do + unless Gem.win_platform? + let(:builder_location) { DocBuilderWrapper.new.default_builder_location } + let(:arr_libs) { Dir.entries(File.dirname(builder_location)) } + let(:simple_script_windows) { 'js/wrapper/add_text_with_bold_in_paragraph_windows.js' } + end let(:simple_script) { 'js/wrapper/add_text_with_bold_in_paragraph.js' } - let(:simple_script_windows) { 'js/wrapper/add_text_with_bold_in_paragraph_windows.js' } let(:simple_xlsx_script) { 'js/wrapper/simplest_xlsx_file.js' } - describe 'build_doc' do + describe 'build_doc', :win do it 'raises correct error if input file is incorrect' do skip('Opening local file is not available in web builder') if web_builder? expect { builder.build('test') }.to raise_error(DocBuilderError, /error: cannot read run file\n/) @@ -37,7 +41,7 @@ end end - describe 'change_output_file' do + describe 'change_output_file', :win do it 'check that change output file do not change original file' do before_change = File.binread(simple_script) builder.change_output_file(simple_script) @@ -81,4 +85,13 @@ expect(File.extname(xlsx.file_path)).to eq('.xlsx') end end + + describe 'check windows build libs', :win do + TestData.libs.each do |lib| + it lib.to_s do + skip('[WIN] check build libs') unless Gem.win_platform? + expect(arr_libs).to include(lib) + end + end + end end diff --git a/spec/licensing_spec.rb b/spec/licensing_spec.rb index cada1eb1..2bab1dfc 100644 --- a/spec/licensing_spec.rb +++ b/spec/licensing_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'DocumentBuilder licensing' do +describe 'DocumentBuilder licensing', :win do it 'running docbuilder will not create temp license' do skip('This test only for Desktop Builder') if web_builder? expect(Dir["#{builder.license_path}/*.lickey"]).to be_empty diff --git a/spec/test_data.rb b/spec/test_data.rb index 13c4bd1f..3b0aef33 100644 --- a/spec/test_data.rb +++ b/spec/test_data.rb @@ -4,8 +4,36 @@ module TestData # CDE number formats (7.4.0) def self.number_formats - ['General', '0.00', '$#,##0.00', '_($* #,##0.00_)', 'm/d/yyyy', - '[$-F800]dddd, mmmm dd, yyyy', '[$-F400]h:mm:ss AM/PM', - '0.00%', '0%', '# ?/?', '0.00E+00'].freeze + ['General', + '0.00', + '$#,##0.00', + '_($* #,##0.00_)', + 'm/d/yyyy', + '[$-F800]dddd, mmmm dd, yyyy', + '[$-F400]h:mm:ss AM/PM', + '0.00%', + '0%', + '# ?/?', + '0.00E+00'].freeze + end + + # @return [Array] + def self.libs + %w[DjVuFile.dll + docbuilder.com.dll + docbuilder.net.dll + doctrenderer.dll + DocxRenderer.dll + EpubFile.dll + Fb2File.dll + graphics.dll + HtmlRenderer.dll + icudt58.dll + icuuc58.dll + kernel.dll + kernel_network.dll + PdfFile.dll + UnicodeConverter.dll + XpsFile.dll] end end diff --git a/spec/versioning_spec.rb b/spec/versioning_spec.rb index 58f5c29f..f61d833c 100644 --- a/spec/versioning_spec.rb +++ b/spec/versioning_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'DocumentBuilder version' do +describe 'DocumentBuilder version', :win do it 'showing version should not raise any error' do expect { builder.version }.not_to output.to_stderr_from_any_process end