onlyoffice_documentserver_testing_framework 2.4.0 → 2.6.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: 0f74cb36c08ce0c13f7805732784fd67768f2ebf74d2c44e126433b5e2e7541f
4
- data.tar.gz: 7d824945bf257daf01fa9d002fc6653bb44d066e26ca1b6984b97ad059d03ca9
3
+ metadata.gz: 6967c2a133ff6880c81d2ecead2504ad6fcc569282fc44b7321a9b5aa10a4680
4
+ data.tar.gz: 821bc1465b598a0537bcc9a2904064eedc5941c78f25f348993661707cadcf59
5
5
  SHA512:
6
- metadata.gz: 67efa48bf9e7f71c80f152c4f27cc02db052d72cc5357bafb4ed103c56aa0e86e3221b3adc7edbf4f0941ffa1d3c5f539babc620120ab970340621444a4b9898
7
- data.tar.gz: 80fb3f4f04d40ad40dec2161ea92ebd59d7c67cc447056ccf11223d9b11b67f82cfda5582a1624906531a3907bc3f9c21e351856da2bc839a56b73835dedd901
6
+ metadata.gz: 0e1d61ea7d92e8277c41c796b93ef367a917ae7b1d815e99cd286f99d1c20d01255d0da237f668aceb2ca513550fbd17717235b212a6c904bac1c2d0ef392277
7
+ data.tar.gz: eb394dea96fc4b12c51f00c24551b6f6dd152e8365a652b8816827a74bcdf6252ac5339f2acb5025ab435eca6a396ce6df924c9b2e6bb317bd0ad0aced5399e5
@@ -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
@@ -22,7 +22,7 @@ module OnlyofficeDocumentserverTestingFramework
22
22
  file_name = @instance.management.document_name
23
23
  size_before = @instance.integration_example_api.file_data(file_name)['pureContentLength'].to_i
24
24
  @instance.go_to_base_url
25
- @instance.webdriver.wait_until(timeout, "File #{file_name} is not built in #{timeout}") do
25
+ @instance.webdriver.wait_until(timeout, "File `#{file_name}` is built") do
26
26
  file_data = @instance.integration_example_api.file_data(file_name)
27
27
  !file_data.nil? && file_data['pureContentLength'].to_i != size_before
28
28
  end
@@ -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
@@ -232,4 +235,18 @@ class DocTestSiteFunctions
232
235
  "#{file}")
233
236
  .map(&:strip)
234
237
  end
238
+
239
+ private
240
+
241
+ # Indexes of different modes
242
+ # @return [Hash] name with index
243
+ def default_modes_indexes
244
+ {
245
+ comment_mode: 4,
246
+ review_mode: 5,
247
+ fill_forms: 7,
248
+ view_mode: 8,
249
+ embedded: 10
250
+ }
251
+ end
235
252
  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.0'
7
+ STRING = '2.6.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.0
4
+ version: 2.6.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-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: onlyoffice_logger_helper