mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Fix expression filter descriptions in selector failure messages
This commit is contained in:
parent
6e2caa57a8
commit
383211de9f
2 changed files with 16 additions and 1 deletions
|
@ -251,7 +251,7 @@ module Capybara
|
|||
end
|
||||
|
||||
def describe_all_expression_filters(**opts)
|
||||
expression_filters.map { |ef| " with #{ef} #{opts[ef]}" if opts.key?(ef) }.join
|
||||
expression_filters.keys.map { |ef| " with #{ef} #{opts[ef]}" if opts.key?(ef) }.join
|
||||
end
|
||||
|
||||
def find_by_attr(attribute, value)
|
||||
|
|
|
@ -27,6 +27,7 @@ RSpec.describe Capybara do
|
|||
<input type="text" name="form[my_text_input]" placeholder="my text" id="my_text_input"/>
|
||||
<input type="file" id="file" class=".special file"/>
|
||||
<input type="hidden" id="hidden_field" value="this is hidden"/>
|
||||
<input type="submit" value="click me" title="submit button"/>
|
||||
<a href="#">link</a>
|
||||
<fieldset></fieldset>
|
||||
<select id="select">
|
||||
|
@ -193,6 +194,20 @@ RSpec.describe Capybara do
|
|||
expect(string.find(:option, disabled: false, selected: false).value).to eq 'a'
|
||||
end
|
||||
end
|
||||
|
||||
describe ":button selector" do
|
||||
it "finds by value" do
|
||||
expect(string.find(:button, 'click me').value).to eq 'click me'
|
||||
end
|
||||
|
||||
it "finds by title" do
|
||||
expect(string.find(:button, 'submit button').value).to eq 'click me'
|
||||
end
|
||||
|
||||
it "includes non-matching parameters in failure message" do
|
||||
expect { string.find(:button, 'click me', title: 'click me') }.to raise_error(/with title click me/)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue