cypress-rails 0.4.2 → 0.5.0

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: c66865f1f844c8e3bd6fc86a881db8059fe26db9ebe70b1eeb0fc05e6ace601a
4
- data.tar.gz: b94c1d60432ba1cf738f43574ef5ee9a831a2420cfcc4091446d6c0837860b64
3
+ metadata.gz: 562fe8191d39ef805cb9f6ff8cc82f7c1329acc61332425bd23a6c6ff1ccccd2
4
+ data.tar.gz: 267ac2d8ef9c9969205798acbe5239d398eb35ba93a2a45bedaa18fba8056a60
5
5
  SHA512:
6
- metadata.gz: e8878b2be16bd34dbcb4994a0d2cec648dc1fdf41ea88dea4b51092d9e882d7e199dbd189dbc1873f96b3c5834f04df05b08a7592de55b71649cd8f7720e3c07
7
- data.tar.gz: 1f200193af7bdddc8e4c56f9d3a3f9b38eeed17fef9e7cd5a26fa0c31b93eb6ba04a4e62b73ed42c5d7c79d6382d9883754311a5a946d4cf8ef00861d1c1d609
6
+ metadata.gz: 9b8b12ab6e9f8f565afd72dfc345d717fb8b957ebe6ca4e73f883d9a2f4278eef4ae89335b85e305065114bedbe797e4ba2fb5cdb5b4457ccd93ea9b245f7a51
7
+ data.tar.gz: 90945b95efc3e0d58651af35d1a13a7740eea905103aa4b8263af380c789f6f0c8a605f58542d8077e26639136ca9f5f0e44ca915b216c8decabd4f2c8e20999
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.5.0
4
+
5
+ * Add hook `before_server_start`
6
+ [#63](https://github.com/testdouble/cypress-rails/pull/63)
7
+ * Fix namespace bug
8
+ [#64](https://github.com/testdouble/cypress-rails/pull/64)
9
+
3
10
  ## 0.4.2
4
11
 
5
12
  * Add support to Rails 6.1 ([#52](https://github.com/testdouble/cypress-rails/issue/52))
data/Gemfile.lock CHANGED
@@ -1,27 +1,27 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cypress-rails (0.4.2)
4
+ cypress-rails (0.5.0)
5
5
  puma (>= 3.8.0)
6
6
  railties (>= 5.2.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionpack (6.1.0)
12
- actionview (= 6.1.0)
13
- activesupport (= 6.1.0)
11
+ actionpack (6.1.3.1)
12
+ actionview (= 6.1.3.1)
13
+ activesupport (= 6.1.3.1)
14
14
  rack (~> 2.0, >= 2.0.9)
15
15
  rack-test (>= 0.6.3)
16
16
  rails-dom-testing (~> 2.0)
17
17
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
- actionview (6.1.0)
19
- activesupport (= 6.1.0)
18
+ actionview (6.1.3.1)
19
+ activesupport (= 6.1.3.1)
20
20
  builder (~> 3.1)
21
21
  erubi (~> 1.4)
22
22
  rails-dom-testing (~> 2.0)
23
23
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
- activesupport (6.1.0)
24
+ activesupport (6.1.3.1)
25
25
  concurrent-ruby (~> 1.0, >= 1.0.2)
26
26
  i18n (>= 1.6, < 2)
27
27
  minitest (>= 5.1)
@@ -29,25 +29,27 @@ GEM
29
29
  zeitwerk (~> 2.3)
30
30
  ast (2.4.1)
31
31
  builder (3.2.4)
32
- concurrent-ruby (1.1.7)
32
+ concurrent-ruby (1.1.8)
33
33
  crass (1.0.6)
34
34
  erubi (1.10.0)
35
- i18n (1.8.5)
35
+ i18n (1.8.10)
36
36
  concurrent-ruby (~> 1.0)
37
- loofah (2.8.0)
37
+ loofah (2.9.0)
38
38
  crass (~> 1.0.2)
39
39
  nokogiri (>= 1.5.9)
40
40
  method_source (1.0.0)
41
- mini_portile2 (2.4.0)
41
+ mini_portile2 (2.5.0)
42
42
  minitest (5.14.2)
43
- nio4r (2.5.4)
44
- nokogiri (1.10.10)
45
- mini_portile2 (~> 2.4.0)
43
+ nio4r (2.5.7)
44
+ nokogiri (1.11.2)
45
+ mini_portile2 (~> 2.5.0)
46
+ racc (~> 1.4)
46
47
  parallel (1.20.1)
47
48
  parser (2.7.2.0)
48
49
  ast (~> 2.4.1)
49
- puma (5.1.1)
50
+ puma (5.2.2)
50
51
  nio4r (~> 2.0)
52
+ racc (1.5.2)
51
53
  rack (2.2.3)
52
54
  rack-test (1.1.0)
53
55
  rack (>= 1.0, < 3)
@@ -56,9 +58,9 @@ GEM
56
58
  nokogiri (>= 1.6)
57
59
  rails-html-sanitizer (1.3.0)
58
60
  loofah (~> 2.3)
59
- railties (6.1.0)
60
- actionpack (= 6.1.0)
61
- activesupport (= 6.1.0)
61
+ railties (6.1.3.1)
62
+ actionpack (= 6.1.3.1)
63
+ activesupport (= 6.1.3.1)
62
64
  method_source
63
65
  rake (>= 0.8.7)
64
66
  thor (~> 1.0)
@@ -84,7 +86,7 @@ GEM
84
86
  standard (0.10.2)
85
87
  rubocop (= 1.4.2)
86
88
  rubocop-performance (= 1.9.1)
87
- thor (1.0.1)
89
+ thor (1.1.0)
88
90
  tzinfo (2.0.4)
89
91
  concurrent-ruby (~> 1.0)
90
92
  unicode-display_width (1.7.0)
@@ -101,4 +103,4 @@ DEPENDENCIES
101
103
  standard (>= 0.2.0)
102
104
 
103
105
  BUNDLED WITH
104
- 2.1.4
106
+ 2.2.3
data/README.md CHANGED
@@ -170,7 +170,7 @@ preferred environment variables project-wide using a tool like
170
170
  general this means anything done during `cypress open` or `cypress run` will
171
171
  be rolled back on exit (similar to running a Rails System test)
172
172
  * **CYPRESS_RAILS_CYPRESS_OPTS** (default: _none_) any options you want to
173
- forward to the Cypress CLI when running its `open` or `run` commands
173
+ forward to the Cypress CLI when running its `open` or `run` commands.
174
174
 
175
175
  #### Example: Running a single spec from the command line
176
176
 
@@ -181,6 +181,14 @@ Cypress test would look like this:
181
181
  $ CYPRESS_RAILS_CYPRESS_OPTS="--spec cypress/integration/a_test.js" bin/rake cypress:run
182
182
  ```
183
183
 
184
+ #### Example: Running your tests in Chromium
185
+
186
+ By default, Cypress will run its tests in its packaged Electron app, unless you've configured it globally. To choose which browser it will run from the command line, try this:
187
+
188
+ ```
189
+ $ CYPRESS_RAILS_CYPRESS_OPTS="--browser chromium" bin/rake cypress:run
190
+ ```
191
+
184
192
  ### Initializer hooks
185
193
 
186
194
  ### before_server_start
@@ -190,6 +198,11 @@ will execute before the server or any transaction has been started. If you use
190
198
  Rails fixtures, it may make sense to load them here, so they don't need to be
191
199
  re-inserted for each request
192
200
 
201
+ ### after_server_start
202
+
203
+ Pass a block to `CypressRails.hooks.after_server_start` to register a hook that
204
+ will execute after the server has booted.
205
+
193
206
  ### after_transaction_start
194
207
 
195
208
  If there's any custom behavior or state management you want to do inside the
@@ -304,7 +317,7 @@ experience. In particular:
304
317
  and more information dense than using Capybara and Selenium. Rather than
305
318
  running a test from the command line, seeing it fail, then adding a debug
306
319
  breakpoint to a test to try to manipulate the browser or tweaking a call to a
307
- Capybara API method, failures to be rather obvious when using Cypress and
320
+ Capybara API method, failures tend to be rather obvious when using Cypress and
308
321
  fixing it is usually as easy as tweaking a command, hitting save, and watching
309
322
  it re-run
310
323
  * With very few exceptions, a Cypress test that works in a browser window will
@@ -12,6 +12,10 @@ module CypressRails
12
12
  register(:before_server_start, blk)
13
13
  end
14
14
 
15
+ def after_server_start(&blk)
16
+ register(:after_server_start, blk)
17
+ end
18
+
15
19
  def after_transaction_start(&blk)
16
20
  register(:after_transaction_start, blk)
17
21
  end
@@ -20,7 +20,7 @@ module CypressRails
20
20
 
21
21
  begin
22
22
  connection = ActiveRecord::Base.connection_handler.retrieve_connection(spec_name)
23
- rescue ConnectionNotEstablished
23
+ rescue ActiveRecord::ConnectionNotEstablished
24
24
  connection = nil
25
25
  end
26
26
 
@@ -3,6 +3,7 @@
3
3
  require "uri"
4
4
  require "net/http"
5
5
  require "rack"
6
+ require_relative "initializer_hooks"
6
7
  require_relative "server/middleware"
7
8
  require_relative "server/checker"
8
9
  require_relative "server/timer"
@@ -32,6 +33,7 @@ module CypressRails
32
33
  @port ||= Server.ports[port_key]
33
34
  @port ||= find_available_port(host)
34
35
  @checker = Checker.new(@host, @port)
36
+ @initializer_hooks = InitializerHooks.instance
35
37
  end
36
38
 
37
39
  def reset_error!
@@ -78,6 +80,7 @@ module CypressRails
78
80
  raise "Rack application timed out during boot" if timer.expired?
79
81
 
80
82
  @server_thread.join(0.1)
83
+ @initializer_hooks.run(:after_server_start)
81
84
  end
82
85
  end
83
86
 
@@ -1,3 +1,3 @@
1
1
  module CypressRails
2
- VERSION = "0.4.2"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cypress-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-17 00:00:00.000000000 Z
11
+ date: 2021-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubygems_version: 3.1.2
160
+ rubygems_version: 3.2.3
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: Helps you write Cypress tests of your Rails app