cypress-rails 0.5.3 → 0.6.1

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: efaf85898e684adf953cc9951a47fd6c97dde338cb0b5719ed6686dcb7b2b19b
4
- data.tar.gz: 3685cd5e6be4e515c65da1c4b756e8847ead9899936fd0925b97145332b7b977
3
+ metadata.gz: 24eb8b9afcb78821b2291a9f649aa23289be2de7b7e301aa04bbc521af73f5d6
4
+ data.tar.gz: 76d178ce43355d9072d400101bf7e2166e84124e20e406b785b1d3983a5c7f5e
5
5
  SHA512:
6
- metadata.gz: '088fbf9e266da8d373d4e8f2b70635dc80956bc38a22c28b74555ed0e5ecf0774188bcf9e35f4d612dbdb4ea94f7c904da82b06c21162a9390edccde254328d4'
7
- data.tar.gz: 327e0a512b34dfa1157465b77d42a4150cf54d2a93e03ef1f342b388bb5e0dfd9a95d9b30a1b707d3ac819c113d0c9a3cd84f612e71b4e4d55b3d3aced211b8a
6
+ metadata.gz: de8f996a5e27aa4788c5fcf496b6c48d486261b343bb914ed0a55399c1560499642cf9413faa39bad17db08cb29fda94d91ecb4ec03539ae7a495380ef8d4d2b
7
+ data.tar.gz: c12bdc03096784182c2aa048e96386e8ce3ca8742eed24d1c1b0a0dcbcf438270f53a1d07d721d17eee85d9b950633d705760a519a7441811a9c5f6a0da23529
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.6.1
4
+
5
+ * Fix a deprecation warning in Rails
6
+ [#157](https://github.com/testdouble/cypress-rails/pull/157)
7
+
8
+ ## 0.6.0
9
+
10
+ * Update initializer task to generate valid Cypress v10+ configurations
11
+ [#156](https://github.com/testdouble/cypress-rails/pull/156)
12
+
13
+ ## 0.5.5
14
+
15
+ * Add Puma 6 support
16
+ [#136](https://github.com/testdouble/cypress-rails/pull/136)
17
+
18
+ ## 0.5.4
19
+
20
+ * Fix Rails 5 support
21
+ [#126](https://github.com/testdouble/cypress-rails/pull/126)
22
+
3
23
  ## 0.5.3
4
24
 
5
25
  * Fix 2.5 & 2.6 compatibility
data/Gemfile.lock CHANGED
@@ -1,96 +1,98 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cypress-rails (0.5.3)
4
+ cypress-rails (0.6.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.1.4.1)
12
- actionview (= 6.1.4.1)
13
- activesupport (= 6.1.4.1)
14
- rack (~> 2.0, >= 2.0.9)
11
+ actionpack (7.0.6)
12
+ actionview (= 7.0.6)
13
+ activesupport (= 7.0.6)
14
+ rack (~> 2.0, >= 2.2.4)
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.4.1)
19
- activesupport (= 6.1.4.1)
18
+ actionview (7.0.6)
19
+ activesupport (= 7.0.6)
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.4.1)
24
+ activesupport (7.0.6)
25
25
  concurrent-ruby (~> 1.0, >= 1.0.2)
26
26
  i18n (>= 1.6, < 2)
27
27
  minitest (>= 5.1)
28
28
  tzinfo (~> 2.0)
29
- zeitwerk (~> 2.3)
30
29
  ast (2.4.2)
31
30
  builder (3.2.4)
32
- concurrent-ruby (1.1.9)
31
+ concurrent-ruby (1.2.2)
33
32
  crass (1.0.6)
34
- erubi (1.10.0)
35
- i18n (1.8.10)
33
+ erubi (1.12.0)
34
+ i18n (1.14.1)
36
35
  concurrent-ruby (~> 1.0)
37
- loofah (2.12.0)
36
+ loofah (2.21.3)
38
37
  crass (~> 1.0.2)
39
- nokogiri (>= 1.5.9)
38
+ nokogiri (>= 1.12.0)
40
39
  method_source (1.0.0)
41
- mini_portile2 (2.6.1)
42
- minitest (5.14.4)
43
- nio4r (2.5.8)
44
- nokogiri (1.12.4)
45
- mini_portile2 (~> 2.6.1)
40
+ mini_portile2 (2.8.2)
41
+ minitest (5.15.0)
42
+ nio4r (2.5.9)
43
+ nokogiri (1.15.3)
44
+ mini_portile2 (~> 2.8.2)
46
45
  racc (~> 1.4)
47
- parallel (1.20.1)
48
- parser (3.0.1.1)
46
+ parallel (1.22.1)
47
+ parser (3.1.2.0)
49
48
  ast (~> 2.4.1)
50
- puma (5.4.0)
49
+ puma (6.3.0)
51
50
  nio4r (~> 2.0)
52
- racc (1.5.2)
53
- rack (2.2.3)
54
- rack-test (1.1.0)
55
- rack (>= 1.0, < 3)
56
- rails-dom-testing (2.0.3)
57
- activesupport (>= 4.2.0)
51
+ racc (1.7.1)
52
+ rack (2.2.7)
53
+ rack-test (2.1.0)
54
+ rack (>= 1.3)
55
+ rails-dom-testing (2.1.1)
56
+ activesupport (>= 5.0.0)
57
+ minitest
58
58
  nokogiri (>= 1.6)
59
- rails-html-sanitizer (1.4.2)
60
- loofah (~> 2.3)
61
- railties (6.1.4.1)
62
- actionpack (= 6.1.4.1)
63
- activesupport (= 6.1.4.1)
59
+ rails-html-sanitizer (1.6.0)
60
+ loofah (~> 2.21)
61
+ nokogiri (~> 1.14)
62
+ railties (7.0.6)
63
+ actionpack (= 7.0.6)
64
+ activesupport (= 7.0.6)
64
65
  method_source
65
- rake (>= 0.13)
66
+ rake (>= 12.2)
66
67
  thor (~> 1.0)
67
- rainbow (3.0.0)
68
- rake (13.0.4)
69
- regexp_parser (2.1.1)
68
+ zeitwerk (~> 2.5)
69
+ rainbow (3.1.1)
70
+ rake (13.0.6)
71
+ regexp_parser (2.4.0)
70
72
  rexml (3.2.5)
71
- rubocop (1.18.2)
73
+ rubocop (1.29.1)
72
74
  parallel (~> 1.10)
73
- parser (>= 3.0.0.0)
75
+ parser (>= 3.1.0.0)
74
76
  rainbow (>= 2.2.2, < 4.0)
75
77
  regexp_parser (>= 1.8, < 3.0)
76
- rexml
77
- rubocop-ast (>= 1.7.0, < 2.0)
78
+ rexml (>= 3.2.5, < 4.0)
79
+ rubocop-ast (>= 1.17.0, < 2.0)
78
80
  ruby-progressbar (~> 1.7)
79
81
  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)
82
+ rubocop-ast (1.18.0)
83
+ parser (>= 3.1.1.0)
84
+ rubocop-performance (1.13.3)
83
85
  rubocop (>= 1.7.0, < 2.0)
84
86
  rubocop-ast (>= 0.4.0)
85
87
  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)
88
+ standard (1.12.1)
89
+ rubocop (= 1.29.1)
90
+ rubocop-performance (= 1.13.3)
91
+ thor (1.2.2)
92
+ tzinfo (2.0.6)
91
93
  concurrent-ruby (~> 1.0)
92
- unicode-display_width (2.0.0)
93
- zeitwerk (2.4.2)
94
+ unicode-display_width (2.1.0)
95
+ zeitwerk (2.6.8)
94
96
 
95
97
  PLATFORMS
96
98
  ruby
@@ -103,4 +105,4 @@ DEPENDENCIES
103
105
  standard (>= 0.2.0)
104
106
 
105
107
  BUNDLED WITH
106
- 2.2.15
108
+ 2.3.13
data/README.md CHANGED
@@ -50,7 +50,7 @@ Once installed, you'll want to run:
50
50
  $ rake cypress:init
51
51
  ```
52
52
 
53
- This will override a few configurations in your `cypress.json` configuration
53
+ This will override a few configurations in your `cypress.config.js` configuration
54
54
  file.
55
55
 
56
56
  ## Usage
@@ -161,7 +161,7 @@ preferred environment variables project-wide using a tool like
161
161
  the Rails test server on
162
162
  * **CYPRESS_RAILS_BASE_PATH** (default: `"/"`) the base path for all Cypress's
163
163
  requests to the app (e.g. via `cy.visit()`). If you've customized your
164
- `baseUrl` setting (e.g. in `cypress.json`), you'll need to duplicate it with
164
+ `baseUrl` setting (e.g. in `cypress.config.js`), you'll need to duplicate it with
165
165
  this environment variable
166
166
  * **CYPRESS_RAILS_TRANSACTIONAL_SERVER** (default: `true`) when true, will start
167
167
  a transaction on all database connections before launching the server. In
@@ -11,6 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = "Helps you write Cypress tests of your Rails app"
12
12
  spec.homepage = "https://github.com/testdouble/cypress-rails"
13
13
  spec.license = "MIT"
14
+ spec.metadata["rubygems_mfa_required"] = "true"
14
15
 
15
16
  # Specify which files should be added to the gem when it is released.
16
17
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -1,30 +1,32 @@
1
1
  module CypressRails
2
2
  class Init
3
- DEFAULT_CONFIG = {
4
- "screenshotsFolder" => "tmp/cypress_screenshots",
5
- "videosFolder" => "tmp/cypress_videos",
6
- "trashAssetsBeforeRuns" => false
7
- }
3
+ DEFAULT_CONFIG = <<~JS
4
+ const { defineConfig } = require('cypress')
8
5
 
9
- def call(dir = Dir.pwd)
10
- config_path = File.join(dir, "cypress.json")
11
- json = JSON.pretty_generate(determine_new_config(config_path))
12
- File.write(config_path, json)
13
- puts "Cypress config (re)initialized in #{config_path}"
14
- end
15
-
16
- private
6
+ module.exports = defineConfig({
7
+ // setupNodeEvents can be defined in either
8
+ // the e2e or component configuration
9
+ e2e: {
10
+ setupNodeEvents(on, config) {
11
+ on('before:browser:launch', (browser = {}, launchOptions) => {
12
+ /* ... */
13
+ })
14
+ },
15
+ },
16
+ screenshotsFolder: "tmp/cypress_screenshots",
17
+ videosFolder: "tmp/cypress_videos",
18
+ trashAssetsBeforeRuns: false
19
+ })
20
+ JS
17
21
 
18
- def determine_new_config(config_path)
19
- if File.exist?(config_path)
20
- merge_existing_with_defaults(config_path)
22
+ def call(dir = Dir.pwd)
23
+ config_path = File.join(dir, "cypress.config.js")
24
+ if !File.exist?(config_path)
25
+ File.write(config_path, DEFAULT_CONFIG)
26
+ puts "Cypress config initialized in `#{config_path}'"
21
27
  else
22
- DEFAULT_CONFIG
28
+ warn "Cypress config already exists in `#{config_path}'. Skipping."
23
29
  end
24
30
  end
25
-
26
- def merge_existing_with_defaults(json_path)
27
- JSON.parse(File.read(json_path)).merge(DEFAULT_CONFIG).sort.to_h
28
- end
29
31
  end
30
32
  end
@@ -46,7 +46,7 @@ module CypressRails
46
46
  end
47
47
  @connections.clear
48
48
 
49
- ActiveRecord::Base.clear_active_connections!
49
+ ActiveRecord::Base.connection_handler.clear_active_connections!
50
50
  end
51
51
 
52
52
  private
@@ -68,6 +68,7 @@ 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
+ return unless ActiveRecord::TestFixtures.respond_to?(:setup_shared_connection_pool)
71
72
  @legacy_saved_pool_configs ||= Hash.new { |hash, key| hash[key] = {} }
72
73
  @saved_pool_configs ||= Hash.new { |hash, key| hash[key] = {} }
73
74
 
@@ -1,7 +1,7 @@
1
1
  require "pathname"
2
2
  CLI = Pathname.new(File.dirname(__FILE__)).join("../../exe/cypress-rails")
3
3
 
4
- desc "Initialize cypress.json"
4
+ desc "Initialize cypress.config.js"
5
5
  task :"cypress:init" do
6
6
  system "#{CLI} init"
7
7
  end
@@ -12,18 +12,18 @@ module CypressRails
12
12
 
13
13
  conf = Rack::Handler::Puma.config(app, options)
14
14
  conf.clamp
15
- events = ::Puma::Events.stdio
15
+ logger = (defined?(::Puma::LogWriter) ? ::Puma::LogWriter : ::Puma::Events).stdio
16
16
 
17
17
  puma_ver = Gem::Version.new(::Puma::Const::PUMA_VERSION)
18
18
  require_relative "patches/puma_ssl" if (Gem::Version.new("4.0.0")...Gem::Version.new("4.1.0")).cover? puma_ver
19
19
 
20
- events.log "Starting Puma..."
21
- events.log "* Version #{::Puma::Const::PUMA_VERSION} , codename: #{::Puma::Const::CODE_NAME}"
22
- events.log "* Min threads: #{conf.options[:min_threads]}, max threads: #{conf.options[:max_threads]}"
20
+ logger.log "Starting Puma..."
21
+ logger.log "* Version #{::Puma::Const::PUMA_VERSION} , codename: #{::Puma::Const::CODE_NAME}"
22
+ logger.log "* Min threads: #{conf.options[:min_threads]}, max threads: #{conf.options[:max_threads]}"
23
23
 
24
- ::Puma::Server.new(conf.app, events, conf.options).tap do |s|
25
- s.binder.parse conf.options[:binds], s.events
26
- s.min_threads, s.max_threads = conf.options[:min_threads], conf.options[:max_threads]
24
+ ::Puma::Server.new(conf.app, defined?(::Puma::LogWriter) ? nil : logger, conf.options).tap do |s|
25
+ s.binder.parse conf.options[:binds], s.respond_to?(:log_writer) ? s.log_writer : s.events
26
+ s.min_threads, s.max_threads = conf.options[:min_threads], conf.options[:max_threads] if s.respond_to?(:min_threads=)
27
27
  end.run.join
28
28
  end
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module CypressRails
2
- VERSION = "0.5.3"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -10,6 +10,7 @@ yarn install
10
10
 
11
11
  # test a normal test run
12
12
  bundle exec rake db:test:prepare
13
+ NODE_OPTIONS=--openssl-legacy-provider RAILS_ENV=test bundle exec rake assets:precompile
13
14
  bundle exec rake cypress:run
14
15
 
15
16
  # test that passing options works (by printing help)
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.5.3
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-17 00:00:00.000000000 Z
11
+ date: 2023-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -142,7 +142,8 @@ files:
142
142
  homepage: https://github.com/testdouble/cypress-rails
143
143
  licenses:
144
144
  - MIT
145
- metadata: {}
145
+ metadata:
146
+ rubygems_mfa_required: 'true'
146
147
  post_install_message:
147
148
  rdoc_options: []
148
149
  require_paths:
@@ -158,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
159
  - !ruby/object:Gem::Version
159
160
  version: '0'
160
161
  requirements: []
161
- rubygems_version: 3.2.15
162
+ rubygems_version: 3.4.14
162
163
  signing_key:
163
164
  specification_version: 4
164
165
  summary: Helps you write Cypress tests of your Rails app