Module: OnlyofficeDocumentserverTestingFramework::PasswordProtectedConversionHelper

Included in:
DocTestSiteFunctions
Defined in:
lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/password_protected_conversion_helper.rb

Overview

Helper to handle password protected files on conversion step

Instance Method Summary collapse

Instance Method Details

#handle_password_protection(password) ⇒ Object

Handle password block



35
36
37
38
39
40
41
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/password_protected_conversion_helper.rb', line 35

def handle_password_protection(password)
  @instance.selenium.type_text(xpath_input_password, password)
  @instance.selenium.click_on_locator(xpath_enter_password)
  wait_to_check_password
  @instance.webdriver.webdriver_error("Cannot open file with password: `#{password}`") if incorrect_password_shown?
  OnlyofficeLoggerHelper.log('Entered password')
end

#incorrect_password_shown?Boolean

Returns check if incorrect password warning is shown.

Returns:

  • (Boolean)

    check if incorrect password warning is shown



30
31
32
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/password_protected_conversion_helper.rb', line 30

def incorrect_password_shown?
  @instance.selenium.element_visible?(xpath_password_error)
end

#wait_to_check_passwordNothing

Waits until password is checked

Returns:

  • (Nothing)


23
24
25
26
27
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/password_protected_conversion_helper.rb', line 23

def wait_to_check_password
  @instance.webdriver.wait_until(5) do
    !@instance.webdriver.get_attribute(@xpath_conversion_step, 'class').include?('current')
  end
end

#xpath_enter_passwordString

Returns xpath of enter button.

Returns:

  • (String)

    xpath of enter button



12
13
14
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/password_protected_conversion_helper.rb', line 12

def xpath_enter_password
  '//div[@id="enterPass"]'
end

#xpath_input_passwordString

Returns xpath of password input.

Returns:

  • (String)

    xpath of password input



7
8
9
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/password_protected_conversion_helper.rb', line 7

def xpath_input_password
  '//input[@id="filePass"]'
end

#xpath_password_errorString

Returns xpath of error message.

Returns:

  • (String)

    xpath of error message



17
18
19
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/password_protected_conversion_helper.rb', line 17

def xpath_password_error
  '//span[@class="errorPass"]'
end