Module: OnlyofficeDocumentserverTestingFramework::LoaderHelper

Extended by:
Gem::Deprecate
Included in:
Management
Defined in:
lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management/loader_helper.rb

Overview

Module for methods with loader of document

Instance Method Summary collapse

Instance Method Details

#check_2_5_version_errorObject

Check if any error from DocumentServer v2.5



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management/loader_helper.rb', line 7

def check_2_5_version_error
  @instance.selenium.select_frame(@xpath_iframe, @xpath_iframe_count)
  base_error_message_xpath = '//div[contains(@class,"x-message-box")]'
  error_box_xpath = "#{base_error_message_xpath}/div[2]/div[1]/div[2]/span"
  if @instance.selenium.element_visible?(error_box_xpath) &&
     @instance.selenium.get_style_parameter(base_error_message_xpath, 'left')
              .gsub('px', '').to_i.positive?
    error_text = @instance.selenium.get_text(error_box_xpath).tr("\n", ' ')
    @instance.selenium.webdriver_error("Server Error: #{error_text}")
  end
end

#error_message_alertObject Also known as: get_error_message_alert

Check for error message 3.0 version



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management/loader_helper.rb', line 28

def error_message_alert
  alert_xpath = "//div[contains(@class,'asc-window modal alert')]"
  return unless visible?("#{alert_xpath}/div[2]/div[1]/div[2]/span") &&
                selenium_functions(:get_style_parameter, alert_xpath, 'left')
                .gsub('px', '').to_i.positive?

  error = selenium_functions(:get_text, "#{alert_xpath}/div[2]/div[1]/div[2]/span").tr("\n", ' ')
  if error.include?('There are one or more circular references')
    click_on_button("#{@alert_dialog_xpath}//button[@result='ok']")
    return nil
  end
  "Server Error: #{error}"
end

#handle_alert_dialogObject

Handle some more alert dialogs



47
48
49
50
51
52
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management/loader_helper.rb', line 47

def handle_alert_dialog
  return unless @instance.selenium.element_visible?(@alert_dialog_span_xpath)

  error = @instance.selenium.get_text(@alert_dialog_span_xpath).tr("\n", ' ')
  @instance.selenium.webdriver_error("Server Error: #{error}")
end

#handle_errorObject

Handle default error in alert



20
21
22
23
24
25
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/management/loader_helper.rb', line 20

def handle_error
  @instance.selenium.select_top_frame
  error = error_message_alert
  @instance.selenium.webdriver_error(error) unless error.nil?
  @instance.selenium.select_frame(@xpath_iframe, @xpath_iframe_count)
end