chop 0.36.5 → 0.36.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 580959eb5a8d18eadb47078793c58b977c0d3310029b586b55db825cb70c9c0b
4
- data.tar.gz: 172bec5372e5a2d4456ebe6648397e89a6a08a316104935826e51d2075ca01c1
3
+ metadata.gz: a4d477e3610880a15f5ab315ad6c2f3a212f28f443147e363edc79508c7316b8
4
+ data.tar.gz: c0cdf43b5a9415e21216d1ed4babddee3a141d9651bf593d6ffac484b1d1140c
5
5
  SHA512:
6
- metadata.gz: 9a3a9888fac132c449dc50767a507497e4089632e356e30a409197e34b9ba02e383237f3d5d395fa54028f82bc9776652590eb1f705e5a92d3a513eb45819faa
7
- data.tar.gz: 6b07b6f679ec9ed24c9956604ff2831485d84497bbb33b13fafe6e85d9e46dd6c56191d55a9ea8cb1a66940abf5e97a5cb01b85cef4146b88f1d4428001345a9
6
+ metadata.gz: e3c86c9f999bdb1c9b2cbb8c721affa85008ae8cd65947311d182bdd1c5923d0aeedd14f4e2e75a6820c211a7e477a599e18628c2230c26dc6ef75530728d6ec
7
+ data.tar.gz: e51e524727d4a813a0e19756fdc9c82a389e2e30404eac8de13fd7f512fd4edf218ca96787b5c9a63e56e2dc2557115add2851cb2d408adfc0c6399de35e4185
data/lib/chop/diff.rb CHANGED
@@ -8,7 +8,7 @@ module Chop
8
8
  class Diff < Struct.new(:selector, :table, :session, :timeout, :block)
9
9
  def self.diff! selector, table, session: Capybara.current_session, timeout: Capybara.default_max_wait_time, errors: [], **kwargs, &block
10
10
  errors += session.driver.invalid_element_errors
11
- errors += [Capybara::ElementNotFound, Cucumber::MultilineArgument::DataTable::Different]
11
+ errors += [Cucumber::MultilineArgument::DataTable::Different]
12
12
  session.document.synchronize timeout, errors: errors do
13
13
  new(selector, table, session, timeout, block).diff! **kwargs
14
14
  end
data/lib/chop/dsl.rb CHANGED
@@ -9,19 +9,16 @@ module Chop
9
9
  end
10
10
 
11
11
  def diff! selector, table, session: Capybara.current_session, as: nil, timeout: nil, **kwargs, &block
12
- sync_timeout = timeout || Capybara.default_max_wait_time
13
12
  class_name = if as
14
13
  as.to_s
15
14
  elsif selector.respond_to?(:tag_name)
16
15
  selector.tag_name
17
16
  else
18
- session.document.synchronize sync_timeout, errors: session.driver.invalid_element_errors do
19
- session.find(selector).tag_name
20
- end
17
+ session.find(selector).tag_name
21
18
  end.camelize
22
19
  klass = const_get("Chop::#{class_name}")
23
20
  kwargs[:session] = session
24
- kwargs[:timeout] = timeout if timeout
21
+ kwargs[:timeout] = timeout if timeout.present?
25
22
  klass.diff! selector, table, **kwargs, &block
26
23
  end
27
24
 
data/lib/chop/form.rb CHANGED
@@ -7,34 +7,26 @@ module Chop
7
7
  new(table, session, path).fill_in!
8
8
  end
9
9
 
10
- def self.diff! selector, table, session: Capybara.current_session, timeout: Capybara.default_max_wait_time, &block
11
- errors = session.driver.invalid_element_errors + [Capybara::ElementNotFound, Cucumber::MultilineArgument::DataTable::Different]
12
- session.document.synchronize timeout, errors: errors do
13
- root = begin
14
- if selector.is_a?(Capybara::Node::Element)
15
- selector
16
- else
17
- session.find(selector, wait: timeout)
18
- end
19
- rescue Capybara::ElementNotFound
20
- raise unless @allow_not_found
21
- Node("")
10
+ def self.diff! selector, table, session: Capybara.current_session, &block
11
+ root = begin
12
+ if selector.is_a?(Capybara::Node::Element)
13
+ selector
14
+ else
15
+ session.find(selector)
22
16
  end
17
+ rescue Capybara::ElementNotFound
18
+ raise unless @allow_not_found
19
+ Node("")
20
+ end
23
21
 
24
- actual = root.all(Field.combined_css_selector, allow_reload: true)
25
- .filter_map { |field_element| Field.from(session, field_element) }
26
- .select(&:should_include_in_diff?)
27
- .uniq { |field| field.field[:name] }
28
- .filter_map(&:to_diff_row)
22
+ actual = root.all(Field.combined_css_selector, allow_reload: true)
23
+ .filter_map { |field_element| Field.from(session, field_element) }
24
+ .select(&:should_include_in_diff?)
25
+ .uniq { |field| field.field[:name] }
26
+ .filter_map(&:to_diff_row)
29
27
 
30
- # Retry if form fields haven't loaded yet (e.g., turbo-frame still loading)
31
- if actual.empty? && !table.raw.flatten.empty?
32
- raise Capybara::ElementNotFound, "No form fields found in #{selector.inspect}"
33
- end
34
-
35
- block.call(actual, root) if block_given?
36
- table.diff! actual, surplus_row: false, misplaced_col: false
37
- end
28
+ block.call(actual, root) if block_given?
29
+ table.diff! actual, surplus_row: false, misplaced_col: false
38
30
  end
39
31
 
40
32
 
@@ -54,15 +46,13 @@ module Chop
54
46
  return nil if locator.nil?
55
47
 
56
48
  @locator = locator.to_s
57
- @session.document.synchronize(Capybara.default_max_wait_time, errors: [Capybara::ElementNotFound]) do
58
- @all_fields = @session.all(@css_selector, minimum: 1, wait: 0)
59
-
60
- find_by_direct_attributes ||
61
- find_by_aria_label ||
62
- find_by_associated_label ||
63
- find_by_wrapping_label ||
64
- raise_not_found
65
- end
49
+ @all_fields = @session.all(@css_selector)
50
+
51
+ find_by_direct_attributes ||
52
+ find_by_aria_label ||
53
+ find_by_associated_label ||
54
+ find_by_wrapping_label ||
55
+ raise_not_found
66
56
  end
67
57
 
68
58
  private
data/lib/chop/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Chop
2
- VERSION = "0.36.5"
2
+ VERSION = "0.36.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.36.5
4
+ version: 0.36.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel