some cleanup, docs too
This commit is contained in:
parent
118472bb7d
commit
15ac9af489
13
README.md
13
README.md
@ -22,8 +22,10 @@ Capybara.default_driver = :persistent_selenium
|
|||||||
Should work just the same as if you used the standard Capybara Selenium driver, except for
|
Should work just the same as if you used the standard Capybara Selenium driver, except for
|
||||||
these two differences:
|
these two differences:
|
||||||
|
|
||||||
* The browser starts up first thing and sticks around.
|
* The browser starts up first thing and sticks around, so you don't pay the startup/shutdown
|
||||||
* The last page you were on before your tests passed/failed stays there, so you can inspect it.
|
penalty with each test run.
|
||||||
|
* The last page you were on before your tests passed/failed stays there, so you can inspect it
|
||||||
|
and adjust your tests.
|
||||||
|
|
||||||
The browser's cookies and such are reset before the next test runs, so you still get the state
|
The browser's cookies and such are reset before the next test runs, so you still get the state
|
||||||
cleared out before your next set of tests.
|
cleared out before your next set of tests.
|
||||||
@ -32,3 +34,10 @@ cleared out before your next set of tests.
|
|||||||
|
|
||||||
It's DRb, which Just Works (tm), and a little reshuffling of the default Capybara Selenium driver's code.
|
It's DRb, which Just Works (tm), and a little reshuffling of the default Capybara Selenium driver's code.
|
||||||
|
|
||||||
|
#### When DRb doesn't Just Work (tm)
|
||||||
|
|
||||||
|
You may see recycled object errorrs. Capybara is complex enough that, eventually, something
|
||||||
|
will get garbage collected on the server and an object on the client will notice.
|
||||||
|
I turned off garbage collection on the server but it still happens.
|
||||||
|
Just rerun the test. It doesn't happen too often. It's the price you pay for speed.
|
||||||
|
|
||||||
|
@ -4,4 +4,5 @@ $: << File.expand_path('../../lib', __FILE__)
|
|||||||
|
|
||||||
require 'persistent_selenium/cli'
|
require 'persistent_selenium/cli'
|
||||||
|
|
||||||
|
GC.disable
|
||||||
PersistentSelenium::CLI.start
|
PersistentSelenium::CLI.start
|
||||||
|
@ -6,6 +6,7 @@ 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
|
||||||
|
@__found_elements__ = []
|
||||||
end
|
end
|
||||||
|
|
||||||
def browser
|
def browser
|
||||||
@ -43,10 +44,6 @@ module PersistentSelenium
|
|||||||
# instead.
|
# instead.
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
GC.enable
|
|
||||||
GC.start
|
|
||||||
GC.disable
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def starting_page
|
def starting_page
|
||||||
|
@ -8,6 +8,7 @@ module PersistentSelenium
|
|||||||
def start
|
def start
|
||||||
require 'persistent_selenium/browser'
|
require 'persistent_selenium/browser'
|
||||||
require 'drb'
|
require 'drb'
|
||||||
|
GC.disable
|
||||||
|
|
||||||
PersistentSelenium.configure do |c|
|
PersistentSelenium.configure do |c|
|
||||||
c.port = options[:port]
|
c.port = options[:port]
|
||||||
@ -16,10 +17,10 @@ module PersistentSelenium
|
|||||||
|
|
||||||
puts "Starting persistent_selenium on #{PersistentSelenium.port} with #{PersistentSelenium.browser}"
|
puts "Starting persistent_selenium on #{PersistentSelenium.port} with #{PersistentSelenium.browser}"
|
||||||
|
|
||||||
browser = Browser.new(PersistentSelenium.browser)
|
@browser = Browser.new(PersistentSelenium.browser)
|
||||||
browser.browser
|
@browser.browser
|
||||||
|
|
||||||
DRb.start_service PersistentSelenium.url, browser
|
DRb.start_service PersistentSelenium.url, @browser
|
||||||
|
|
||||||
DRb.thread.join
|
DRb.thread.join
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user