onlyoffice_documentserver_testing_framework 2.7.1 → 2.8.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: c98c0385a7174e452ef41b48d7b0bdb05a52fa30e13e3d1b01c53c84dd557fac
4
- data.tar.gz: bb5936eec38055273da3f6a4dab539d8a0535c86a003a72e4fd6111f46cdda08
3
+ metadata.gz: 341504efd44e53df56234a60d803c6a00baee4350e78cd7c74a861009b8fd56c
4
+ data.tar.gz: 4665427fdc68fc72eb5cdafa1e032947c15f0d53f74bb5dadafae7c9a0c5aa04
5
5
  SHA512:
6
- metadata.gz: 2f354452f0b040424089f5121d12f25e7c57737e37bc4fb4ed501aa59a3563dfe05e9ee6d9aac8fa379ee5e2110a9f575c2c3ee6890bd1d22581797e779cfb5b
7
- data.tar.gz: 504679d10ec82b4551d512df5815fea7f26b3ec702e90d7e3ffdc6a60f89669414ff926a4fcfc86222f59a0dc1b7ed628b0169df5fe61e2228bec32b8ea9efd0
6
+ metadata.gz: edb27a38de4d8844ff5fa5d99a11189465749a83e7890888f23b70025151354e328b3bfc9b194032870ee028df84155d0872967058591ee7a1a788d00b9902d6
7
+ data.tar.gz: 07e47e22020a05fdf08ef96d95830ac92dff4c2e27f57f3c8ee2f623eb492cabf828c1b3cbecf0f0b48fcb1e226b3a5cc3848aac87dc63f73b3aed9ffea084f9
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OnlyofficeDocumentserverTestingFramework
4
+ # Meta class to describe editors tabs
5
+ class EditorTab
6
+ include SeleniumWrapper
7
+
8
+ def initialize(instance, tab_xpath: nil, tab_name: 'Default tab name')
9
+ @instance = instance
10
+ @xpath_insert_tab = tab_xpath
11
+ @tab_name = tab_name
12
+ end
13
+
14
+ # @return [True, False] is tab present
15
+ def present?
16
+ result = visible?(@xpath_insert_tab)
17
+ OnlyofficeLoggerHelper.log("#{@tab_name} Tab present?: #{result}")
18
+ result
19
+ end
20
+
21
+ # @return [True, False] if this tab opened
22
+ def active?
23
+ active = get_attribute(@xpath_insert_tab, 'class').include?('active')
24
+ OnlyofficeLoggerHelper.log("#{@tab_name} Tab active?: #{active}")
25
+ active
26
+ end
27
+
28
+ # Click on tab
29
+ # @return [Nothing]
30
+ def click
31
+ click_on_button(@xpath_insert_tab)
32
+ OnlyofficeLoggerHelper.log("Clicked on #{@tab_name} Tab")
33
+ sleep 2 # timeout for tab animation
34
+ end
35
+
36
+ # Double click on tab
37
+ # @return [Nothing]
38
+ def double_click
39
+ selenium_functions(:double_click, @xpath_insert_tab)
40
+ OnlyofficeLoggerHelper.log("Double Clicked on #{@tab_name} Tab")
41
+ sleep 2 # need time to toolbar to hide
42
+ end
43
+
44
+ # Open current tab
45
+ # @param [Boolean] to_open open or close this tab
46
+ # @return [Void]
47
+ # rubocop disable to not change interface of public method
48
+ # rubocop:disable Style/OptionalBooleanParameter
49
+ def open(to_open = true)
50
+ return if to_open == active?
51
+
52
+ click
53
+ end
54
+ # rubocop:enable Style/OptionalBooleanParameter
55
+ end
56
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'home_tab/editor_tab'
4
+
5
+ module OnlyofficeDocumentserverTestingFramework
6
+ # Class for Home tab actions
7
+ # https://user-images.githubusercontent.com/668524/28775382-4b8609d0-75fa-11e7-8bfd-a2de8e8a1332.png
8
+ class HomeTab < EditorTab
9
+ def initialize(instance, tab_xpath: '//a[@data-tab="home"]/..', tab_name: 'Home')
10
+ super
11
+ @instance = instance
12
+ @xpath_insert_tab = tab_xpath
13
+ @tab_name = tab_name
14
+ end
15
+ end
16
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'doc_editor_top_toolbar/home_tab'
3
4
  require_relative 'doc_editor_top_toolbar/top_toolbar_users'
4
5
  require_relative 'doc_editor_top_toolbar/top_toolbar_document'
5
6
  require_relative 'doc_editor_top_toolbar/title_row'
@@ -25,5 +26,10 @@ module OnlyofficeDocumentserverTestingFramework
25
26
  def top_toolbar
26
27
  @top_toolbar = TopToolbarDocument.new(@instance)
27
28
  end
29
+
30
+ # @return [HomeTab] home tab
31
+ def home_tab
32
+ @home_tab ||= HomeTab.new(@instance)
33
+ end
28
34
  end
29
35
  end
@@ -223,5 +223,21 @@ module OnlyofficeDocumentserverTestingFramework
223
223
  name ||= @instance.doc_editor.top_toolbar.top_toolbar.document_name
224
224
  name[-1] == '*'
225
225
  end
226
+
227
+ # Check if opened document is in viewer
228
+ # @return [true, false] true if viewer, false if editor
229
+ def viewer?
230
+ canvas_loaded = canvas_editor?
231
+ tabs_present = @instance.doc_editor.top_toolbar.home_tab.present?
232
+ result = canvas_loaded && !tabs_present
233
+ OnlyofficeLoggerHelper.log("viewer?: #{result}")
234
+ result
235
+ end
236
+
237
+ # Check if opened editor is canvas editor
238
+ # @return [true, false] true if canvas, false if not canvas
239
+ def canvas_editor?
240
+ visible?('//*[@id="id_viewer"]') || visible?('//*[@id="ws-canvas"]')
241
+ end
226
242
  end
227
243
  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.7.1'
7
+ STRING = '2.8.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.7.1
4
+ version: 2.8.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-04-12 00:00:00.000000000 Z
12
+ date: 2022-04-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: onlyoffice_logger_helper
@@ -189,6 +189,8 @@ files:
189
189
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/common_editor/editor_windows.rb
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
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/home_tab.rb
193
+ - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/home_tab/editor_tab.rb
192
194
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/title_row.rb
193
195
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/top_toolbar_document.rb
194
196
  - lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/top_toolbar_users.rb
@@ -239,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
241
  - !ruby/object:Gem::Version
240
242
  version: '0'
241
243
  requirements: []
242
- rubygems_version: 3.3.11
244
+ rubygems_version: 3.3.7
243
245
  signing_key:
244
246
  specification_version: 4
245
247
  summary: ONLYOFFICE DocumentServer testing framework