teamcapybara / capybara

Acceptance test framework for web applications

Home Page:http://teamcapybara.github.io/capybara/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rack::Test fails to load `about:blank`

esanzgar opened this issue · comments

Meta

Capybara Version: 3.39.2
Driver Information (and browser if relevant): rack-test 2.1.0

Expected Behavior

page.visit 'about:blank`

it should succeed.

Actual Behavior

NoMethodError: undefined method `empty?' for nil:NilClass

      c.path.sub!(%r{/[^/]*$}, '/') unless uri.path.empty?
                                                   ^^^^^^^
from /Users/esanzgar/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/capybara-3.39.2/lib/capybara/rack_test/browser.rb:159:in `block in base_relative_uri_for'

uri.path is nil and calling empty? raises the exception.

Sometimes it is challenging testing elements that are present in the old and new page. It is useful load a different page, about:blank, in between the old and new pages.

Since the rack test driver is synchronous in it's page loading and doesn't support dynamic modification of the page (no JS) this feature request doesn't really have any value.