Compare commits
3 Commits
master
...
rspec-cucu
Author | SHA1 | Date | |
---|---|---|---|
|
02b1e7553e | ||
|
5e205ea347 | ||
|
fdeb1b9eb5 |
@ -5,7 +5,7 @@ require 'base64'
|
|||||||
module PersistentSelenium
|
module PersistentSelenium
|
||||||
class Browser < Capybara::Selenium::Driver
|
class Browser < Capybara::Selenium::Driver
|
||||||
def initialize(browser_type)
|
def initialize(browser_type)
|
||||||
@browser_type = browser_type
|
@browser_type = browser_type.to_s.to_sym
|
||||||
@__found_elements__ = []
|
@__found_elements__ = []
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -30,6 +30,10 @@ module PersistentSelenium
|
|||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def browser_initialized?
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
def visit(path)
|
def visit(path)
|
||||||
if !path[/^http/]
|
if !path[/^http/]
|
||||||
path = @app_host + path
|
path = @app_host + path
|
||||||
|
8
lib/persistent_selenium/cucumber.rb
Normal file
8
lib/persistent_selenium/cucumber.rb
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
require_relative './driver'
|
||||||
|
|
||||||
|
Before do
|
||||||
|
if Capybara.current_driver == :persistent_selenium
|
||||||
|
Capybara.server_port ||= '3001'
|
||||||
|
Capybara.app_host ||= "http://localhost:#{Capybara.server_port}"
|
||||||
|
end
|
||||||
|
end
|
@ -4,16 +4,17 @@ require 'capybara/selenium/driver'
|
|||||||
# make sure these classes exist on this end
|
# make sure these classes exist on this end
|
||||||
[ Selenium::WebDriver::Error::StaleElementReferenceError, Selenium::WebDriver::Error::UnhandledError, Selenium::WebDriver::Error::ElementNotVisibleError ]
|
[ Selenium::WebDriver::Error::StaleElementReferenceError, Selenium::WebDriver::Error::UnhandledError, Selenium::WebDriver::Error::ElementNotVisibleError ]
|
||||||
|
|
||||||
Before do
|
|
||||||
if Capybara.current_driver == :persistent_selenium
|
|
||||||
Capybara.server_port ||= '3001'
|
|
||||||
Capybara.app_host ||= "http://localhost:#{Capybara.server_port}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
Capybara.register_driver :persistent_selenium do |app|
|
Capybara.register_driver :persistent_selenium do |app|
|
||||||
require 'drb'
|
require 'drb'
|
||||||
|
|
||||||
|
module DRb
|
||||||
|
class DRbObject
|
||||||
|
def method(name)
|
||||||
|
method_missing(:method, name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
DRb.start_service
|
DRb.start_service
|
||||||
browser = DRbObject.new nil, PersistentSelenium.url
|
browser = DRbObject.new nil, PersistentSelenium.url
|
||||||
|
|
||||||
|
10
lib/persistent_selenium/rspec.rb
Normal file
10
lib/persistent_selenium/rspec.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
require_relative './driver'
|
||||||
|
|
||||||
|
RSpec.configure do |c|
|
||||||
|
c.before :each do
|
||||||
|
if Capybara.current_driver == :persistent_selenium
|
||||||
|
Capybara.server_port ||= '3001'
|
||||||
|
Capybara.app_host ||= "http://localhost:#{Capybara.server_port}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user