Class: OnlyofficeDocumentserverTestingFramework::TestInstanceDocs

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyoffice_documentserver_testing_framework/test_instance_docs.rb

Overview

Main class for browser instance

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(webdriver: OnlyofficeWebdriverWrapper::WebDriver.new(:chrome), doc_server_base_url: nil) ⇒ TestInstanceDocs

Initialize new instance

Parameters:

  • webdriver (OnlyofficeWebdriverWrapper::WebDriver) (defaults to: OnlyofficeWebdriverWrapper::WebDriver.new(:chrome))

    for test instance

  • doc_server_base_url (String) (defaults to: nil)

    base url of DocumentServer



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

def initialize(webdriver: OnlyofficeWebdriverWrapper::WebDriver.new(:chrome), doc_server_base_url: nil)
  @selenium = webdriver
  @doc_server_base_url = doc_server_base_url
end

Instance Attribute Details

#doc_server_base_urlString (readonly)

Returns base url of DocumentServer.

Returns:

  • (String)

    base url of DocumentServer



18
19
20
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs.rb', line 18

def doc_server_base_url
  @doc_server_base_url
end

#seleniumObject Also known as: webdriver

Returns the value of attribute selenium.



16
17
18
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs.rb', line 16

def selenium
  @selenium
end

Instance Method Details

#doc_editorDocEditor

Returns Document Editor instance.

Returns:



52
53
54
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs.rb', line 52

def doc_editor
  @doc_editor ||= DocEditor.new(self)
end

#doc_service_welcomeDocServiceWelcome

Returns welcome page of DocumentServer.

Returns:



35
36
37
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs.rb', line 35

def doc_service_welcome
  @doc_service_welcome ||= DocServiceWelcome.new(self)
end

#doc_test_functionsDocTestSiteFunctions

Returns methods for test site.

Returns:



40
41
42
43
44
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs.rb', line 40

def doc_test_functions
  # Do not cache methods since they use PageObject and cause all sort of troubles
  # if test run several times with different webdriver
  DocTestSiteFunctions.new(self)
end

#env_optionsHash

Returns Options read from environment variable.

Returns:

  • (Hash)

    Options read from environment variable



72
73
74
75
76
77
78
79
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs.rb', line 72

def env_options
  return @env_options if @env_options

  raw_options = ENV.fetch('ONLYOFFICE_DS_TESTING_OPTIONS', '{}')
  @env_options = JSON.parse(raw_options)
  @env_options['IgnoredJSErrors'] = [] unless @env_options['IgnoredJSErrors']
  @env_options
end

#go_to_base_urlObject

Open DocServer base url page



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

def go_to_base_url
  webdriver.open(doc_server_base_url)
end

#integration_example_apiIntegrationExampleApi

Returns for methods.

Returns:



47
48
49
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs.rb', line 47

def integration_example_api
  @integration_example_api ||= IntegrationExampleApi.new(self)
end

#managementManagement

Returns management methods.

Returns:



67
68
69
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs.rb', line 67

def management
  @management ||= Management.new(self)
end

#presentation_editorPresentationEditor

Returns editor of presentations.

Returns:



62
63
64
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs.rb', line 62

def presentation_editor
  @presentation_editor ||= PresentationEditor.new(self)
end

#spreadsheet_editorSpreadsheetEditor

Returns Spreadsheet Editor instance.

Returns:



57
58
59
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs.rb', line 57

def spreadsheet_editor
  @spreadsheet_editor ||= SpreadsheetEditor.new(self)
end