capybara 3.10.0 → 3.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58e17a63edc194f43995b9c63196fe91311450999a03da4ee7c2f1aa1e1e34e4
4
- data.tar.gz: f0a20f11e8a454f62a9abd62dc4d1f18f8419460c43a0e37f250d8c603cffc60
3
+ metadata.gz: ab5799591629ab7839ce7bd05f651e7ca3215e300bd1e6622130e01e0431ad86
4
+ data.tar.gz: b848caed06658e44c604d490eb26b4a5d313a5879c4deb6fc3f8d3ba2b784644
5
5
  SHA512:
6
- metadata.gz: ee9b34f496afec3a99be65c5fcdcfebef38640eccb146a4e43ec811a55c99edf8393695e9a9d228db07d738d753feaa7f8c8090bc7cf37189ff3b192e5b15482
7
- data.tar.gz: 002ae33fdef7b207d2cba11b8ce125c1d4ef972b10226d9f766dc41605791b8167c11c69ae1295ff229049bbd668a4b49021747eefee4861b152489ddbbe4f5d
6
+ metadata.gz: b74973ebd8ca32addec5f7aeb005ef022d6b2e9e5633203b51ccafa4608378121ad582eed792bd7de44496e2d9b8692a49b648575fe3b8ee399f4ca6515e3b22
7
+ data.tar.gz: ebb6f2aeb95d168e23d515d6d97e1af702d244c030a39ba7474a2dbd3a6bd954b70e29bacf31e7def0e9f66e5db8e53ae255709751e99431b869d5c2c84b0041
data/History.md CHANGED
@@ -1,3 +1,11 @@
1
+ # Version 3.10.1
2
+ Release date: 2018-11-03
3
+
4
+ ### Fixed
5
+
6
+ * Fix `aria-label` and `test_id` matching for `link_or_button` selector type - Issue #2125
7
+ * Fixed crash in element path creation for matcher failure messages - Issue #2120
8
+
1
9
  # Version 3.10.0
2
10
  Release date: 2018-10-23
3
11
 
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=capybara&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=capybara&package-manager=bundler&version-scheme=semver)
8
8
 
9
9
  **Note** You are viewing the README for the development version of Capybara. If you are using the current release version
10
- you can find the README at https://github.com/teamcapybara/capybara/blob/3.9_stable/README.md
10
+ you can find the README at https://github.com/teamcapybara/capybara/blob/3.10_stable/README.md
11
11
 
12
12
 
13
13
  Capybara helps you test web applications by simulating how a real user would
@@ -156,7 +156,6 @@ module Capybara
156
156
 
157
157
  def matches_node_filters?(node)
158
158
  unapplied_options = options.keys - valid_keys
159
-
160
159
  node_filters.all? do |filter_name, filter|
161
160
  if filter.matcher?
162
161
  unapplied_options.select { |option_name| filter.handles_option?(option_name) }.all? do |option_name|
@@ -178,7 +178,7 @@ end
178
178
  Capybara.add_selector(:link_or_button) do
179
179
  label 'link or button'
180
180
  xpath do |locator, **options|
181
- self.class.all.values_at(:link, :button).map { |selector| selector.xpath.call(locator, options) }.reduce(:union)
181
+ self.class.all.values_at(:link, :button).map { |selector| selector.call(locator, **options, selector_config: @config) }.reduce(:union)
182
182
  end
183
183
 
184
184
  node_filter(:disabled, :boolean, default: false, skip_if: :all) { |node, value| node.tag_name == 'a' || !(value ^ node.disabled?) }
@@ -181,7 +181,9 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
181
181
  when 1
182
182
  '' # index not necessary when only one matching element
183
183
  else
184
- "[#{siblings.index(node) + 1}]"
184
+ idx = siblings.index(node)
185
+ # Element may not be found in the siblings if it has gone away
186
+ idx.nil? ? '[ERROR]' : "[#{idx + 1}]"
185
187
  end
186
188
  end
187
189
  result.push selector
@@ -110,4 +110,20 @@ Capybara::SpecHelper.spec '#click_link_or_button' do
110
110
  link = @session.find(:link, 'Blank Anchor')
111
111
  expect(@session.click_link_or_button('Blank Anchor')).to eq link
112
112
  end
113
+
114
+ context 'with enable_aria_label' do
115
+ it 'should click on link' do
116
+ @session.visit('/with_html')
117
+ expect do
118
+ @session.click_link_or_button('Go to simple', enable_aria_label: true)
119
+ end.not_to raise_error
120
+ end
121
+
122
+ it 'should click on button' do
123
+ @session.visit('/form')
124
+ expect do
125
+ @session.click_link_or_button('Aria button', enable_aria_label: true)
126
+ end.not_to raise_error
127
+ end
128
+ end
113
129
  end
@@ -39,10 +39,29 @@ Capybara::SpecHelper.spec '#has_css?' do
39
39
  expect(@session).to have_css('h2', id: /2ON/i)
40
40
  end
41
41
 
42
- it 'should respect scopes' do
43
- @session.within "//p[@id='first']" do
44
- expect(@session).to have_css('a#foo')
45
- expect(@session).not_to have_css('a#red')
42
+ context 'when scoped' do
43
+ it 'should look in the scope' do
44
+ @session.within "//p[@id='first']" do
45
+ expect(@session).to have_css('a#foo')
46
+ expect(@session).not_to have_css('a#red')
47
+ end
48
+ end
49
+
50
+ it 'should be able to generate an error message if the scope is a sibling' do
51
+ el = @session.find(:css, '#first')
52
+ @session.within el.sibling(:css, '#second') do
53
+ expect {
54
+ expect(@session).to have_css('a#not_on_page')
55
+ }.to raise_error /there were no matches/
56
+ end
57
+ end
58
+
59
+ it 'should be able to generate an error message if the scope is a sibling from XPath' do
60
+ el = @session.find(:css, '#first').find(:xpath, './following-sibling::*[1]') do
61
+ expect {
62
+ expect(el).to have_css('a#not_on_page')
63
+ }.to raise_error /there were no matches/
64
+ end
46
65
  end
47
66
  end
48
67
 
@@ -434,7 +434,7 @@ New line after and before textarea tag
434
434
  </p>
435
435
 
436
436
  <p>
437
- <input type="button" name="form[fresh]" id="fresh_btn" value="i am fresh"/>
437
+ <input type="button" aria-label="Aria button" name="form[fresh]" id="fresh_btn" value="i am fresh"/>
438
438
  <input type="submit" name="form[awesome]" id="awe123" title="What an Awesome Button" value="awesome"/>
439
439
  <input type="submit" name="form[crappy]" id="crap321" value="crappy"/>
440
440
  <input type="image" name="form[okay]" id="okay556" title="Okay 556 Image" value="okay" alt="oh hai thar"/>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Capybara
4
- VERSION = '3.10.0'
4
+ VERSION = '3.10.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.0
4
+ version: 3.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Walpole
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain:
12
12
  - gem-public_cert.pem
13
- date: 2018-10-24 00:00:00.000000000 Z
13
+ date: 2018-11-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: addressable
@@ -525,7 +525,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
525
525
  version: '0'
526
526
  requirements: []
527
527
  rubyforge_project:
528
- rubygems_version: 2.7.6
528
+ rubygems_version: 2.7.8
529
529
  signing_key:
530
530
  specification_version: 4
531
531
  summary: Capybara aims to simplify the process of integration testing Rack applications,