capybara-lockstep 0.6.0 → 0.7.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: ef423eecbf9d793e932d66b056feee733835efa0387ec6740fecb2975585f95e
4
- data.tar.gz: 55e8872d7b892567797ded6fb67ed17500bc3daf29e11fbf4fee45588cdab9f2
3
+ metadata.gz: 8335399770451283be7443be41f3f1e5c2b0401f16a64a7722fb6b39ec2f3143
4
+ data.tar.gz: 601249c76c50789b44199e734a64fb039cd3b77c1db3e9f9068b1e7dea188216
5
5
  SHA512:
6
- metadata.gz: cd14f06c4b820e5e0dda482438d282e7a856c790ef0952f44c28a6f18dd9fb863323f782b8e21d9846ec9660fcf804ea257e5c05640482e777408e71ab820ccd
7
- data.tar.gz: dc64900722119cc945b6b22113b63d13706d0cfb2ae39e0b8411c62aad0cbfc716ff84433189521f685219ee85f48554852df1204ce0fad1fed4e7f19b1d3cf0
6
+ metadata.gz: 638b0671d9f919c85b972cb2af4df763932a8c00ab21cd8387e3b483fda43448bb3c28b434aa821c0c6e75d4c67d82acb1dad0788128a5b1761bae0ae45400d6
7
+ data.tar.gz: eed68edd632b78dea169e208162e4a041cfc1ed2a78c6593eebf55d27d2fe54d9161e1c65f21771cb66de2ef4e2e2ce92573569118e30e8a3148368ffaaafe53
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: Tests
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ branches:
9
+ - master
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-20.04
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ include:
17
+ - ruby: 2.6.6
18
+ gemfile: Gemfile
19
+ - ruby: 2.7.2
20
+ gemfile: Gemfile
21
+ - ruby: 3.0.1
22
+ gemfile: Gemfile
23
+ env:
24
+ BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
25
+ steps:
26
+ - uses: actions/checkout@v2
27
+ - name: Install ruby
28
+ uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: "${{ matrix.ruby }}"
31
+ - name: Bundle
32
+ run: |
33
+ gem install bundler:2.2.15
34
+ bundle install --no-deployment
35
+ - name: Run tests
36
+ run: bundle exec rake spec
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ .idea
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
data/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ All notable changes to this project will be documented in this file.
2
+
3
+ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
+
5
+
6
+ ## Unreleased
7
+
8
+ ### Breaking changes
9
+
10
+ -
11
+
12
+ ### Compatible changes
13
+
14
+ -
15
+
16
+ ## 0.7.0 - 2021-05-04
17
+
18
+ ### Compatible changes
19
+
20
+ - add changelog
21
+ - add gemika for tests with github actions
22
+ - add Ruby 3 support
23
+
24
+ ## 0.6.0 - 2021-03-10
25
+ ## 0.5.0 - 2021-03-09
26
+ ## 0.4.0 - 2021-03-05
27
+ ## 0.3.3 - 2021-03-05
28
+ ## 0.3.2 - 2021-03-04
29
+ ## 0.3.1 - 2021-03-04
30
+ ## 0.3.0 - 2021-03-04
31
+ ## 0.2.3 - 2021-03-03
32
+ ## 0.2.2 - 2021-03-03
33
+ ## 0.2.1 - 2021-03-03
data/Gemfile CHANGED
@@ -8,5 +8,9 @@ gemspec
8
8
  gem "rake", "~> 13.0"
9
9
 
10
10
  gem "rspec", "~> 3.0"
11
+ gem 'jasmine'
12
+ gem 'thin' # ruby 3 does not include a webserver
13
+ gem 'chrome_remote'
11
14
 
12
15
  gem 'byebug'
16
+ gem 'gemika'
data/Gemfile.lock CHANGED
@@ -1,15 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capybara-lockstep (0.6.0)
4
+ capybara-lockstep (0.7.0)
5
5
  activesupport (>= 3.2)
6
6
  capybara (>= 2.0)
7
+ ruby2_keywords
7
8
  selenium-webdriver (>= 3)
8
9
 
9
10
  GEM
10
11
  remote: https://rubygems.org/
11
12
  specs:
12
- activesupport (6.1.3)
13
+ activesupport (6.1.3.1)
13
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
15
  i18n (>= 1.6, < 2)
15
16
  minitest (>= 5.1)
@@ -27,16 +28,28 @@ GEM
27
28
  regexp_parser (>= 1.5, < 3.0)
28
29
  xpath (~> 3.2)
29
30
  childprocess (3.0.0)
31
+ chrome_remote (0.3.0)
32
+ websocket-driver (~> 0.6)
30
33
  concurrent-ruby (1.1.8)
34
+ daemons (1.3.1)
31
35
  diff-lcs (1.3)
32
- i18n (1.8.9)
36
+ eventmachine (1.2.7)
37
+ gemika (0.6.0)
38
+ i18n (1.8.10)
33
39
  concurrent-ruby (~> 1.0)
34
- mini_mime (1.0.2)
35
- mini_portile2 (2.5.0)
40
+ jasmine (3.6.0)
41
+ jasmine-core (~> 3.6.0)
42
+ phantomjs
43
+ rack (>= 1.2.1)
44
+ rake
45
+ jasmine-core (3.6.0)
46
+ mini_mime (1.1.0)
47
+ mini_portile2 (2.5.1)
36
48
  minitest (5.14.4)
37
- nokogiri (1.11.1)
49
+ nokogiri (1.11.3)
38
50
  mini_portile2 (~> 2.5.0)
39
51
  racc (~> 1.4)
52
+ phantomjs (2.1.1.0)
40
53
  public_suffix (4.0.6)
41
54
  racc (1.5.2)
42
55
  rack (2.2.3)
@@ -57,12 +70,20 @@ GEM
57
70
  diff-lcs (>= 1.2.0, < 2.0)
58
71
  rspec-support (~> 3.7.0)
59
72
  rspec-support (3.7.0)
73
+ ruby2_keywords (0.0.4)
60
74
  rubyzip (2.3.0)
61
75
  selenium-webdriver (3.142.7)
62
76
  childprocess (>= 0.5, < 4.0)
63
77
  rubyzip (>= 1.2.2)
78
+ thin (1.8.0)
79
+ daemons (~> 1.0, >= 1.0.9)
80
+ eventmachine (~> 1.0, >= 1.0.4)
81
+ rack (>= 1, < 3)
64
82
  tzinfo (2.0.4)
65
83
  concurrent-ruby (~> 1.0)
84
+ websocket-driver (0.7.3)
85
+ websocket-extensions (>= 0.1.0)
86
+ websocket-extensions (0.1.5)
66
87
  xpath (3.2.0)
67
88
  nokogiri (~> 1.8)
68
89
  zeitwerk (2.4.2)
@@ -73,8 +94,12 @@ PLATFORMS
73
94
  DEPENDENCIES
74
95
  byebug
75
96
  capybara-lockstep!
97
+ chrome_remote
98
+ gemika
99
+ jasmine
76
100
  rake (~> 13.0)
77
101
  rspec (~> 3.0)
102
+ thin
78
103
 
79
104
  BUNDLED WITH
80
- 2.2.12
105
+ 2.2.15
data/README.md CHANGED
@@ -132,9 +132,8 @@ document.addEventListener('DOMContentLoaded', function() {
132
132
  Libary.initialize({
133
133
  onFinished: function() {
134
134
  document.body.removeAttribute('data-initializing')
135
- })
135
+ }
136
136
  })
137
- setTimeout(function() { document.body.removeAttribute('data-initializing') })
138
137
  })
139
138
  ```
140
139
 
data/Rakefile CHANGED
@@ -6,3 +6,11 @@ require "rspec/core/rake_task"
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
8
  task default: :spec
9
+ require 'jasmine'
10
+ load 'jasmine/tasks/jasmine.rake'
11
+
12
+ begin
13
+ require 'gemika/tasks'
14
+ rescue LoadError
15
+ puts 'Run `gem install gemika` for additional tasks'
16
+ end
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency "capybara", ">= 2.0"
28
28
  spec.add_dependency "selenium-webdriver", ">= 3"
29
29
  spec.add_dependency "activesupport", ">= 3.2"
30
+ spec.add_dependency "ruby2_keywords"
30
31
 
31
32
  # For more information and examples about making a new gem, checkout our
32
33
  # guide at: https://bundler.io/guides/creating_gem.html
@@ -1,7 +1,9 @@
1
+ require 'ruby2_keywords'
2
+
1
3
  module Capybara
2
4
  module Lockstep
3
5
  module VisitWithWaiting
4
- def visit(*args, &block)
6
+ ruby2_keywords def visit(*args, &block)
5
7
  url = args[0]
6
8
  # Some of our apps have a Cucumber step that changes drivers mid-scenario.
7
9
  # It works by creating a new Capybara session and re-visits the URL from the
@@ -65,6 +67,7 @@ module Capybara
65
67
  end
66
68
  end
67
69
  end
70
+ ruby2_keywords meth
68
71
  end
69
72
  prepend(mod)
70
73
  end
@@ -92,6 +95,7 @@ module Capybara
92
95
  Lockstep.synchronized = false
93
96
  end
94
97
  end
98
+ ruby2_keywords meth
95
99
  end
96
100
  prepend(mod)
97
101
  end
@@ -138,7 +142,7 @@ end
138
142
  module Capybara
139
143
  module Lockstep
140
144
  module SynchronizeWithCatchUp
141
- def synchronize(*args, &block)
145
+ ruby2_keywords def synchronize(*args, &block)
142
146
  # This method is called very frequently by capybara.
143
147
  # We use the { lazy } option to only synchronize when we're out of sync.
144
148
  Capybara::Lockstep.synchronize(lazy: true)
@@ -1,8 +1,17 @@
1
1
  window.CapybaraLockstep = (function() {
2
- let jobCount = 0
3
- let idleCallbacks = []
4
- let debug = false
5
- let waitTasks = 0
2
+ // State and configuration
3
+ let debug
4
+ let jobCount
5
+ let idleCallbacks
6
+ let waitTasks
7
+ reset()
8
+
9
+ function reset() {
10
+ jobCount = 0
11
+ idleCallbacks = []
12
+ waitTasks = 0
13
+ debug = false
14
+ }
6
15
 
7
16
  function isIdle() {
8
17
  // Can't check for document.readyState or body.initializing here,
@@ -42,7 +51,8 @@ window.CapybaraLockstep = (function() {
42
51
 
43
52
  function startWorkUntil(promise, tag) {
44
53
  startWork(tag)
45
- promise.then(stopWork, stopWork)
54
+ let taggedStopWork = stopWork.bind(this, tag)
55
+ promise.then(taggedStopWork, taggedStopWork)
46
56
  }
47
57
 
48
58
  function stopWork(tag) {
@@ -312,9 +322,12 @@ window.CapybaraLockstep = (function() {
312
322
 
313
323
  return {
314
324
  track: track,
325
+ isBusy: isBusy,
326
+ isIdle: isIdle,
315
327
  startWork: startWork,
316
328
  stopWork: stopWork,
317
329
  synchronize: synchronize,
330
+ reset: reset,
318
331
  set debug(value) { debug = value },
319
332
  set waitTasks(value) { waitTasks = value }
320
333
  }
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Lockstep
3
- VERSION = "0.6.0"
3
+ VERSION = "0.7.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: 0.6.0
4
+ version: 0.7.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: 2021-03-10 00:00:00.000000000 Z
11
+ date: 2021-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: ruby2_keywords
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description:
56
70
  email:
57
71
  - henning.koch@makandra.de
@@ -59,9 +73,11 @@ executables: []
59
73
  extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
76
+ - ".github/workflows/test.yml"
62
77
  - ".gitignore"
63
78
  - ".rspec"
64
79
  - ".ruby-version"
80
+ - CHANGELOG.md
65
81
  - Gemfile
66
82
  - Gemfile.lock
67
83
  - LICENSE.txt
@@ -100,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
116
  - !ruby/object:Gem::Version
101
117
  version: '0'
102
118
  requirements: []
103
- rubygems_version: 3.2.6
119
+ rubygems_version: 3.0.3
104
120
  signing_key:
105
121
  specification_version: 4
106
122
  summary: Synchronize Capybara commands with client-side JavaScript and AJAX requests