cypress-on-rails 1.17.0 → 1.19.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/.github/workflows/claude-code-review.yml +57 -0
- data/.github/workflows/claude.yml +50 -0
- data/.github/workflows/ruby.yml +14 -14
- data/CHANGELOG.md +319 -98
- data/README.md +271 -23
- data/RELEASING.md +200 -0
- data/Rakefile +1 -4
- data/cypress-on-rails.gemspec +1 -0
- data/docs/BEST_PRACTICES.md +678 -0
- data/docs/DX_IMPROVEMENTS.md +163 -0
- data/docs/PLAYWRIGHT_GUIDE.md +554 -0
- data/docs/RELEASE.md +124 -0
- data/docs/TROUBLESHOOTING.md +351 -0
- data/docs/VCR_GUIDE.md +499 -0
- data/docs/authentication.md +30 -0
- data/docs/factory_bot_associations.md +14 -0
- data/lib/cypress_on_rails/configuration.rb +29 -0
- data/lib/cypress_on_rails/railtie.rb +17 -2
- data/lib/cypress_on_rails/server.rb +197 -0
- data/lib/cypress_on_rails/state_reset_middleware.rb +58 -0
- data/lib/cypress_on_rails/vcr/insert_eject_middleware.rb +75 -0
- data/lib/cypress_on_rails/vcr/middleware_helpers.rb +51 -0
- data/lib/cypress_on_rails/vcr/use_cassette_middleware.rb +56 -0
- data/lib/cypress_on_rails/version.rb +1 -1
- data/lib/generators/cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb +20 -0
- data/lib/generators/cypress_on_rails/templates/spec/cypress/e2e/rails_examples/using_factory_bot.cy.js +2 -2
- data/lib/generators/cypress_on_rails/templates/spec/cypress/e2e/rails_examples/using_scenarios.cy.js +1 -1
- data/lib/generators/cypress_on_rails/templates/spec/cypress/support/commands.js +22 -0
- data/lib/generators/cypress_on_rails/templates/spec/cypress/support/on-rails.js +2 -1
- data/lib/generators/cypress_on_rails/templates/spec/e2e/e2e_helper.rb.erb +0 -5
- data/lib/tasks/cypress.rake +33 -0
- data/rakelib/release.rake +80 -0
- data/rakelib/task_helpers.rb +23 -0
- data/rakelib/update_changelog.rake +63 -0
- data/spec/cypress_on_rails/configuration_spec.rb +4 -1
- data/spec/cypress_on_rails/vcr/insert_eject_middleware_spec.rb +177 -0
- data/spec/cypress_on_rails/vcr/use_cassette_middleware_spec.rb +68 -0
- data/specs_e2e/rails_6_1/.gitattributes +10 -0
- data/specs_e2e/rails_6_1/Gemfile +20 -0
- data/specs_e2e/{rails_5_2 → rails_6_1}/Rakefile +1 -1
- data/specs_e2e/rails_6_1/app/assets/stylesheets/application.css +15 -0
- data/specs_e2e/rails_6_1/app/jobs/application_job.rb +7 -0
- data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/layouts/application.html.erb +1 -1
- data/specs_e2e/rails_6_1/bin/bundle +114 -0
- data/specs_e2e/rails_6_1/bin/rails +5 -0
- data/specs_e2e/rails_6_1/bin/rake +5 -0
- data/specs_e2e/{rails_5_2 → rails_6_1}/bin/setup +15 -4
- data/specs_e2e/rails_6_1/bin/spring +14 -0
- data/specs_e2e/rails_6_1/bin/yarn +17 -0
- data/specs_e2e/rails_6_1/config/application.rb +34 -0
- data/specs_e2e/rails_6_1/config/boot.rb +4 -0
- data/specs_e2e/rails_6_1/config/cable.yml +10 -0
- data/specs_e2e/rails_6_1/config/credentials.yml.enc +1 -0
- data/specs_e2e/{rails_5_2 → rails_6_1}/config/database.yml +7 -0
- data/specs_e2e/{rails_5_2 → rails_6_1}/config/environment.rb +1 -1
- data/specs_e2e/{rails_5_2 → rails_6_1}/config/environments/development.rb +22 -5
- data/specs_e2e/rails_6_1/config/environments/production.rb +120 -0
- data/specs_e2e/{rails_5_2 → rails_6_1}/config/environments/test.rb +24 -7
- data/specs_e2e/rails_6_1/config/initializers/backtrace_silencers.rb +8 -0
- data/specs_e2e/{rails_5_2 → rails_6_1}/config/initializers/content_security_policy.rb +5 -0
- data/specs_e2e/{rails_4_2 → rails_6_1}/config/initializers/filter_parameter_logging.rb +3 -1
- data/specs_e2e/rails_6_1/config/initializers/permissions_policy.rb +11 -0
- data/specs_e2e/{rails_3_2 → rails_6_1}/config/initializers/wrap_parameters.rb +5 -1
- data/specs_e2e/{rails_5_2 → rails_6_1}/config/locales/en.yml +1 -1
- data/specs_e2e/rails_6_1/config/master.key +1 -0
- data/specs_e2e/rails_6_1/config/puma.rb +43 -0
- data/specs_e2e/rails_6_1/config/storage.yml +34 -0
- data/specs_e2e/{rails_5_2 → rails_6_1}/config.ru +2 -1
- data/specs_e2e/{rails_5_2 → rails_6_1}/db/migrate/20180621085832_create_posts.rb +1 -1
- data/specs_e2e/rails_6_1/package.json +8 -0
- data/specs_e2e/rails_6_1/playwright-report/index.html +71 -0
- data/specs_e2e/rails_6_1/public/robots.txt +1 -0
- data/specs_e2e/rails_6_1/test-results/.last-run.json +4 -0
- data/specs_e2e/{rails_4_2 → rails_6_1}/test.sh +22 -15
- data/specs_e2e/rails_7_2/.gitattributes +9 -0
- data/specs_e2e/rails_7_2/.gitignore +16 -0
- data/specs_e2e/rails_7_2/.rubocop.yml +8 -0
- data/specs_e2e/rails_7_2/Gemfile +11 -0
- data/specs_e2e/{rails_4_2 → rails_7_2}/Rakefile +1 -1
- data/specs_e2e/rails_7_2/app/assets/stylesheets/application.css +15 -0
- data/specs_e2e/rails_7_2/app/controllers/application_controller.rb +4 -0
- data/specs_e2e/rails_7_2/app/controllers/posts_controller.rb +58 -0
- data/specs_e2e/rails_7_2/app/helpers/posts_helper.rb +2 -0
- data/specs_e2e/rails_7_2/app/jobs/application_job.rb +7 -0
- data/specs_e2e/rails_7_2/app/models/application_record.rb +3 -0
- data/specs_e2e/rails_7_2/app/models/post.rb +2 -0
- data/specs_e2e/rails_7_2/app/views/layouts/application.html.erb +22 -0
- data/specs_e2e/rails_7_2/app/views/posts/_form.html.erb +32 -0
- data/specs_e2e/rails_7_2/app/views/posts/edit.html.erb +6 -0
- data/specs_e2e/rails_7_2/app/views/posts/index.html.erb +31 -0
- data/specs_e2e/rails_7_2/app/views/posts/new.html.erb +5 -0
- data/specs_e2e/rails_7_2/app/views/posts/show.html.erb +19 -0
- data/specs_e2e/rails_7_2/bin/brakeman +7 -0
- data/specs_e2e/rails_7_2/bin/bundle +109 -0
- data/specs_e2e/rails_7_2/bin/importmap +4 -0
- data/specs_e2e/rails_7_2/bin/rails +4 -0
- data/specs_e2e/rails_7_2/bin/rake +4 -0
- data/specs_e2e/rails_7_2/bin/setup +37 -0
- data/specs_e2e/rails_7_2/config/application.rb +37 -0
- data/specs_e2e/rails_7_2/config/boot.rb +4 -0
- data/specs_e2e/rails_7_2/config/cable.yml +10 -0
- data/specs_e2e/rails_7_2/config/credentials.yml.enc +1 -0
- data/specs_e2e/rails_7_2/config/database.yml +32 -0
- data/specs_e2e/{rails_4_2 → rails_7_2}/config/environment.rb +1 -1
- data/specs_e2e/rails_7_2/config/environments/development.rb +54 -0
- data/specs_e2e/rails_7_2/config/environments/production.rb +105 -0
- data/specs_e2e/rails_7_2/config/environments/test.rb +45 -0
- data/specs_e2e/rails_7_2/config/importmap.rb +7 -0
- data/specs_e2e/rails_7_2/config/initializers/content_security_policy.rb +25 -0
- data/specs_e2e/rails_7_2/config/initializers/filter_parameter_logging.rb +8 -0
- data/specs_e2e/{rails_5_2 → rails_7_2}/config/initializers/inflections.rb +4 -4
- data/specs_e2e/rails_7_2/config/initializers/permissions_policy.rb +13 -0
- data/specs_e2e/rails_7_2/config/locales/en.yml +31 -0
- data/specs_e2e/rails_7_2/config/master.key +1 -0
- data/specs_e2e/rails_7_2/config/puma.rb +34 -0
- data/specs_e2e/rails_7_2/config/routes.rb +5 -0
- data/specs_e2e/rails_7_2/config/storage.yml +34 -0
- data/specs_e2e/{rails_4_2 → rails_7_2}/config.ru +3 -1
- data/specs_e2e/rails_7_2/db/migrate/20180621085832_create_posts.rb +11 -0
- data/specs_e2e/rails_7_2/db/seeds.rb +9 -0
- data/specs_e2e/rails_7_2/db/test.sqlite3-shm +0 -0
- data/specs_e2e/rails_7_2/db/test.sqlite3-wal +0 -0
- data/specs_e2e/rails_7_2/package.json +8 -0
- data/specs_e2e/rails_7_2/playwright-report/index.html +71 -0
- data/specs_e2e/{rails_4_2 → rails_7_2}/public/404.html +6 -6
- data/specs_e2e/rails_7_2/public/406-unsupported-browser.html +66 -0
- data/specs_e2e/{rails_4_2 → rails_7_2}/public/422.html +6 -6
- data/specs_e2e/{rails_4_2 → rails_7_2}/public/500.html +6 -6
- data/specs_e2e/rails_7_2/public/icon.png +0 -0
- data/specs_e2e/rails_7_2/public/icon.svg +3 -0
- data/specs_e2e/rails_7_2/public/robots.txt +1 -0
- data/specs_e2e/rails_7_2/storage/test.sqlite3 +0 -0
- data/specs_e2e/rails_7_2/test/controllers/posts_controller_test.rb +48 -0
- data/specs_e2e/rails_7_2/test/cypress_fixtures/posts.yml +11 -0
- data/specs_e2e/rails_7_2/test/fixtures/posts.yml +11 -0
- data/specs_e2e/rails_7_2/test/models/post_test.rb +7 -0
- data/specs_e2e/rails_7_2/test-results/.last-run.json +4 -0
- data/specs_e2e/rails_7_2/test.sh +57 -0
- data/specs_e2e/rails_8/.gitattributes +9 -0
- data/specs_e2e/rails_8/.gitignore +16 -0
- data/specs_e2e/rails_8/.rubocop.yml +8 -0
- data/specs_e2e/rails_8/Gemfile +20 -0
- data/specs_e2e/{rails_3_2 → rails_8}/Rakefile +2 -3
- data/specs_e2e/rails_8/app/assets/stylesheets/application.css +10 -0
- data/specs_e2e/rails_8/app/controllers/application_controller.rb +4 -0
- data/specs_e2e/rails_8/app/controllers/posts_controller.rb +58 -0
- data/specs_e2e/rails_8/app/helpers/posts_helper.rb +2 -0
- data/specs_e2e/rails_8/app/jobs/application_job.rb +7 -0
- data/specs_e2e/rails_8/app/models/application_record.rb +3 -0
- data/specs_e2e/rails_8/app/models/post.rb +2 -0
- data/specs_e2e/rails_8/app/views/layouts/application.html.erb +27 -0
- data/specs_e2e/rails_8/app/views/posts/_form.html.erb +32 -0
- data/specs_e2e/rails_8/app/views/posts/edit.html.erb +6 -0
- data/specs_e2e/rails_8/app/views/posts/index.html.erb +31 -0
- data/specs_e2e/rails_8/app/views/posts/new.html.erb +5 -0
- data/specs_e2e/rails_8/app/views/posts/show.html.erb +19 -0
- data/specs_e2e/rails_8/bin/brakeman +7 -0
- data/specs_e2e/rails_8/bin/bundle +109 -0
- data/specs_e2e/rails_8/bin/dev +2 -0
- data/specs_e2e/rails_8/bin/importmap +4 -0
- data/specs_e2e/rails_8/bin/rails +4 -0
- data/specs_e2e/rails_8/bin/rake +4 -0
- data/specs_e2e/rails_8/bin/setup +34 -0
- data/specs_e2e/rails_8/bin/thrust +5 -0
- data/specs_e2e/rails_8/config/application.rb +27 -0
- data/specs_e2e/rails_8/config/boot.rb +4 -0
- data/specs_e2e/rails_8/config/cable.yml +17 -0
- data/specs_e2e/rails_8/config/cache.yml +16 -0
- data/specs_e2e/rails_8/config/credentials.yml.enc +1 -0
- data/specs_e2e/rails_8/config/database.yml +41 -0
- data/specs_e2e/rails_8/config/deploy.yml +116 -0
- data/specs_e2e/rails_8/config/environment.rb +5 -0
- data/specs_e2e/rails_8/config/environments/development.rb +57 -0
- data/specs_e2e/rails_8/config/environments/production.rb +90 -0
- data/specs_e2e/rails_8/config/environments/test.rb +45 -0
- data/specs_e2e/rails_8/config/importmap.rb +7 -0
- data/specs_e2e/rails_8/config/initializers/content_security_policy.rb +25 -0
- data/specs_e2e/rails_8/config/initializers/filter_parameter_logging.rb +8 -0
- data/specs_e2e/rails_8/config/initializers/inflections.rb +16 -0
- data/specs_e2e/rails_8/config/locales/en.yml +31 -0
- data/specs_e2e/rails_8/config/master.key +1 -0
- data/specs_e2e/rails_8/config/puma.rb +41 -0
- data/specs_e2e/rails_8/config/queue.yml +18 -0
- data/specs_e2e/rails_8/config/recurring.yml +10 -0
- data/specs_e2e/rails_8/config/routes.rb +5 -0
- data/specs_e2e/rails_8/config/storage.yml +34 -0
- data/specs_e2e/rails_8/config.ru +6 -0
- data/specs_e2e/rails_8/db/cable_schema.rb +11 -0
- data/specs_e2e/rails_8/db/cache_schema.rb +14 -0
- data/specs_e2e/rails_8/db/migrate/20180621085832_create_posts.rb +11 -0
- data/specs_e2e/rails_8/db/queue_schema.rb +129 -0
- data/specs_e2e/rails_8/db/seeds.rb +9 -0
- data/specs_e2e/rails_8/package.json +8 -0
- data/specs_e2e/rails_8/playwright-report/index.html +71 -0
- data/specs_e2e/rails_8/public/400.html +114 -0
- data/specs_e2e/rails_8/public/404.html +114 -0
- data/specs_e2e/rails_8/public/406-unsupported-browser.html +114 -0
- data/specs_e2e/rails_8/public/422.html +114 -0
- data/specs_e2e/rails_8/public/500.html +114 -0
- data/specs_e2e/rails_8/public/icon.png +0 -0
- data/specs_e2e/rails_8/public/icon.svg +3 -0
- data/specs_e2e/rails_8/public/robots.txt +1 -0
- data/specs_e2e/rails_8/storage/test.sqlite3 +0 -0
- data/specs_e2e/rails_8/storage/test.sqlite3-shm +0 -0
- data/specs_e2e/rails_8/storage/test.sqlite3-wal +0 -0
- data/specs_e2e/rails_8/test/application_system_test_case.rb +5 -0
- data/specs_e2e/rails_8/test/controllers/posts_controller_test.rb +48 -0
- data/specs_e2e/rails_8/test/cypress_fixtures/posts.yml +11 -0
- data/specs_e2e/rails_8/test/fixtures/posts.yml +11 -0
- data/specs_e2e/rails_8/test/models/post_test.rb +7 -0
- data/specs_e2e/rails_8/test/test_helper.rb +15 -0
- data/specs_e2e/rails_8/test-results/.last-run.json +4 -0
- data/specs_e2e/{rails_5_2 → rails_8}/test.sh +1 -1
- metadata +246 -150
- data/lib/cypress_on_rails/vcr_middleware.rb +0 -73
- data/spec/cypress_on_rails/vcr_middleware_spec.rb +0 -119
- data/specs_e2e/rails_3_2/.gitignore +0 -9
- data/specs_e2e/rails_3_2/.ruby_version +0 -1
- data/specs_e2e/rails_3_2/Gemfile +0 -7
- data/specs_e2e/rails_3_2/README.rdoc +0 -261
- data/specs_e2e/rails_3_2/app/assets/stylesheets/application.css +0 -13
- data/specs_e2e/rails_3_2/app/controllers/application_controller.rb +0 -3
- data/specs_e2e/rails_3_2/app/controllers/welcome_controller.rb +0 -4
- data/specs_e2e/rails_3_2/app/helpers/application_helper.rb +0 -2
- data/specs_e2e/rails_3_2/app/models/post.rb +0 -21
- data/specs_e2e/rails_3_2/app/views/layouts/application.html.erb +0 -13
- data/specs_e2e/rails_3_2/app/views/welcome/index.html.erb +0 -24
- data/specs_e2e/rails_3_2/bin/rails +0 -6
- data/specs_e2e/rails_3_2/config/application.rb +0 -68
- data/specs_e2e/rails_3_2/config/boot.rb +0 -6
- data/specs_e2e/rails_3_2/config/environment.rb +0 -5
- data/specs_e2e/rails_3_2/config/environments/development.rb +0 -31
- data/specs_e2e/rails_3_2/config/environments/production.rb +0 -64
- data/specs_e2e/rails_3_2/config/environments/test.rb +0 -35
- data/specs_e2e/rails_3_2/config/initializers/backtrace_silencers.rb +0 -7
- data/specs_e2e/rails_3_2/config/initializers/inflections.rb +0 -15
- data/specs_e2e/rails_3_2/config/initializers/mime_types.rb +0 -5
- data/specs_e2e/rails_3_2/config/initializers/secret_token.rb +0 -7
- data/specs_e2e/rails_3_2/config/initializers/session_store.rb +0 -8
- data/specs_e2e/rails_3_2/config/locales/en.yml +0 -5
- data/specs_e2e/rails_3_2/config/routes.rb +0 -60
- data/specs_e2e/rails_3_2/config.ru +0 -4
- data/specs_e2e/rails_3_2/public/404.html +0 -26
- data/specs_e2e/rails_3_2/public/422.html +0 -26
- data/specs_e2e/rails_3_2/public/500.html +0 -25
- data/specs_e2e/rails_3_2/public/robots.txt +0 -5
- data/specs_e2e/rails_3_2/test.sh +0 -50
- data/specs_e2e/rails_4_2/.gitignore +0 -12
- data/specs_e2e/rails_4_2/Gemfile +0 -11
- data/specs_e2e/rails_4_2/README.rdoc +0 -28
- data/specs_e2e/rails_4_2/app/assets/javascripts/using_vcr.js +0 -2
- data/specs_e2e/rails_4_2/app/assets/stylesheets/using_vcr.css +0 -4
- data/specs_e2e/rails_4_2/app/controllers/application_controller.rb +0 -5
- data/specs_e2e/rails_4_2/app/controllers/using_vcr_controller.rb +0 -10
- data/specs_e2e/rails_4_2/app/controllers/welcome_controller.rb +0 -4
- data/specs_e2e/rails_4_2/app/models/post.rb +0 -23
- data/specs_e2e/rails_4_2/app/views/layouts/application.html.erb +0 -12
- data/specs_e2e/rails_4_2/app/views/using_vcr/index.html.erb +0 -6
- data/specs_e2e/rails_4_2/app/views/using_vcr/record_cats.html.erb +0 -7
- data/specs_e2e/rails_4_2/app/views/welcome/index.html.erb +0 -24
- data/specs_e2e/rails_4_2/bin/bundle +0 -3
- data/specs_e2e/rails_4_2/bin/rails +0 -4
- data/specs_e2e/rails_4_2/bin/rake +0 -4
- data/specs_e2e/rails_4_2/bin/setup +0 -29
- data/specs_e2e/rails_4_2/config/application.rb +0 -32
- data/specs_e2e/rails_4_2/config/boot.rb +0 -3
- data/specs_e2e/rails_4_2/config/environments/development.rb +0 -25
- data/specs_e2e/rails_4_2/config/environments/production.rb +0 -64
- data/specs_e2e/rails_4_2/config/environments/test.rb +0 -42
- data/specs_e2e/rails_4_2/config/initializers/backtrace_silencers.rb +0 -7
- data/specs_e2e/rails_4_2/config/initializers/cookies_serializer.rb +0 -3
- data/specs_e2e/rails_4_2/config/initializers/session_store.rb +0 -3
- data/specs_e2e/rails_4_2/config/initializers/to_time_preserves_timezone.rb +0 -10
- data/specs_e2e/rails_4_2/config/initializers/wrap_parameters.rb +0 -9
- data/specs_e2e/rails_4_2/config/locales/en.yml +0 -23
- data/specs_e2e/rails_4_2/config/routes.rb +0 -61
- data/specs_e2e/rails_4_2/config/secrets.yml +0 -22
- data/specs_e2e/rails_4_2/package.json +0 -12
- data/specs_e2e/rails_4_2/playwright-report/index.html +0 -62
- data/specs_e2e/rails_4_2/public/favicon.ico +0 -0
- data/specs_e2e/rails_4_2/public/robots.txt +0 -5
- data/specs_e2e/rails_4_2/spec/fixtures/vcr_cassettes/cats.yml +0 -63
- data/specs_e2e/rails_5_2/Gemfile +0 -15
- data/specs_e2e/rails_5_2/app/assets/javascripts/posts.js +0 -2
- data/specs_e2e/rails_5_2/app/assets/stylesheets/posts.css +0 -4
- data/specs_e2e/rails_5_2/app/assets/stylesheets/scaffold.css +0 -80
- data/specs_e2e/rails_5_2/app/jobs/application_job.rb +0 -2
- data/specs_e2e/rails_5_2/app/views/welcome/index.html.erb +0 -5
- data/specs_e2e/rails_5_2/bin/bundle +0 -3
- data/specs_e2e/rails_5_2/bin/rails +0 -4
- data/specs_e2e/rails_5_2/bin/rake +0 -4
- data/specs_e2e/rails_5_2/bin/update +0 -25
- data/specs_e2e/rails_5_2/config/application.rb +0 -33
- data/specs_e2e/rails_5_2/config/boot.rb +0 -4
- data/specs_e2e/rails_5_2/config/credentials.yml.enc +0 -1
- data/specs_e2e/rails_5_2/config/environments/production.rb +0 -68
- data/specs_e2e/rails_5_2/config/initializers/backtrace_silencers.rb +0 -7
- data/specs_e2e/rails_5_2/config/initializers/filter_parameter_logging.rb +0 -4
- data/specs_e2e/rails_5_2/config/initializers/mime_types.rb +0 -4
- data/specs_e2e/rails_5_2/config/initializers/wrap_parameters.rb +0 -9
- data/specs_e2e/rails_5_2/config/master.key +0 -1
- data/specs_e2e/rails_5_2/public/favicon.ico +0 -0
- data/specs_e2e/rails_5_2/public/robots.txt +0 -1
- /data/specs_e2e/{rails_5_2 → rails_6_1}/.gitignore +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/app/controllers/application_controller.rb +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/app/controllers/posts_controller.rb +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/app/helpers/posts_helper.rb +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/app/models/application_record.rb +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/app/models/post.rb +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/_form.html.erb +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/edit.html.erb +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/index.html.erb +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/new.html.erb +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/show.html.erb +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/config/initializers/application_controller_renderer.rb +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/config/initializers/cookies_serializer.rb +0 -0
- /data/specs_e2e/{rails_4_2 → rails_6_1}/config/initializers/inflections.rb +0 -0
- /data/specs_e2e/{rails_4_2 → rails_6_1}/config/initializers/mime_types.rb +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/config/routes.rb +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/public/404.html +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/public/422.html +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/public/500.html +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/public/apple-touch-icon-precomposed.png +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/public/apple-touch-icon.png +0 -0
- /data/specs_e2e/{rails_3_2 → rails_6_1}/public/favicon.ico +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/test/controllers/posts_controller_test.rb +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/test/cypress_fixtures/posts.yml +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/test/fixtures/posts.yml +0 -0
- /data/specs_e2e/{rails_5_2 → rails_6_1}/test/models/post_test.rb +0 -0
- /data/specs_e2e/{rails_3_2/log → rails_6_1/vendor}/.keep +0 -0
- /data/specs_e2e/{rails_3_2/tmp → rails_7_2/vendor}/.keep +0 -0
- /data/specs_e2e/{rails_4_2/spec → rails_7_2/vendor/javascript}/.keep +0 -0
- /data/specs_e2e/{rails_5_2 → rails_8}/README.md +0 -0
- /data/specs_e2e/{rails_4_2/vendor → rails_8/storage}/.keep +0 -0
- /data/specs_e2e/{rails_5_2 → rails_8}/vendor/.keep +0 -0
- /data/specs_e2e/{rails_3_2/vendor/.gitkeep → rails_8/vendor/javascript/.keep} +0 -0
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Cypress and Playwright on Rails
|
2
2
|
|
3
3
|

|
4
4
|
[](https://dashboard.cypress.io/projects/2b6cjr/runs)
|
@@ -6,33 +6,78 @@
|
|
6
6
|
|
7
7
|
----
|
8
8
|
|
9
|
-
This project is sponsored by the software consulting firm [ShakaCode](https://www.shakacode.com), creator of the [React on Rails Gem](https://github.com/shakacode/react_on_rails).
|
9
|
+
This project is sponsored by the software consulting firm [ShakaCode](https://www.shakacode.com), creator of the [React on Rails Gem](https://github.com/shakacode/react_on_rails).
|
10
10
|
|
11
|
-
|
11
|
+
### ShakaCode Support
|
12
12
|
|
13
|
-
|
13
|
+
[ShakaCode](https://www.shakacode.com) focuses on helping Ruby on Rails teams use React and Webpack better. We can upgrade your project and improve your development and customer experiences, allowing you to focus on building new features or fixing bugs instead.
|
14
|
+
|
15
|
+
For an overview of working with us, see our [Client Engagement Model](https://www.shakacode.com/blog/client-engagement-model/) article and [how we bill for time](https://www.shakacode.com/blog/shortcut-jira-trello-github-toggl-time-and-task-tracking/).
|
16
|
+
|
17
|
+
We also specialize in helping development teams lower infrastructure and CI costs. Check out our project [Control Plane Flow](https://github.com/shakacode/control-plane-flow/), which can allow you to get the ease of Heroku with the power of Kubernetes and big cost savings.
|
18
|
+
|
19
|
+
If you think ShakaCode can help your project, [click here](https://meetings.hubspot.com/justingordon/30-minute-consultation) to book a call with [Justin Gordon](mailto:justin@shakacode.com), the creator of React on Rails and Shakapacker.
|
20
|
+
|
21
|
+
Here's a testimonial of how ShakaCode can help from [Florian Gößler](https://github.com/FGoessler) of [Blinkist](https://www.blinkist.com/), January 2, 2023:
|
22
|
+
> Hey Justin 👋
|
23
|
+
>
|
24
|
+
> I just wanted to let you know that we today shipped the webpacker to shakapacker upgrades and it all seems to be running smoothly! Thanks again for all your support and your teams work! 😍
|
25
|
+
>
|
26
|
+
> On top of your work, it was now also very easy for me to upgrade Tailwind and include our external node_module based web component library which we were using for our other (more modern) apps already. That work is going to be shipped later this week though as we are polishing the last bits of it. 😉
|
27
|
+
>
|
28
|
+
> Have a great 2023 and maybe we get to work together again later in the year! 🙌
|
29
|
+
|
30
|
+
Read the [full review here](https://clutch.co/profile/shakacode#reviews?sort_by=date_DESC#review-2118154).
|
31
|
+
|
32
|
+
---
|
33
|
+
|
34
|
+
Feel free to engage in discussions around this gem at our [Slack Channel](https://join.slack.com/t/reactrails/shared_invite/enQtNjY3NTczMjczNzYxLTlmYjdiZmY3MTVlMzU2YWE0OWM0MzNiZDI0MzdkZGFiZTFkYTFkOGVjODBmOWEyYWQ3MzA2NGE1YWJjNmVlMGE) or our [forum category for Cypress](https://forum.shakacode.com/c/cypress-on-rails/55).
|
35
|
+
|
36
|
+
Need help with cypress-on-rails? Contact [Justin Gordon](mailto:justin@shakacode.com).
|
14
37
|
|
15
38
|
----
|
16
39
|
|
17
|
-
#
|
18
|
-
|
40
|
+
# New to Cypress?
|
41
|
+
Consider first learning the basics of Cypress before attempting to integrate with Ruby on Rails.
|
19
42
|
|
20
43
|
* [Good start Here](https://docs.cypress.io/examples/tutorials.html#Best-Practices)
|
21
44
|
|
22
45
|
# Totally new to Playwright?
|
23
|
-
|
46
|
+
Consider first learning the basics of Playwright before attempting to integrate with Ruby on Rails.
|
24
47
|
|
25
48
|
* [Good start Here](https://playwright.dev/docs/writing-tests)
|
26
49
|
|
50
|
+
## Quick Start
|
51
|
+
|
52
|
+
```bash
|
53
|
+
# 1. Add to Gemfile
|
54
|
+
gem 'cypress-on-rails', '~> 1.0'
|
55
|
+
|
56
|
+
# 2. Install and generate
|
57
|
+
bundle install
|
58
|
+
bin/rails g cypress_on_rails:install
|
59
|
+
|
60
|
+
# 3. Run tests (new rake tasks!)
|
61
|
+
bin/rails cypress:open # Open Cypress UI
|
62
|
+
bin/rails cypress:run # Run headless
|
63
|
+
```
|
64
|
+
|
65
|
+
For Playwright:
|
66
|
+
```bash
|
67
|
+
bin/rails g cypress_on_rails:install --framework playwright
|
68
|
+
bin/rails playwright:open # Open Playwright UI
|
69
|
+
bin/rails playwright:run # Run headless
|
70
|
+
```
|
71
|
+
|
27
72
|
## Overview
|
28
73
|
|
29
|
-
Gem for using [cypress.io](http://github.com/cypress-io/) or [playwright.dev](https://playwright.dev/) in Rails and Ruby Rack applications
|
74
|
+
Gem for using [cypress.io](http://github.com/cypress-io/) or [playwright.dev](https://playwright.dev/) in Rails and Ruby Rack applications to control state as mentioned in [Cypress Best Practices](https://docs.cypress.io/guides/references/best-practices.html#Organizing-Tests-Logging-In-Controlling-State).
|
30
75
|
|
31
|
-
It allows you to run code in the application
|
76
|
+
It allows you to run code in the context of the application when executing Cypress or Playwright tests.
|
32
77
|
Do things like:
|
33
78
|
* use database_cleaner before each test
|
34
79
|
* seed the database with default data for each test
|
35
|
-
* use factory_bot to
|
80
|
+
* use factory_bot to set up data
|
36
81
|
* create scenario files used for specific tests
|
37
82
|
|
38
83
|
Has examples of setting up state with:
|
@@ -41,7 +86,16 @@ Has examples of setting up state with:
|
|
41
86
|
* scenarios
|
42
87
|
* custom commands
|
43
88
|
|
44
|
-
##
|
89
|
+
## Documentation
|
90
|
+
|
91
|
+
### 📚 Essential Guides
|
92
|
+
* **[Best Practices Guide](docs/BEST_PRACTICES.md)** - Recommended patterns and practices
|
93
|
+
* **[Troubleshooting Guide](docs/TROUBLESHOOTING.md)** - Solutions to common issues
|
94
|
+
* **[Playwright Guide](docs/PLAYWRIGHT_GUIDE.md)** - Complete Playwright documentation
|
95
|
+
* **[VCR Integration Guide](docs/VCR_GUIDE.md)** - HTTP recording and mocking
|
96
|
+
* **[DX Improvements](docs/DX_IMPROVEMENTS.md)** - Recent improvements based on user feedback
|
97
|
+
|
98
|
+
### 🎥 Resources
|
45
99
|
* [Video of getting started with this gem](https://grant-ps.blog/2018/08/10/getting-started-with-cypress-io-and-ruby-on-rails/)
|
46
100
|
* [Article: Introduction to Cypress on Rails](https://www.shakacode.com/blog/introduction-to-cypress-on-rails/)
|
47
101
|
|
@@ -96,10 +150,11 @@ Now you can create scenarios and commands that are plain Ruby files that get loa
|
|
96
150
|
|
97
151
|
### Update your database.yml
|
98
152
|
|
99
|
-
When writing and running tests on your local computer it's recommended to start your server in development mode so that changes you
|
153
|
+
When writing and running tests on your local computer, it's recommended to start your server in development mode so that changes you
|
100
154
|
make are picked up without having to restart your local server.
|
155
|
+
|
101
156
|
It's recommended you update your `database.yml` to check if the `CYPRESS` environment variable is set and switch it to the test database
|
102
|
-
otherwise cypress will keep clearing your development database.
|
157
|
+
otherwise, cypress will keep clearing your development database.
|
103
158
|
|
104
159
|
For example:
|
105
160
|
```yaml
|
@@ -119,6 +174,29 @@ Please use with extra caution if starting your local server on 0.0.0.0 or runnin
|
|
119
174
|
|
120
175
|
Getting started on your local environment
|
121
176
|
|
177
|
+
### Using Rake Tasks (Recommended)
|
178
|
+
|
179
|
+
The easiest way to run tests is using the provided rake tasks, which automatically manage the Rails server:
|
180
|
+
|
181
|
+
```shell
|
182
|
+
# For Cypress
|
183
|
+
bin/rails cypress:open # Opens Cypress test runner UI
|
184
|
+
bin/rails cypress:run # Runs Cypress tests in headless mode
|
185
|
+
|
186
|
+
# For Playwright
|
187
|
+
bin/rails playwright:open # Opens Playwright test runner UI
|
188
|
+
bin/rails playwright:run # Runs Playwright tests in headless mode
|
189
|
+
```
|
190
|
+
|
191
|
+
These tasks will:
|
192
|
+
- Start the Rails test server automatically
|
193
|
+
- Execute your tests
|
194
|
+
- Stop the server when done
|
195
|
+
|
196
|
+
### Manual Server Management
|
197
|
+
|
198
|
+
You can also manage the server manually:
|
199
|
+
|
122
200
|
```shell
|
123
201
|
# start rails
|
124
202
|
CYPRESS=1 bin/rails server -p 5017
|
@@ -148,6 +226,7 @@ npx cypress run --project ./e2e
|
|
148
226
|
|
149
227
|
You can run your [factory_bot](https://github.com/thoughtbot/factory_bot) directly as well
|
150
228
|
|
229
|
+
then in Cypress
|
151
230
|
```js
|
152
231
|
// spec/cypress/e2e/simple.cy.js
|
153
232
|
describe('My First Test', () => {
|
@@ -171,6 +250,32 @@ describe('My First Test', () => {
|
|
171
250
|
})
|
172
251
|
})
|
173
252
|
```
|
253
|
+
|
254
|
+
then in Playwright
|
255
|
+
```js
|
256
|
+
const { test, expect, request } = require('@playwright/test');
|
257
|
+
|
258
|
+
test.describe('My First Test', () => {
|
259
|
+
test('visit root', async ({ page }) => {
|
260
|
+
// This calls to the backend to prepare the application state
|
261
|
+
await appFactories([
|
262
|
+
['create_list', 'post', 10],
|
263
|
+
['create', 'post', { title: 'Hello World' }],
|
264
|
+
['create', 'post', 'with_comments', { title: 'Factory_bot Traits here' }]
|
265
|
+
]);
|
266
|
+
|
267
|
+
// Visit the application under test
|
268
|
+
await page.goto('/');
|
269
|
+
|
270
|
+
await expect(page).toHaveText('Hello World');
|
271
|
+
|
272
|
+
// Accessing result
|
273
|
+
const records = await appFactories([['create', 'invoice', { paid: false }]]);
|
274
|
+
await page.goto(`/invoices/${records[0].id}`);
|
275
|
+
});
|
276
|
+
});
|
277
|
+
```
|
278
|
+
|
174
279
|
You can check the [association docs](docs/factory_bot_associations.md) on more ways to setup association with the correct data.
|
175
280
|
|
176
281
|
In some cases, using static Cypress fixtures may not provide sufficient flexibility when mocking HTTP response bodies. It's possible to use `FactoryBot.build` to generate Ruby hashes that can then be used as mock JSON responses:
|
@@ -331,16 +436,21 @@ yarn add cypress-on-rails --dev
|
|
331
436
|
### for VCR
|
332
437
|
|
333
438
|
This only works when you start the Rails server with a single worker and single thread
|
439
|
+
It can be used in two modes:
|
440
|
+
- with separate insert/eject calls (more general, recommended way)
|
441
|
+
- with use_cassette wrapper (supports only GraphQL integration)
|
334
442
|
|
335
|
-
#### setup
|
443
|
+
#### basic setup
|
336
444
|
|
337
|
-
Add your VCR configuration to your `
|
445
|
+
Add your VCR configuration to your `config/cypress_on_rails.rb`
|
338
446
|
|
339
447
|
```ruby
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
448
|
+
c.vcr_options = {
|
449
|
+
hook_into: :webmock,
|
450
|
+
default_cassette_options: { record: :once },
|
451
|
+
# It's possible to override cassette_library_dir using install_folder
|
452
|
+
cassette_library_dir: File.expand_path("#{__dir__}/../../spec/cypress/fixtures/vcr_cassettes")
|
453
|
+
}
|
344
454
|
```
|
345
455
|
|
346
456
|
Add to your `cypress/support/index.js`:
|
@@ -357,13 +467,16 @@ VCR.turn_off!
|
|
357
467
|
WebMock.disable! if defined?(WebMock)
|
358
468
|
```
|
359
469
|
|
470
|
+
#### insert/eject setup
|
471
|
+
|
360
472
|
Add to your `config/cypress_on_rails.rb`:
|
361
473
|
|
362
474
|
```ruby
|
363
475
|
c.use_vcr_middleware = !Rails.env.production? && ENV['CYPRESS'].present?
|
476
|
+
# c.use_vcr_use_cassette_middleware = !Rails.env.production? && ENV['CYPRESS'].present?
|
364
477
|
```
|
365
478
|
|
366
|
-
#### usage
|
479
|
+
#### insert/eject usage
|
367
480
|
|
368
481
|
You have `vcr_insert_cassette` and `vcr_eject_cassette` available. https://www.rubydoc.info/github/vcr/vcr/VCR:insert_cassette
|
369
482
|
|
@@ -390,6 +503,101 @@ describe('My First Test', () => {
|
|
390
503
|
})
|
391
504
|
```
|
392
505
|
|
506
|
+
#### use_cassette setup
|
507
|
+
|
508
|
+
Add to your `config/cypress_on_rails.rb`:
|
509
|
+
|
510
|
+
```ruby
|
511
|
+
# c.use_vcr_middleware = !Rails.env.production? && ENV['CYPRESS'].present?
|
512
|
+
c.use_vcr_use_cassette_middleware = !Rails.env.production? && ENV['CYPRESS'].present?
|
513
|
+
```
|
514
|
+
|
515
|
+
Adjust record mode in `config/cypress_on_rails.rb` if needed:
|
516
|
+
|
517
|
+
```ruby
|
518
|
+
c.vcr_options = {
|
519
|
+
hook_into: :webmock,
|
520
|
+
default_cassette_options: { record: :once },
|
521
|
+
}
|
522
|
+
```
|
523
|
+
|
524
|
+
Add to your `cypress/support/command.js`:
|
525
|
+
|
526
|
+
```js
|
527
|
+
// Add proxy-like mock to add operation name into query string
|
528
|
+
Cypress.Commands.add('mockGraphQL', () => {
|
529
|
+
cy.on('window:before:load', (win) => {
|
530
|
+
const originalFetch = win.fetch;
|
531
|
+
const fetch = (path, options, ...rest) => {
|
532
|
+
if (options && options.body) {
|
533
|
+
try {
|
534
|
+
const body = JSON.parse(options.body);
|
535
|
+
if (body.operationName) {
|
536
|
+
return originalFetch(`${path}?operation=${body.operationName}`, options, ...rest);
|
537
|
+
}
|
538
|
+
} catch (e) {
|
539
|
+
return originalFetch(path, options, ...rest);
|
540
|
+
}
|
541
|
+
}
|
542
|
+
return originalFetch(path, options, ...rest);
|
543
|
+
};
|
544
|
+
cy.stub(win, 'fetch', fetch);
|
545
|
+
});
|
546
|
+
});
|
547
|
+
```
|
548
|
+
|
549
|
+
Add to your `cypress/support/on-rails.js`, to `beforeEach`:
|
550
|
+
|
551
|
+
```js
|
552
|
+
cy.mockGraphQL() // for GraphQL usage with use_cassette, see cypress/support/commands.rb
|
553
|
+
```
|
554
|
+
|
555
|
+
#### use_cassette usage
|
556
|
+
|
557
|
+
There is nothing special to be called during the Cypress scenario. Each request is wrapped with `VCR.use_cassette`.
|
558
|
+
Consider VCR configuration in `cypress_helper.rb` to ignore hosts.
|
559
|
+
|
560
|
+
All cassettes will be recorded and saved automatically, using the pattern `<vcs_cassettes_path>/graphql/<operation_name>`
|
561
|
+
|
562
|
+
|
563
|
+
## Server Hooks Configuration
|
564
|
+
|
565
|
+
When using the rake tasks (`cypress:open`, `cypress:run`, `playwright:open`, `playwright:run`), you can configure lifecycle hooks to customize test server behavior:
|
566
|
+
|
567
|
+
```ruby
|
568
|
+
CypressOnRails.configure do |c|
|
569
|
+
# Run code before Rails server starts
|
570
|
+
c.before_server_start = -> {
|
571
|
+
puts "Preparing test environment..."
|
572
|
+
}
|
573
|
+
|
574
|
+
# Run code after Rails server is ready
|
575
|
+
c.after_server_start = -> {
|
576
|
+
puts "Server is ready for testing!"
|
577
|
+
}
|
578
|
+
|
579
|
+
# Run code after database transaction begins (transactional mode only)
|
580
|
+
c.after_transaction_start = -> {
|
581
|
+
# Load seed data that should be rolled back after tests
|
582
|
+
}
|
583
|
+
|
584
|
+
# Run code after application state is reset
|
585
|
+
c.after_state_reset = -> {
|
586
|
+
Rails.cache.clear
|
587
|
+
}
|
588
|
+
|
589
|
+
# Run code before Rails server stops
|
590
|
+
c.before_server_stop = -> {
|
591
|
+
puts "Cleaning up test environment..."
|
592
|
+
}
|
593
|
+
|
594
|
+
# Configure server settings
|
595
|
+
c.server_host = 'localhost' # or use ENV['CYPRESS_RAILS_HOST']
|
596
|
+
c.server_port = 3001 # or use ENV['CYPRESS_RAILS_PORT']
|
597
|
+
c.transactional_server = true # Enable automatic transaction rollback
|
598
|
+
end
|
599
|
+
```
|
600
|
+
|
393
601
|
## `before_request` configuration
|
394
602
|
|
395
603
|
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.
|
@@ -485,6 +693,46 @@ beforeEach(() => {
|
|
485
693
|
});
|
486
694
|
```
|
487
695
|
|
696
|
+
add the following file to Playwright
|
697
|
+
```js
|
698
|
+
// test/playwright/support/on-rails.js
|
699
|
+
async function appCommands(body) {
|
700
|
+
const context = await request.newContext();
|
701
|
+
const response = await context.post('/__e2e__/command', {
|
702
|
+
data: body,
|
703
|
+
headers: {
|
704
|
+
'Content-Type': 'application/json'
|
705
|
+
}
|
706
|
+
});
|
707
|
+
|
708
|
+
if (response.status() !== 201) {
|
709
|
+
const responseBody = await response.text();
|
710
|
+
throw new Error(`Expected status 201 but got ${response.status()} - ${responseBody}`);
|
711
|
+
}
|
712
|
+
|
713
|
+
return response.json();
|
714
|
+
}
|
715
|
+
|
716
|
+
async function app(name, commandOptions = {}) {
|
717
|
+
const body = await appCommands({ name, options: commandOptions });
|
718
|
+
return body[0];
|
719
|
+
}
|
720
|
+
|
721
|
+
async function appScenario(name, options = {}) {
|
722
|
+
const body = { name: `scenarios/${name}`, options };
|
723
|
+
const result = await appCommands(body);
|
724
|
+
return result[0];
|
725
|
+
}
|
726
|
+
|
727
|
+
async function appFactories(options) {
|
728
|
+
return app('factory_bot', options);
|
729
|
+
}
|
730
|
+
|
731
|
+
async function clean() {
|
732
|
+
await app('clean');
|
733
|
+
}
|
734
|
+
```
|
735
|
+
|
488
736
|
## API Prefix
|
489
737
|
|
490
738
|
If your Rails server is exposed under a proxy, typically https://my-local.dev/api, you can use the `api_prefix` option.
|
@@ -506,8 +754,8 @@ In `config/initializers/cypress_on_rails.rb`, add this line:
|
|
506
754
|
|
507
755
|
## Supporters
|
508
756
|
|
509
|
-
<a href="https://
|
510
|
-
<img src="https://
|
757
|
+
<a href="https://jb.gg/OpenSource" style="margin-right: 20px;">
|
758
|
+
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.png" alt="JetBrains" height="120px">
|
511
759
|
</a>
|
512
760
|
<a href="https://scoutapp.com">
|
513
761
|
<picture>
|
@@ -516,7 +764,7 @@ In `config/initializers/cypress_on_rails.rb`, add this line:
|
|
516
764
|
<img alt="ScoutAPM" src="https://user-images.githubusercontent.com/4244251/184881152-9f2d8fba-88ac-4ba6-873b-22387f8711c5.png" height="120px">
|
517
765
|
</picture>
|
518
766
|
</a>
|
519
|
-
<a href="https://controlplane.com">
|
767
|
+
<a href="https://shakacode.controlplane.com">
|
520
768
|
<picture>
|
521
769
|
<img alt="Control Plane" src="https://github.com/shakacode/.github/assets/20628911/90babd87-62c4-4de3-baa4-3d78ef4bec25" height="120px">
|
522
770
|
</picture>
|
data/RELEASING.md
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
# Release Process
|
2
|
+
|
3
|
+
This document describes how to release a new version of cypress-playwright-on-rails.
|
4
|
+
|
5
|
+
## Prerequisites
|
6
|
+
|
7
|
+
1. Maintainer access to the repository
|
8
|
+
2. RubyGems account with publish permissions for `cypress-on-rails`
|
9
|
+
3. Clean working directory on `master` branch
|
10
|
+
4. Development dependencies installed: `bundle install`
|
11
|
+
- Includes `gem-release` for gem management (like react_on_rails)
|
12
|
+
|
13
|
+
## Release Command
|
14
|
+
|
15
|
+
The project uses a single rake task to automate the entire release process:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
rake release[VERSION,DRY_RUN]
|
19
|
+
```
|
20
|
+
|
21
|
+
### Examples
|
22
|
+
|
23
|
+
```bash
|
24
|
+
# Release version 1.19.0
|
25
|
+
rake release[1.19.0]
|
26
|
+
|
27
|
+
# Automatic patch version bump (e.g., 1.18.0 -> 1.18.1)
|
28
|
+
rake release
|
29
|
+
|
30
|
+
# Dry run to preview what would happen
|
31
|
+
rake release[1.19.0,true]
|
32
|
+
```
|
33
|
+
|
34
|
+
### What the Release Task Does
|
35
|
+
|
36
|
+
The `rake release` task will:
|
37
|
+
|
38
|
+
1. Pull latest changes from master
|
39
|
+
2. Bump the version in `lib/cypress_on_rails/version.rb`
|
40
|
+
3. Update `Gemfile.lock` via `bundle install`
|
41
|
+
4. Commit the version bump and Gemfile.lock changes
|
42
|
+
5. Create a git tag (e.g., `v1.19.0`)
|
43
|
+
6. Push the commit and tag to GitHub
|
44
|
+
7. Build and publish the gem to RubyGems (will prompt for OTP)
|
45
|
+
|
46
|
+
### Post-Release Steps
|
47
|
+
|
48
|
+
After publishing, complete these manual steps:
|
49
|
+
|
50
|
+
1. **Update CHANGELOG.md**
|
51
|
+
```bash
|
52
|
+
bundle exec rake update_changelog
|
53
|
+
git commit -a -m 'Update CHANGELOG.md'
|
54
|
+
git push
|
55
|
+
```
|
56
|
+
|
57
|
+
2. **Create GitHub Release**
|
58
|
+
- Go to the releases page: https://github.com/shakacode/cypress-playwright-on-rails/releases
|
59
|
+
- Click on the newly created tag
|
60
|
+
- Copy release notes from CHANGELOG.md
|
61
|
+
- Publish the release
|
62
|
+
|
63
|
+
3. **Announce the Release** (optional)
|
64
|
+
- Post in Slack channel
|
65
|
+
- Tweet about the release
|
66
|
+
- Update forum posts if needed
|
67
|
+
|
68
|
+
## Version Numbering
|
69
|
+
|
70
|
+
Follow [Semantic Versioning](https://semver.org/):
|
71
|
+
|
72
|
+
- **MAJOR** (X.0.0): Breaking changes
|
73
|
+
- **MINOR** (1.X.0): New features, backwards compatible
|
74
|
+
- **PATCH** (1.19.X): Bug fixes, backwards compatible
|
75
|
+
|
76
|
+
### Examples
|
77
|
+
|
78
|
+
```bash
|
79
|
+
# Patch release (bug fixes)
|
80
|
+
rake release[1.18.1]
|
81
|
+
|
82
|
+
# Minor release (new features)
|
83
|
+
rake release[1.19.0]
|
84
|
+
|
85
|
+
# Major release (breaking changes)
|
86
|
+
rake release[2.0.0]
|
87
|
+
|
88
|
+
# Automatic patch bump
|
89
|
+
rake release
|
90
|
+
```
|
91
|
+
|
92
|
+
## Pre-Release Checklist
|
93
|
+
|
94
|
+
Before running `rake release`:
|
95
|
+
|
96
|
+
- [ ] All PRs for the release are merged
|
97
|
+
- [ ] CI is passing on master
|
98
|
+
- [ ] CHANGELOG.md has [Unreleased] section with all changes
|
99
|
+
- [ ] Major changes have been tested manually
|
100
|
+
- [ ] Documentation is up to date
|
101
|
+
|
102
|
+
## Troubleshooting
|
103
|
+
|
104
|
+
### "Must be on master branch" error
|
105
|
+
|
106
|
+
```bash
|
107
|
+
git checkout master
|
108
|
+
git pull --rebase
|
109
|
+
```
|
110
|
+
|
111
|
+
### "Working directory is not clean" error
|
112
|
+
|
113
|
+
```bash
|
114
|
+
# Commit or stash your changes
|
115
|
+
git status
|
116
|
+
git add -A && git commit -m "Your message"
|
117
|
+
# or
|
118
|
+
git stash
|
119
|
+
```
|
120
|
+
|
121
|
+
|
122
|
+
### "Failed to push gem to RubyGems" error
|
123
|
+
|
124
|
+
Ensure you're authenticated with RubyGems:
|
125
|
+
```bash
|
126
|
+
gem signin
|
127
|
+
# Enter your RubyGems credentials
|
128
|
+
```
|
129
|
+
|
130
|
+
### Tag already exists
|
131
|
+
|
132
|
+
If you need to re-release the same version:
|
133
|
+
```bash
|
134
|
+
# Delete local tag
|
135
|
+
git tag -d v1.19.0
|
136
|
+
|
137
|
+
# Delete remote tag
|
138
|
+
git push origin :v1.19.0
|
139
|
+
|
140
|
+
# Reset to before the release commit
|
141
|
+
git reset --hard HEAD~1
|
142
|
+
|
143
|
+
# Try the release again
|
144
|
+
rake release[1.19.0]
|
145
|
+
```
|
146
|
+
|
147
|
+
## Rollback
|
148
|
+
|
149
|
+
If you need to rollback a release:
|
150
|
+
|
151
|
+
### Yank the gem from RubyGems
|
152
|
+
```bash
|
153
|
+
gem yank cypress-on-rails -v 1.19.0
|
154
|
+
```
|
155
|
+
|
156
|
+
### Delete the git tag
|
157
|
+
```bash
|
158
|
+
git tag -d v1.19.0
|
159
|
+
git push origin :v1.19.0
|
160
|
+
```
|
161
|
+
|
162
|
+
### Revert the version commit
|
163
|
+
```bash
|
164
|
+
git revert HEAD
|
165
|
+
git push origin master
|
166
|
+
```
|
167
|
+
|
168
|
+
## Example Release Flow
|
169
|
+
|
170
|
+
```bash
|
171
|
+
# 1. Ensure you're on master and up to date
|
172
|
+
git checkout master
|
173
|
+
git pull --rebase
|
174
|
+
|
175
|
+
# 2. Check CI is passing
|
176
|
+
# Visit: https://github.com/shakacode/cypress-playwright-on-rails/actions
|
177
|
+
|
178
|
+
# 3. Release (will handle everything automatically)
|
179
|
+
rake release[1.19.0]
|
180
|
+
# Enter your RubyGems OTP when prompted
|
181
|
+
|
182
|
+
# 4. Update the changelog
|
183
|
+
bundle exec rake update_changelog
|
184
|
+
git commit -a -m 'Update CHANGELOG.md'
|
185
|
+
git push
|
186
|
+
|
187
|
+
# 5. Create GitHub release
|
188
|
+
open "https://github.com/shakacode/cypress-playwright-on-rails/releases"
|
189
|
+
# Click on the new tag, add release notes from CHANGELOG.md
|
190
|
+
|
191
|
+
# 6. Celebrate! 🎉
|
192
|
+
```
|
193
|
+
|
194
|
+
## Notes
|
195
|
+
|
196
|
+
- The release task handles all git operations (commit, tag, push) automatically
|
197
|
+
- Always ensure CI is green before releasing
|
198
|
+
- The task will fail fast if working directory is not clean
|
199
|
+
- Failed releases can be retried after fixing issues
|
200
|
+
- Use dry run mode (`rake release[VERSION,true]`) to preview changes
|
data/Rakefile
CHANGED
data/cypress-on-rails.gemspec
CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_development_dependency 'railties', '>= 3.2'
|
22
22
|
s.add_development_dependency 'factory_bot', '!= 6.4.5'
|
23
23
|
s.add_development_dependency 'vcr'
|
24
|
+
s.add_development_dependency 'gem-release'
|
24
25
|
s.metadata = {
|
25
26
|
"bug_tracker_uri" => "https://github.com/shakacode/cypress-on-rails/issues",
|
26
27
|
"changelog_uri" => "https://github.com/shakacode/cypress-on-rails/blob/master/CHANGELOG.md",
|