onlyoffice_documentserver_testing_framework 0.7.0 → 2.2.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: 976f20d4a3c91861624c79b35a8672f5700a687dca62506398a77199745c599e
4
- data.tar.gz: 113e81fbc57dd8a66f71c6062ffb6997dd45d93432bc9348d15330a52efe3001
3
+ metadata.gz: 71d976cf3ab5dee10b20ed7bc7d16e8cbe9319d504417aa94a2e5ec06585270b
4
+ data.tar.gz: 29e69cdc7d450c67550da9c842aff868d68d0533deb63789cad9d6f64219cb9f
5
5
  SHA512:
6
- metadata.gz: e31abfd59e920898c8b665f9316fe15c7043e8f27ea3292791cda65d0592715107b35f7013341d3d9894c8a601b40d5b828bb064a2a916feb943c251ff9827ba
7
- data.tar.gz: e10c8e148dff642c07950997d81af33d47498dc6cec5962eab224949872d3661e0fc3d217510158fee56bff498ddb4ccf33b2e176849dfc7ee4a5a430f8429c2
6
+ metadata.gz: afeb754c66e26b38fedb9dac48de03ad78e8e888b0cf191a12a7f442fb03432c1cb619d0f0fe22f093db8f26e7dd6757287a1c8b5fd15954eddcbb943e1e44bb
7
+ data.tar.gz: 6a1bb7d6f359e4378f2840771d1cb5d36a43d0b91a718e07a43d58b765d4b037c1918d20c79bd355a3aa219886d3bc9067d26ac78e69db5366640e8bbd7654f2
@@ -11,9 +11,9 @@ module OnlyofficeDocumentserverTestingFramework
11
11
  # @param name [Symbol] function to call
12
12
  # @param arguments [Hash] list of arguments
13
13
  # @return [Object] result of method
14
- def selenium_functions(name, *arguments)
14
+ def selenium_functions(name, *arguments, **options)
15
15
  select_frame do
16
- @instance.selenium.send name, *arguments
16
+ @instance.selenium.send name, *arguments, **options
17
17
  end
18
18
  end
19
19
 
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OnlyofficeDocumentserverTestingFramework
4
+ # More methods for working with top toolbar of document
5
+ class TopToolbarDocument
6
+ include SeleniumWrapper
7
+
8
+ def initialize(instance)
9
+ @instance = instance
10
+ @xpath_document_name = '//*[(@id="rib-doc-name") or (@id="title-doc-name")]'
11
+ end
12
+
13
+ # @return [String] name of the document
14
+ def document_name
15
+ # TODO: use `get_text` before `get_text_by_js`
16
+ # as soon as https://bugzilla.onlyoffice.com/show_bug.cgi?id=45981 resolved
17
+ # If top toolbar is hidden - cannot get text by WebDriver, use js instead
18
+ text = selenium_functions(:get_text_by_js, @xpath_document_name)
19
+ OnlyofficeLoggerHelper.log("Get document name from header: #{text}")
20
+ text
21
+ end
22
+ end
23
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'doc_editor_top_toolbar/top_toolbar_users'
4
+ require_relative 'doc_editor_top_toolbar/top_toolbar_document'
4
5
  require_relative 'doc_editor_top_toolbar/title_row'
5
6
 
6
7
  module OnlyofficeDocumentserverTestingFramework
@@ -19,5 +20,10 @@ module OnlyofficeDocumentserverTestingFramework
19
20
  def users
20
21
  @users ||= TopToolbarUsers.new(@instance)
21
22
  end
23
+
24
+ # @return [TopToolbarDocument] more top toolbar data of document
25
+ def top_toolbar
26
+ @top_toolbar = TopToolbarDocument.new(@instance)
27
+ end
22
28
  end
23
29
  end
@@ -107,8 +107,7 @@ class DocTestSiteFileListEntry
107
107
  {
108
108
  comment_mode: 4,
109
109
  review_mode: 5,
110
- fill_forms: 6,
111
- only_fill_forms: 7,
110
+ fill_forms: 7,
112
111
  view_mode: 8,
113
112
  embedded: 10
114
113
  }
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OnlyofficeDocumentserverTestingFramework
4
+ # Module for Reopen file related methods
5
+ module FileReopenHelper
6
+ # Perform reopen after autosave
7
+ def reopen_after_autosave
8
+ url = @instance.selenium.get_url
9
+ leave_file_and_build_it
10
+ @instance.webdriver.open(url)
11
+ @instance.management.wait_for_operation_with_round_status_canvas
12
+ end
13
+
14
+ private
15
+
16
+ # Leave current opened file and wait until it's builder
17
+ # @return [nil]
18
+ def leave_file_and_build_it
19
+ file_name = @instance.management.document_name
20
+ size_before = @instance.integration_example_api.file_data(file_name)['pureContentLength'].to_i
21
+ @instance.go_to_base_url
22
+ @instance.webdriver.wait_until do
23
+ @instance.integration_example_api.file_data(file_name)['pureContentLength'].to_i != size_before
24
+ end
25
+ OnlyofficeLoggerHelper.log("File: `#{file_name}` was built after editing")
26
+ end
27
+ end
28
+ end
@@ -3,10 +3,12 @@
3
3
  require_relative 'doc_test_site_functions/healthcheck_page'
4
4
  require_relative 'doc_test_site_functions/doc_test_file_list'
5
5
  require_relative 'doc_test_site_functions/doc_test_site_server_helper'
6
+ require_relative 'doc_test_site_functions/file_reopen_helper'
6
7
  # Class to work with test examples
7
8
  class DocTestSiteFunctions
8
9
  extend DocTestSiteServerHelper
9
10
  include PageObject
11
+ include OnlyofficeDocumentserverTestingFramework::FileReopenHelper
10
12
 
11
13
  select_list(:user_list, xpath: '//*[@id="user"]')
12
14
  select_list(:language_list, xpath: '//*[@id="language"]')
@@ -217,15 +219,6 @@ class DocTestSiteFunctions
217
219
  @healthcheck = HealthcheckPage.new(@instance)
218
220
  end
219
221
 
220
- # Perform reopen after autosave
221
- def reopen_after_autosave
222
- url = @instance.selenium.get_url
223
- @instance.go_to_base_url
224
- sleep(60) # just a rough value for building document version
225
- @instance.webdriver.open(url)
226
- @instance.management.wait_for_operation_with_round_status_canvas
227
- end
228
-
229
222
  # @param [DocumentServerVersion] version of server
230
223
  # @return [Array<String>] list of supported languages
231
224
  def self.supported_languages(version = OnlyofficeDocumentserverTestingFramework::DocumentServerVersion.new(6, 2, 0))
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OnlyofficeDocumentserverTestingFramework
4
+ # Check different messages of document load
5
+ module ManagerMessagesChecker
6
+ # @return [Boolean] is permission denied message shown
7
+ def permission_denied_message?
8
+ denied_xpath = '//div[contains(text(),"You don\'t have enough permission to view the file")]'
9
+ @instance.selenium.select_frame
10
+ error_on_loading = @instance.selenium.element_present?(denied_xpath)
11
+ @instance.selenium.select_top_frame
12
+ error_on_loading
13
+ end
14
+
15
+ # @return [Boolean] is `File not found` message shown
16
+ def file_not_found_message?
17
+ message_xpath = '//div[contains(@class, "tooltip-inner") and '\
18
+ 'contains(text(),"The required file was not found")]'
19
+ @instance.selenium.select_frame
20
+ error_on_loading = @instance.selenium.element_visible?(message_xpath)
21
+ @instance.selenium.select_top_frame
22
+ OnlyofficeLoggerHelper.log("file_not_found_message is shown: #{error_on_loading}")
23
+ error_on_loading
24
+ end
25
+ end
26
+ end
@@ -10,7 +10,7 @@ module OnlyofficeDocumentserverTestingFramework
10
10
 
11
11
  # @return [String] xpath of ok in protected file dialog
12
12
  def xpath_ok_password
13
- "#{xpath_input_password}/../../../../../..//button"
13
+ "#{xpath_input_password}/../../../../../..//button[@result='ok']"
14
14
  end
15
15
 
16
16
  # @return [Boolean] check if incorrect password warning is shown
@@ -1,11 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'management/loader_helper'
4
+ require_relative 'management/manager_messages_checker'
4
5
  require_relative 'management/password_protected_helper'
5
6
  module OnlyofficeDocumentserverTestingFramework
6
7
  # Class for management main methods
7
8
  class Management
8
9
  include SeleniumWrapper
10
+ include ManagerMessagesChecker
9
11
  include LoaderHelper
10
12
  include PasswordProtectedHelper
11
13
 
@@ -169,24 +171,6 @@ module OnlyofficeDocumentserverTestingFramework
169
171
  end
170
172
  end
171
173
 
172
- def permission_denied_message?
173
- denied_xpath = '//div[contains(text(),"You don\'t have enough permission to view the file")]'
174
- @instance.selenium.select_frame
175
- error_on_loading = @instance.selenium.element_present?(denied_xpath)
176
- @instance.selenium.select_top_frame
177
- error_on_loading
178
- end
179
-
180
- def file_not_found_message?
181
- message_xpath = '//div[contains(@class, "tooltip-inner") and '\
182
- 'contains(text(),"The required file was not found")]'
183
- @instance.selenium.select_frame
184
- error_on_loading = @instance.selenium.element_visible?(message_xpath)
185
- @instance.selenium.select_top_frame
186
- OnlyofficeLoggerHelper.log("file_not_found_message is shown: #{error_on_loading}")
187
- error_on_loading
188
- end
189
-
190
174
  # Add js code to handle JS errors
191
175
  # @return [nil]
192
176
  def add_error_handler
@@ -221,5 +205,23 @@ module OnlyofficeDocumentserverTestingFramework
221
205
 
222
206
  true
223
207
  end
208
+
209
+ # Get name of currently opened document
210
+ # @param [Boolean] with_extension - should extension be included
211
+ # @return [String]
212
+ def document_name(with_extension: true)
213
+ doc_name = @instance.doc_editor.top_toolbar.top_toolbar.document_name
214
+ doc_name.chop! if status_save?(doc_name)
215
+ doc_name = File.basename(doc_name, '.*') unless with_extension
216
+ doc_name
217
+ end
218
+
219
+ # Check if document has not be saved until now
220
+ # @param [String] name of document
221
+ # @return [Boolean] result of that check
222
+ def status_save?(name = nil)
223
+ name ||= @instance.doc_editor.top_toolbar.top_toolbar.document_name
224
+ name[-1] == '*'
225
+ end
224
226
  end
225
227
  end
@@ -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 = '0.7.0'
7
+ STRING = '2.2.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: 0.7.0
4
+ version: 2.2.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: 2021-12-24 00:00:00.000000000 Z
12
+ date: 2022-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: onlyoffice_logger_helper
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0'
34
+ version: '1'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0'
41
+ version: '1'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: overcommit
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -190,6 +190,7 @@ files:
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
192
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/title_row.rb
193
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/top_toolbar_document.rb
193
194
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/top_toolbar_users.rb
194
195
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows.rb
195
196
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows/txt_options.rb
@@ -200,10 +201,12 @@ files:
200
201
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_site_languages_after_6_2.list
201
202
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_site_languages_before_6_2.list
202
203
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_site_server_helper.rb
204
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/file_reopen_helper.rb
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/integration_example_api.rb
205
207
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management.rb
206
208
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management/loader_helper.rb
209
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management/manager_messages_checker.rb
207
210
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management/password_protected_helper.rb
208
211
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/presentation_editor.rb
209
212
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/spreadsheet_editor.rb
@@ -228,14 +231,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
228
231
  requirements:
229
232
  - - ">="
230
233
  - !ruby/object:Gem::Version
231
- version: '2.5'
234
+ version: '2.7'
232
235
  required_rubygems_version: !ruby/object:Gem::Requirement
233
236
  requirements:
234
237
  - - ">="
235
238
  - !ruby/object:Gem::Version
236
239
  version: '0'
237
240
  requirements: []
238
- rubygems_version: 3.3.2
241
+ rubygems_version: 3.3.4
239
242
  signing_key:
240
243
  specification_version: 4
241
244
  summary: ONLYOFFICE DocumentServer testing framework