cypress-on-rails 1.15.1 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,63 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://cat-fact.herokuapp.com/facts
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Host:
|
17
|
+
- cat-fact.herokuapp.com
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Cowboy
|
25
|
+
Report-To:
|
26
|
+
- '{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1704261545&sid=929419e7-33ea-4e2f-85f0-7d8b7cd5cbd6&s=OabIZbJae2naQpkmA6oM8tyC0dn4yWUtvOVjuyytaRg%3D"}]}'
|
27
|
+
Reporting-Endpoints:
|
28
|
+
- heroku-nel=https://nel.heroku.com/reports?ts=1704261545&sid=929419e7-33ea-4e2f-85f0-7d8b7cd5cbd6&s=OabIZbJae2naQpkmA6oM8tyC0dn4yWUtvOVjuyytaRg%3D
|
29
|
+
Nel:
|
30
|
+
- '{"report_to":"heroku-nel","max_age":3600,"success_fraction":0.005,"failure_fraction":0.05,"response_headers":["Via"]}'
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
X-Powered-By:
|
34
|
+
- Express
|
35
|
+
Access-Control-Allow-Origin:
|
36
|
+
- "*"
|
37
|
+
Content-Type:
|
38
|
+
- application/json; charset=utf-8
|
39
|
+
Content-Length:
|
40
|
+
- '1877'
|
41
|
+
Etag:
|
42
|
+
- W/"755-h8iGk8b461dj2B2tvSoMjrc8cAA"
|
43
|
+
Set-Cookie:
|
44
|
+
- connect.sid=s%3ASQfrvsPQGDLjbr1QrsrgV8BwZQptae4i.6BlC7zySZLgqSg%2BRmO6edW%2FxM6WR%2FJ9Xz2lD16D4nWo;
|
45
|
+
Path=/; HttpOnly
|
46
|
+
Date:
|
47
|
+
- Wed, 03 Jan 2024 05:59:05 GMT
|
48
|
+
Via:
|
49
|
+
- 1.1 vegur
|
50
|
+
body:
|
51
|
+
encoding: UTF-8
|
52
|
+
string: '[{"status":{"verified":true,"sentCount":1},"_id":"58e00b5f0aac31001185ed24","user":"58e007480aac31001185ecef","text":"When
|
53
|
+
asked if her husband had any hobbies, Mary Todd Lincoln is said to have replied
|
54
|
+
\"cats.\"","__v":0,"source":"user","updatedAt":"2020-08-23T20:20:01.611Z","type":"cat","createdAt":"2018-02-19T21:20:03.434Z","deleted":false,"used":false},{"status":{"verified":true,"feedback":"","sentCount":1},"_id":"5887e1d85c873e0011036889","user":"5a9ac18c7478810ea6c06381","text":"Cats
|
55
|
+
make about 100 different sounds. Dogs make only about 10.","__v":0,"source":"user","updatedAt":"2020-09-03T16:39:39.578Z","type":"cat","createdAt":"2018-01-15T21:20:00.003Z","deleted":false,"used":true},{"status":{"verified":true,"sentCount":1},"_id":"58e008780aac31001185ed05","user":"58e007480aac31001185ecef","text":"Owning
|
56
|
+
a cat can reduce the risk of stroke and heart attack by a third.","__v":0,"source":"user","updatedAt":"2020-08-23T20:20:01.611Z","type":"cat","createdAt":"2018-03-29T20:20:03.844Z","deleted":false,"used":false},{"status":{"verified":true,"sentCount":1},"_id":"58e009390aac31001185ed10","user":"58e007480aac31001185ecef","text":"Most
|
57
|
+
cats are lactose intolerant, and milk can cause painful stomach cramps and
|
58
|
+
diarrhea. It''s best to forego the milk and just give your cat the standard:
|
59
|
+
clean, cool drinking water.","__v":0,"source":"user","updatedAt":"2020-08-23T20:20:01.611Z","type":"cat","createdAt":"2018-03-04T21:20:02.979Z","deleted":false,"used":false},{"status":{"verified":true,"sentCount":1},"_id":"58e00af60aac31001185ed1d","user":"58e007480aac31001185ecef","text":"It
|
60
|
+
was illegal to slay cats in ancient Egypt, in large part because they provided
|
61
|
+
the great service of controlling the rat population.","__v":0,"source":"user","updatedAt":"2020-09-16T20:20:04.164Z","type":"cat","createdAt":"2018-01-15T21:20:02.945Z","deleted":false,"used":true}]'
|
62
|
+
recorded_at: Wed, 03 Jan 2024 05:59:06 GMT
|
63
|
+
recorded_with: VCR 6.0.0
|
data/specs_e2e/rails_4_2/test.sh
CHANGED
@@ -14,15 +14,15 @@ gem install bundler -v "~> 1.0" --conservative
|
|
14
14
|
bundle --version
|
15
15
|
bundle install --quiet --gemfile="$DIR/Gemfile" --retry 2 --path vendor/bundle
|
16
16
|
|
17
|
-
echo '-- cypress
|
18
|
-
bundle exec ./bin/rails g cypress_on_rails:install --install_folder=spec
|
17
|
+
echo '-- cypress install'
|
18
|
+
bundle exec ./bin/rails g cypress_on_rails:install --install_folder=spec --framework cypress --experimental --install_with=npm --force
|
19
19
|
rm -vf spec/cypress/e2e/rails_examples/advance_factory_bot.cy.js
|
20
20
|
|
21
21
|
echo '-- start rails server'
|
22
22
|
# make sure the server is not running
|
23
|
-
(kill -9 `cat
|
23
|
+
(kill -9 `cat ../server.pid` || true )
|
24
24
|
|
25
|
-
bundle exec ./bin/rails server -p 5017 -e test &
|
25
|
+
bundle exec ./bin/rails server -p 5017 -e test -P ../server.pid &
|
26
26
|
sleep 5 # give rails a chance to start up correctly
|
27
27
|
|
28
28
|
echo '-- cypress run'
|
@@ -31,14 +31,20 @@ cp -fv ../cypress.config.js spec/
|
|
31
31
|
# then
|
32
32
|
# npx cypress run -P ./spec
|
33
33
|
# else
|
34
|
-
npx cypress
|
34
|
+
npx cypress install
|
35
|
+
npx cypress run -P ./spec # --record
|
35
36
|
# fi
|
36
37
|
|
38
|
+
echo '-- playwright install'
|
39
|
+
bundle exec ./bin/rails g cypress_on_rails:install --install_folder=spec --framework playwright --experimental --install_with=npm --force
|
40
|
+
rm -vf spec/playwright/e2e/rails_examples/advance_factory_bot.cy.js
|
41
|
+
|
37
42
|
echo '-- playwright run'
|
38
43
|
cp -fv ../playwright.config.js spec/
|
39
44
|
cd spec
|
40
45
|
npx playwright install-deps
|
41
|
-
npx playwright
|
46
|
+
npx playwright install
|
47
|
+
npx playwright test spec/playwright/e2e
|
42
48
|
|
43
49
|
echo '-- stop rails server'
|
44
|
-
kill -9 `cat
|
50
|
+
kill -9 `cat ../../server.pid` || true
|
@@ -1,12 +1,16 @@
|
|
1
1
|
.bundle
|
2
2
|
test/node_modules
|
3
3
|
test/cypress.config.js
|
4
|
+
test/playwright.config.js
|
4
5
|
test/package.json
|
5
6
|
test/yarn.lock
|
6
7
|
test/cypress/
|
8
|
+
test/playwright/
|
9
|
+
test/playwright-report/
|
7
10
|
config/initializers/cypress_on_rails.rb
|
8
11
|
vendor/bundle
|
9
12
|
db/*.sqlite3
|
10
13
|
db/schema.rb
|
11
14
|
tmp/*
|
12
15
|
log/*
|
16
|
+
specs_e2e/server.pid
|
data/specs_e2e/rails_5_2/test.sh
CHANGED
@@ -18,31 +18,40 @@ echo '-- migration'
|
|
18
18
|
bundle exec ./bin/rails db:drop || true
|
19
19
|
bundle exec ./bin/rails db:create db:migrate
|
20
20
|
|
21
|
-
echo '-- cypress
|
22
|
-
bundle exec ./bin/rails g cypress_on_rails:install --install_folder=test
|
21
|
+
echo '-- cypress install'
|
22
|
+
bundle exec ./bin/rails g cypress_on_rails:install --install_folder=test --framework cypress --install_with=npm --force
|
23
23
|
rm -vf test/cypress/e2e/rails_examples/using_vcr.cy.js
|
24
24
|
|
25
25
|
echo '-- start rails server'
|
26
26
|
# make sure the server is not running
|
27
|
-
(kill -9 `cat
|
27
|
+
(kill -9 `cat ../server.pid` || true )
|
28
28
|
|
29
|
-
bundle exec ./bin/rails server -p 5017 -e test &
|
29
|
+
bundle exec ./bin/rails server -p 5017 -e test -P ../server.pid &
|
30
30
|
sleep 2 # give rails a chance to start up correctly
|
31
31
|
|
32
32
|
echo '-- cypress run'
|
33
33
|
cp -fv ../cypress.config.js test/
|
34
34
|
cd test
|
35
|
+
npx cypress install
|
35
36
|
# if [ -z $CYPRESS_RECORD_KEY ]
|
36
37
|
# then
|
37
38
|
# npx cypress run
|
38
39
|
# else
|
39
|
-
npx cypress run --record
|
40
|
+
npx cypress run # --record
|
40
41
|
# fi
|
41
42
|
|
43
|
+
echo '-- playwright install'
|
44
|
+
cd ..
|
45
|
+
bundle exec ./bin/rails g cypress_on_rails:install --install_folder=test --framework playwright --install_with=npm --force
|
46
|
+
rm -vf test/playwright/e2e/rails_examples/using_vcr.cy.js
|
47
|
+
|
42
48
|
echo '-- playwright run'
|
49
|
+
cd test
|
43
50
|
cp -fv ../../playwright.config.js .
|
44
51
|
npx playwright install-deps
|
45
|
-
npx playwright
|
52
|
+
npx playwright install
|
53
|
+
npx playwright test test/playwright
|
54
|
+
# npx playwright show-report
|
46
55
|
|
47
56
|
echo '-- stop rails server'
|
48
|
-
kill -9 `cat
|
57
|
+
kill -9 `cat ../../server.pid` || true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cypress-on-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- miceportal team
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-01-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -71,16 +71,16 @@ dependencies:
|
|
71
71
|
name: factory_bot
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - "
|
74
|
+
- - "!="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 6.4.5
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - "
|
81
|
+
- - "!="
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: 6.4.5
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: vcr
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,7 +152,6 @@ files:
|
|
152
152
|
- lib/generators/cypress_on_rails/templates/spec/playwright/e2e/rails_examples/using_scenarios.spec.js
|
153
153
|
- lib/generators/cypress_on_rails/templates/spec/playwright/support/index.js.erb
|
154
154
|
- lib/generators/cypress_on_rails/templates/spec/playwright/support/on-rails.js
|
155
|
-
- lib/generators/cypress_on_rails/update_generator.rb
|
156
155
|
- plugin/.gitignore
|
157
156
|
- plugin/cypress/plugins/index.js
|
158
157
|
- plugin/package.json
|
@@ -244,12 +243,14 @@ files:
|
|
244
243
|
- specs_e2e/rails_4_2/config/routes.rb
|
245
244
|
- specs_e2e/rails_4_2/config/secrets.yml
|
246
245
|
- specs_e2e/rails_4_2/package.json
|
246
|
+
- specs_e2e/rails_4_2/playwright-report/index.html
|
247
247
|
- specs_e2e/rails_4_2/public/404.html
|
248
248
|
- specs_e2e/rails_4_2/public/422.html
|
249
249
|
- specs_e2e/rails_4_2/public/500.html
|
250
250
|
- specs_e2e/rails_4_2/public/favicon.ico
|
251
251
|
- specs_e2e/rails_4_2/public/robots.txt
|
252
252
|
- specs_e2e/rails_4_2/spec/.keep
|
253
|
+
- specs_e2e/rails_4_2/spec/fixtures/vcr_cassettes/cats.yml
|
253
254
|
- specs_e2e/rails_4_2/test.sh
|
254
255
|
- specs_e2e/rails_4_2/vendor/.keep
|
255
256
|
- specs_e2e/rails_5_2/.gitignore
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module CypressOnRails
|
2
|
-
class UpdateGenerator < Rails::Generators::Base
|
3
|
-
class_option :install_folder, type: :string, default: 'spec/e2e'
|
4
|
-
class_option :install_cypress, type: :boolean, default: true
|
5
|
-
class_option :install_playwright, type: :boolean, default: false
|
6
|
-
class_option :install_with, type: :string, default: 'yarn'
|
7
|
-
class_option :cypress_folder, type: :string, default: 'spec/cypress'
|
8
|
-
class_option :playwright_folder, type: :string, default: 'spec/playwright'
|
9
|
-
source_root File.expand_path('../templates', __FILE__)
|
10
|
-
|
11
|
-
def update_generated_files
|
12
|
-
template "config/initializers/cypress_on_rails.rb.erb", "config/initializers/cypress_on_rails.rb"
|
13
|
-
template "spec/e2e/e2e_helper.rb.erb", "#{options.install_folder}/e2e_helper.rb"
|
14
|
-
directory 'spec/e2e/app_commands', "#{options.install_folder}/app_commands"
|
15
|
-
|
16
|
-
if options.install_cypress
|
17
|
-
copy_file "spec/cypress/support/on-rails.js", "#{options.cypress_folder}/support/on-rails.js"
|
18
|
-
end
|
19
|
-
if options.install_playwright
|
20
|
-
copy_file "spec/playwright/support/on-rails.js", "#{options.playwright_folder}/support/on-rails.js"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|