Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support paths using 2-byte characters #70

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Loading