capybara-lockstep 1.2.1 → 1.3.1

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: 963aaa637f5f364f53f2a16087accf68035381e260aa4f7b0b2703d9a00a8abb
4
+ data.tar.gz: a48cdd51fc2fcf9e6d87d0d692e1448c90a639d36695b38e97d4a1183a44043c
5
5
  SHA512:
6
- metadata.gz: dffa87e401d189b8afea6bb72b49bb14a6f9865d306fc7a838e50b4fb4dfc715fe8930502b9e3e2b4139c214b45eefe189c0ddb8e3e867d30d3021331ba76ea3
7
- data.tar.gz: b311ee487b65ae42dc5dcc114cdd2aca2ff39ed49953fe43959ecf8578b3691740ebd2019aeae95fc87334cc5b87835f18b1f816ed2ad0a234e6475b549baad8
6
+ metadata.gz: 8e2ab4e0227f8f3511e40b82ba0dfe80df61615547c6291db4f0d16bfa097a1863e612d57bd6d16c86bd5e5a4a9cd8be3f6040cdf3138071d487311dcfbb5b1f
7
+ data.tar.gz: 0060560ae282df788924891c6fff31cdf27491e79468f6c172154667466f66784bce54920e31d0838b96ad91d84904f8cb859573c390a5a327b8e4c40351d2f5
@@ -22,12 +22,12 @@ jobs:
22
22
  gemfile: Gemfile
23
23
  - ruby: 2.7.2
24
24
  gemfile: Gemfile
25
- - ruby: 3.0.1
25
+ - ruby: 3.2.0
26
26
  gemfile: Gemfile
27
27
  env:
28
28
  BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
29
29
  steps:
30
- - uses: actions/checkout@v2
30
+ - uses: actions/checkout@v3
31
31
  - name: Install Chrome
32
32
  uses: browser-actions/setup-chrome@latest
33
33
  - name: Show Chrome version
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.2
1
+ 3.2.0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@ All notable changes to this project will be documented in this file.
2
2
 
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
+ ## 1.3.1 - 2023-10-25
6
+
7
+ Now synchronizes before and after `evaluate_script`.
8
+
9
+ Previously we only synchronized around `execute_script` and `evaluate_async_script`.
10
+
11
+
12
+ ## 1.3.0 - 2023-01-10
13
+
14
+ You can configure a proc to run after successful synchronization:
15
+
16
+ ```ruby
17
+ Capybara::Lockstep.after_synchronize do
18
+ puts "Synchronized!"
19
+ end
20
+ ````
5
21
 
6
22
  ## 1.2.1 - 2022-09-12
7
23
 
data/Gemfile CHANGED
@@ -13,6 +13,9 @@ gem 'thin' # ruby 3 does not include a webserver
13
13
  gem 'chrome_remote'
14
14
 
15
15
  gem 'byebug'
16
- gem 'gemika'
16
+ gem 'gemika', '>= 0.8.1'
17
17
 
18
18
  gem 'activesupport', '~> 6.0'
19
+
20
+ gem 'capybara', '= 3.36.0' # last version compatible with Ruby < 2.7, which is in our test matrix
21
+ gem 'selenium-webdriver', '=4.1.0' # last version compatible with Ruby < 2.7, which is in our test matrix
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.1)
5
5
  activesupport (>= 3.2)
6
6
  capybara (>= 2.0)
7
7
  ruby2_keywords
@@ -19,7 +19,7 @@ GEM
19
19
  addressable (2.8.1)
20
20
  public_suffix (>= 2.0.2, < 6.0)
21
21
  byebug (11.1.3)
22
- capybara (3.37.1)
22
+ capybara (3.36.0)
23
23
  addressable
24
24
  matrix
25
25
  mini_mime (>= 0.1.3)
@@ -35,7 +35,7 @@ GEM
35
35
  daemons (1.3.1)
36
36
  diff-lcs (1.3)
37
37
  eventmachine (1.2.7)
38
- gemika (0.6.0)
38
+ gemika (0.8.1)
39
39
  i18n (1.12.0)
40
40
  concurrent-ruby (~> 1.0)
41
41
  jasmine (3.6.0)
@@ -46,8 +46,10 @@ GEM
46
46
  jasmine-core (3.6.0)
47
47
  matrix (0.4.2)
48
48
  mini_mime (1.1.2)
49
+ mini_portile2 (2.8.1)
49
50
  minitest (5.16.3)
50
- nokogiri (1.13.8-x86_64-linux)
51
+ nokogiri (1.13.8)
52
+ mini_portile2 (~> 2.8.0)
51
53
  racc (~> 1.4)
52
54
  phantomjs (2.1.1.0)
53
55
  public_suffix (5.0.0)
@@ -73,18 +75,16 @@ GEM
73
75
  rspec-support (3.7.0)
74
76
  ruby2_keywords (0.0.5)
75
77
  rubyzip (2.3.2)
76
- selenium-webdriver (4.4.0)
78
+ selenium-webdriver (4.1.0)
77
79
  childprocess (>= 0.5, < 5.0)
78
80
  rexml (~> 3.2, >= 3.2.5)
79
- rubyzip (>= 1.2.2, < 3.0)
80
- websocket (~> 1.0)
81
+ rubyzip (>= 1.2.2)
81
82
  thin (1.8.0)
82
83
  daemons (~> 1.0, >= 1.0.9)
83
84
  eventmachine (~> 1.0, >= 1.0.4)
84
85
  rack (>= 1, < 3)
85
86
  tzinfo (2.0.5)
86
87
  concurrent-ruby (~> 1.0)
87
- websocket (1.2.9)
88
88
  websocket-driver (0.7.3)
89
89
  websocket-extensions (>= 0.1.0)
90
90
  websocket-extensions (0.1.5)
@@ -98,12 +98,14 @@ PLATFORMS
98
98
  DEPENDENCIES
99
99
  activesupport (~> 6.0)
100
100
  byebug
101
+ capybara (= 3.36.0)
101
102
  capybara-lockstep!
102
103
  chrome_remote
103
- gemika
104
+ gemika (>= 0.8.1)
104
105
  jasmine
105
106
  rake (~> 13.0)
106
107
  rspec (~> 3.0)
108
+ selenium-webdriver (= 4.1.0)
107
109
  thin
108
110
 
109
111
  BUNDLED WITH
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>.
@@ -145,9 +145,8 @@ Capybara::Session.class_eval do
145
145
  extend Capybara::Lockstep::SynchronizeAroundScriptMethod
146
146
 
147
147
  synchronize_around_script_method :execute_script
148
+ synchronize_around_script_method :evaluate_script
148
149
  synchronize_around_script_method :evaluate_async_script
149
- # Don't synchronize around evaluate_script. It calls execute_script
150
- # internally and we don't want to synchronize multiple times.
151
150
  end
152
151
 
153
152
  # Capybara 3 has driver-specific Node classes which sometimes
@@ -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.1"
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.1
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-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
- rubygems_version: 3.2.6
122
+ rubygems_version: 3.4.3
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: Synchronize Capybara commands with client-side JavaScript and AJAX requests