onlyoffice_documentserver_testing_framework 2.0.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/top_toolbar_document.rb +23 -0
- data/lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar.rb +6 -0
- data/lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/file_reopen_helper.rb +29 -0
- data/lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions.rb +2 -9
- data/lib/onlyoffice_documentserver_testing_framework/test_instance_docs/integration_example_api.rb +6 -3
- data/lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management/manager_messages_checker.rb +26 -0
- data/lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management/password_protected_helper.rb +1 -1
- data/lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management.rb +20 -18
- data/lib/onlyoffice_documentserver_testing_framework/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ab7b2294145d4aaceb138342594c7270e474061641f87374f6df344d435d2ed
|
4
|
+
data.tar.gz: 7fffe8732f397203293276dee2d231e2c1cf75b8c56414edb0f0366a53cb58d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cedc5215f243c8dea0001872f33dfd2174de722dae9d83b2a16130f28be58d47fe83b36b44cc1b8c9bfbc32924eddddaa8b60b8b2d17f8a5d1c11d1d153d33be
|
7
|
+
data.tar.gz: 2fb4b2a130a3d9d125080c0cf88d43284b32d0e23b5bf25ff74bf55999e93730029cafee289730b0f8618185928743b4a4ae441b662fa950ee00baa7ba98e3bb
|
@@ -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,29 @@
|
|
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
|
+
file_data = @instance.integration_example_api.file_data(file_name)
|
24
|
+
!file_data.nil? && file_data['pureContentLength'].to_i != size_before
|
25
|
+
end
|
26
|
+
OnlyofficeLoggerHelper.log("File: `#{file_name}` was built after editing")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions.rb
CHANGED
@@ -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))
|
data/lib/onlyoffice_documentserver_testing_framework/test_instance_docs/integration_example_api.rb
CHANGED
@@ -6,9 +6,12 @@ require 'net/http'
|
|
6
6
|
module OnlyofficeDocumentserverTestingFramework
|
7
7
|
# Class for working with integration example api
|
8
8
|
class IntegrationExampleApi
|
9
|
-
|
9
|
+
# @return [String] url of api endpoint
|
10
|
+
attr_reader :api_endpoint
|
11
|
+
|
12
|
+
def initialize(instance, api_endpoint: "#{instance.doc_server_base_url}/example")
|
10
13
|
@instance = instance
|
11
|
-
@api_endpoint =
|
14
|
+
@api_endpoint = api_endpoint
|
12
15
|
end
|
13
16
|
|
14
17
|
# @return [Array<Hash>] list of file on example
|
@@ -38,7 +41,7 @@ module OnlyofficeDocumentserverTestingFramework
|
|
38
41
|
def delete_file(file_name)
|
39
42
|
raise 'File name is not found on server' unless file_data(file_name)
|
40
43
|
|
41
|
-
url = URI("#{@api_endpoint}/file?filename=#{file_name}")
|
44
|
+
url = URI::DEFAULT_PARSER.escape("#{@api_endpoint}/file?filename=#{file_name}")
|
42
45
|
request = Net::HTTP::Delete.new(url)
|
43
46
|
response = http_from_url(url).request(request)
|
44
47
|
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
|
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.
|
4
|
+
version: 2.3.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-
|
12
|
+
date: 2022-02-15 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
|
@@ -235,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
235
238
|
- !ruby/object:Gem::Version
|
236
239
|
version: '0'
|
237
240
|
requirements: []
|
238
|
-
rubygems_version: 3.3.
|
241
|
+
rubygems_version: 3.3.7
|
239
242
|
signing_key:
|
240
243
|
specification_version: 4
|
241
244
|
summary: ONLYOFFICE DocumentServer testing framework
|