lib/capybara/driver/terminus.rb in terminus-0.5.0 vs lib/capybara/driver/terminus.rb in terminus-0.6.0
- old
+ new
@@ -13,14 +13,19 @@
@rack_server.boot
sleep(0.1) until Terminus.server_running?(@rack_server)
Terminus.register_local_port(@rack_server.port)
end
- def find(xpath)
- browser.find(xpath, self)
+ def find_css(css)
+ browser.find_css(css, self)
end
+ def find_xpath(xpath)
+ browser.find_xpath(xpath, self)
+ end
+ alias :find :find_xpath
+
def invalid_element_errors
[::Terminus::ObsoleteElementError]
end
def needs_server?
@@ -41,18 +46,22 @@
def_delegators :browser, :body,
:current_url,
:debugger,
:evaluate_script,
:execute_script,
+ :go_back,
+ :go_forward,
:html,
:reset!,
:response_headers,
:save_screenshot,
:source,
- :status_code
+ :status_code,
+ :title
def within_window(name)
+ name = name['id'] unless String === name
current_browser = browser
Terminus.browser = browser.id + '/' + name
result = yield
Terminus.browser = current_browser
result
@@ -81,8 +90,9 @@
# not really waiting for Ajax to complete, it's just having its messages blocked
# because EventMachine is frozen.
Capybara.server do |app, port|
handler = Rack::Handler.get('webrick')
- handler.run(app, :Port => port, :AccessLog => [], :Logger => WEBrick::Log::new(nil, 0))
+ logger = Terminus.debug ? Logger.new(STDOUT) : WEBrick::Log.new(nil, 0)
+ handler.run(app, :Port => port, :AccessLog => [], :Logger => logger)
end