onlyoffice_documentserver_testing_framework 2.1.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: 341d7258f91b8315d7b02b0ea984a88b99f36a80bcd89ed3368380384cf7ee7d
4
- data.tar.gz: 3b906bca0dfaa59d28fc565caf9a41b4e520920f8257df0064bd2d8b692023ac
3
+ metadata.gz: 71d976cf3ab5dee10b20ed7bc7d16e8cbe9319d504417aa94a2e5ec06585270b
4
+ data.tar.gz: 29e69cdc7d450c67550da9c842aff868d68d0533deb63789cad9d6f64219cb9f
5
5
  SHA512:
6
- metadata.gz: 4cbc2dda83e7443ec7f5d7ece25e99ae18989638c9753d248fff8f77e0361272fbf7e72b6eb48111e4dd3f8a362744fe6fe86a8bc50e2cf2bad40c264d95419b
7
- data.tar.gz: 3b712586bb36f05741e6ad618e025d94dfe677b10cc29fcf0113f98377779692266a298e73adfbb69ebd9736fbb13d0412b8b61a354d280488229fb118dd1a1b
6
+ metadata.gz: afeb754c66e26b38fedb9dac48de03ad78e8e888b0cf191a12a7f442fb03432c1cb619d0f0fe22f093db8f26e7dd6757287a1c8b5fd15954eddcbb943e1e44bb
7
+ data.tar.gz: 6a1bb7d6f359e4378f2840771d1cb5d36a43d0b91a718e07a43d58b765d4b037c1918d20c79bd355a3aa219886d3bc9067d26ac78e69db5366640e8bbd7654f2
@@ -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))
@@ -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
@@ -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 = '2.1.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: 2.1.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: 2022-02-04 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
@@ -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