onlyoffice_documentserver_testing_framework 2.7.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57e9e337dc8d7477109cdfe89b0fc34a3fbbd14b7d5b14088b27f9c4b67834d4
4
- data.tar.gz: e935d196d93db199cef87d44fc99eb97b98901afdc103133078462ecec5dd058
3
+ metadata.gz: 549a8273d55e4763aa715b048a02dc05197975c408ba139fbfa0d6d5fbc4648c
4
+ data.tar.gz: 0fe5138abec4d65fefbe86f7c8380a38e2d6f24f0340211584435dc4252e06fe
5
5
  SHA512:
6
- metadata.gz: 7c45f7b1d5361b269398539db8be0e088d0f4398b41c2960517147ab96501fd18328a91f372a0a4865f9170a310c565320454e1533ec3f88d8923273f149750c
7
- data.tar.gz: 7d7d08ac514a1d804b96f530bae84f1107cb2af389916dae8633dfd929f1f07620c2dd183a688c338a2f4e2d2d3b7d23b6619826cad82df47cc89a127fb83037
6
+ metadata.gz: 88d398c768bf7fb178f3e1cc75beccc7a61d9185a1cf8bf62553b0847106cae488253bc152ec067d636703d284bea1afa7c1c1930c41521e6af055a7d50bbda5
7
+ data.tar.gz: 37185151d10cba09b75e7d369403c28be46771267a4d702a180d467723b3899f1e1d93307b530b5847e1f7f8ed1976e4d8b8713fd9b777b89a80e27f81577575
@@ -6,8 +6,8 @@ module SeleniumWrapperJsErrors
6
6
  def ignored_errors
7
7
  return @ignored_errors if @ignored_errors
8
8
 
9
- @ignored_errors = File.readlines("#{File.expand_path('..', __dir__)}"\
10
- '/selenium_wrapper/selenium_wrapper_js_errors'\
9
+ @ignored_errors = File.readlines("#{File.expand_path('..', __dir__)}" \
10
+ '/selenium_wrapper/selenium_wrapper_js_errors' \
11
11
  '/ignored_errors.list')
12
12
  .map(&:strip)
13
13
  end
@@ -116,13 +116,6 @@ module OnlyofficeDocumentserverTestingFramework
116
116
  selenium_functions(:get_attribute, xpath, 'class').include?('disabled')
117
117
  end
118
118
 
119
- # Move to element
120
- # @param xpath [String] xpath to move
121
- # @return [nil]
122
- def move_to_element(xpath)
123
- selenium_functions :move_to_element_by_locator, xpath
124
- end
125
-
126
119
  # Remove element
127
120
  # @param xpath [String] xpath to remove
128
121
  # @return [nil]
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OnlyofficeDocumentserverTestingFramework
4
+ # Meta class to describe editors tabs
5
+ class EditorTab
6
+ include SeleniumWrapper
7
+
8
+ def initialize(instance, tab_xpath: nil, tab_name: 'Default tab name')
9
+ @instance = instance
10
+ @xpath_insert_tab = tab_xpath
11
+ @tab_name = tab_name
12
+ end
13
+
14
+ # @return [True, False] is tab present
15
+ def present?
16
+ result = visible?(@xpath_insert_tab)
17
+ OnlyofficeLoggerHelper.log("#{@tab_name} Tab present?: #{result}")
18
+ result
19
+ end
20
+
21
+ # @return [True, False] if this tab opened
22
+ def active?
23
+ active = get_attribute(@xpath_insert_tab, 'class').include?('active')
24
+ OnlyofficeLoggerHelper.log("#{@tab_name} Tab active?: #{active}")
25
+ active
26
+ end
27
+
28
+ # Click on tab
29
+ # @return [Nothing]
30
+ def click
31
+ click_on_button(@xpath_insert_tab)
32
+ OnlyofficeLoggerHelper.log("Clicked on #{@tab_name} Tab")
33
+ sleep 2 # timeout for tab animation
34
+ end
35
+
36
+ # Double click on tab
37
+ # @return [Nothing]
38
+ def double_click
39
+ selenium_functions(:double_click, @xpath_insert_tab)
40
+ OnlyofficeLoggerHelper.log("Double Clicked on #{@tab_name} Tab")
41
+ sleep 2 # need time to toolbar to hide
42
+ end
43
+
44
+ # Open current tab
45
+ # @param [Boolean] to_open open or close this tab
46
+ # @return [Void]
47
+ # rubocop disable to not change interface of public method
48
+ # rubocop:disable Style/OptionalBooleanParameter
49
+ def open(to_open = true)
50
+ return if to_open == active?
51
+
52
+ click
53
+ end
54
+ # rubocop:enable Style/OptionalBooleanParameter
55
+ end
56
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'home_tab/editor_tab'
4
+
5
+ module OnlyofficeDocumentserverTestingFramework
6
+ # Class for Home tab actions
7
+ # https://user-images.githubusercontent.com/668524/28775382-4b8609d0-75fa-11e7-8bfd-a2de8e8a1332.png
8
+ class HomeTab < EditorTab
9
+ def initialize(instance, tab_xpath: '//a[@data-tab="home"]/..', tab_name: 'Home')
10
+ super
11
+ @instance = instance
12
+ @xpath_insert_tab = tab_xpath
13
+ @tab_name = tab_name
14
+ end
15
+ end
16
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'doc_editor_top_toolbar/home_tab'
3
4
  require_relative 'doc_editor_top_toolbar/top_toolbar_users'
4
5
  require_relative 'doc_editor_top_toolbar/top_toolbar_document'
5
6
  require_relative 'doc_editor_top_toolbar/title_row'
@@ -25,5 +26,10 @@ module OnlyofficeDocumentserverTestingFramework
25
26
  def top_toolbar
26
27
  @top_toolbar = TopToolbarDocument.new(@instance)
27
28
  end
29
+
30
+ # @return [HomeTab] home tab
31
+ def home_tab
32
+ @home_tab ||= HomeTab.new(@instance)
33
+ end
28
34
  end
29
35
  end
@@ -0,0 +1,38 @@
1
+ English
2
+ Armenian
3
+ Azerbaijani
4
+ Basque
5
+ Belarusian
6
+ Bulgarian
7
+ Catalan
8
+ Chinese (People's Republic of China)
9
+ Chinese (Traditional, Taiwan)
10
+ Czech
11
+ Danish
12
+ Dutch
13
+ Finnish
14
+ French
15
+ Galego
16
+ German
17
+ Greek
18
+ Hungarian
19
+ Indonesian
20
+ Italian
21
+ Japanese
22
+ Korean
23
+ Latvian
24
+ Lao
25
+ Malay (Malaysia)
26
+ Norwegian
27
+ Polish
28
+ Portuguese (Brazil)
29
+ Portuguese (Portugal)
30
+ Romanian
31
+ Russian
32
+ Slovak
33
+ Slovenian
34
+ Spanish
35
+ Swedish
36
+ Turkish
37
+ Ukrainian
38
+ Vietnamese
@@ -21,11 +21,11 @@ class DocTestSiteFunctions
21
21
  @xpath_conversion_step = '//*[@id="step2"]'
22
22
  @xpath_editor_scripts_step = '//*[@id="step3"]'
23
23
  @xpath_file_entry = '//*[@class="stored-list"]//table/tbody/tr'
24
- @xpath_create_doc = '//*[contains(@class, "try-editor document")]|'\
24
+ @xpath_create_doc = '//*[contains(@class, "try-editor document")]|' \
25
25
  '//*[contains(@class, "try-editor word")]'
26
- @xpath_create_workbook = '//*[contains(@class, "try-editor spreadsheet")]|'\
26
+ @xpath_create_workbook = '//*[contains(@class, "try-editor spreadsheet")]|' \
27
27
  '//*[contains(@class, "try-editor cell")]'
28
- @xpath_create_presentation = '//*[contains(@class, "try-editor presentation")]|'\
28
+ @xpath_create_presentation = '//*[contains(@class, "try-editor presentation")]|' \
29
29
  '//*[contains(@class, "try-editor slide")]'
30
30
  @edit_modes_indexes = edit_modes_indexes
31
31
  end
@@ -57,7 +57,7 @@ class DocTestSiteFunctions
57
57
  # Upload file to portal
58
58
  # @param [String] file_path like as '/mnt/data_share/Files/DOCX/empty.docx'
59
59
  def upload_file(file_path)
60
- file_path_absolute = file_path.gsub('~', ENV['HOME'])
60
+ file_path_absolute = file_path.gsub('~', Dir.home)
61
61
  @instance.selenium.type_to_locator('//*[@id="fileupload"]', file_path_absolute, false, false, false, true)
62
62
  wait_loading_file
63
63
  wait_conversion
@@ -72,7 +72,7 @@ class DocTestSiteFunctions
72
72
 
73
73
  return if error_message.empty?
74
74
 
75
- @instance.selenium.webdriver_error('Error while uploading document. '\
75
+ @instance.selenium.webdriver_error('Error while uploading document. ' \
76
76
  "Error message: #{error_message}")
77
77
  end
78
78
 
@@ -224,16 +224,18 @@ class DocTestSiteFunctions
224
224
 
225
225
  # @param [DocumentServerVersion] version of server
226
226
  # @return [Array<String>] list of supported languages
227
- def self.supported_languages(version = OnlyofficeDocumentserverTestingFramework::DocumentServerVersion.new(6, 2, 0))
228
- file = if version >= OnlyofficeDocumentserverTestingFramework::DocumentServerVersion.new(7, 1)
229
- 'doc_test_site_languages_after_7.1.list'
227
+ def self.supported_languages(version = OnlyofficeDocumentserverTestingFramework::DocumentServerVersion.new(7, 1, 0))
228
+ file = if version >= OnlyofficeDocumentserverTestingFramework::DocumentServerVersion.new(7, 2)
229
+ 'doc_test_site_languages_after_7_2.list'
230
+ elsif version >= OnlyofficeDocumentserverTestingFramework::DocumentServerVersion.new(7, 1)
231
+ 'doc_test_site_languages_after_7_1.list'
230
232
  elsif version >= OnlyofficeDocumentserverTestingFramework::DocumentServerVersion.new(6, 2)
231
233
  'doc_test_site_languages_after_6_2.list'
232
234
  else
233
235
  'doc_test_site_languages_before_6_2.list'
234
236
  end
235
- File.readlines("#{File.expand_path('..', __dir__)}"\
236
- '/test_instance_docs/doc_test_site_functions/'\
237
+ File.readlines("#{File.expand_path('..', __dir__)}" \
238
+ '/test_instance_docs/doc_test_site_functions/' \
237
239
  "languages_list/#{file}")
238
240
  .map(&:strip)
239
241
  end
@@ -244,9 +246,9 @@ class DocTestSiteFunctions
244
246
  # @return [Hash] name with index
245
247
  def default_modes_indexes
246
248
  {
247
- comment_mode: 4,
248
- review_mode: 5,
249
- fill_forms: 7,
249
+ comment_mode: 2,
250
+ review_mode: 4,
251
+ fill_forms: 6,
250
252
  view_mode: 8,
251
253
  embedded: 10
252
254
  }
@@ -14,7 +14,7 @@ module OnlyofficeDocumentserverTestingFramework
14
14
 
15
15
  # @return [Boolean] is `File not found` message shown
16
16
  def file_not_found_message?
17
- message_xpath = '//div[contains(@class, "tooltip-inner") and '\
17
+ message_xpath = '//div[contains(@class, "tooltip-inner") and ' \
18
18
  'contains(text(),"The required file was not found")]'
19
19
  @instance.selenium.select_frame
20
20
  error_on_loading = @instance.selenium.element_visible?(message_xpath)
@@ -22,7 +22,7 @@ module OnlyofficeDocumentserverTestingFramework
22
22
  @instance = instance
23
23
  @xpath_iframe_count = 1
24
24
  # Don't mixup iframe with help
25
- @xpath_iframe = '//iframe[not(contains(@src, "/help/")) and '\
25
+ @xpath_iframe = '//iframe[not(contains(@src, "/help/")) and ' \
26
26
  'not(contains(@id, "fileFrame"))]'
27
27
  @alert_dialog_xpath = '//div[@role="alertdialog"]'
28
28
  @alert_dialog_span_xpath = "#{@alert_dialog_xpath}/div/div/div/span"
@@ -33,7 +33,7 @@ module OnlyofficeDocumentserverTestingFramework
33
33
  # @return [Boolean] check if loader present
34
34
  def loading_present?
35
35
  if @instance.webdriver.alert_exists?
36
- raise 'Service Unavailable. There is alert while loading docs: '\
36
+ raise 'Service Unavailable. There is alert while loading docs: ' \
37
37
  "\"#{@instance.webdriver.alert_text}\""
38
38
  end
39
39
 
@@ -76,7 +76,7 @@ module OnlyofficeDocumentserverTestingFramework
76
76
  while timer < timeout && !loading_present?
77
77
  sleep 1
78
78
  timer += 1
79
- OnlyofficeLoggerHelper.log('Waiting for start loading of documents. '\
79
+ OnlyofficeLoggerHelper.log('Waiting for start loading of documents. ' \
80
80
  "Waiting for #{timer} seconds of #{timeout}")
81
81
  end
82
82
  return unless timer == timeout
@@ -98,8 +98,8 @@ module OnlyofficeDocumentserverTestingFramework
98
98
  while loading_present?
99
99
  sleep(1)
100
100
  current_wait_time += 1
101
- OnlyofficeLoggerHelper.log('Waiting for Round Status for '\
102
- "#{current_wait_time} of "\
101
+ OnlyofficeLoggerHelper.log('Waiting for Round Status for ' \
102
+ "#{current_wait_time} of " \
103
103
  "#{timeout_in_seconds} timeout")
104
104
  @instance.doc_editor.windows.txt_options.txt_options = 'Unicode (UTF-8)'
105
105
  @instance.spreadsheet_editor.windows.csv_option.csv_options = options
@@ -174,8 +174,8 @@ module OnlyofficeDocumentserverTestingFramework
174
174
  # Add js code to handle JS errors
175
175
  # @return [nil]
176
176
  def add_error_handler
177
- js_handler = 'window.jsErrors = [];'\
178
- 'window.onerror = function(errorMessage) '\
177
+ js_handler = 'window.jsErrors = [];' \
178
+ 'window.onerror = function(errorMessage) ' \
179
179
  '{window.jsErrors[window.jsErrors.length] = errorMessage;}'
180
180
  @instance.selenium.select_frame @instance.management.xpath_iframe
181
181
  @instance.selenium.execute_javascript(js_handler)
@@ -223,5 +223,21 @@ module OnlyofficeDocumentserverTestingFramework
223
223
  name ||= @instance.doc_editor.top_toolbar.top_toolbar.document_name
224
224
  name[-1] == '*'
225
225
  end
226
+
227
+ # Check if opened document is in viewer
228
+ # @return [true, false] true if viewer, false if editor
229
+ def viewer?
230
+ canvas_loaded = canvas_editor?
231
+ tabs_present = @instance.doc_editor.top_toolbar.home_tab.present?
232
+ result = canvas_loaded && !tabs_present
233
+ OnlyofficeLoggerHelper.log("viewer?: #{result}")
234
+ result
235
+ end
236
+
237
+ # Check if opened editor is canvas editor
238
+ # @return [true, false] true if canvas, false if not canvas
239
+ def canvas_editor?
240
+ visible?('//*[@id="id_viewer"]') || visible?('//*[@id="ws-canvas"]')
241
+ end
226
242
  end
227
243
  end
@@ -72,7 +72,7 @@ module OnlyofficeDocumentserverTestingFramework
72
72
  def env_options
73
73
  return @env_options if @env_options
74
74
 
75
- raw_options = ENV['ONLYOFFICE_DS_TESTING_OPTIONS'] || '{}'
75
+ raw_options = ENV.fetch('ONLYOFFICE_DS_TESTING_OPTIONS', '{}')
76
76
  @env_options = JSON.parse(raw_options)
77
77
  @env_options['IgnoredJSErrors'] = [] unless @env_options['IgnoredJSErrors']
78
78
  @env_options
@@ -4,6 +4,6 @@ module OnlyofficeDocumentserverTestingFramework
4
4
  # Module to hold version of Gem
5
5
  module Version
6
6
  # [String] version of gem
7
- STRING = '2.7.0'
7
+ STRING = '2.9.0'
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onlyoffice_documentserver_testing_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ONLYOFFICE
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-04-12 00:00:00.000000000 Z
12
+ date: 2022-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: onlyoffice_logger_helper
@@ -189,6 +189,8 @@ files:
189
189
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/common_editor/editor_windows.rb
190
190
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor.rb
191
191
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar.rb
192
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/home_tab.rb
193
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/home_tab/editor_tab.rb
192
194
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/title_row.rb
193
195
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/top_toolbar_document.rb
194
196
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/top_toolbar_users.rb
@@ -203,6 +205,7 @@ files:
203
205
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/healthcheck_page.rb
204
206
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/languages_list/doc_test_site_languages_after_6_2.list
205
207
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/languages_list/doc_test_site_languages_after_7_1.list
208
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/languages_list/doc_test_site_languages_after_7_2.list
206
209
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/languages_list/doc_test_site_languages_before_6_2.list
207
210
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/integration_example_api.rb
208
211
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management.rb
@@ -239,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
242
  - !ruby/object:Gem::Version
240
243
  version: '0'
241
244
  requirements: []
242
- rubygems_version: 3.3.11
245
+ rubygems_version: 3.3.19
243
246
  signing_key:
244
247
  specification_version: 4
245
248
  summary: ONLYOFFICE DocumentServer testing framework