Class: OnlyofficeDocumentserverTestingFramework::EditorTab

Inherits:
Object
  • Object
show all
Includes:
SeleniumWrapper
Defined in:
lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/home_tab/editor_tab.rb

Overview

Meta class to describe editors tabs

Direct Known Subclasses

HomeTab

Instance Method Summary collapse

Methods included from SeleniumWrapper

#button_disabled?, #button_menu_active?, #button_menu_open?, #button_pressed?, #click_on_button, #click_on_displayed_button, #click_on_of_several_by_display_button, #frame_count_addition, #get_attribute, #line_checked?, #line_enabled?, #menu_disabled?, #remove_element, #select_frame, #selenium_functions, #visible?

Methods included from SeleniumWrapperJsErrors

#console_errors, #error_ignored?, #fail_if_console_error, #ignored_errors

Constructor Details

#initialize(instance, tab_xpath: nil, tab_name: 'Default tab name') ⇒ EditorTab

Returns a new instance of EditorTab.



8
9
10
11
12
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/home_tab/editor_tab.rb', line 8

def initialize(instance, tab_xpath: nil, tab_name: 'Default tab name')
  @instance = instance
  @xpath_insert_tab = tab_xpath
  @tab_name = tab_name
end

Instance Method Details

#active?True, False

Returns if this tab opened.

Returns:

  • (True, False)

    if this tab opened



22
23
24
25
26
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/home_tab/editor_tab.rb', line 22

def active?
  active = get_attribute(@xpath_insert_tab, 'class').include?('active')
  OnlyofficeLoggerHelper.log("#{@tab_name} Tab active?: #{active}")
  active
end

#clickNothing

Click on tab

Returns:

  • (Nothing)


30
31
32
33
34
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/home_tab/editor_tab.rb', line 30

def click
  click_on_button(@xpath_insert_tab)
  OnlyofficeLoggerHelper.log("Clicked on #{@tab_name} Tab")
  sleep 2 # timeout for tab animation
end

#close_tooltipsNothing

Close tooltips

Returns:

  • (Nothing)


56
57
58
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/home_tab/editor_tab.rb', line 56

def close_tooltips
  click_on_button(close_tooltip_xpath) while visible?(tooltip_xpath)
end

#double_clickNothing

Double click on tab

Returns:

  • (Nothing)


38
39
40
41
42
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/home_tab/editor_tab.rb', line 38

def double_click
  selenium_functions(:double_click, @xpath_insert_tab)
  OnlyofficeLoggerHelper.log("Double Clicked on #{@tab_name} Tab")
  sleep 2 # need time to toolbar to hide
end

#open(to_open = true) ⇒ Void

Open current tab rubocop disable to not change interface of public method rubocop:disable Style/OptionalBooleanParameter

Parameters:

  • to_open (Boolean) (defaults to: true)

    open or close this tab

Returns:

  • (Void)


49
50
51
52
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/home_tab/editor_tab.rb', line 49

def open(to_open = true)
  click if to_open != active?
  close_tooltips
end

#present?True, False

Returns is tab present.

Returns:

  • (True, False)

    is tab present



15
16
17
18
19
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/home_tab/editor_tab.rb', line 15

def present?
  result = visible?(@xpath_insert_tab)
  OnlyofficeLoggerHelper.log("#{@tab_name} Tab present?: #{result}")
  result
end