capybara-lockstep 2.0.1 → 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: fec95c22e010d3c9f9fbf5c9625a2660267de90a80da2a395355a9aa6ffe292e
4
- data.tar.gz: 80b6ccc788241ca29aec1eddc2e0a5faa85ce5122fda16ba000b9980ca921270
3
+ metadata.gz: bc0373be228e0d19b35174656617d256a469fb1f652728eaa031b91a9370aa38
4
+ data.tar.gz: 45a3b441340e1cf477564f47af7961799ac0cf37e533a42393c89a08744f1657
5
5
  SHA512:
6
- metadata.gz: bb4df421a7b648a20950d56c91bfdf3ed6c3155a5fe93a9808bb48de550a31820a17a265306957df3cbed7fc3b119b9dd643be05aea372bec33dcff131dcfb18
7
- data.tar.gz: 8f5dcb3934037d1cccf3c03257a00c4d8fa45b1797d0261fd74a19b3f787f9034b9966064eed25be3fc556cc4be5ecfbf930508893c9b973b6a5cb2f70c3e38e
6
+ metadata.gz: b3c3f17a3a6b1e32b43ee86106294b9351bc312234070f4308e93dce8dfeae4198831f04c50e20ca37fc533ecbf1f77b51fe11e24c1336f2866018380052e07a
7
+ data.tar.gz: 64b39c510daba699db4c0204caa5004e8d367c3e6208a9b2d0a7912925e4dd7c5223e3caf516633310c7f41dbf524af0520715c5051c1d0ead3f8494a0bb0a75
data/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@ 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
+
13
+ # 2.0.2
14
+
15
+ - Fix a bug where setting a logger object with `Capybara::Lockstep.debug = logger` would crash (by @dorianmarie).
16
+
17
+
6
18
  # 2.0.1
7
19
 
8
20
  - Don't crash when an interaction closes the window (tab).
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capybara-lockstep (2.0.1)
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.
@@ -35,7 +35,7 @@ module Capybara
35
35
  end
36
36
 
37
37
  send_config_to_browser(<<~JS)
38
- CapybaraLockstep.debug = #{value.to_json}
38
+ CapybaraLockstep.debug = #{debug?.to_json}
39
39
  JS
40
40
 
41
41
  @debug
@@ -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
 
@@ -6,7 +6,7 @@ module Capybara
6
6
  message = "[capybara-lockstep] #{message}"
7
7
  if is_logger?(Lockstep.debug)
8
8
  # If someone set Capybara::Lockstep.debug to a logger, use that
9
- Lockstep.debug(message)
9
+ Lockstep.debug.debug(message)
10
10
  else
11
11
  # Otherwise print to STDOUT
12
12
  puts message
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Lockstep
3
- VERSION = "2.0.1"
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.1
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-11-30 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