Class: OLE_QA::Framework::Session
- Inherits:
-
Object
- Object
- OLE_QA::Framework::Session
- Defined in:
- lib/ole-qa-framework.rb
Overview
Handle Browser Functions, Headless Session Invoke with @ole = Session.new(opts) Exit with @ole.quit
Default options loaded from lib/config/default_options.yml
Instance Attribute Summary collapse
-
#base_url ⇒ Object
(also: #fs_url)
readonly
OLE Installation Base URL - Also serves as OLE Financial System Main Menu URL.
-
#explicit_wait ⇒ Object
Wait period (in seconds) used by OLE QAF Web Element functions.
-
#ls_url ⇒ Object
readonly
OLE Library System Base URL.
-
#options ⇒ Object
readonly
The options with which this OLE_QA Framework Session was invoked.
Instance Method Summary collapse
-
#browser ⇒ Object
Access Watir-Webdriver's browser session.
-
#initialize(options = {}) ⇒ Session
constructor
Options hash keys: :base_url => "http://tst.ole.kuali.org/" (URL for OLE Installation) :ls_url => "http://tst.rice2.ole.kuali.org" (URL for OLE Library System Rice Instance) :headless => true/false (Use Headless gem to handle XVFB session) :implicit_wait => NN (Set Selenium Webdriver's default wait period) :explicit_wait => NN (Set the wait period used by custom wait functions) :doc_wait => NN (Set the wait period for eDoc routing to complete) :browser => selenium_webdriver (Where browser is a Selenium WebDriver session).
-
#open(url = @base_url) ⇒ Object
Open a page via URL.
-
#quit ⇒ Object
Teardown the OLE QA Framework.
-
#windows ⇒ Object
Access Watir-Webdriver's Window Handling Method.
Constructor Details
#initialize(options = {}) ⇒ Session
Options hash keys:
:base_url => "http://tst.ole.kuali.org/"
(URL for OLE Installation)
:ls_url => "http://tst.rice2.ole.kuali.org"
(URL for OLE Library System Rice Instance)
:headless => true/false
(Use Headless gem to handle XVFB session)
:implicit_wait => NN
(Set Selenium Webdriver's default wait period)
:explicit_wait => NN
(Set the wait period used by custom wait functions)
:doc_wait => NN
(Set the wait period for eDoc routing to complete)
:browser => selenium_webdriver
(Where browser is a Selenium WebDriver session)
To configure the default options, edit lib/config/default_options.yml
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/ole-qa-framework.rb', line 114 def initialize( ={} ) yaml_configuration = File.open(OLE_QA::Framework::load_dir + '/config/default_options.yml', 'r') = YAML.load(yaml_configuration) yaml_configuration.close @options = .merge() # Start headless session if requested if @options[:headless?] @headless = Headless.new @headless.start end # Globalize options to accessors @base_url = @options[:base_url] @ls_url = @options[:ls_url] @explicit_wait = @options[:explicit_wait] @doc_wait = @options[:doc_wait] # Pass explicit_wait to a module accessor for use with OLE_QA::Tools OLE_QA::Framework.instance_variable_set(:@explicit_wait,@options[:explicit_wait]) # Pass doc_wait to a module accessor for use with OLE_QA::Tools OLE_QA::Framework.instance_variable_set(:@doc_wait,@options[:doc_wait]) # Browser Start if @options.has_key?(:browser) && @options[:browser].class == Watir::Browser @browser = @options[:browser] else @browser = Watir::Browser.new :firefox @browser.driver.manage.timeouts.implicit_wait = @options[:implicit_wait] end end |
Instance Attribute Details
#base_url ⇒ Object (readonly) Also known as: fs_url
OLE Installation Base URL
- Also serves as OLE Financial System Main Menu URL
83 84 85 |
# File 'lib/ole-qa-framework.rb', line 83 def base_url @base_url end |
#explicit_wait ⇒ Object
Wait period (in seconds) used by OLE QAF Web Element functions
90 91 92 |
# File 'lib/ole-qa-framework.rb', line 90 def explicit_wait @explicit_wait end |
#ls_url ⇒ Object (readonly)
OLE Library System Base URL
87 88 89 |
# File 'lib/ole-qa-framework.rb', line 87 def ls_url @ls_url end |
#options ⇒ Object (readonly)
The options with which this OLE_QA Framework Session was invoked
93 94 95 |
# File 'lib/ole-qa-framework.rb', line 93 def @options end |
Instance Method Details
#browser ⇒ Object
Access Watir-Webdriver's browser session.
149 150 151 |
# File 'lib/ole-qa-framework.rb', line 149 def browser @browser end |
#open(url = @base_url) ⇒ Object
Open a page via URL. (Defaults to @base_url.)
159 160 161 |
# File 'lib/ole-qa-framework.rb', line 159 def open(url = @base_url) @browser.goto(url) end |
#quit ⇒ Object
Teardown the OLE QA Framework.
- Exit the Selenium WebDriver browser session.
- Exit the Headless (XVFB) session if necessary.
166 167 168 169 170 171 |
# File 'lib/ole-qa-framework.rb', line 166 def quit @browser.quit if @options[:headless?] then @headless.destroy end end |
#windows ⇒ Object
Access Watir-Webdriver's Window Handling Method
154 155 156 |
# File 'lib/ole-qa-framework.rb', line 154 def windows @browser.windows end |