cypress-rails 0.3.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +21 -0
- data/.standard.yml +2 -2
- data/CHANGELOG.md +30 -0
- data/Gemfile.lock +57 -52
- data/README.md +46 -7
- data/lib/cypress-rails/config.rb +11 -2
- data/lib/cypress-rails/env.rb +2 -5
- data/lib/cypress-rails/init.rb +1 -1
- data/lib/cypress-rails/initializer_hooks.rb +4 -0
- data/lib/cypress-rails/launches_cypress.rb +1 -0
- data/lib/cypress-rails/manages_transactions.rb +5 -14
- data/lib/cypress-rails/server.rb +5 -2
- data/lib/cypress-rails/starts_rails_server.rb +2 -2
- data/lib/cypress-rails/version.rb +1 -1
- data/script/test +19 -0
- data/script/test_example_app +1 -1
- metadata +9 -8
- data/.circleci/config.yml +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a89d2ae87c67c2df6c45dd8e3642a9ca52b0f3a88b29b4d7e7569dc22579ff76
|
4
|
+
data.tar.gz: 94d308d83c47086800430e3c8954e068637575f7c4d9e3f4327b1f325600c8dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3630cfd6de6541c551163a34c6e513865743b3733a603a492a4328efd5a827d68925757eba5c0de3d7b095b7597f357f653a52e5040542e8e6c979c869805db
|
7
|
+
data.tar.gz: 0f80be8f0c63d8de21917913b02d83a59d6a436da223c9838b1a0421ca3317bbd5d71289fa60f5021e69d94167453c6b015d4469b61c209e05464449e1bb4034
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push, pull_request, workflow_dispatch]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby-version: ['2.7', '3.0']
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: ${{ matrix.ruby-version }}
|
18
|
+
bundler-cache: true
|
19
|
+
|
20
|
+
- name: Run tests
|
21
|
+
run: ./script/test
|
data/.standard.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,35 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.5.1
|
4
|
+
|
5
|
+
* Sprinkles two instance variables to the custom transaction manager that cribs
|
6
|
+
its implementation from ActiveRecord::TestFixtures (see f75f280)
|
7
|
+
[#88](https://github.com/testdouble/cypress-rails/issues/88)
|
8
|
+
[#89](https://github.com/testdouble/cypress-rails/pull/89)
|
9
|
+
|
10
|
+
## 0.5.0
|
11
|
+
|
12
|
+
* Add hook `after_server_start`
|
13
|
+
[#63](https://github.com/testdouble/cypress-rails/pull/63)
|
14
|
+
* Fix namespace bug
|
15
|
+
[#64](https://github.com/testdouble/cypress-rails/pull/64)
|
16
|
+
|
17
|
+
## 0.4.2
|
18
|
+
|
19
|
+
* Add support to Rails 6.1 ([#52](https://github.com/testdouble/cypress-rails/issue/52))
|
20
|
+
|
21
|
+
## 0.4.1
|
22
|
+
|
23
|
+
* Add backcompat for Ruby 2.4
|
24
|
+
([#47](https://github.com/testdouble/cypress-rails/pull/47))
|
25
|
+
|
26
|
+
## 0.4.0
|
27
|
+
|
28
|
+
* Add a `CYPRESS_RAILS_HOST` option that allows a hostname to be specified (as
|
29
|
+
opposed to 127.0.0.1). Puma will still bind to 127.0.0.1, but Cypress will use
|
30
|
+
the hostname in its `baseUrl`, which may be necessary for some folks' tests to
|
31
|
+
work
|
32
|
+
|
3
33
|
## 0.3.0
|
4
34
|
|
5
35
|
* Add a `CYPRESS_RAILS_BASE_PATH` option which will be appended to the
|
data/Gemfile.lock
CHANGED
@@ -1,55 +1,56 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cypress-rails (0.
|
4
|
+
cypress-rails (0.5.1)
|
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.
|
12
|
-
actionview (= 6.
|
13
|
-
activesupport (= 6.
|
14
|
-
rack (~> 2.0, >= 2.0.
|
11
|
+
actionpack (6.1.4)
|
12
|
+
actionview (= 6.1.4)
|
13
|
+
activesupport (= 6.1.4)
|
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.
|
19
|
-
activesupport (= 6.
|
18
|
+
actionview (6.1.4)
|
19
|
+
activesupport (= 6.1.4)
|
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.
|
24
|
+
activesupport (6.1.4)
|
25
25
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
|
-
i18n (>=
|
27
|
-
minitest (
|
28
|
-
tzinfo (~>
|
29
|
-
zeitwerk (~> 2.
|
30
|
-
ast (2.4.
|
26
|
+
i18n (>= 1.6, < 2)
|
27
|
+
minitest (>= 5.1)
|
28
|
+
tzinfo (~> 2.0)
|
29
|
+
zeitwerk (~> 2.3)
|
30
|
+
ast (2.4.2)
|
31
31
|
builder (3.2.4)
|
32
|
-
concurrent-ruby (1.1.
|
32
|
+
concurrent-ruby (1.1.9)
|
33
33
|
crass (1.0.6)
|
34
|
-
erubi (1.
|
35
|
-
i18n (1.8.
|
34
|
+
erubi (1.10.0)
|
35
|
+
i18n (1.8.10)
|
36
36
|
concurrent-ruby (~> 1.0)
|
37
|
-
|
38
|
-
loofah (2.5.0)
|
37
|
+
loofah (2.10.0)
|
39
38
|
crass (~> 1.0.2)
|
40
39
|
nokogiri (>= 1.5.9)
|
41
40
|
method_source (1.0.0)
|
42
|
-
mini_portile2 (2.
|
43
|
-
minitest (5.14.
|
44
|
-
nio4r (2.5.
|
45
|
-
nokogiri (1.
|
46
|
-
mini_portile2 (~> 2.
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
41
|
+
mini_portile2 (2.5.3)
|
42
|
+
minitest (5.14.4)
|
43
|
+
nio4r (2.5.7)
|
44
|
+
nokogiri (1.11.7)
|
45
|
+
mini_portile2 (~> 2.5.0)
|
46
|
+
racc (~> 1.4)
|
47
|
+
parallel (1.20.1)
|
48
|
+
parser (3.0.1.1)
|
49
|
+
ast (~> 2.4.1)
|
50
|
+
puma (5.3.2)
|
51
51
|
nio4r (~> 2.0)
|
52
|
-
|
52
|
+
racc (1.5.2)
|
53
|
+
rack (2.2.3)
|
53
54
|
rack-test (1.1.0)
|
54
55
|
rack (>= 1.0, < 3)
|
55
56
|
rails-dom-testing (2.0.3)
|
@@ -57,35 +58,39 @@ GEM
|
|
57
58
|
nokogiri (>= 1.6)
|
58
59
|
rails-html-sanitizer (1.3.0)
|
59
60
|
loofah (~> 2.3)
|
60
|
-
railties (6.
|
61
|
-
actionpack (= 6.
|
62
|
-
activesupport (= 6.
|
61
|
+
railties (6.1.4)
|
62
|
+
actionpack (= 6.1.4)
|
63
|
+
activesupport (= 6.1.4)
|
63
64
|
method_source
|
64
|
-
rake (>= 0.
|
65
|
-
thor (
|
65
|
+
rake (>= 0.13)
|
66
|
+
thor (~> 1.0)
|
66
67
|
rainbow (3.0.0)
|
67
|
-
rake (13.0.
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
rake (13.0.4)
|
69
|
+
regexp_parser (2.1.1)
|
70
|
+
rexml (3.2.5)
|
71
|
+
rubocop (1.18.2)
|
71
72
|
parallel (~> 1.10)
|
72
|
-
parser (>=
|
73
|
+
parser (>= 3.0.0.0)
|
73
74
|
rainbow (>= 2.2.2, < 4.0)
|
75
|
+
regexp_parser (>= 1.8, < 3.0)
|
74
76
|
rexml
|
77
|
+
rubocop-ast (>= 1.7.0, < 2.0)
|
75
78
|
ruby-progressbar (~> 1.7)
|
76
|
-
unicode-display_width (>= 1.4.0, <
|
77
|
-
rubocop-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
rubocop (
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
79
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
80
|
+
rubocop-ast (1.7.0)
|
81
|
+
parser (>= 3.0.1.1)
|
82
|
+
rubocop-performance (1.11.3)
|
83
|
+
rubocop (>= 1.7.0, < 2.0)
|
84
|
+
rubocop-ast (>= 0.4.0)
|
85
|
+
ruby-progressbar (1.11.0)
|
86
|
+
standard (1.1.4)
|
87
|
+
rubocop (= 1.18.2)
|
88
|
+
rubocop-performance (= 1.11.3)
|
89
|
+
thor (1.1.0)
|
90
|
+
tzinfo (2.0.4)
|
91
|
+
concurrent-ruby (~> 1.0)
|
92
|
+
unicode-display_width (2.0.0)
|
93
|
+
zeitwerk (2.4.2)
|
89
94
|
|
90
95
|
PLATFORMS
|
91
96
|
ruby
|
@@ -98,4 +103,4 @@ DEPENDENCIES
|
|
98
103
|
standard (>= 0.2.0)
|
99
104
|
|
100
105
|
BUNDLED WITH
|
101
|
-
2.
|
106
|
+
2.2.15
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# cypress-rails
|
2
2
|
|
3
|
-
[![CircleCI](https://circleci.com/gh/testdouble/cypress-rails/tree/
|
3
|
+
[![CircleCI](https://circleci.com/gh/testdouble/cypress-rails/tree/main.svg?style=svg)](https://circleci.com/gh/testdouble/cypress-rails/tree/main)
|
4
4
|
|
5
5
|
This is a simple gem to make it easier to start writing browser tests with
|
6
6
|
[Cypress](http://cypress.io) for your [Rails](https://rubyonrails.org) apps,
|
@@ -102,7 +102,7 @@ like:
|
|
102
102
|
return unless Rails.env.test?
|
103
103
|
|
104
104
|
CypressRails.hooks.before_server_start do
|
105
|
-
# Called once, before
|
105
|
+
# Called once, before either the transaction or the server is started
|
106
106
|
end
|
107
107
|
|
108
108
|
CypressRails.hooks.after_transaction_start do
|
@@ -120,7 +120,7 @@ end
|
|
120
120
|
|
121
121
|
(You can find [an
|
122
122
|
example
|
123
|
-
initializer](/example/
|
123
|
+
initializer](/example/config/initializers/cypress_rails_initializer.rb)
|
124
124
|
in this repo.)
|
125
125
|
|
126
126
|
The gem also provides a special route on the test server:
|
@@ -138,9 +138,9 @@ This way, you can easily instruct the server to reset its test state from your
|
|
138
138
|
Cypress tests like so:
|
139
139
|
|
140
140
|
```js
|
141
|
-
beforeEach(() =>
|
141
|
+
beforeEach(() => {
|
142
142
|
cy.request('/cypress_rails_reset_state')
|
143
|
-
)
|
143
|
+
})
|
144
144
|
```
|
145
145
|
|
146
146
|
(Remember, in Cypress, `before` is a before-all hook and `beforeEach` is run
|
@@ -158,6 +158,7 @@ preferred environment variables project-wide using a tool like
|
|
158
158
|
|
159
159
|
|
160
160
|
* **CYPRESS_RAILS_DIR** (default: `Dir.pwd`) the directory of your project
|
161
|
+
* **CYPRESS_RAILS_HOST** (default: `"127.0.0.1"`) the hostname to bind to
|
161
162
|
* **CYPRESS_RAILS_PORT** (default: _a random available port_) the port to run
|
162
163
|
the Rails test server on
|
163
164
|
* **CYPRESS_RAILS_BASE_PATH** (default: `"/"`) the base path for all Cypress's
|
@@ -169,7 +170,24 @@ preferred environment variables project-wide using a tool like
|
|
169
170
|
general this means anything done during `cypress open` or `cypress run` will
|
170
171
|
be rolled back on exit (similar to running a Rails System test)
|
171
172
|
* **CYPRESS_RAILS_CYPRESS_OPTS** (default: _none_) any options you want to
|
172
|
-
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
|
+
|
175
|
+
#### Example: Running a single spec from the command line
|
176
|
+
|
177
|
+
It's a little verbose, but an example of using the above options to run a single
|
178
|
+
Cypress test would look like this:
|
179
|
+
|
180
|
+
```
|
181
|
+
$ CYPRESS_RAILS_CYPRESS_OPTS="--spec cypress/integration/a_test.js" bin/rake cypress:run
|
182
|
+
```
|
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
|
+
```
|
173
191
|
|
174
192
|
### Initializer hooks
|
175
193
|
|
@@ -180,6 +198,11 @@ will execute before the server or any transaction has been started. If you use
|
|
180
198
|
Rails fixtures, it may make sense to load them here, so they don't need to be
|
181
199
|
re-inserted for each request
|
182
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
|
+
|
183
206
|
### after_transaction_start
|
184
207
|
|
185
208
|
If there's any custom behavior or state management you want to do inside the
|
@@ -202,6 +225,22 @@ pollute other test suites or scripts, you can use the `before_server_stop` to
|
|
202
225
|
of your test database. To set up the hook, pass a block to
|
203
226
|
`CypressRails.hooks.before_server_stop`.
|
204
227
|
|
228
|
+
## Configuring Rails
|
229
|
+
|
230
|
+
Beyond the configuration options above, you'll probably also want to disable caching
|
231
|
+
in your Rails app's [config/environments/test.rb](/example/config/environments/test.rb#L9)
|
232
|
+
file, so that changes to your Ruby code are reflected in your tests while you
|
233
|
+
work on them with `rake cypress:open`. (If either option is set to
|
234
|
+
`true`, any changes to your Ruby code will require a server restart to be reflected as you work
|
235
|
+
on your tests.)
|
236
|
+
|
237
|
+
To illustrate, here's what that might look like in `config/environments/test.rb`:
|
238
|
+
|
239
|
+
```ruby
|
240
|
+
config.cache_classes = false
|
241
|
+
config.action_view.cache_template_loading = false
|
242
|
+
```
|
243
|
+
|
205
244
|
## Setting up continuous integration
|
206
245
|
|
207
246
|
#### Circle CI
|
@@ -278,7 +317,7 @@ experience. In particular:
|
|
278
317
|
and more information dense than using Capybara and Selenium. Rather than
|
279
318
|
running a test from the command line, seeing it fail, then adding a debug
|
280
319
|
breakpoint to a test to try to manipulate the browser or tweaking a call to a
|
281
|
-
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
|
282
321
|
fixing it is usually as easy as tweaking a command, hitting save, and watching
|
283
322
|
it re-run
|
284
323
|
* With very few exceptions, a Cypress test that works in a browser window will
|
data/lib/cypress-rails/config.rb
CHANGED
@@ -1,15 +1,23 @@
|
|
1
1
|
require_relative "env"
|
2
2
|
|
3
3
|
module CypressRails
|
4
|
-
class Config
|
4
|
+
class Config
|
5
|
+
attr_accessor :dir, :host, :port, :base_path, :transactional_server, :cypress_cli_opts
|
6
|
+
|
5
7
|
def initialize(
|
6
8
|
dir: Env.fetch("CYPRESS_RAILS_DIR", default: Dir.pwd),
|
9
|
+
host: Env.fetch("CYPRESS_RAILS_HOST", default: "127.0.0.1"),
|
7
10
|
port: Env.fetch("CYPRESS_RAILS_PORT"),
|
8
11
|
base_path: Env.fetch("CYPRESS_RAILS_BASE_PATH", default: "/"),
|
9
12
|
transactional_server: Env.fetch("CYPRESS_RAILS_TRANSACTIONAL_SERVER", type: :boolean, default: true),
|
10
13
|
cypress_cli_opts: Env.fetch("CYPRESS_RAILS_CYPRESS_OPTS", default: "")
|
11
14
|
)
|
12
|
-
|
15
|
+
@dir = dir
|
16
|
+
@host = host
|
17
|
+
@port = port
|
18
|
+
@base_path = base_path
|
19
|
+
@transactional_server = transactional_server
|
20
|
+
@cypress_cli_opts = cypress_cli_opts
|
13
21
|
end
|
14
22
|
|
15
23
|
def to_s
|
@@ -18,6 +26,7 @@ module CypressRails
|
|
18
26
|
cypress-rails configuration:
|
19
27
|
============================
|
20
28
|
CYPRESS_RAILS_DIR.....................#{dir.inspect}
|
29
|
+
CYPRESS_RAILS_HOST....................#{host.inspect}
|
21
30
|
CYPRESS_RAILS_PORT....................#{port.inspect}
|
22
31
|
CYPRESS_RAILS_BASE_PATH...............#{base_path.inspect}
|
23
32
|
CYPRESS_RAILS_TRANSACTIONAL_SERVER....#{transactional_server.inspect}
|
data/lib/cypress-rails/env.rb
CHANGED
@@ -4,11 +4,8 @@ module CypressRails
|
|
4
4
|
return default unless ENV.key?(name)
|
5
5
|
|
6
6
|
if type == :boolean
|
7
|
-
|
8
|
-
|
9
|
-
else
|
10
|
-
true
|
11
|
-
end
|
7
|
+
no_like_flag = ["", "0", "n", "no", "false"].include?(ENV.fetch(name))
|
8
|
+
!no_like_flag
|
12
9
|
else
|
13
10
|
ENV.fetch(name)
|
14
11
|
end
|
data/lib/cypress-rails/init.rb
CHANGED
@@ -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
|
|
@@ -68,19 +68,10 @@ module CypressRails
|
|
68
68
|
# need to share a connection pool so that the reading connection
|
69
69
|
# can see data in the open transaction on the writing connection.
|
70
70
|
def setup_shared_connection_pool
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
ActiveRecord::
|
75
|
-
if handler != writing_handler
|
76
|
-
handler.connection_pool_list.each do |pool|
|
77
|
-
name = pool.spec.name
|
78
|
-
writing_connection = writing_handler.retrieve_connection_pool(name)
|
79
|
-
return nil unless writing_connection
|
80
|
-
handler.send(:owner_to_pool)[name] = writing_connection
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
71
|
+
@legacy_saved_pool_configs ||= Hash.new { |hash, key| hash[key] = {} }
|
72
|
+
@saved_pool_configs ||= Hash.new { |hash, key| hash[key] = {} }
|
73
|
+
|
74
|
+
ActiveRecord::TestFixtures.instance_method(:setup_shared_connection_pool).bind_call(self)
|
84
75
|
end
|
85
76
|
end
|
86
77
|
end
|
data/lib/cypress-rails/server.rb
CHANGED
@@ -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"
|
@@ -16,11 +17,11 @@ module CypressRails
|
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
19
|
-
attr_reader :app, :
|
20
|
+
attr_reader :app, :host, :port
|
20
21
|
|
21
22
|
def initialize(app,
|
23
|
+
host:,
|
22
24
|
port:,
|
23
|
-
host: "127.0.0.1",
|
24
25
|
reportable_errors: [Exception],
|
25
26
|
extra_middleware: [])
|
26
27
|
@app = app
|
@@ -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
|
|
@@ -3,10 +3,10 @@ require_relative "server"
|
|
3
3
|
|
4
4
|
module CypressRails
|
5
5
|
class StartsRailsServer
|
6
|
-
def call(port:, transactional_server:)
|
6
|
+
def call(host:, port:, transactional_server:)
|
7
7
|
configure_rails_to_run_our_state_reset_on_every_request!(transactional_server)
|
8
8
|
app = create_rack_app
|
9
|
-
Server.new(app, port: port).tap do |server|
|
9
|
+
Server.new(app, host: host, port: port).tap do |server|
|
10
10
|
server.boot
|
11
11
|
end
|
12
12
|
end
|
data/script/test
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
PS4='[script/test:${LINENO}] $ '
|
4
|
+
set -euo pipefail
|
5
|
+
set -x
|
6
|
+
|
7
|
+
echo "---> Installing dependencies"
|
8
|
+
bundle
|
9
|
+
cd example
|
10
|
+
bundle
|
11
|
+
yarn
|
12
|
+
cd ..
|
13
|
+
|
14
|
+
echo "---> Running tests"
|
15
|
+
bundle exec rake
|
16
|
+
./script/test_example_app
|
17
|
+
|
18
|
+
echo "---> Job's done!"
|
19
|
+
|
data/script/test_example_app
CHANGED
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
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.2.0
|
97
|
-
description:
|
97
|
+
description:
|
98
98
|
email:
|
99
99
|
- searls@gmail.com
|
100
100
|
executables:
|
@@ -102,7 +102,7 @@ executables:
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
-
- ".
|
105
|
+
- ".github/workflows/main.yml"
|
106
106
|
- ".gitignore"
|
107
107
|
- ".standard.yml"
|
108
108
|
- ".travis.yml"
|
@@ -137,12 +137,13 @@ files:
|
|
137
137
|
- lib/cypress-rails/starts_rails_server.rb
|
138
138
|
- lib/cypress-rails/tracks_resets.rb
|
139
139
|
- lib/cypress-rails/version.rb
|
140
|
+
- script/test
|
140
141
|
- script/test_example_app
|
141
142
|
homepage: https://github.com/testdouble/cypress-rails
|
142
143
|
licenses:
|
143
144
|
- MIT
|
144
145
|
metadata: {}
|
145
|
-
post_install_message:
|
146
|
+
post_install_message:
|
146
147
|
rdoc_options: []
|
147
148
|
require_paths:
|
148
149
|
- lib
|
@@ -157,8 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
158
|
- !ruby/object:Gem::Version
|
158
159
|
version: '0'
|
159
160
|
requirements: []
|
160
|
-
rubygems_version: 3.
|
161
|
-
signing_key:
|
161
|
+
rubygems_version: 3.2.15
|
162
|
+
signing_key:
|
162
163
|
specification_version: 4
|
163
164
|
summary: Helps you write Cypress tests of your Rails app
|
164
165
|
test_files: []
|
data/.circleci/config.yml
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
version: 2
|
2
|
-
jobs:
|
3
|
-
build:
|
4
|
-
docker:
|
5
|
-
- image: circleci/ruby:2.6-node-browsers
|
6
|
-
steps:
|
7
|
-
- checkout
|
8
|
-
|
9
|
-
# Bundle install dependencies
|
10
|
-
- type: cache-restore
|
11
|
-
key: v1-main-{{ checksum "Gemfile.lock" }}
|
12
|
-
|
13
|
-
- run: gem install bundler --version `tail -1 Gemfile.lock`
|
14
|
-
- run: bundle install --path vendor/bundle
|
15
|
-
|
16
|
-
- type: cache-save
|
17
|
-
key: v1-main-{{ checksum "Gemfile.lock" }}
|
18
|
-
paths:
|
19
|
-
- vendor/bundle
|
20
|
-
|
21
|
-
# Bundle install dependencies for example app
|
22
|
-
- type: cache-restore
|
23
|
-
key: v1-example-{{ checksum "example/an_app/Gemfile.lock" }}
|
24
|
-
|
25
|
-
- run: |
|
26
|
-
cd example/an_app
|
27
|
-
bundle install --path vendor/bundle
|
28
|
-
|
29
|
-
- type: cache-save
|
30
|
-
key: v1-example-{{ checksum "example/an_app/Gemfile.lock" }}
|
31
|
-
paths:
|
32
|
-
- example/an_app/vendor/bundle
|
33
|
-
|
34
|
-
# Yarn dependencies
|
35
|
-
- restore_cache:
|
36
|
-
keys:
|
37
|
-
- v2-yarn-{{ checksum "example/an_app/package.json" }}
|
38
|
-
# fallback to using the latest cache if no exact match is found
|
39
|
-
- v2-yarn-
|
40
|
-
|
41
|
-
- run: |
|
42
|
-
cd example/an_app
|
43
|
-
yarn install
|
44
|
-
|
45
|
-
- save_cache:
|
46
|
-
paths:
|
47
|
-
- example/an_app/node_modules
|
48
|
-
- ~/.cache
|
49
|
-
key: v2-yarn-{{ checksum "example/an_app/package.json" }}
|
50
|
-
|
51
|
-
- run: bundle exec rake
|
52
|
-
- run: ./script/test_example_app
|
53
|
-
|