Class: Applitools::Eyes
- Inherits:
-
Object
- Object
- Applitools::Eyes
- Defined in:
- lib/eyes_selenium/capybara.rb,
lib/eyes_selenium/eyes/eyes.rb
Overview
Override create driver to inject into capybara’s driver
Constant Summary collapse
- DEFAULT_MATCH_TIMEOUT =
Seconds
2.0
- BASE_AGENT_ID =
'eyes.selenium.ruby/' + Applitools::VERSION
- DEFAULT_EYES_SERVER =
'https://eyessdk.applitools.com'
Instance Attribute Summary collapse
-
#agent_id ⇒ Object
Returns the value of attribute agent_id.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#app_name ⇒ Object
readonly
Attributes:.
-
#baseline_name ⇒ Object
Returns the value of attribute baseline_name.
-
#batch ⇒ Object
Returns the value of attribute batch.
-
#branch_name ⇒ Object
Returns the value of attribute branch_name.
-
#driver ⇒ Object
readonly
Attributes:.
-
#failure_reports ⇒ Object
Returns the value of attribute failure_reports.
-
#full_agent_id ⇒ Object
readonly
Returns the value of attribute full_agent_id.
-
#host_app ⇒ Object
Returns the value of attribute host_app.
-
#host_os ⇒ Object
Returns the value of attribute host_os.
-
#is_disabled ⇒ Object
Returns the value of attribute is_disabled.
-
#is_open ⇒ Object
readonly
Attributes:.
-
#log_handler ⇒ Object
Returns the value of attribute log_handler.
-
#match_level ⇒ Object
Returns the value of attribute match_level.
-
#match_timeout ⇒ Object
Returns the value of attribute match_timeout.
-
#parent_branch_name ⇒ Object
Returns the value of attribute parent_branch_name.
-
#rotation ⇒ Object
Returns the value of attribute rotation.
-
#save_failed_tests ⇒ Object
Returns the value of attribute save_failed_tests.
-
#save_new_tests ⇒ Object
Returns the value of attribute save_new_tests.
-
#server_url ⇒ Object
Returns the value of attribute server_url.
-
#test_name ⇒ Object
readonly
Attributes:.
-
#user_inputs ⇒ Object
Returns the value of attribute user_inputs.
-
#viewport_size ⇒ Object
readonly
Attributes:.
Instance Method Summary collapse
- #abort_if_not_closed ⇒ Object
- #check_region(how, what, tag = nil, specific_timeout = -1)) ⇒ Object
- #check_window(tag = nil, specific_timeout = -1)) ⇒ Object
- #clear_user_inputs ⇒ Object
- #close(raise_ex = true) ⇒ Object
-
#initialize(params = {}) ⇒ Eyes
constructor
A new instance of Eyes.
- #open(params = {}) ⇒ Object
- #open? ⇒ Boolean
-
#test(params = {}, &block) ⇒ Object
Use this method to perform seamless testing with selenium through eyes driver.
- #title ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Eyes
Returns a new instance of Eyes.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 101 def initialize(params={}) @is_disabled = false return if disabled? @api_key = nil @user_inputs = [] server_url = params.fetch(:server_url, DEFAULT_EYES_SERVER) @agent_connector = Applitools::AgentConnector.new(server_url) @match_timeout = DEFAULT_MATCH_TIMEOUT @match_level = Applitools::MatchLevel::EXACT @failure_reports = Applitools::FailureReports::ON_CLOSE @save_new_tests = true @save_failed_tests = false @dont_get_title = false end |
Instance Attribute Details
#agent_id ⇒ Object
Returns the value of attribute agent_id.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def agent_id @agent_id end |
#api_key ⇒ Object
Returns the value of attribute api_key.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def api_key @api_key end |
#app_name ⇒ Object (readonly)
Attributes:
app_name
-
String
The application name which was provided as an argument toopen
. test_name
-
String
The test name which was provided as an argument toopen
. is_open
-
boolean
Is there an open session. viewport_size
-
Hash
The viewport size which was provided as an argument toopen
. Should includewidth
and +height+.
driver
-
Applitools::Driver
The driver instance wrapping the driver which was provided as an argument toopen
. api_key
-
String
The user’s API key. match_timeout
-
Float
The default timeout for check_XXXX operations. (Seconds) batch
-
BatchInfo
The current tests grouping, if any. host_os
-
String
A string identifying the OS running the AUT. Set this if you wish to override Eyes’ automatic inference. host_app
-
String
A string identifying the container application running the AUT (e.g., Firefox). Set this ifyou wish to override Eyes' automatic inference.
branch_name
-
String
If set, names the branch in which the test should run. parent_branch_name
-
String
If set, names the parent branch of the branch in which the test should run. user_inputs
-
Applitools::MouseTrigger
/Applitools::KeyboardTrigger
Mouse/Keyboard events which happened after the last visual validation. save_new_tests
-
boolean
Whether or not new tests should be automatically accepted as baseline. save_failed_tests
-
boolean
Whether or not failed tests should be automatically accepted as baseline. match_level
-
String
The default match level for the entire session. SeeApplitools::MatchLevel
. baseline_name
-
String
A string identifying the baseline which the test will be compared against. Set this if you wish to override Eyes’ automatic baseline inference. is_disabled
-
boolean
Set totrue
if you wish to disable Eyes without deleting code (Eyes’ methods act as a mock, and will do nothing). server_url
-
String
The Eyes’ server. Set this if you wish to override the default Eyes server URL. agent_id
-
String
An optional string identifying the current library using the SDK. log_handler
-
Logger
The logger to which Eyes will send info/debug messages. failure_reports
-
String
Whether the current test will report mismatches immediately or when it is finished. SeeApplitools::FailureReports
. rotation
-
Integer
|nil
The degrees by which to rotate the screenshots received from the driver. Set this tooverride Eyes' automatic rotation inference. Positive values = clockwise rotation, negative values = counter-clockwise, 0 = force no rotation, +nil+ = use Eyes' automatic rotation inference.
50 51 52 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 50 def app_name @app_name end |
#baseline_name ⇒ Object
Returns the value of attribute baseline_name.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def baseline_name @baseline_name end |
#batch ⇒ Object
Returns the value of attribute batch.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def batch @batch end |
#branch_name ⇒ Object
Returns the value of attribute branch_name.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def branch_name @branch_name end |
#driver ⇒ Object (readonly)
Attributes:
app_name
-
String
The application name which was provided as an argument toopen
. test_name
-
String
The test name which was provided as an argument toopen
. is_open
-
boolean
Is there an open session. viewport_size
-
Hash
The viewport size which was provided as an argument toopen
. Should includewidth
and +height+.
driver
-
Applitools::Driver
The driver instance wrapping the driver which was provided as an argument toopen
. api_key
-
String
The user’s API key. match_timeout
-
Float
The default timeout for check_XXXX operations. (Seconds) batch
-
BatchInfo
The current tests grouping, if any. host_os
-
String
A string identifying the OS running the AUT. Set this if you wish to override Eyes’ automatic inference. host_app
-
String
A string identifying the container application running the AUT (e.g., Firefox). Set this ifyou wish to override Eyes' automatic inference.
branch_name
-
String
If set, names the branch in which the test should run. parent_branch_name
-
String
If set, names the parent branch of the branch in which the test should run. user_inputs
-
Applitools::MouseTrigger
/Applitools::KeyboardTrigger
Mouse/Keyboard events which happened after the last visual validation. save_new_tests
-
boolean
Whether or not new tests should be automatically accepted as baseline. save_failed_tests
-
boolean
Whether or not failed tests should be automatically accepted as baseline. match_level
-
String
The default match level for the entire session. SeeApplitools::MatchLevel
. baseline_name
-
String
A string identifying the baseline which the test will be compared against. Set this if you wish to override Eyes’ automatic baseline inference. is_disabled
-
boolean
Set totrue
if you wish to disable Eyes without deleting code (Eyes’ methods act as a mock, and will do nothing). server_url
-
String
The Eyes’ server. Set this if you wish to override the default Eyes server URL. agent_id
-
String
An optional string identifying the current library using the SDK. log_handler
-
Logger
The logger to which Eyes will send info/debug messages. failure_reports
-
String
Whether the current test will report mismatches immediately or when it is finished. SeeApplitools::FailureReports
. rotation
-
Integer
|nil
The degrees by which to rotate the screenshots received from the driver. Set this tooverride Eyes' automatic rotation inference. Positive values = clockwise rotation, negative values = counter-clockwise, 0 = force no rotation, +nil+ = use Eyes' automatic rotation inference.
50 51 52 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 50 def driver @driver end |
#failure_reports ⇒ Object
Returns the value of attribute failure_reports.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def failure_reports @failure_reports end |
#full_agent_id ⇒ Object (readonly)
Returns the value of attribute full_agent_id.
8 9 10 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 8 def full_agent_id @full_agent_id end |
#host_app ⇒ Object
Returns the value of attribute host_app.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def host_app @host_app end |
#host_os ⇒ Object
Returns the value of attribute host_os.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def host_os @host_os end |
#is_disabled ⇒ Object
Returns the value of attribute is_disabled.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def is_disabled @is_disabled end |
#is_open ⇒ Object (readonly)
Attributes:
app_name
-
String
The application name which was provided as an argument toopen
. test_name
-
String
The test name which was provided as an argument toopen
. is_open
-
boolean
Is there an open session. viewport_size
-
Hash
The viewport size which was provided as an argument toopen
. Should includewidth
and +height+.
driver
-
Applitools::Driver
The driver instance wrapping the driver which was provided as an argument toopen
. api_key
-
String
The user’s API key. match_timeout
-
Float
The default timeout for check_XXXX operations. (Seconds) batch
-
BatchInfo
The current tests grouping, if any. host_os
-
String
A string identifying the OS running the AUT. Set this if you wish to override Eyes’ automatic inference. host_app
-
String
A string identifying the container application running the AUT (e.g., Firefox). Set this ifyou wish to override Eyes' automatic inference.
branch_name
-
String
If set, names the branch in which the test should run. parent_branch_name
-
String
If set, names the parent branch of the branch in which the test should run. user_inputs
-
Applitools::MouseTrigger
/Applitools::KeyboardTrigger
Mouse/Keyboard events which happened after the last visual validation. save_new_tests
-
boolean
Whether or not new tests should be automatically accepted as baseline. save_failed_tests
-
boolean
Whether or not failed tests should be automatically accepted as baseline. match_level
-
String
The default match level for the entire session. SeeApplitools::MatchLevel
. baseline_name
-
String
A string identifying the baseline which the test will be compared against. Set this if you wish to override Eyes’ automatic baseline inference. is_disabled
-
boolean
Set totrue
if you wish to disable Eyes without deleting code (Eyes’ methods act as a mock, and will do nothing). server_url
-
String
The Eyes’ server. Set this if you wish to override the default Eyes server URL. agent_id
-
String
An optional string identifying the current library using the SDK. log_handler
-
Logger
The logger to which Eyes will send info/debug messages. failure_reports
-
String
Whether the current test will report mismatches immediately or when it is finished. SeeApplitools::FailureReports
. rotation
-
Integer
|nil
The degrees by which to rotate the screenshots received from the driver. Set this tooverride Eyes' automatic rotation inference. Positive values = clockwise rotation, negative values = counter-clockwise, 0 = force no rotation, +nil+ = use Eyes' automatic rotation inference.
50 51 52 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 50 def is_open @is_open end |
#log_handler ⇒ Object
Returns the value of attribute log_handler.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def log_handler @log_handler end |
#match_level ⇒ Object
Returns the value of attribute match_level.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def match_level @match_level end |
#match_timeout ⇒ Object
Returns the value of attribute match_timeout.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def match_timeout @match_timeout end |
#parent_branch_name ⇒ Object
Returns the value of attribute parent_branch_name.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def parent_branch_name @parent_branch_name end |
#rotation ⇒ Object
Returns the value of attribute rotation.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def rotation @rotation end |
#save_failed_tests ⇒ Object
Returns the value of attribute save_failed_tests.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def save_failed_tests @save_failed_tests end |
#save_new_tests ⇒ Object
Returns the value of attribute save_new_tests.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def save_new_tests @save_new_tests end |
#server_url ⇒ Object
Returns the value of attribute server_url.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def server_url @server_url end |
#test_name ⇒ Object (readonly)
Attributes:
app_name
-
String
The application name which was provided as an argument toopen
. test_name
-
String
The test name which was provided as an argument toopen
. is_open
-
boolean
Is there an open session. viewport_size
-
Hash
The viewport size which was provided as an argument toopen
. Should includewidth
and +height+.
driver
-
Applitools::Driver
The driver instance wrapping the driver which was provided as an argument toopen
. api_key
-
String
The user’s API key. match_timeout
-
Float
The default timeout for check_XXXX operations. (Seconds) batch
-
BatchInfo
The current tests grouping, if any. host_os
-
String
A string identifying the OS running the AUT. Set this if you wish to override Eyes’ automatic inference. host_app
-
String
A string identifying the container application running the AUT (e.g., Firefox). Set this ifyou wish to override Eyes' automatic inference.
branch_name
-
String
If set, names the branch in which the test should run. parent_branch_name
-
String
If set, names the parent branch of the branch in which the test should run. user_inputs
-
Applitools::MouseTrigger
/Applitools::KeyboardTrigger
Mouse/Keyboard events which happened after the last visual validation. save_new_tests
-
boolean
Whether or not new tests should be automatically accepted as baseline. save_failed_tests
-
boolean
Whether or not failed tests should be automatically accepted as baseline. match_level
-
String
The default match level for the entire session. SeeApplitools::MatchLevel
. baseline_name
-
String
A string identifying the baseline which the test will be compared against. Set this if you wish to override Eyes’ automatic baseline inference. is_disabled
-
boolean
Set totrue
if you wish to disable Eyes without deleting code (Eyes’ methods act as a mock, and will do nothing). server_url
-
String
The Eyes’ server. Set this if you wish to override the default Eyes server URL. agent_id
-
String
An optional string identifying the current library using the SDK. log_handler
-
Logger
The logger to which Eyes will send info/debug messages. failure_reports
-
String
Whether the current test will report mismatches immediately or when it is finished. SeeApplitools::FailureReports
. rotation
-
Integer
|nil
The degrees by which to rotate the screenshots received from the driver. Set this tooverride Eyes' automatic rotation inference. Positive values = clockwise rotation, negative values = counter-clockwise, 0 = force no rotation, +nil+ = use Eyes' automatic rotation inference.
50 51 52 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 50 def test_name @test_name end |
#user_inputs ⇒ Object
Returns the value of attribute user_inputs.
51 52 53 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 51 def user_inputs @user_inputs end |
#viewport_size ⇒ Object (readonly)
Attributes:
app_name
-
String
The application name which was provided as an argument toopen
. test_name
-
String
The test name which was provided as an argument toopen
. is_open
-
boolean
Is there an open session. viewport_size
-
Hash
The viewport size which was provided as an argument toopen
. Should includewidth
and +height+.
driver
-
Applitools::Driver
The driver instance wrapping the driver which was provided as an argument toopen
. api_key
-
String
The user’s API key. match_timeout
-
Float
The default timeout for check_XXXX operations. (Seconds) batch
-
BatchInfo
The current tests grouping, if any. host_os
-
String
A string identifying the OS running the AUT. Set this if you wish to override Eyes’ automatic inference. host_app
-
String
A string identifying the container application running the AUT (e.g., Firefox). Set this ifyou wish to override Eyes' automatic inference.
branch_name
-
String
If set, names the branch in which the test should run. parent_branch_name
-
String
If set, names the parent branch of the branch in which the test should run. user_inputs
-
Applitools::MouseTrigger
/Applitools::KeyboardTrigger
Mouse/Keyboard events which happened after the last visual validation. save_new_tests
-
boolean
Whether or not new tests should be automatically accepted as baseline. save_failed_tests
-
boolean
Whether or not failed tests should be automatically accepted as baseline. match_level
-
String
The default match level for the entire session. SeeApplitools::MatchLevel
. baseline_name
-
String
A string identifying the baseline which the test will be compared against. Set this if you wish to override Eyes’ automatic baseline inference. is_disabled
-
boolean
Set totrue
if you wish to disable Eyes without deleting code (Eyes’ methods act as a mock, and will do nothing). server_url
-
String
The Eyes’ server. Set this if you wish to override the default Eyes server URL. agent_id
-
String
An optional string identifying the current library using the SDK. log_handler
-
Logger
The logger to which Eyes will send info/debug messages. failure_reports
-
String
Whether the current test will report mismatches immediately or when it is finished. SeeApplitools::FailureReports
. rotation
-
Integer
|nil
The degrees by which to rotate the screenshots received from the driver. Set this tooverride Eyes' automatic rotation inference. Positive values = clockwise rotation, negative values = counter-clockwise, 0 = force no rotation, +nil+ = use Eyes' automatic rotation inference.
50 51 52 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 50 def @viewport_size end |
Instance Method Details
#abort_if_not_closed ⇒ Object
265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 265 def abort_if_not_closed return if disabled? @is_open = false if session begin agent_connector.stop_session(session, true, false) rescue Applitools::EyesError => e EyesLogger.info "Failed to abort server session -> #{e.} " ensure self.session = nil end end end |
#check_region(how, what, tag = nil, specific_timeout = -1)) ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 164 def check_region(how, what, tag=nil, specific_timeout=-1) EyesLogger.debug 'check_region called' return if disabled? # We have to start the session if it's not started, since we want the viewport size to be set before getting the # element's position and size raise Applitools::EyesError.new('Eyes not open') if !open? unless session EyesLogger.debug 'Starting session...' start_session EyesLogger.debug 'Done! Creating match window task...' self.match_window_task = Applitools::MatchWindowTask.new(self, agent_connector, session, driver, match_timeout) EyesLogger.debug 'Done!' end EyesLogger.debug 'Finding element...' element_to_check = driver.find_element(how, what) EyesLogger.debug 'Done! Getting element location...' location = element_to_check.location EyesLogger.debug 'Done! Getting element size...' size = element_to_check.size EyesLogger.debug 'Done! Creating region...' region = Applitools::Region.new(location.x, location.y, size.width, size.height) EyesLogger.debug 'Done! Checking region...' check_region_(region, tag, specific_timeout) EyesLogger.debug 'Done!' end |
#check_window(tag = nil, specific_timeout = -1)) ⇒ Object
191 192 193 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 191 def check_window(tag=nil, specific_timeout=-1) check_region_(Applitools::Region::EMPTY, tag, specific_timeout) end |
#clear_user_inputs ⇒ Object
160 161 162 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 160 def clear_user_inputs user_inputs.clear end |
#close(raise_ex = true) ⇒ Object
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 195 def close(raise_ex=true) return if disabled? @is_open = false # if there's no running session, the test was never started (never reached checkWindow) if !session EyesLogger.debug 'close(): Server session was not started' EyesLogger.info 'close(): --- Empty test ended.' return Applitools::TestResults.new end session_results_url = session.url new_session = session.new_session? EyesLogger.debug "close(): Ending server session..." save = (new_session && save_new_tests) || (!new_session && save_failed_tests) results = agent_connector.stop_session(session, false, save) results.is_new = new_session results.url = session_results_url EyesLogger.debug "close(): #{results}" self.session = nil if new_session instructions = "Please approve the new baseline at #{session_results_url}" EyesLogger.info "--- New test ended. #{instructions}" if raise_ex = "'#{session_start_info.scenario_id_or_name}' of"\ " '#{session_start_info.app_id_or_name}'. #{instructions}" raise Applitools::NewTestError.new(, results) end return results end if !results.is_passed # Test failed EyesLogger.info "--- Failed test ended. See details at #{session_results_url}" if raise_ex = "'#{session_start_info.scenario_id_or_name}' of"\ " '#{session_start_info.app_id_or_name}'. see details at #{session_results_url}" raise Applitools::TestFailedError.new(, results) end return results end # Test passed EyesLogger.info "--- Test passed. See details at #{session_results_url}" results end |
#open(params = {}) ⇒ Object
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 147 148 149 150 151 152 153 154 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 119 def open(params={}) @driver = get_driver(params) return driver if disabled? if api_key.nil? #noinspection RubyQuotedStringsInspection raise Applitools::EyesError.new( "API key not set! Log in to https://applitools.com to obtain your API Key and use 'api_key' to set it.") end if driver.is_a?(Selenium::WebDriver::Driver) @driver = Applitools::Driver.new(self, {driver: driver}) elsif defined?(Appium::Driver) && driver.is_a?(Appium::Driver) @driver = Applitools::Driver.new(self, {driver: driver.driver, is_mobile_device: true}) elsif defined?(Watir::Browser) && driver.is_a?(Watir::Browser) @driver = Applitools::Driver.new(self, {driver: driver.driver}) else unless driver.is_a?(Applitools::Driver) raise Applitools::EyesError.new("Driver is not a Selenium::WebDriver::Driver (#{driver.class.name})") end end if open? abort_if_not_closed msg = 'a test is already running' EyesLogger.info(msg) and raise Applitools::EyesError.new(msg) end @user_inputs = [] @app_name = params.fetch(:app_name) @test_name = params.fetch(:test_name) @viewport_size = params.fetch(:viewport_size, nil) @is_open = true driver end |
#open? ⇒ Boolean
156 157 158 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 156 def open? is_open end |
#test(params = {}, &block) ⇒ Object
Use this method to perform seamless testing with selenium through eyes driver. Using Selenium methods inside the ‘test’ block will send the messages to Selenium after creating the Eyes triggers for them.
Example:
eyes.test(app_name: 'my app1', test_name: 'my test') do |d|
get "http://www.google.com"
check_window("initial")
end
noinspection RubyUnusedLocalVariable
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 254 def test(params={}, &block) begin previous_driver = Capybara.current_driver previous_browser = Capybara.current_session.driver.instance_variable_get(:@browser) Capybara.current_driver = :selenium Capybara.current_session.driver.instance_variable_set(:@browser, driver) open(params) yield(self, driver) close rescue Applitools::EyesError ensure abort_if_not_closed Capybara.current_session.driver.instance_variable_set(:@browser, previous_browser) Capybara.current_driver = previous_driver end end |
#title ⇒ Object
90 91 92 93 94 95 96 97 98 99 |
# File 'lib/eyes_selenium/eyes/eyes.rb', line 90 def title unless dont_get_title begin return driver.title rescue self.dont_get_title = true end end '' end |