Class: OnlyofficeDocumentserverTestingFramework::TxtOptions
- Inherits:
-
Object
- Object
- OnlyofficeDocumentserverTestingFramework::TxtOptions
- Extended by:
- Gem::Deprecate
- Includes:
- SeleniumWrapper
- Defined in:
- lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows/txt_options.rb
Overview
Class for TXT export window
Direct Known Subclasses
Instance Method Summary collapse
-
#click_on_cancel ⇒ nil
Click on cancel button.
-
#click_on_ok ⇒ nil
Click on ok button.
-
#close_warning_loose_data ⇒ nil
Close warning about loose data.
-
#dialog_window_opened? ⇒ True, False
Is txt options dialog opened.
-
#encoding ⇒ BoundComboBoxUl
Control to set encoding.
- #encoding_select(encoding_name) ⇒ Object
-
#initialize(instance) ⇒ TxtOptions
constructor
A new instance of TxtOptions.
-
#loose_data_warning_present? ⇒ True, False
Is loose data warning visible.
-
#scroll_encoding_list_to(list_item_number) ⇒ nil
List encoding list to item number.
-
#txt_options=(encoding_to_set = nil) ⇒ nil
(also: #set_txt_options)
Set options in txt window.
-
#wait_options ⇒ nil
Wait for csv options to show.
-
#wait_warning ⇒ nil
Wait for loose data warning to show.
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) ⇒ TxtOptions
Returns a new instance of TxtOptions.
8 9 10 11 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows/txt_options.rb', line 8 def initialize(instance) @instance = instance @xpath_codepage_selector = '//*[contains(text(), "TXT")]/../..//div[@id="id-codepages-combo"]' end |
Instance Method Details
#click_on_cancel ⇒ nil
Click on cancel button
38 39 40 41 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows/txt_options.rb', line 38 def click_on_cancel '//button[@result="cancel"]' OnlyofficeLoggerHelper.log('Click on CANCEL button') end |
#click_on_ok ⇒ nil
Click on ok button
31 32 33 34 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows/txt_options.rb', line 31 def click_on_ok '//button[@result="ok"]' OnlyofficeLoggerHelper.log('Click on OK button') end |
#close_warning_loose_data ⇒ nil
Close warning about loose data
111 112 113 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows/txt_options.rb', line 111 def close_warning_loose_data click_on_ok if loose_data_warning_present? end |
#dialog_window_opened? ⇒ True, False
Returns is txt options dialog opened.
16 17 18 19 20 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows/txt_options.rb', line 16 def dialog_window_opened? visible = visible? @xpath_codepage_selector OnlyofficeLoggerHelper.log("Codepage option window is opened: #{visible}") visible end |
#encoding ⇒ BoundComboBoxUl
Control to set encoding
45 46 47 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows/txt_options.rb', line 45 def encoding BoundComboBoxUl.new(@instance, @xpath_codepage_selector, nil, 'span') end |
#encoding_select(encoding_name) ⇒ Object
86 87 88 89 90 91 92 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows/txt_options.rb', line 86 def encoding_select(encoding_name) encoding.open # TODO: Replace with correct include after find out https://github.com/ONLYOFFICE/testing-documentserver/pull/2006 list_item_number = encoding.items_text.index { |item| item.include?(encoding_name) } + 1 scroll_encoding_list_to list_item_number encoding.select_by_number list_item_number end |
#loose_data_warning_present? ⇒ True, False
Returns is loose data warning visible.
23 24 25 26 27 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows/txt_options.rb', line 23 def loose_data_warning_present? visible = visible? '//*[contains(@class, "asc-window modal alert")]' OnlyofficeLoggerHelper.log("Codepage option window is opened: #{visible}") visible end |
#scroll_encoding_list_to(list_item_number) ⇒ nil
List encoding list to item number
52 53 54 55 56 57 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows/txt_options.rb', line 52 def scroll_encoding_list_to(list_item_number) selenium_functions(:scroll_list_by_pixels, "//*[@id='id-codepages-combo']/span/ul", (list_item_number - 1) * 25) OnlyofficeLoggerHelper.log("Scroll to #{list_item_number} element") end |
#txt_options=(encoding_to_set = nil) ⇒ nil Also known as: set_txt_options
Set options in txt window
97 98 99 100 101 102 103 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows/txt_options.rb', line 97 def (encoding_to_set = nil) return unless dialog_window_opened? encoding_to_set = encoding.items_text.last if encoding_to_set.nil? encoding_select encoding_to_set click_on_ok end |
#wait_options ⇒ nil
Wait for csv options to show
76 77 78 79 80 81 82 83 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows/txt_options.rb', line 76 def counter = 0 while !dialog_window_opened? && counter < 30 sleep 1 counter += 1 end @instance.webdriver.webdriver_error 'Wait for TXT options failed' if counter == 30 end |
#wait_warning ⇒ nil
Wait for loose data warning to show
65 66 67 68 69 70 71 72 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_windows/txt_options.rb', line 65 def wait_warning counter = 0 while !loose_data_warning_present? && counter < 30 sleep 1 counter += 1 end @instance.webdriver.webdriver_error 'Wait for TXT warning failed' if counter == 30 end |