Class: OnlyofficeDocumentserverTestingFramework::CsvOption

Inherits:
TxtOptions
  • Object
show all
Extended by:
Gem::Deprecate
Includes:
SeleniumWrapper
Defined in:
lib/onlyoffice_documentserver_testing_framework/test_instance_docs/spreadsheet_editor/spreadsheet_windows/csv_option.rb

Overview

Class for CSV window

Constant Summary collapse

DELIMITER_TYPE =

Returns list of possible csv delimiters.

Returns:

  • (Array<Symbol>)

    list of possible csv delimiters

%i[comma semicolon colon tab space other].freeze

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

Methods inherited from TxtOptions

#click_on_cancel, #click_on_ok, #close_warning_loose_data, #dialog_window_opened?, #encoding, #encoding_select, #loose_data_warning_present?, #scroll_encoding_list_to, #txt_options=, #wait_options, #wait_warning

Constructor Details

#initialize(instance) ⇒ CsvOption

Returns a new instance of CsvOption.



8
9
10
11
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/spreadsheet_editor/spreadsheet_windows/csv_option.rb', line 8

def initialize(instance)
  super
  @xpath_codepage_selector = '//*[contains(text(), "CSV")]/../..//div[@id="id-codepages-combo"]'
end

Instance Method Details

#csv_options=(options = {}) ⇒ nil Also known as: set_csv_options

Set options in csv window

Parameters:

  • options (Hash) (defaults to: {})

    options to set

Returns:

  • (nil)


43
44
45
46
47
48
49
50
51
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/spreadsheet_editor/spreadsheet_windows/csv_option.rb', line 43

def csv_options=(options = {})
  options[:encoding_to_set] ||= 'Unicode (UTF-8)'
  options[:csv_delimiter] ||= :comma
  return unless dialog_window_opened?

  encoding_select options[:encoding_to_set]
  delimiter_select options[:csv_delimiter]
  click_on_ok
end

#delimiterObject

region CVN Framework



17
18
19
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/spreadsheet_editor/spreadsheet_windows/csv_option.rb', line 17

def delimiter
  BoundComboBoxUl.new(@instance, '//*[@id="id-delimiters-combo"]', nil, 'span')
end

#delimiter_select(delimiter_type) ⇒ Object

Parameters:

  • delimiter_type (Symbol)

    like as :semicolon



31
32
33
34
35
36
37
38
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/spreadsheet_editor/spreadsheet_windows/csv_option.rb', line 31

def delimiter_select(delimiter_type)
  if DELIMITER_TYPE.include?(delimiter_type)
    delimiter.select_by_number(DELIMITER_TYPE.index(delimiter_type) + 1)
  else
    delimiter.select_by_number(DELIMITER_TYPE.index(:other) + 1)
    other_delimiter.set(delimiter_type)
  end
end

#other_delimiterTextInput

Returns text input for enter custom delimiter.

Returns:

  • (TextInput)

    text input for enter custom delimiter



22
23
24
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/spreadsheet_editor/spreadsheet_windows/csv_option.rb', line 22

def other_delimiter
  @other_delimiter ||= TextInput.new(@instance, '//*[@id="id-delimiter-other"]')
end