onlyoffice_documentserver_testing_framework 1.0.0 → 2.2.1

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: 17567e4fc1878b2daa5440e7f35dbaebfdc5d131063eb4ecfd5d59d0f0728969
4
- data.tar.gz: cbc6e28420e32b836cc7519bb8b2e2f88291e1e3561f9c946377381eb7cf8bc0
3
+ metadata.gz: 36dbc0fe0c71ba6c46646fe89ce746a204c0ed709fd8ae41c9e838a589891fe1
4
+ data.tar.gz: 30ed604f753f3ba08cb439316d58889e75ab08aef0dcfc7e0aed61a9d455c5cd
5
5
  SHA512:
6
- metadata.gz: 713ff6238cc2716a92380e0e62330211055b87a43d7f4dbbbbe3ad89b1a67657e5870fc6ce0298a4ecb2e29683dae1ad9ded11bc023523309f81ce89f36045cb
7
- data.tar.gz: 69465a34dd3760da08f8c61c11867b4dd8a24ef72cca11a7ff89183a1d30026a5dc50e102979003b58150f68dc758dff6f0b4511788b48a51b3b9ac13a99cd51
6
+ metadata.gz: 53a1944e52d3eacdb27fa3fa6efbe7577e8cab07a6b848326ec41dae4f413caa9bdc5febbb323a419ac2ccc15b52bd1e7870c5e1b0f6e37aba3ab7fe1e7a20e9
7
+ data.tar.gz: 87889c2899bb3889056b2fc509e527c51aa2b22a2098d3afd7083729cda2323f88d1bdcf1494899608a982df4169fb4a5879b71d6d3c311bb40d11363bd8f379
@@ -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
@@ -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))
@@ -38,7 +38,7 @@ module OnlyofficeDocumentserverTestingFramework
38
38
  def delete_file(file_name)
39
39
  raise 'File name is not found on server' unless file_data(file_name)
40
40
 
41
- url = URI("#{@api_endpoint}/file?filename=#{file_name}")
41
+ url = URI::DEFAULT_PARSER.escape("#{@api_endpoint}/file?filename=#{file_name}")
42
42
  request = Net::HTTP::Delete.new(url)
43
43
  response = http_from_url(url).request(request)
44
44
  JSON.parse(response.read_body)
@@ -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 = '1.0.0'
7
+ STRING = '2.2.1'
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: 1.0.0
4
+ version: 2.2.1
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-01-21 00:00:00.000000000 Z
12
+ date: 2022-02-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: onlyoffice_logger_helper
@@ -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.4
241
+ rubygems_version: 3.3.7
239
242
  signing_key:
240
243
  specification_version: 4
241
244
  summary: ONLYOFFICE DocumentServer testing framework