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/.yml
Instance Attribute Summary collapse
-
#docstore_url ⇒ Object
(also: #docstore)
readonly
OLE Document Store Installation Base URL (e.g. docstore.ole.your-site.edu/).
-
#explicit_wait ⇒ Object
Wait period (in seconds) used by OLE QAF Web Element functions.
-
#options ⇒ Object
readonly
The options with which this OLE_QA Framework Session was invoked.
-
#url ⇒ Object
(also: #fs_url, #base_url, #ls_url)
readonly
OLE Installation Base URL (e.g. ole.your-site.edu/).
Instance Method Summary collapse
-
#browser ⇒ Object
Access Watir-Webdriver’s browser session.
-
#initialize(options = {}) ⇒ Session
constructor
Options hash keys: :url => “tst.ole.kuali.org/” (URL for OLE Installation) :docstore_url => ‘tst.docstore.ole.kuali.org/’ (URL for OLE DocStore Installation) :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 => watir_webdriver (Where browser is a Watir WebDriver session).
-
#open(url = @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:
:url => "http://tst.ole.kuali.org/"
(URL for OLE Installation)
:docstore_url => 'http://tst.docstore.ole.kuali.org/'
(URL for OLE DocStore Installation)
: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 => watir_webdriver
(Where browser is a Watir WebDriver session)
To configure the default options, edit
lib/config/.yml
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/ole-qa-framework.rb', line 133 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 # Set trailing slash on URLs for consistency if not set. add_slash = ->(which) { which =~ /\/$/ ? which : which + '/' } # Globalize options to accessors @url = add_slash.call(@options[:url]) @docstore_url = add_slash.call(@options[:docstore_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
#docstore_url ⇒ Object (readonly) Also known as: docstore
OLE Document Store Installation Base URL
(e.g. http://docstore.ole.your-site.edu/)
105 106 107 |
# File 'lib/ole-qa-framework.rb', line 105 def docstore_url @docstore_url end |
#explicit_wait ⇒ Object
Wait period (in seconds) used by OLE QAF Web Element functions
109 110 111 |
# File 'lib/ole-qa-framework.rb', line 109 def explicit_wait @explicit_wait end |
#options ⇒ Object (readonly)
The options with which this OLE_QA Framework Session was invoked
112 113 114 |
# File 'lib/ole-qa-framework.rb', line 112 def @options end |
#url ⇒ Object (readonly) Also known as: fs_url, base_url, ls_url
OLE Installation Base URL
(e.g. http://ole.your-site.edu/)
97 98 99 |
# File 'lib/ole-qa-framework.rb', line 97 def url @url end |
Instance Method Details
#browser ⇒ Object
Access Watir-Webdriver’s browser session.
171 172 173 |
# File 'lib/ole-qa-framework.rb', line 171 def browser @browser end |
#open(url = @url) ⇒ Object
Open a page via URL. (Defaults to @base_url.)
181 182 183 |
# File 'lib/ole-qa-framework.rb', line 181 def open(url = @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.
188 189 190 191 192 193 |
# File 'lib/ole-qa-framework.rb', line 188 def quit @browser.quit if @options[:headless?] then @headless.destroy end end |
#windows ⇒ Object
Access Watir-Webdriver’s Window Handling Method
176 177 178 |
# File 'lib/ole-qa-framework.rb', line 176 def windows @browser.windows end |