Skip to content

Commit

Permalink
Feature/windows & check win builder libs (#972)
Browse files Browse the repository at this point in the history
* dafault path to builder

* separate win tests

* ref: rubocop auto gen

* fix: run win tests on linux
  • Loading branch information
askonev authored Oct 25, 2023
1 parent 2ec80be commit 45b0c8c
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ doc
# bundler
.bundle
.idea

# other
.vscode
6 changes: 3 additions & 3 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 16 additions & 3 deletions spec/doc_builder_wrapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion spec/licensing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 31 additions & 3 deletions spec/test_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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<String (frozen)>]
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
2 changes: 1 addition & 1 deletion spec/versioning_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 45b0c8c

Please sign in to comment.