Class: OnlyofficeDocumentserverTestingFramework::TitleRow
- Inherits:
-
Object
- Object
- OnlyofficeDocumentserverTestingFramework::TitleRow
- Includes:
- SeleniumWrapper
- Defined in:
- lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/title_row.rb
Overview
Module for description of title row
Instance Method Summary collapse
-
#document_name(with_extension: true) ⇒ String
Current document name.
-
#document_unsaved?(name = nil) ⇒ Boolean
Check if current document unsaved.
-
#initialize(instance) ⇒ TitleRow
constructor
A new instance of TitleRow.
-
#rename(new_name) ⇒ nil
Rename current document.
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) ⇒ TitleRow
Returns a new instance of TitleRow.
9 10 11 12 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/title_row.rb', line 9 def initialize(instance) @instance = instance @xpath_document_name = '//*[(@id="rib-doc-name") or (@id="title-doc-name")]' end |
Instance Method Details
#document_name(with_extension: true) ⇒ String
Returns current document name.
16 17 18 19 20 21 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/title_row.rb', line 16 def document_name(with_extension: true) doc_name = raw_document_name doc_name.chop! if document_unsaved?(doc_name) doc_name = File.basename(doc_name, '.*') unless with_extension doc_name end |
#document_unsaved?(name = nil) ⇒ Boolean
Check if current document unsaved
26 27 28 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/title_row.rb', line 26 def document_unsaved?(name = nil) name[-1] == '*' end |
#rename(new_name) ⇒ nil
Rename current document
33 34 35 36 37 |
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_editor/doc_editor_top_toolbar/title_row.rb', line 33 def rename(new_name) selenium_functions(:type_to_locator, @xpath_document_name, "#{new_name}\n", true, true) OnlyofficeLoggerHelper.log("Renamed document to `#{new_name}` name") OnlyofficeLoggerHelper.sleep_and_log('Wait for rename to complete', 5) end |