onlyoffice_documentserver_testing_framework 2.7.1 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c98c0385a7174e452ef41b48d7b0bdb05a52fa30e13e3d1b01c53c84dd557fac
4
- data.tar.gz: bb5936eec38055273da3f6a4dab539d8a0535c86a003a72e4fd6111f46cdda08
3
+ metadata.gz: 3d7a64abfcf73c447754f1baed6247d2f5795759bc7700fcf69b68efc5069131
4
+ data.tar.gz: 3fd1c539aa055955dac2d2d4e88fff52aa707a501c68cfb9c5eabcdbf6c75a81
5
5
  SHA512:
6
- metadata.gz: 2f354452f0b040424089f5121d12f25e7c57737e37bc4fb4ed501aa59a3563dfe05e9ee6d9aac8fa379ee5e2110a9f575c2c3ee6890bd1d22581797e779cfb5b
7
- data.tar.gz: 504679d10ec82b4551d512df5815fea7f26b3ec702e90d7e3ffdc6a60f89669414ff926a4fcfc86222f59a0dc1b7ed628b0169df5fe61e2228bec32b8ea9efd0
6
+ metadata.gz: 7cd8e4a4dd97bf991ab8af8ecedd87738f72542cac4d4920b82061f5faa1c2490210ab70a352a8b2a692544c5f03c52e48caa148eb0c7f0c6d1da673f9d527ef
7
+ data.tar.gz: 41f906177e6c34952bfc4c20b6f146a26ffcd8df7f83953aec1069b955c280c86e54499c848635a785cc27b70fa147533cd0acb955b6dd341f9f292e5ee07993
@@ -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
@@ -91,8 +91,8 @@ module OnlyofficeDocumentserverTestingFramework
91
91
  # @param xpath [String] xpath to click
92
92
  # @return [nil]
93
93
  def click_on_displayed_button(xpath)
94
- selenium_functions :wait_element, xpath
95
- selenium_functions :click_on_displayed, xpath
94
+ selenium_functions(:wait_until_element_visible, xpath)
95
+ selenium_functions(:click_on_displayed, xpath)
96
96
  end
97
97
 
98
98
  # Is line enabled
@@ -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
@@ -7,7 +7,7 @@ module OnlyofficeDocumentserverTestingFramework
7
7
  # @param [Integer] timeout for wait for file to build
8
8
  # @return [Boolean] result of opening
9
9
  def reopen_after_autosave(timeout: 30)
10
- url = @instance.selenium.get_url
10
+ url = @instance.selenium.current_url
11
11
  leave_file_and_build_it(timeout: timeout)
12
12
  @instance.webdriver.open(url)
13
13
  @instance.management.wait_for_operation_with_round_status_canvas
@@ -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
 
@@ -150,7 +150,7 @@ class DocTestSiteFunctions
150
150
  # Get url of document which opened in editor
151
151
  # @return [String] url
152
152
  def current_document_storage_url
153
- page_source = @instance.selenium.get_page_source
153
+ page_source = @instance.selenium.page_source
154
154
  url_line = page_source.scan(/"?url"?: ".*$/).first
155
155
  url_line.delete('"').gsub('url: ', '').chop
156
156
  end
@@ -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)
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)
229
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)
@@ -185,7 +185,7 @@ module OnlyofficeDocumentserverTestingFramework
185
185
  # @return [Symbol] editor typo of opened document
186
186
  def editor_type
187
187
  @instance.selenium.select_top_frame
188
- url = selenium_functions(:get_url)
188
+ url = selenium_functions(:current_url)
189
189
  case url
190
190
  when /documenteditor/
191
191
  :document
@@ -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.1'
7
+ STRING = '2.10.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.1
4
+ version: 2.10.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-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: onlyoffice_logger_helper
@@ -32,6 +32,9 @@ dependencies:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '1'
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: 1.10.0
35
38
  type: :runtime
36
39
  prerelease: false
37
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -39,6 +42,9 @@ dependencies:
39
42
  - - "~>"
40
43
  - !ruby/object:Gem::Version
41
44
  version: '1'
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.10.0
42
48
  - !ruby/object:Gem::Dependency
43
49
  name: overcommit
44
50
  requirement: !ruby/object:Gem::Requirement
@@ -189,6 +195,8 @@ files:
189
195
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/common_editor/editor_windows.rb
190
196
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor.rb
191
197
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar.rb
198
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/home_tab.rb
199
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/home_tab/editor_tab.rb
192
200
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/title_row.rb
193
201
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/top_toolbar_document.rb
194
202
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/top_toolbar_users.rb
@@ -203,6 +211,7 @@ files:
203
211
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/healthcheck_page.rb
204
212
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/languages_list/doc_test_site_languages_after_6_2.list
205
213
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/languages_list/doc_test_site_languages_after_7_1.list
214
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/languages_list/doc_test_site_languages_after_7_2.list
206
215
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/languages_list/doc_test_site_languages_before_6_2.list
207
216
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/integration_example_api.rb
208
217
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management.rb
@@ -239,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
248
  - !ruby/object:Gem::Version
240
249
  version: '0'
241
250
  requirements: []
242
- rubygems_version: 3.3.11
251
+ rubygems_version: 3.3.20
243
252
  signing_key:
244
253
  specification_version: 4
245
254
  summary: ONLYOFFICE DocumentServer testing framework