cypress-on-rails 1.15.1 → 1.17.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 +4 -4
- data/.gitignore +2 -1
- data/CHANGELOG.md +17 -0
- data/README.md +71 -27
- data/cypress-on-rails.gemspec +1 -1
- data/lib/cypress_on_rails/configuration.rb +2 -0
- data/lib/cypress_on_rails/middleware.rb +5 -0
- data/lib/cypress_on_rails/simple_rails_factory.rb +0 -2
- data/lib/cypress_on_rails/version.rb +1 -1
- data/lib/generators/cypress_on_rails/install_generator.rb +31 -29
- data/lib/generators/cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb +10 -1
- data/lib/generators/cypress_on_rails/templates/spec/cypress/support/on-rails.js +6 -0
- data/spec/cypress_on_rails/configuration_spec.rb +4 -0
- data/specs_e2e/rails_3_2/test.sh +14 -7
- data/specs_e2e/rails_4_2/.gitignore +1 -0
- data/specs_e2e/rails_4_2/package.json +4 -2
- data/specs_e2e/rails_4_2/playwright-report/index.html +62 -0
- data/specs_e2e/rails_4_2/spec/fixtures/vcr_cassettes/cats.yml +63 -0
- data/specs_e2e/rails_4_2/test.sh +13 -7
- data/specs_e2e/rails_5_2/.gitignore +4 -0
- data/specs_e2e/rails_5_2/test.sh +16 -7
- metadata +8 -7
- data/lib/generators/cypress_on_rails/update_generator.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c9e7d196e802c6bc10ed4a31fdfc868d92a4f059452e3315fa6c2b525f0ff17
|
4
|
+
data.tar.gz: 7378fe702963ed71a808dcdcf518c60519ef5c0149211b1e7e8692823dbb3796
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49c39f927764cab07fd2e1e7dd5c73773a60ce3c515666267fc8602e00b233c0d18f905653df742acb56c16ab594c7c463b13d66e71cde04be5ba785555c3150
|
7
|
+
data.tar.gz: 39701b20ce5fa8024fc9672dd49bbe6f66445d50f45764a22ad18068684595ebb5bd87f6b9a7d031b84df36cb5c705d1f808e056482f11c79247c4b9cd8ccbb4
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
## [1.17.0]
|
2
|
+
[Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.16.0...v1.17.0
|
3
|
+
|
4
|
+
### Changed
|
5
|
+
* Removed the update generator and reduced options for install generator [PR 149](https://github.com/shakacode/cypress-on-rails/pull/149)
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
* fix update index.js in install generator [PR 147](https://github.com/shakacode/cypress-on-rails/pull/147) by [Judahmeek]
|
9
|
+
* Support rails 7.1 by adding content-type header to generated on-rails.js file [PR 148](https://github.com/shakacode/cypress-on-rails/pull/148) by [anark]
|
10
|
+
* Rewind body before reading it [PR 150](https://github.com/shakacode/cypress-on-rails/pull/150)
|
11
|
+
|
12
|
+
## [1.16.0]
|
13
|
+
[Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.15.1...v1.16.0
|
14
|
+
|
15
|
+
### Added
|
16
|
+
* Add support for `before_request` options on the middleware, for authentication [PR 138](https://github.com/shakacode/cypress-on-rails/pull/138) by [RomainEndelin]
|
17
|
+
|
1
18
|
## [1.15.1]
|
2
19
|
[Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.15.0...v1.15.1
|
3
20
|
|
data/README.md
CHANGED
@@ -61,46 +61,43 @@ Generate the boilerplate code using:
|
|
61
61
|
# by default installs only cypress
|
62
62
|
bin/rails g cypress_on_rails:install
|
63
63
|
|
64
|
-
# if you have/want a different cypress folder (default is
|
65
|
-
bin/rails g cypress_on_rails:install --
|
64
|
+
# if you have/want a different cypress folder (default is e2e)
|
65
|
+
bin/rails g cypress_on_rails:install --install_folder=spec/cypress
|
66
66
|
|
67
|
-
# to install
|
68
|
-
bin/rails g cypress_on_rails:install --
|
69
|
-
|
70
|
-
# to change where the Ruby files reside (default is e2e)
|
71
|
-
bin/rails g cypress_on_rails:install --install_folder=test/e2e
|
67
|
+
# to install playwright instead of cypress
|
68
|
+
bin/rails g cypress_on_rails:install --framework playwright
|
72
69
|
|
73
70
|
# if you target the Rails server with a path prefix to your URL
|
74
71
|
bin/rails g cypress_on_rails:install --api_prefix=/api
|
75
72
|
|
76
|
-
# if you want to install
|
77
|
-
bin/rails g cypress_on_rails:install --
|
73
|
+
# if you want to install with npm instead
|
74
|
+
bin/rails g cypress_on_rails:install --install_with=npm
|
78
75
|
|
79
76
|
# if you already have cypress installed globally
|
80
|
-
bin/rails g cypress_on_rails:install --
|
77
|
+
bin/rails g cypress_on_rails:install --install_with=skip
|
81
78
|
|
82
79
|
# to update the generated files run
|
83
|
-
bin/rails g cypress_on_rails:
|
80
|
+
bin/rails g cypress_on_rails:install --install_with=skip
|
84
81
|
```
|
85
82
|
|
86
83
|
The generator modifies/adds the following files/directory in your application:
|
87
84
|
* `config/initializers/cypress_on_rails.rb` used to configure Cypress on Rails
|
88
|
-
* `
|
89
|
-
* `
|
90
|
-
* `
|
91
|
-
* `
|
92
|
-
* `
|
93
|
-
* `
|
85
|
+
* `e2e/cypress/integration/` contains your cypress tests
|
86
|
+
* `e2e/cypress/support/on-rails.js` contains Cypress on Rails support code
|
87
|
+
* `e2e/cypress/e2e_helper.rb` contains helper code to require libraries like factory_bot
|
88
|
+
* `e2e/cypress/app_commands/` contains your scenario definitions
|
89
|
+
* `e2e/playwright/e2e/` contains your playwright tests
|
90
|
+
* `e2e/playwright/support/on-rails.js` contains Playwright on Rails support code
|
94
91
|
|
95
|
-
If you are not using `database_cleaner` look at `
|
96
|
-
If you are not using `factory_bot` look at `
|
92
|
+
If you are not using `database_cleaner` look at `e2e/cypress/app_commands/clean.rb`.
|
93
|
+
If you are not using `factory_bot` look at `e2e/cypress/app_commands/factory_bot.rb`.
|
97
94
|
|
98
95
|
Now you can create scenarios and commands that are plain Ruby files that get loaded through middleware, the ruby sky is your limit.
|
99
96
|
|
100
97
|
### Update your database.yml
|
101
98
|
|
102
|
-
When
|
103
|
-
make are picked up without having to restart
|
99
|
+
When writing and running tests on your local computer it's recommended to start your server in development mode so that changes you
|
100
|
+
make are picked up without having to restart your local server.
|
104
101
|
It's recommended you update your `database.yml` to check if the `CYPRESS` environment variable is set and switch it to the test database
|
105
102
|
otherwise cypress will keep clearing your development database.
|
106
103
|
|
@@ -127,11 +124,9 @@ Getting started on your local environment
|
|
127
124
|
CYPRESS=1 bin/rails server -p 5017
|
128
125
|
|
129
126
|
# in separate window start cypress
|
130
|
-
yarn cypress open
|
127
|
+
yarn cypress open --project ./e2e
|
131
128
|
# or for npm
|
132
|
-
|
133
|
-
# or if you changed the cypress folder to spec/cypress
|
134
|
-
yarn cypress open --project ./spec
|
129
|
+
npx cypress open --project ./e2e
|
135
130
|
# or for playwright
|
136
131
|
yarn playwright test --ui
|
137
132
|
# or using npm
|
@@ -144,9 +139,9 @@ How to run cypress on CI
|
|
144
139
|
# setup rails and start server in background
|
145
140
|
# ...
|
146
141
|
|
147
|
-
yarn run cypress run
|
142
|
+
yarn run cypress run --project ./e2e
|
148
143
|
# or for npm
|
149
|
-
npx cypress run
|
144
|
+
npx cypress run --project ./e2e
|
150
145
|
```
|
151
146
|
|
152
147
|
### Example of using factory bot
|
@@ -395,6 +390,47 @@ describe('My First Test', () => {
|
|
395
390
|
})
|
396
391
|
```
|
397
392
|
|
393
|
+
## `before_request` configuration
|
394
|
+
|
395
|
+
You may perform any custom action before running a CypressOnRails command, such as authentication, or sending metrics. Please set `before_request` as part of the CypressOnRails configuration.
|
396
|
+
|
397
|
+
You should get familiar with [Rack middlewares](https://www.rubyguides.com/2018/09/rack-middleware/).
|
398
|
+
If your function returns a `[status, header, body]` response, CypressOnRails will halt, and your command will not be executed. To execute the command, `before_request` should return `nil`.
|
399
|
+
|
400
|
+
### Authenticate CypressOnRails
|
401
|
+
|
402
|
+
```ruby
|
403
|
+
CypressOnRails.configure do |c|
|
404
|
+
# ...
|
405
|
+
|
406
|
+
# Refer to https://www.rubydoc.info/gems/rack/Rack/Request for the `request` argument.
|
407
|
+
c.before_request = lambda { |request|
|
408
|
+
body = JSON.parse(request.body.string)
|
409
|
+
if body['cypress_token'] != ENV.fetch('SWEEP_CYPRESS_SECRET_TOKEN')
|
410
|
+
# You may also use warden for authentication:
|
411
|
+
# if !request.env['warden'].authenticate(:secret_key)
|
412
|
+
return [401, {}, ['unauthorized']]
|
413
|
+
end
|
414
|
+
|
415
|
+
}
|
416
|
+
end
|
417
|
+
```
|
418
|
+
|
419
|
+
### Send usage metrics
|
420
|
+
|
421
|
+
```ruby
|
422
|
+
CypressOnRails.configure do |c|
|
423
|
+
# ...
|
424
|
+
|
425
|
+
# Refer to https://www.rubydoc.info/gems/rack/Rack/Request for the `request` argument.
|
426
|
+
c.before_request = lambda { |request|
|
427
|
+
statsd = Datadog::Statsd.new('localhost', 8125)
|
428
|
+
|
429
|
+
statsd.increment('cypress_on_rails.requests')
|
430
|
+
}
|
431
|
+
end
|
432
|
+
```
|
433
|
+
|
398
434
|
## Usage with other rack applications
|
399
435
|
|
400
436
|
Add CypressOnRails to your config.ru
|
@@ -422,6 +458,9 @@ Cypress.Commands.add('appCommands', (body) => {
|
|
422
458
|
method: 'POST',
|
423
459
|
url: '/__cypress__/command',
|
424
460
|
body: JSON.stringify(body),
|
461
|
+
headers: {
|
462
|
+
'Content-Type': 'application/json; charset=utf-8',
|
463
|
+
},
|
425
464
|
log: true,
|
426
465
|
failOnStatusCode: true
|
427
466
|
})
|
@@ -477,6 +516,11 @@ In `config/initializers/cypress_on_rails.rb`, add this line:
|
|
477
516
|
<img alt="ScoutAPM" src="https://user-images.githubusercontent.com/4244251/184881152-9f2d8fba-88ac-4ba6-873b-22387f8711c5.png" height="120px">
|
478
517
|
</picture>
|
479
518
|
</a>
|
519
|
+
<a href="https://controlplane.com">
|
520
|
+
<picture>
|
521
|
+
<img alt="Control Plane" src="https://github.com/shakacode/.github/assets/20628911/90babd87-62c4-4de3-baa4-3d78ef4bec25" height="120px">
|
522
|
+
</picture>
|
523
|
+
</a>
|
480
524
|
<br />
|
481
525
|
<a href="https://www.browserstack.com">
|
482
526
|
<picture>
|
data/cypress-on-rails.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_development_dependency 'rake'
|
20
20
|
s.add_development_dependency 'rspec'
|
21
21
|
s.add_development_dependency 'railties', '>= 3.2'
|
22
|
-
s.add_development_dependency 'factory_bot'
|
22
|
+
s.add_development_dependency 'factory_bot', '!= 6.4.5'
|
23
23
|
s.add_development_dependency 'vcr'
|
24
24
|
s.metadata = {
|
25
25
|
"bug_tracker_uri" => "https://github.com/shakacode/cypress-on-rails/issues",
|
@@ -6,6 +6,7 @@ module CypressOnRails
|
|
6
6
|
attr_accessor :install_folder
|
7
7
|
attr_accessor :use_middleware
|
8
8
|
attr_accessor :use_vcr_middleware
|
9
|
+
attr_accessor :before_request
|
9
10
|
attr_accessor :logger
|
10
11
|
|
11
12
|
# Attributes for backwards compatibility
|
@@ -30,6 +31,7 @@ module CypressOnRails
|
|
30
31
|
self.install_folder = 'spec/e2e'
|
31
32
|
self.use_middleware = true
|
32
33
|
self.use_vcr_middleware = false
|
34
|
+
self.before_request = -> (request) {}
|
33
35
|
self.logger = Logger.new(STDOUT)
|
34
36
|
end
|
35
37
|
|
@@ -47,6 +47,11 @@ module CypressOnRails
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def handle_command(req)
|
50
|
+
maybe_env = configuration.before_request.call(req)
|
51
|
+
# Halt the middleware if an Rack Env was returned by `before_request`
|
52
|
+
return maybe_env unless maybe_env.nil?
|
53
|
+
|
54
|
+
req.body.rewind
|
50
55
|
body = JSON.parse(req.body.read)
|
51
56
|
logger.info "handle_command: #{body}"
|
52
57
|
commands = Command.from_body(body, configuration)
|
@@ -1,12 +1,9 @@
|
|
1
1
|
module CypressOnRails
|
2
2
|
class InstallGenerator < Rails::Generators::Base
|
3
3
|
class_option :api_prefix, type: :string, default: ''
|
4
|
+
class_option :framework, type: :string, default: 'cypress'
|
4
5
|
class_option :install_folder, type: :string, default: 'e2e'
|
5
|
-
class_option :install_cypress, type: :boolean, default: true
|
6
|
-
class_option :install_playwright, type: :boolean, default: false
|
7
6
|
class_option :install_with, type: :string, default: 'yarn'
|
8
|
-
class_option :cypress_folder, type: :string, default: 'cypress'
|
9
|
-
class_option :playwright_folder, type: :string, default: 'playwright'
|
10
7
|
class_option :experimental, type: :boolean, default: false
|
11
8
|
source_root File.expand_path('../templates', __FILE__)
|
12
9
|
|
@@ -17,10 +14,11 @@ module CypressOnRails
|
|
17
14
|
|
18
15
|
command = nil
|
19
16
|
packages = []
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
packages = if options.framework == 'cypress'
|
18
|
+
['cypress', 'cypress-on-rails']
|
19
|
+
elsif options.framework == 'playwright'
|
20
|
+
['playwright', '@playwright/test']
|
21
|
+
end
|
24
22
|
if options.install_with == 'yarn'
|
25
23
|
command = "yarn --cwd=#{install_dir} add #{packages.join(' ')} --dev"
|
26
24
|
elsif options.install_with == 'npm'
|
@@ -31,38 +29,42 @@ module CypressOnRails
|
|
31
29
|
fail "failed to install #{packages.join(' ')}" unless system(command)
|
32
30
|
end
|
33
31
|
|
34
|
-
if options.
|
35
|
-
template "spec/cypress/support/index.js.erb", "#{options.
|
36
|
-
copy_file "spec/cypress/support/commands.js", "#{options.
|
37
|
-
copy_file "spec/cypress.config.js", "#{options.
|
32
|
+
if options.framework == 'cypress'
|
33
|
+
template "spec/cypress/support/index.js.erb", "#{options.install_folder}/cypress/support/index.js"
|
34
|
+
copy_file "spec/cypress/support/commands.js", "#{options.install_folder}/cypress/support/commands.js"
|
35
|
+
copy_file "spec/cypress.config.js", "#{options.install_folder}/cypress.config.js"
|
38
36
|
end
|
39
|
-
if options.
|
40
|
-
template "spec/playwright/support/index.js.erb", "#{options.
|
41
|
-
copy_file "spec/playwright.config.js", "#{options.
|
37
|
+
if options.framework == 'playwright'
|
38
|
+
template "spec/playwright/support/index.js.erb", "#{options.install_folder}/playwright/support/index.js"
|
39
|
+
copy_file "spec/playwright.config.js", "#{options.install_folder}/playwright.config.js"
|
42
40
|
end
|
43
41
|
end
|
44
42
|
|
45
43
|
def add_initial_files
|
46
44
|
template "config/initializers/cypress_on_rails.rb.erb", "config/initializers/cypress_on_rails.rb"
|
47
|
-
template "spec/e2e/e2e_helper.rb.erb", "#{options.install_folder}/e2e_helper.rb"
|
48
|
-
directory 'spec/e2e/app_commands', "#{options.install_folder}/app_commands"
|
49
|
-
if options.
|
50
|
-
copy_file "spec/cypress/support/on-rails.js", "#{options.
|
51
|
-
directory 'spec/cypress/e2e/rails_examples', "#{options.
|
45
|
+
template "spec/e2e/e2e_helper.rb.erb", "#{options.install_folder}/#{options.framework}/e2e_helper.rb"
|
46
|
+
directory 'spec/e2e/app_commands', "#{options.install_folder}/#{options.framework}/app_commands"
|
47
|
+
if options.framework == 'cypress'
|
48
|
+
copy_file "spec/cypress/support/on-rails.js", "#{options.install_folder}/cypress/support/on-rails.js"
|
49
|
+
directory 'spec/cypress/e2e/rails_examples', "#{options.install_folder}/cypress/e2e/rails_examples"
|
52
50
|
end
|
53
|
-
if options.
|
54
|
-
copy_file "spec/playwright/support/on-rails.js", "#{options.
|
55
|
-
directory 'spec/playwright/e2e/rails_examples', "#{options.
|
51
|
+
if options.framework == 'playwright'
|
52
|
+
copy_file "spec/playwright/support/on-rails.js", "#{options.install_folder}/playwright/support/on-rails.js"
|
53
|
+
directory 'spec/playwright/e2e/rails_examples', "#{options.install_folder}/playwright/e2e/rails_examples"
|
56
54
|
end
|
57
55
|
end
|
58
56
|
|
59
57
|
def update_files
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
58
|
+
if options.framework == 'cypress'
|
59
|
+
append_to_file "#{options.install_folder}/cypress/support/index.js",
|
60
|
+
"\nimport './on-rails'",
|
61
|
+
after: 'import \'./commands\''
|
62
|
+
end
|
63
|
+
if options.framework == 'playwright'
|
64
|
+
append_to_file "#{options.install_folder}/playwright/support/index.js",
|
65
|
+
"\nimport './on-rails'",
|
66
|
+
after: '// Import commands.js using ES2015 syntax:'
|
67
|
+
end
|
66
68
|
end
|
67
69
|
end
|
68
70
|
end
|
@@ -1,12 +1,21 @@
|
|
1
1
|
if defined?(CypressOnRails)
|
2
2
|
CypressOnRails.configure do |c|
|
3
3
|
c.api_prefix = "<%= options.api_prefix %>"
|
4
|
-
c.install_folder = File.expand_path("#{__dir__}/../../<%= options.install_folder %>")
|
4
|
+
c.install_folder = File.expand_path("#{__dir__}/../../<%= options.install_folder %>/<%= options.framework %>")
|
5
5
|
# WARNING!! CypressOnRails can execute arbitrary ruby code
|
6
6
|
# please use with extra caution if enabling on hosted servers or starting your local server on 0.0.0.0
|
7
7
|
c.use_middleware = !Rails.env.production?
|
8
8
|
<% unless options.experimental %># <% end %> c.use_vcr_middleware = !Rails.env.production?
|
9
9
|
c.logger = Rails.logger
|
10
|
+
|
11
|
+
# If you want to enable a before_request logic, such as authentication, logging, sending metrics, etc.
|
12
|
+
# Refer to https://www.rubydoc.info/gems/rack/Rack/Request for the `request` argument.
|
13
|
+
# Return nil to continue through the Cypress command. Return a response [status, header, body] to halt.
|
14
|
+
# c.before_request = lambda { |request|
|
15
|
+
# unless request.env['warden'].authenticate(:secret_key)
|
16
|
+
# return [403, {}, ["forbidden"]]
|
17
|
+
# end
|
18
|
+
# }
|
10
19
|
end
|
11
20
|
|
12
21
|
# # if you compile your asssets on CI
|
@@ -6,6 +6,9 @@ Cypress.Commands.add('appCommands', function (body) {
|
|
6
6
|
method: 'POST',
|
7
7
|
url: "/__e2e__/command",
|
8
8
|
body: JSON.stringify(body),
|
9
|
+
headers: {
|
10
|
+
'Content-Type': 'application/json',
|
11
|
+
},
|
9
12
|
log: false,
|
10
13
|
failOnStatusCode: false
|
11
14
|
}).then((response) => {
|
@@ -52,6 +55,9 @@ Cypress.on('fail', (err, runnable) => {
|
|
52
55
|
Cypress.$.ajax({
|
53
56
|
url: '/__e2e__/command',
|
54
57
|
data: JSON.stringify({name: 'log_fail', options: {error_message: err.message, runnable_full_title: runnable.fullTitle() }}),
|
58
|
+
headers: {
|
59
|
+
'Content-Type': 'application/json',
|
60
|
+
},
|
55
61
|
async: false,
|
56
62
|
method: 'POST'
|
57
63
|
});
|
@@ -8,19 +8,23 @@ RSpec.describe CypressOnRails::Configuration do
|
|
8
8
|
expect(CypressOnRails.configuration.install_folder).to eq('spec/e2e')
|
9
9
|
expect(CypressOnRails.configuration.use_middleware?).to eq(true)
|
10
10
|
expect(CypressOnRails.configuration.logger).to_not be_nil
|
11
|
+
expect(CypressOnRails.configuration.before_request).to_not be_nil
|
11
12
|
end
|
12
13
|
|
13
14
|
it 'can be configured' do
|
14
15
|
my_logger = Logger.new(STDOUT)
|
16
|
+
before_request_lambda = -> (_) { return [200, {}, ['hello world']] }
|
15
17
|
CypressOnRails.configure do |config|
|
16
18
|
config.api_prefix = '/api'
|
17
19
|
config.install_folder = 'my/path'
|
18
20
|
config.use_middleware = false
|
19
21
|
config.logger = my_logger
|
22
|
+
config.before_request = before_request_lambda
|
20
23
|
end
|
21
24
|
expect(CypressOnRails.configuration.api_prefix).to eq('/api')
|
22
25
|
expect(CypressOnRails.configuration.install_folder).to eq('my/path')
|
23
26
|
expect(CypressOnRails.configuration.use_middleware?).to eq(false)
|
24
27
|
expect(CypressOnRails.configuration.logger).to eq(my_logger)
|
28
|
+
expect(CypressOnRails.configuration.before_request).to eq(before_request_lambda)
|
25
29
|
end
|
26
30
|
end
|
data/specs_e2e/rails_3_2/test.sh
CHANGED
@@ -10,19 +10,20 @@ export BUNDLE_GEMFILE="$DIR/Gemfile"
|
|
10
10
|
cd $DIR
|
11
11
|
|
12
12
|
echo '-- bundle install'
|
13
|
-
|
14
|
-
bundle
|
13
|
+
gem install bundler -v '1.0.22'
|
14
|
+
bundle _1.0.22_ --version
|
15
|
+
bundle _1.0.22_ install --quiet --gemfile="$DIR/Gemfile" --path vendor/bundle
|
15
16
|
|
16
17
|
echo '-- cypress install'
|
17
|
-
bundle exec ./bin/rails g cypress_on_rails:install --
|
18
|
+
bundle exec ./bin/rails g cypress_on_rails:install --install_with=npm --install_folder="." --force
|
18
19
|
rm -vf cypress/e2e/rails_examples/advance_factory_bot.cy.js
|
19
20
|
rm -vf cypress/e2e/rails_examples/using_vcr.cy.js
|
20
21
|
|
21
22
|
echo '-- start rails server'
|
22
23
|
# make sure the server is not running
|
23
|
-
(kill -9 `cat
|
24
|
+
(kill -9 `cat ../server.pid` || true )
|
24
25
|
|
25
|
-
bundle exec ./bin/rails server -p 5017 -e test &
|
26
|
+
bundle exec ./bin/rails server -p 5017 -e test -P ../server.pid &
|
26
27
|
sleep 2 # give rails a chance to start up correctly
|
27
28
|
|
28
29
|
echo '-- cypress run'
|
@@ -31,13 +32,19 @@ cp -fv ../cypress.config.js .
|
|
31
32
|
# then
|
32
33
|
# node_modules/.bin/cypress run
|
33
34
|
# else
|
34
|
-
|
35
|
+
npx cypress run --record
|
35
36
|
# fi
|
36
37
|
|
38
|
+
echo '-- playwright install'
|
39
|
+
bundle exec ./bin/rails g cypress_on_rails:install --framework playwright --install_with=npm --install_folder="." --force
|
40
|
+
rm -vf playwright/e2e/rails_examples/advance_factory_bot.cy.js
|
41
|
+
rm -vf playwright/e2e/rails_examples/using_vcr.cy.js
|
42
|
+
|
37
43
|
echo '-- playwright run'
|
38
44
|
cp -fv ../playwright.config.js .
|
39
45
|
npx playwright install-deps
|
46
|
+
npx playwright install
|
40
47
|
npx playwright test playwright/e2e/
|
41
48
|
|
42
49
|
echo '-- stop rails server'
|
43
|
-
kill -9 `cat
|
50
|
+
kill -9 `cat ../server.pid` || true
|
@@ -4,7 +4,9 @@
|
|
4
4
|
"main": "index.js",
|
5
5
|
"license": "MIT",
|
6
6
|
"devDependencies": {
|
7
|
-
"
|
8
|
-
"cypress
|
7
|
+
"@playwright/test": "^1.40.1",
|
8
|
+
"cypress": "^10.11.0",
|
9
|
+
"cypress-on-rails": "file:../../plugin",
|
10
|
+
"playwright": "^1.40.1"
|
9
11
|
}
|
10
12
|
}
|