Skip to content

Commit

Permalink
Merge pull request #70 from sinsoku/support-paths-using-2bytes
Browse files Browse the repository at this point in the history
Support paths using 2-byte characters
  • Loading branch information
YusukeIwaki authored Feb 16, 2024
2 parents f46952e + ef4cdc5 commit 2dccc51
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions capybara-playwright.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ['lib']

spec.required_ruby_version = '>= 2.4'
spec.add_dependency 'addressable'
spec.add_dependency 'capybara'
spec.add_dependency 'playwright-ruby-client', '>= 1.16.0'
spec.add_development_dependency 'allure-rspec'
Expand Down
5 changes: 3 additions & 2 deletions lib/capybara/playwright/browser.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'addressable/uri'
require_relative './tmpdir_owner'

module Capybara
Expand Down Expand Up @@ -74,9 +75,9 @@ def visit(path)
assert_page_alive {
url =
if Capybara.app_host
URI(Capybara.app_host).merge(path)
Addressable::URI.parse(Capybara.app_host) + path
elsif Capybara.default_host
URI(Capybara.default_host).merge(path)
Addressable::URI.parse(Capybara.default_host) + path
else
path
end
Expand Down
10 changes: 10 additions & 0 deletions spec/feature/assertion_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
sinatra.get '/finish.html' do
'finish'
end

sinatra.get '/猫' do
'cat'
end
end

it 'survives against navigation' do
Expand All @@ -56,4 +60,10 @@
refresh
expect(page).to have_content('finish')
end

it 'can access paths using 2-byte characters' do
visit '/猫'

expect(page).to have_content('cat')
end
end

0 comments on commit 2dccc51

Please sign in to comment.