onlyoffice_documentserver_testing_framework 0.2.0 → 0.3.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: 941e375b508dde231ae51e9f00824a5485de8b29fc8ed9bf6c552f3e40a08b51
4
- data.tar.gz: 5e246acbb1d6e0eac6c9f2fe6812eb5d6f2429ee40cde9d8d500f9082d1d0f59
3
+ metadata.gz: b6272fb5c8b263cd7df59357b5b53f3a2282e2f21373d052ef054edb26b4a3bf
4
+ data.tar.gz: 34ebc6388986663a06496b198f95fd1c4dbc5932e6ac00b6c5e0e7ecae433f39
5
5
  SHA512:
6
- metadata.gz: fbcec58347a88accef63c913ff1d148709eb8cd6f489d4ef93ae197399ac3f5eb34960bece2a9b9bd4af5dd41b263be45d50ebdb6b6b3de5268c3d77b178684d
7
- data.tar.gz: 8f4c7c79964f964f2c84febca81fb484d40592961339b5c512dc5405b7d56e23774070ea0eaf1d3373ed660bb7b6d2f5761fef6eeefef572e54cd272b6fde4df
6
+ metadata.gz: 34cf7eb38515440464ff549f1890d7fef47c485289107c7f9444c79eb0e382f07e4da5fef97591712476813002e89c1fc9b36f3e0595661c18b67023aae96096
7
+ data.tar.gz: cf8cf9bc77b1120f768863e86cddfbbdb4513c729637a6db3b901c1c4dc919dfacda13472894635212ead1d7c15714b409d104efb217d04b8d86975fd3727378
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'onlyoffice_documentserver_testing_framework/document_server_version'
3
4
  require_relative 'onlyoffice_documentserver_testing_framework/selenium_wrapper'
4
5
  require_relative 'onlyoffice_documentserver_testing_framework/test_instance_docs'
5
6
  require_relative 'onlyoffice_documentserver_testing_framework/version'
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OnlyofficeDocumentserverTestingFramework
4
+ # Class for working with DocumentServer version
5
+ class DocumentServerVersion
6
+ include Comparable
7
+
8
+ # @return [Integer] Major version
9
+ attr_reader :major
10
+ # @return [Integer] Minor version
11
+ attr_reader :minor
12
+ # @return [Integer] Patch version
13
+ attr_reader :patch
14
+ # @return [Integer] Build version
15
+ attr_reader :build
16
+
17
+ # rubocop:disable Metrics/ParameterLists
18
+ def initialize(major = 0, minor = 0, patch = 0, build = 0)
19
+ @major = major
20
+ @minor = minor
21
+ @patch = patch
22
+ @build = build
23
+ end
24
+ # rubocop:enable Metrics/ParameterLists
25
+
26
+ # @param string [String] string value of build to parse
27
+ # @return [DocumentServerVersion] result of parsing
28
+ def parse(string)
29
+ return self if string == 'Unknown'
30
+
31
+ split_by_dot = string.split('.')
32
+ split_by_space = split_by_dot[2].split
33
+ @major = split_by_dot[0].to_i
34
+ @minor = split_by_dot[1].to_i
35
+ @patch = split_by_space[0].to_i
36
+ @build = split_by_space[1].scan(/\d/).join.to_i
37
+ self
38
+ end
39
+
40
+ # @return [String] string value
41
+ def to_s
42
+ "#{@major}.#{@minor}.#{@patch} (build:#{@build})"
43
+ end
44
+
45
+ # @return [String] sting with all digits separted by dots
46
+ def to_dotted_string
47
+ "#{@major}.#{@minor}.#{@patch}.#{@build}"
48
+ end
49
+
50
+ # Compare two DocumentServerVersion
51
+ # @param [DocumentServerVersion] other to compare
52
+ # @return [Integer] result of compare
53
+ def <=>(other)
54
+ Gem::Version.new(to_dotted_string) <=>
55
+ Gem::Version.new(other.to_dotted_string)
56
+ end
57
+ end
58
+ end
@@ -27,3 +27,5 @@ Blocked autofocusing on a <input> element in a cross-origin subframe.
27
27
  /embed
28
28
  ResponsiveVoice missing API key
29
29
  /libfont/wasm/
30
+ UserControls/Management
31
+ clientscript/
@@ -5,6 +5,7 @@ require_relative 'test_instance_docs/common_editor/editor_windows'
5
5
  require_relative 'test_instance_docs/doc_editor'
6
6
  require_relative 'test_instance_docs/doc_service_welcome'
7
7
  require_relative 'test_instance_docs/doc_test_site_functions'
8
+ require_relative 'test_instance_docs/integration_example_api'
8
9
  require_relative 'test_instance_docs/presentation_editor'
9
10
  require_relative 'test_instance_docs/spreadsheet_editor'
10
11
  require_relative 'test_instance_docs/management'
@@ -13,10 +14,21 @@ module OnlyofficeDocumentserverTestingFramework
13
14
  # Main class for browser instance
14
15
  class TestInstanceDocs
15
16
  attr_accessor :selenium
17
+ # @return [String] base url of DocumentServer
18
+ attr_reader :doc_server_base_url
16
19
  alias webdriver selenium
17
20
 
18
- def initialize(webdriver: OnlyofficeWebdriverWrapper::WebDriver.new(:chrome))
21
+ # Initialize new instance
22
+ # @param [OnlyofficeWebdriverWrapper::WebDriver] webdriver for test instance
23
+ # @param [String] doc_server_base_url base url of DocumentServer
24
+ def initialize(webdriver: OnlyofficeWebdriverWrapper::WebDriver.new(:chrome), doc_server_base_url: nil)
19
25
  @selenium = webdriver
26
+ @doc_server_base_url = doc_server_base_url
27
+ end
28
+
29
+ # Open DocServer base url page
30
+ def go_to_base_url
31
+ webdriver.open(doc_server_base_url)
20
32
  end
21
33
 
22
34
  # @return [DocServiceWelcome] welcome page of DocumentServer
@@ -31,6 +43,11 @@ module OnlyofficeDocumentserverTestingFramework
31
43
  DocTestSiteFunctions.new(self)
32
44
  end
33
45
 
46
+ # @return [IntegrationExampleApi] for methods
47
+ def integration_example_api
48
+ @integration_example_api ||= IntegrationExampleApi.new(self)
49
+ end
50
+
34
51
  # @return [DocEditor] Document Editor instance
35
52
  def doc_editor
36
53
  @doc_editor ||= DocEditor.new(self)
@@ -8,28 +8,6 @@ class DocTestSiteFunctions
8
8
  extend DocTestSiteServerHelper
9
9
  include PageObject
10
10
 
11
- # @return [Array<String>] list of supported languages
12
- SUPPORTED_LANGUAGES = %w[English
13
- Bulgarian
14
- Chinese
15
- Czech
16
- Dutch
17
- French
18
- German
19
- Hungarian
20
- Italian
21
- Japanese
22
- Korean
23
- Latvian
24
- Polish
25
- Portuguese
26
- Russian
27
- Slovak
28
- Slovenian
29
- Spanish
30
- Turkish
31
- Ukrainian
32
- Vietnamese].freeze
33
11
  select_list(:user_list, xpath: '//*[@id="user"]')
34
12
  select_list(:language_list, xpath: '//*[@id="language"]')
35
13
 
@@ -41,6 +19,12 @@ class DocTestSiteFunctions
41
19
  @xpath_conversion_step = '//*[@id="step2"]'
42
20
  @xpath_editor_scripts_step = '//*[@id="step3"]'
43
21
  @xpath_file_entry = '//*[@class="stored-list"]/table/tbody/tr'
22
+ @xpath_create_doc = '//*[contains(@class, "try-editor document")]|'\
23
+ '//*[contains(@class, "try-editor word")]'
24
+ @xpath_create_workbook = '//*[contains(@class, "try-editor spreadsheet")]|'\
25
+ '//*[contains(@class, "try-editor cell")]'
26
+ @xpath_create_presentation = '//*[contains(@class, "try-editor presentation")]|'\
27
+ '//*[contains(@class, "try-editor slide")]'
44
28
  end
45
29
 
46
30
  # Waiting for load of page
@@ -170,7 +154,7 @@ class DocTestSiteFunctions
170
154
 
171
155
  # @return [True, False] is on file list page now?
172
156
  def file_list_opened?
173
- @instance.selenium.element_visible?('//*[contains(@class, "try-editor document")]')
157
+ @instance.selenium.element_visible?(@xpath_create_doc)
174
158
  end
175
159
 
176
160
  # @return [Integer] count of uploaded files
@@ -208,11 +192,11 @@ class DocTestSiteFunctions
208
192
  def open_sample_document(format = :document, wait_to_load: true)
209
193
  case format
210
194
  when :document
211
- @instance.selenium.click_on_locator('//*[contains(@class, "try-editor document")]')
195
+ @instance.selenium.click_on_locator(@xpath_create_doc)
212
196
  when :spreadsheet
213
- @instance.selenium.click_on_locator('//*[contains(@class, "try-editor spreadsheet")]')
197
+ @instance.selenium.click_on_locator(@xpath_create_workbook)
214
198
  when :presentation
215
- @instance.selenium.click_on_locator('//*[contains(@class, "try-editor presentation")]')
199
+ @instance.selenium.click_on_locator(@xpath_create_presentation)
216
200
  else
217
201
  @instance.webdriver.webdriver_error("Unknown file type for open_sample_document(#{format})")
218
202
  end
@@ -232,4 +216,27 @@ class DocTestSiteFunctions
232
216
  def healthcheck
233
217
  @healthcheck = HealthcheckPage.new(@instance)
234
218
  end
219
+
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
+ # @param [DocumentServerVersion] version of server
230
+ # @return [Array<String>] list of supported languages
231
+ def self.supported_languages(version = OnlyofficeDocumentserverTestingFramework::DocumentServerVersion.new(6, 2, 0))
232
+ file = if version >= OnlyofficeDocumentserverTestingFramework::DocumentServerVersion.new(6, 2)
233
+ 'doc_test_site_languages_after_6_2.list'
234
+ else
235
+ 'doc_test_site_languages_before_6_2.list'
236
+ end
237
+ File.readlines("#{File.expand_path('..', __dir__)}"\
238
+ '/test_instance_docs/doc_test_site_functions/'\
239
+ "#{file}")
240
+ .map(&:strip)
241
+ end
235
242
  end
@@ -0,0 +1,31 @@
1
+ English
2
+ Belarusian
3
+ Bulgarian
4
+ Catalan
5
+ Chinese
6
+ Czech
7
+ Danish
8
+ Dutch
9
+ Finnish
10
+ French
11
+ German
12
+ Greek
13
+ Hungarian
14
+ Indonesian
15
+ Italian
16
+ Japanese
17
+ Korean
18
+ Latvian
19
+ Lao
20
+ Norwegian
21
+ Polish
22
+ Portuguese
23
+ Romanian
24
+ Russian
25
+ Slovak
26
+ Slovenian
27
+ Swedish
28
+ Spanish
29
+ Turkish
30
+ Ukrainian
31
+ Vietnamese
@@ -0,0 +1,21 @@
1
+ English
2
+ Bulgarian
3
+ Chinese
4
+ Czech
5
+ Dutch
6
+ French
7
+ German
8
+ Hungarian
9
+ Italian
10
+ Japanese
11
+ Korean
12
+ Latvian
13
+ Polish
14
+ Portuguese
15
+ Russian
16
+ Slovak
17
+ Slovenian
18
+ Spanish
19
+ Turkish
20
+ Ukrainian
21
+ Vietnamese
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'uri'
4
+ require 'net/http'
5
+
6
+ module OnlyofficeDocumentserverTestingFramework
7
+ # Class for working with integration example api
8
+ class IntegrationExampleApi
9
+ def initialize(instance)
10
+ @instance = instance
11
+ @api_endpoint = "#{@instance.doc_server_base_url}/example"
12
+ end
13
+
14
+ # @return [Array<Hash>] list of file on example
15
+ def files
16
+ url = "#{@api_endpoint}/files/"
17
+ request = Net::HTTP::Get.new(url)
18
+ response = http_from_url(url).request(request)
19
+ JSON.parse(response.read_body)
20
+ end
21
+
22
+ # Upload file by it's path
23
+ # @param [String] file_path
24
+ # @return [String] name of uploaded file
25
+ def upload_file(file_path)
26
+ url = URI("#{@api_endpoint}/upload/")
27
+
28
+ request = Net::HTTP::Post.new(url)
29
+ form_data = [['uploadedFile', File.open(file_path)]]
30
+ request.set_form(form_data, 'multipart/form-data')
31
+ response = http_from_url(url).request(request)
32
+ JSON.parse(response.read_body)['filename']
33
+ end
34
+
35
+ # Delete file on server by name
36
+ # @param [String] file_name
37
+ # @return [nil]
38
+ def delete_file(file_name)
39
+ raise 'File name is not found on server' unless file_data(file_name)
40
+
41
+ url = URI("#{@api_endpoint}/file?filename=#{file_name}")
42
+ request = Net::HTTP::Delete.new(url)
43
+ response = http_from_url(url).request(request)
44
+ JSON.parse(response.read_body)
45
+ end
46
+
47
+ # Get file data by it's name
48
+ # @param [String] name
49
+ # @return [String, nil] id
50
+ def file_data(name)
51
+ files.each do |file|
52
+ return file if file['title'] == name
53
+ end
54
+ nil
55
+ end
56
+
57
+ private
58
+
59
+ def http_from_url(url)
60
+ uri = URI(url)
61
+
62
+ http = Net::HTTP.new(uri.host, uri.port)
63
+ http.use_ssl = true if uri.scheme == 'https'
64
+ http
65
+ end
66
+ end
67
+ end
@@ -16,7 +16,7 @@ module OnlyofficeDocumentserverTestingFramework
16
16
  @instance = instance
17
17
  @xpath_iframe_count = 1
18
18
  # Don't mixup iframe with help
19
- @xpath_iframe = '//iframe[not(contains(@src, "help")) and '\
19
+ @xpath_iframe = '//iframe[not(contains(@src, "/help/")) and '\
20
20
  'not(contains(@id, "fileFrame"))]'
21
21
  @alert_dialog_xpath = '//div[@role="alertdialog"]'
22
22
  @alert_dialog_span_xpath = "#{@alert_dialog_xpath}/div/div/div/span"
@@ -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.2.0'
7
+ STRING = '0.3.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.2.0
4
+ version: 0.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: 2020-09-13 00:00:00.000000000 Z
12
+ date: 2021-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: onlyoffice_logger_helper
@@ -43,128 +43,134 @@ dependencies:
43
43
  name: overcommit
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '='
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 0.55.0
48
+ version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '='
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 0.55.0
55
+ version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '='
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 13.0.1
62
+ version: '13'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '='
67
+ - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: 13.0.1
69
+ version: '13'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '='
74
+ - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: 3.9.0
76
+ version: '3'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '='
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: 3.9.0
83
+ version: '3'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rubocop
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '='
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 0.90.0
90
+ version: '1'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '='
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 0.90.0
97
+ version: '1'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rubocop-performance
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - '='
102
+ - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: 1.8.0
104
+ version: '1'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - '='
109
+ - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: 1.8.0
111
+ version: '1'
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: rubocop-rake
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '='
116
+ - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: 0.5.1
118
+ version: '0'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - '='
123
+ - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: 0.5.1
125
+ version: '0'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rubocop-rspec
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '='
130
+ - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: 1.43.2
132
+ version: '2'
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - '='
137
+ - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: 1.43.2
139
+ version: '2'
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: simplecov
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - '='
144
+ - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: 0.18.5
146
+ version: '0'
147
147
  type: :development
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
- - - '='
151
+ - - "~>"
152
152
  - !ruby/object:Gem::Version
153
- version: 0.18.5
153
+ version: '0'
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: yard
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - '='
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ - - ">="
159
162
  - !ruby/object:Gem::Version
160
- version: 0.9.25
163
+ version: 0.9.20
161
164
  type: :development
162
165
  prerelease: false
163
166
  version_requirements: !ruby/object:Gem::Requirement
164
167
  requirements:
165
- - - '='
168
+ - - "~>"
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ - - ">="
166
172
  - !ruby/object:Gem::Version
167
- version: 0.9.25
173
+ version: 0.9.20
168
174
  description: ONLYOFFICE DocumentServer testing framework, used in QA
169
175
  email:
170
176
  - shockwavenn@gmail.com
@@ -173,6 +179,7 @@ extensions: []
173
179
  extra_rdoc_files: []
174
180
  files:
175
181
  - lib/onlyoffice_documentserver_testing_framework.rb
182
+ - lib/onlyoffice_documentserver_testing_framework/document_server_version.rb
176
183
  - lib/onlyoffice_documentserver_testing_framework/name.rb
177
184
  - lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb
178
185
  - lib/onlyoffice_documentserver_testing_framework/selenium_wrapper/selenium_wrapper_exceptions.rb
@@ -189,8 +196,11 @@ files:
189
196
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions.rb
190
197
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list.rb
191
198
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb
199
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_site_languages_after_6_2.list
200
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_site_languages_before_6_2.list
192
201
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_site_server_helper.rb
193
202
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/healthcheck_page.rb
203
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/integration_example_api.rb
194
204
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management.rb
195
205
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management/loader_helper.rb
196
206
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/presentation_editor.rb
@@ -222,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
232
  - !ruby/object:Gem::Version
223
233
  version: '0'
224
234
  requirements: []
225
- rubygems_version: 3.1.4
235
+ rubygems_version: 3.2.14
226
236
  signing_key:
227
237
  specification_version: 4
228
238
  summary: ONLYOFFICE DocumentServer testing framework