onlyoffice_documentserver_testing_framework 2.4.1 → 2.7.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: 0b525df2659aee80684bdc7a0e424670f5887cdf6f749573d728c9bfd51af594
4
- data.tar.gz: b5bcae69c6dc94e756fb67a6a7d7c34856175d5504db657ead0432b7a1119c0d
3
+ metadata.gz: 57e9e337dc8d7477109cdfe89b0fc34a3fbbd14b7d5b14088b27f9c4b67834d4
4
+ data.tar.gz: e935d196d93db199cef87d44fc99eb97b98901afdc103133078462ecec5dd058
5
5
  SHA512:
6
- metadata.gz: '06901f36d44cf9fdc6417b29c4ef3fa09a07add337ea1c053a41f8b31cf9c872b00193785cf1735b2626479e448079aee5312d1317b78e49075e490ae853df87'
7
- data.tar.gz: 5bbdd65c7d0ab130af39eb5d9f587c92d1b76f49cce0daa2b07205b079ac266a9ff60af853a6b41381659ee3fa83918cdd1b534b8302edc5bc2c88be853e5102
6
+ metadata.gz: 7c45f7b1d5361b269398539db8be0e088d0f4398b41c2960517147ab96501fd18328a91f372a0a4865f9170a310c565320454e1533ec3f88d8923273f149750c
7
+ data.tar.gz: 7d7d08ac514a1d804b96f530bae84f1107cb2af389916dae8633dfd929f1f07620c2dd183a688c338a2f4e2d2d3b7d23b6619826cad82df47cc89a127fb83037
@@ -18,9 +18,10 @@ class DocTestSiteFileListEntry
18
18
  # @return [String] View mode url
19
19
  attr_accessor :view_mode_url
20
20
 
21
- def initialize(instance, xpath)
21
+ def initialize(instance, xpath, edit_modes_indexes)
22
22
  @instance = instance
23
23
  @xpath_line = xpath
24
+ @edit_modes_indexes = edit_modes_indexes
24
25
  @file_name = fetch_file_name
25
26
  @embedded_url = fetch_embedded_url
26
27
  @review_mode_url = fetch_review_mode_url
@@ -44,7 +45,7 @@ class DocTestSiteFileListEntry
44
45
 
45
46
  # @return [String] url on review mode
46
47
  def fetch_review_mode_url
47
- xpath_review = "#{@xpath_line}/td[#{mode_indexes[:review_mode]}]/a"
48
+ xpath_review = "#{@xpath_line}/td[#{@edit_modes_indexes[:review_mode]}]/a"
48
49
  return nil unless @instance.selenium.element_present?(xpath_review)
49
50
 
50
51
  url = @instance.selenium.get_attribute(xpath_review, 'href')
@@ -54,7 +55,7 @@ class DocTestSiteFileListEntry
54
55
 
55
56
  # @return [String] url on review mode
56
57
  def fetch_comment_mode_url
57
- xpath_comment = "#{@xpath_line}/td[#{mode_indexes[:comment_mode]}]/a"
58
+ xpath_comment = "#{@xpath_line}/td[#{@edit_modes_indexes[:comment_mode]}]/a"
58
59
  return nil unless @instance.selenium.element_present?(xpath_comment)
59
60
 
60
61
  url = @instance.selenium.get_attribute(xpath_comment, 'href')
@@ -64,7 +65,7 @@ class DocTestSiteFileListEntry
64
65
 
65
66
  # @return [String] url on fill forms mode
66
67
  def fetch_fill_forms_mode_url
67
- xpath_comment = "#{@xpath_line}/td[#{mode_indexes[:fill_forms]}]/a"
68
+ xpath_comment = "#{@xpath_line}/td[#{@edit_modes_indexes[:fill_forms]}]/a"
68
69
  return nil unless @instance.selenium.element_present?(xpath_comment)
69
70
 
70
71
  url = @instance.selenium.get_attribute(xpath_comment, 'href')
@@ -74,7 +75,7 @@ class DocTestSiteFileListEntry
74
75
 
75
76
  # @return [String] url on fill forms mode
76
77
  def fetch_only_fill_forms_mode_url
77
- link_xpath = "#{@xpath_line}/td[#{mode_indexes[:only_fill_forms]}]/a"
78
+ link_xpath = "#{@xpath_line}/td[#{@edit_modes_indexes[:only_fill_forms]}]/a"
78
79
  return nil unless @instance.selenium.element_present?(link_xpath)
79
80
 
80
81
  url = @instance.selenium.get_attribute(link_xpath, 'href')
@@ -84,7 +85,7 @@ class DocTestSiteFileListEntry
84
85
 
85
86
  # @return [String] url on viewer mode
86
87
  def fetch_view_mode_url
87
- xpath_comments = "#{@xpath_line}/td[#{mode_indexes[:view_mode]}]/a"
88
+ xpath_comments = "#{@xpath_line}/td[#{@edit_modes_indexes[:view_mode]}]/a"
88
89
  return nil unless @instance.selenium.element_present?(xpath_comments)
89
90
 
90
91
  url = @instance.selenium.get_attribute(xpath_comments, 'href')
@@ -94,22 +95,11 @@ class DocTestSiteFileListEntry
94
95
 
95
96
  # @return [String] url on embedded file
96
97
  def fetch_embedded_url
97
- url = @instance.selenium.get_attribute("#{@xpath_line}/td[#{mode_indexes[:embedded]}]/a", 'href')
98
+ xpath_embedded = "#{@xpath_line}/td[#{@edit_modes_indexes[:embedded]}]/a"
99
+ return nil unless @instance.selenium.element_present?(xpath_embedded)
100
+
101
+ url = @instance.selenium.get_attribute(xpath_embedded, 'href')
98
102
  OnlyofficeLoggerHelper.log("Got embedded #{@xpath_line} url: #{url}")
99
103
  url
100
104
  end
101
-
102
- private
103
-
104
- # Indexes of different modes
105
- # @return [Hash] name with index
106
- def mode_indexes
107
- {
108
- comment_mode: 4,
109
- review_mode: 5,
110
- fill_forms: 7,
111
- view_mode: 8,
112
- embedded: 10
113
- }
114
- end
115
105
  end
@@ -0,0 +1,33 @@
1
+ English
2
+ Azerbaijani
3
+ Belarusian
4
+ Bulgarian
5
+ Catalan
6
+ Chinese
7
+ Czech
8
+ Danish
9
+ Dutch
10
+ Finnish
11
+ French
12
+ Galego
13
+ German
14
+ Greek
15
+ Hungarian
16
+ Indonesian
17
+ Italian
18
+ Japanese
19
+ Korean
20
+ Latvian
21
+ Lao
22
+ Norwegian
23
+ Polish
24
+ Portuguese
25
+ Romanian
26
+ Russian
27
+ Slovak
28
+ Slovenian
29
+ Spanish
30
+ Swedish
31
+ Turkish
32
+ Ukrainian
33
+ Vietnamese
@@ -13,7 +13,7 @@ class DocTestSiteFunctions
13
13
  select_list(:user_list, xpath: '//*[@id="user"]')
14
14
  select_list(:language_list, xpath: '//*[@id="language"]')
15
15
 
16
- def initialize(instance)
16
+ def initialize(instance, edit_modes_indexes = default_modes_indexes)
17
17
  super(instance.webdriver.driver)
18
18
  @instance = instance
19
19
  @xpath_begin_view = '//*[@id="beginView"]'
@@ -27,6 +27,7 @@ class DocTestSiteFunctions
27
27
  '//*[contains(@class, "try-editor cell")]'
28
28
  @xpath_create_presentation = '//*[contains(@class, "try-editor presentation")]|'\
29
29
  '//*[contains(@class, "try-editor slide")]'
30
+ @edit_modes_indexes = edit_modes_indexes
30
31
  end
31
32
 
32
33
  # Waiting for load of page
@@ -168,7 +169,9 @@ class DocTestSiteFunctions
168
169
  def uploaded_file_list
169
170
  file_list = []
170
171
  (0...uploaded_file_count).each do |current_file_number|
171
- file_list << DocTestSiteFileListEntry.new(@instance, "#{@xpath_file_entry}[#{current_file_number + 1}]")
172
+ file_list << DocTestSiteFileListEntry.new(@instance,
173
+ "#{@xpath_file_entry}[#{current_file_number + 1}]",
174
+ @edit_modes_indexes)
172
175
  end
173
176
  DocTestFileList.new(file_list)
174
177
  end
@@ -222,14 +225,30 @@ class DocTestSiteFunctions
222
225
  # @param [DocumentServerVersion] version of server
223
226
  # @return [Array<String>] list of supported languages
224
227
  def self.supported_languages(version = OnlyofficeDocumentserverTestingFramework::DocumentServerVersion.new(6, 2, 0))
225
- file = if version >= OnlyofficeDocumentserverTestingFramework::DocumentServerVersion.new(6, 2)
228
+ file = if version >= OnlyofficeDocumentserverTestingFramework::DocumentServerVersion.new(7, 1)
229
+ 'doc_test_site_languages_after_7.1.list'
230
+ elsif version >= OnlyofficeDocumentserverTestingFramework::DocumentServerVersion.new(6, 2)
226
231
  'doc_test_site_languages_after_6_2.list'
227
232
  else
228
233
  'doc_test_site_languages_before_6_2.list'
229
234
  end
230
235
  File.readlines("#{File.expand_path('..', __dir__)}"\
231
236
  '/test_instance_docs/doc_test_site_functions/'\
232
- "#{file}")
237
+ "languages_list/#{file}")
233
238
  .map(&:strip)
234
239
  end
240
+
241
+ private
242
+
243
+ # Indexes of different modes
244
+ # @return [Hash] name with index
245
+ def default_modes_indexes
246
+ {
247
+ comment_mode: 4,
248
+ review_mode: 5,
249
+ fill_forms: 7,
250
+ view_mode: 8,
251
+ embedded: 10
252
+ }
253
+ end
235
254
  end
@@ -36,15 +36,20 @@ module OnlyofficeDocumentserverTestingFramework
36
36
  end
37
37
 
38
38
  # Delete file on server by name
39
- # @param [String] file_name
39
+ # @param [String] file_name name of file to delete
40
+ # @param [Integer] sleep_after_delete how much time to sleep after file delete
41
+ # sometimes it took time to delete this file and it cannot be checked by `file_data`
42
+ # method, since file will be not created but you get inside old file
40
43
  # @return [nil]
41
- def delete_file(file_name)
44
+ def delete_file(file_name, sleep_after_delete: 3)
42
45
  raise 'File name is not found on server' unless file_data(file_name)
43
46
 
44
47
  url = URI::DEFAULT_PARSER.escape("#{@api_endpoint}/file?filename=#{file_name}")
45
48
  request = Net::HTTP::Delete.new(url)
46
49
  response = http_from_url(url).request(request)
47
- JSON.parse(response.read_body)
50
+ result = JSON.parse(response.read_body)
51
+ sleep(sleep_after_delete)
52
+ result
48
53
  end
49
54
 
50
55
  # Get file data by it's name
@@ -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.4.1'
7
+ STRING = '2.7.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.4.1
4
+ version: 2.7.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-25 00:00:00.000000000 Z
12
+ date: 2022-04-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: onlyoffice_logger_helper
@@ -198,11 +198,12 @@ files:
198
198
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions.rb
199
199
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list.rb
200
200
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb
201
- - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_site_languages_after_6_2.list
202
- - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_site_languages_before_6_2.list
203
201
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_site_server_helper.rb
204
202
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/file_reopen_helper.rb
205
203
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/healthcheck_page.rb
204
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/languages_list/doc_test_site_languages_after_6_2.list
205
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/languages_list/doc_test_site_languages_after_7_1.list
206
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/languages_list/doc_test_site_languages_before_6_2.list
206
207
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/integration_example_api.rb
207
208
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management.rb
208
209
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management/loader_helper.rb
@@ -238,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
239
  - !ruby/object:Gem::Version
239
240
  version: '0'
240
241
  requirements: []
241
- rubygems_version: 3.3.7
242
+ rubygems_version: 3.3.11
242
243
  signing_key:
243
244
  specification_version: 4
244
245
  summary: ONLYOFFICE DocumentServer testing framework