Module: OnlyofficeDocumentserverTestingFramework::SeleniumWrapper

Includes:
SeleniumWrapperJsErrors
Included in:
CsvOption, EditorTab, Management, TitleRow, TopToolbarDocument, TopToolbarUsers, TxtOptions
Defined in:
lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb

Overview

Module for handle selenium with frames and some other methods

Instance Method Summary collapse

Methods included from SeleniumWrapperJsErrors

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

Instance Method Details

#button_disabled?(xpath) ⇒ Boolean

This method return true if button disabled @param xpath

Returns:

  • (Boolean)


64
65
66
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 64

def button_disabled?(xpath)
  selenium_functions(:get_attribute, xpath, 'class').include?('disabled')
end

#button_menu_active?(xpath) ⇒ True, False

Returns if menu active.

Parameters:

  • xpath (String)

    xpath of menu

Returns:

  • (True, False)

    if menu active



70
71
72
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 70

def button_menu_active?(xpath)
  selenium_functions(:get_attribute, xpath, 'class').include?('menu-active')
end

#button_menu_open?(xpath) ⇒ Boolean

This method return true if button menu open @param xpath

Returns:

  • (Boolean)


77
78
79
80
81
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 77

def button_menu_open?(xpath)
  element_visible = visible?(xpath)
  element_visible = selenium_functions(:get_attribute, xpath, 'class').include?('open') if element_visible
  element_visible
end

#button_pressed?(xpath) ⇒ Boolean Also known as: button_active?

This method return true if button pressed @param xpath

Returns:

  • (Boolean)


55
56
57
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 55

def button_pressed?(xpath)
  selenium_functions(:get_attribute, xpath, 'class').include?('active')
end

#click_on_button(xpath) ⇒ Object

This method click over button by xpath @param xpath



48
49
50
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 48

def click_on_button(xpath)
  selenium_functions :click_on_locator, xpath
end

#click_on_displayed_button(xpath) ⇒ nil

Wait to element to appear and click

Parameters:

  • xpath (String)

    xpath to click

Returns:

  • (nil)


93
94
95
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 93

def click_on_displayed_button(xpath)
  selenium_functions(:click_on_displayed, xpath)
end

#click_on_of_several_by_display_button(xpath) ⇒ nil

Click on one of several displayed

Parameters:

  • xpath (String)

    xpath to click

Returns:

  • (nil)


86
87
88
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 86

def click_on_of_several_by_display_button(xpath)
  selenium_functions :click_on_one_of_several_by_display, xpath
end

#frame_count_additionInteger

Returns frame count with addition.

Returns:

  • (Integer)

    frame count with addition



32
33
34
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 32

def frame_count_addition
  @count_of_frame + @instance.management.xpath_iframe_count - 1
end

#get_attribute(xpath, attribute) ⇒ String

Get attribute

Parameters:

  • xpath (String)

    xpath to get attribute

  • attribute (String)

    attribute to get

Returns:

  • (String)

    result of get attribute



129
130
131
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 129

def get_attribute(xpath, attribute)
  selenium_functions :get_attribute, xpath, attribute
end

#line_checked?(xpath) ⇒ True, False

Is line checked

Parameters:

  • xpath (String)

    xpath to check

Returns:

  • (True, False)


107
108
109
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 107

def line_checked?(xpath)
  selenium_functions(:get_attribute, xpath, 'class').include?('checked')
end

#line_enabled?(xpath) ⇒ True, False

Is line enabled

Parameters:

  • xpath (String)

    xpath to check

Returns:

  • (True, False)


100
101
102
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 100

def line_enabled?(xpath)
  selenium_functions :element_visible?, xpath
end

Is menu disabled

Parameters:

  • xpath (String)

    xpath to check

Returns:

  • (True, False)


114
115
116
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 114

def menu_disabled?(xpath)
  selenium_functions(:get_attribute, xpath, 'class').include?('disabled')
end

#remove_element(xpath) ⇒ nil

Remove element

Parameters:

  • xpath (String)

    xpath to remove

Returns:

  • (nil)


121
122
123
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 121

def remove_element(xpath)
  selenium_functions :remove_element, xpath
end

#select_frameObject

Select actual frame of Editor



21
22
23
24
25
26
27
28
29
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 21

def select_frame
  count_of_frame = @count_of_frame ? frame_count_addition : @instance.management.xpath_iframe_count
  xpath_of_frame = @xpath_of_frame || @instance.management.xpath_iframe
  @instance.selenium.select_frame xpath_of_frame, count_of_frame
  value = yield
  fail_if_console_error
  @instance.selenium.select_top_frame
  value
end

#selenium_functions(name, *arguments, **options) ⇒ Object

Main wrapper function

Parameters:

  • name (Symbol)

    function to call

  • arguments (Hash)

    list of arguments

Returns:

  • (Object)

    result of method



14
15
16
17
18
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 14

def selenium_functions(name, *arguments, **options)
  select_frame do
    @instance.selenium.send name, *arguments, **options
  end
end

#visible?(xpath) ⇒ Boolean Also known as: element_visible?, element_present_and_visible?

This method return true if xpath visible on the web page @param xpath

Returns:

  • (Boolean)


39
40
41
# File 'lib/onlyoffice_documentserver_testing_framework/selenium_wrapper.rb', line 39

def visible?(xpath)
  selenium_functions :element_visible?, xpath
end