capybara-lockstep 2.0.2 → 2.0.3

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: 495d3ed978e831569eb691423ab97e79b4a354e415ce7247c7fba01916bce60a
4
- data.tar.gz: bb51f4acfbd6cbe7b19f3e326d7e8d771004babe1ed415ca9f283c1301822ac9
3
+ metadata.gz: bc0373be228e0d19b35174656617d256a469fb1f652728eaa031b91a9370aa38
4
+ data.tar.gz: 45a3b441340e1cf477564f47af7961799ac0cf37e533a42393c89a08744f1657
5
5
  SHA512:
6
- metadata.gz: aeb726459feb3f529e02bc8cc5d8c8cd5afe2377d7906ff5e78485137770ad851cfa7e9a175a3f9ff59bbf2deb4a8fc0d14a06af584928e552a8d25bba3ddc43
7
- data.tar.gz: 8f6955613d8a1073dcfeb26d003a22c0694462bdbab917ae66f31b11bbca2af36d5164394e4eafd18157b57d5684d7c9ae2afce4c0693230f91aca7c532d8528
6
+ metadata.gz: b3c3f17a3a6b1e32b43ee86106294b9351bc312234070f4308e93dce8dfeae4198831f04c50e20ca37fc533ecbf1f77b51fe11e24c1336f2866018380052e07a
7
+ data.tar.gz: 64b39c510daba699db4c0204caa5004e8d367c3e6208a9b2d0a7912925e4dd7c5223e3caf516633310c7f41dbf524af0520715c5051c1d0ead3f8494a0bb0a75
data/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
5
 
6
+ # 2.0.3
7
+
8
+ - Fix a bug where we wouldn't wait for an additional JavaScript task after a tracked event or async job.
9
+ - Fix a bug where the `Capybara::Lockstep.wait_tasks` configuration would be ignored.
10
+ - Fix a bug where the `capybara_lockstep_js` helper (for use without Rails) would not include the current configuration.
11
+
12
+
6
13
  # 2.0.2
7
14
 
8
15
  - Fix a bug where setting a logger object with `Capybara::Lockstep.debug = logger` would crash (by @dorianmarie).
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capybara-lockstep (2.0.2)
4
+ capybara-lockstep (2.0.3)
5
5
  activesupport (>= 4.2)
6
6
  capybara (>= 3.0)
7
7
  ruby2_keywords
data/README.md CHANGED
@@ -377,7 +377,7 @@ It is theoretically possible that your test will observe the browser in that win
377
377
  Any issues caused by this will usually be mitigated by Capybara's retry logic. **If** you think that this is an issue for your test suite, you can configure capybara-headless to wait additional tasks before it considers the browser to be idle:
378
378
 
379
379
  ```ruby
380
- Capybara::Lockstep.wait_tasks = 2 // default is 1
380
+ Capybara::Lockstep.wait_tasks = 2 # default is 1
381
381
  ```
382
382
 
383
383
  If you see longer chains of `then()` or nested `setTimeout()` calls in your code, you may need to configure a higher number of tasks to wait.
@@ -257,7 +257,10 @@ window.CapybaraLockstep = (function() {
257
257
 
258
258
  function afterWaitTasks(fn, tasksLeft = waitTasks) {
259
259
  if (tasksLeft > 0) {
260
- afterWaitTasks(fn, tasksLeft - 1)
260
+ // Wait 1 task and recurse
261
+ setTimeout(function() {
262
+ afterWaitTasks(fn, tasksLeft - 1)
263
+ })
261
264
  } else {
262
265
  fn()
263
266
  }
@@ -3,10 +3,10 @@ module Capybara
3
3
  module Helper
4
4
 
5
5
  JS_PATH = File.expand_path('../helper.js', __FILE__)
6
- JS = IO.read(JS_PATH)
6
+ HELPER_JS = IO.read(JS_PATH)
7
7
 
8
- def capybara_lockstep_js
9
- JS
8
+ def capybara_lockstep_js(options = {})
9
+ HELPER_JS + capybara_lockstep_config_js(options)
10
10
  end
11
11
 
12
12
  def capybara_lockstep(options = {})
@@ -17,10 +17,11 @@ module Capybara
17
17
  tag_options[:nonce] = options.fetch(:nonce, true)
18
18
  end
19
19
 
20
- js = capybara_lockstep_js + capybara_lockstep_config_js(options)
21
- javascript_tag(js, tag_options)
20
+ javascript_tag(capybara_lockstep_js(options), tag_options)
22
21
  end
23
22
 
23
+ private
24
+
24
25
  def capybara_lockstep_config_js(options = {})
25
26
  js = ''
26
27
 
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Lockstep
3
- VERSION = "2.0.2"
3
+ VERSION = "2.0.3"
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: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-22 00:00:00.000000000 Z
11
+ date: 2024-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara