capybara-lockstep 1.2.1 → 1.3.0

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: e9207a7671ab6f25999a138df922afb783ec3267257eadfab1b179f3c26eb88d
4
- data.tar.gz: 2ddfe3a9a10143894afdc2eb2517ddeeaf76311e3365693606359282004a598d
3
+ metadata.gz: 5496cc79e785bf2ce69669e7a8a6d8ae6f862289f5151487c27a33caa20aa9f7
4
+ data.tar.gz: 635cb396a2ceccbf550a44b2331b3cf1a2340f555557c3eac9440cc6231f5033
5
5
  SHA512:
6
- metadata.gz: dffa87e401d189b8afea6bb72b49bb14a6f9865d306fc7a838e50b4fb4dfc715fe8930502b9e3e2b4139c214b45eefe189c0ddb8e3e867d30d3021331ba76ea3
7
- data.tar.gz: b311ee487b65ae42dc5dcc114cdd2aca2ff39ed49953fe43959ecf8578b3691740ebd2019aeae95fc87334cc5b87835f18b1f816ed2ad0a234e6475b549baad8
6
+ metadata.gz: e69a2f28e913cef9913825fe1b2594bda44ad31af54a1041978adcd437e8f17518d91d8b3b4e4c0dc71f4259780427288db9ba474f39607e39f60e362a143a9f
7
+ data.tar.gz: 2bb6122c49734c852b3ed64486cbe00dc0c10d51d9de8311c7c11ce5aff85482b97105e2d8c4d6acccfb70efbd2f6855526c8a7d58e36e10237e49a15b746af8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capybara-lockstep (1.2.1)
4
+ capybara-lockstep (1.3.0)
5
5
  activesupport (>= 3.2)
6
6
  capybara (>= 2.0)
7
7
  ruby2_keywords
data/README.md CHANGED
@@ -345,6 +345,17 @@ Waiting additional tasks will have a negative performance impact on your test su
345
345
  > **Note:** When capybara-lockstep detects jQuery on the page, it will automatically patch [`$.ajax()`](https://api.jquery.com/jQuery.ajax/) to wait an additional task after the response was received. If your only concern is callbacks to `$.ajax()` you do not need so set `Capybara::Lockstep.wait_tasks`.
346
346
 
347
347
 
348
+ ## Running code after synchronization
349
+
350
+ You can configure a proc to run after successful synchronization:
351
+
352
+ ```ruby
353
+ Capybara::Lockstep.after_synchronize do
354
+ puts "Synchronized!"
355
+ end
356
+ ````
357
+
358
+
348
359
  ## Contributing
349
360
 
350
361
  Pull requests are welcome on GitHub at <https://github.com/makandra/capybara-lockstep>.
@@ -77,8 +77,22 @@ module Capybara
77
77
  @wait_tasks
78
78
  end
79
79
 
80
+ def after_synchronize(&callback)
81
+ after_synchronize_callbacks << callback
82
+ end
83
+
80
84
  private
81
85
 
86
+ def after_synchronize_callbacks
87
+ @before_synchronize_callbacks ||= []
88
+ end
89
+
90
+ def run_after_synchronize_callbacks
91
+ after_synchronize_callbacks.each do |callback|
92
+ instance_eval(&callback)
93
+ end
94
+ end
95
+
82
96
  def javascript_driver?
83
97
  driver.is_a?(Capybara::Selenium::Driver)
84
98
  end
@@ -53,6 +53,8 @@ module Capybara
53
53
  end
54
54
 
55
55
  synchronize_now(log: log)
56
+
57
+ run_after_synchronize_callbacks
56
58
  end
57
59
 
58
60
  # Automatic synchronization from within the capybara-lockstep should always call #auto_synchronize.
@@ -136,9 +138,10 @@ module Capybara
136
138
  end
137
139
  rescue StandardError => e
138
140
  unhandled_synchronize_error(e)
139
- ensure
140
- self.synchronizing = false
141
141
  end
142
+
143
+ ensure
144
+ self.synchronizing = false
142
145
  end
143
146
 
144
147
  def unhandled_synchronize_error(e)
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Lockstep
3
- VERSION = "1.2.1"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-lockstep
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-12 00:00:00.000000000 Z
11
+ date: 2023-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara