Class: Capybara::Experience
- Inherits:
-
Object
- Object
- Capybara::Experience
show all
- Includes:
- DSL
- Defined in:
- lib/capybara/experience.rb,
lib/capybara/experience/rspec.rb,
lib/capybara/experience/session.rb,
lib/capybara/experience/version.rb
Defined Under Namespace
Modules: BehaviorDSL, Session
Classes: Error
Constant Summary
collapse
- VERSION =
"0.2"
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(driver_name: nil) ⇒ Experience
Returns a new instance of Experience.
11
12
13
|
# File 'lib/capybara/experience.rb', line 11
def initialize(driver_name: nil)
@driver_name = driver_name
end
|
Class Method Details
.wait_for_pending_requests ⇒ Object
29
30
31
32
33
|
# File 'lib/capybara/experience.rb', line 29
def self.wait_for_pending_requests
Experience::Session.pool.taken.each do |session|
session.server.try(:wait_for_pending_requests)
end
end
|
Instance Method Details
#click_with_js(element) ⇒ Object
39
40
41
42
43
44
45
46
|
# File 'lib/capybara/experience.rb', line 39
def click_with_js(element)
xpath = element.path
execute_script <<~JS
document.evaluate('#{xpath}', document, null, XPathResult.ANY_TYPE, null)
.iterateNext()
.click()
JS
end
|
#driver_name ⇒ Object
19
20
21
|
# File 'lib/capybara/experience.rb', line 19
def driver_name
@driver_name ||= Capybara.current_driver
end
|
#page ⇒ Object
25
26
27
|
# File 'lib/capybara/experience.rb', line 25
def page
@page ||= Experience::Session.next(driver: driver_name)
end
|
#reload_page ⇒ Object
15
16
17
|
# File 'lib/capybara/experience.rb', line 15
def reload_page
visit current_url
end
|
#save_and_open_screenshot_full(path = nil, options = {}) ⇒ Object
35
36
37
|
# File 'lib/capybara/experience.rb', line 35
def save_and_open_screenshot_full(path = nil, options = {})
save_and_open_screenshot(path, options.merge(full: true))
end
|