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.
Files changed (337) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/claude-code-review.yml +57 -0
  3. data/.github/workflows/claude.yml +50 -0
  4. data/.github/workflows/ruby.yml +14 -14
  5. data/CHANGELOG.md +319 -98
  6. data/README.md +271 -23
  7. data/RELEASING.md +200 -0
  8. data/Rakefile +1 -4
  9. data/cypress-on-rails.gemspec +1 -0
  10. data/docs/BEST_PRACTICES.md +678 -0
  11. data/docs/DX_IMPROVEMENTS.md +163 -0
  12. data/docs/PLAYWRIGHT_GUIDE.md +554 -0
  13. data/docs/RELEASE.md +124 -0
  14. data/docs/TROUBLESHOOTING.md +351 -0
  15. data/docs/VCR_GUIDE.md +499 -0
  16. data/docs/authentication.md +30 -0
  17. data/docs/factory_bot_associations.md +14 -0
  18. data/lib/cypress_on_rails/configuration.rb +29 -0
  19. data/lib/cypress_on_rails/railtie.rb +17 -2
  20. data/lib/cypress_on_rails/server.rb +197 -0
  21. data/lib/cypress_on_rails/state_reset_middleware.rb +58 -0
  22. data/lib/cypress_on_rails/vcr/insert_eject_middleware.rb +75 -0
  23. data/lib/cypress_on_rails/vcr/middleware_helpers.rb +51 -0
  24. data/lib/cypress_on_rails/vcr/use_cassette_middleware.rb +56 -0
  25. data/lib/cypress_on_rails/version.rb +1 -1
  26. data/lib/generators/cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb +20 -0
  27. data/lib/generators/cypress_on_rails/templates/spec/cypress/e2e/rails_examples/using_factory_bot.cy.js +2 -2
  28. data/lib/generators/cypress_on_rails/templates/spec/cypress/e2e/rails_examples/using_scenarios.cy.js +1 -1
  29. data/lib/generators/cypress_on_rails/templates/spec/cypress/support/commands.js +22 -0
  30. data/lib/generators/cypress_on_rails/templates/spec/cypress/support/on-rails.js +2 -1
  31. data/lib/generators/cypress_on_rails/templates/spec/e2e/e2e_helper.rb.erb +0 -5
  32. data/lib/tasks/cypress.rake +33 -0
  33. data/rakelib/release.rake +80 -0
  34. data/rakelib/task_helpers.rb +23 -0
  35. data/rakelib/update_changelog.rake +63 -0
  36. data/spec/cypress_on_rails/configuration_spec.rb +4 -1
  37. data/spec/cypress_on_rails/vcr/insert_eject_middleware_spec.rb +177 -0
  38. data/spec/cypress_on_rails/vcr/use_cassette_middleware_spec.rb +68 -0
  39. data/specs_e2e/rails_6_1/.gitattributes +10 -0
  40. data/specs_e2e/rails_6_1/Gemfile +20 -0
  41. data/specs_e2e/{rails_5_2 → rails_6_1}/Rakefile +1 -1
  42. data/specs_e2e/rails_6_1/app/assets/stylesheets/application.css +15 -0
  43. data/specs_e2e/rails_6_1/app/jobs/application_job.rb +7 -0
  44. data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/layouts/application.html.erb +1 -1
  45. data/specs_e2e/rails_6_1/bin/bundle +114 -0
  46. data/specs_e2e/rails_6_1/bin/rails +5 -0
  47. data/specs_e2e/rails_6_1/bin/rake +5 -0
  48. data/specs_e2e/{rails_5_2 → rails_6_1}/bin/setup +15 -4
  49. data/specs_e2e/rails_6_1/bin/spring +14 -0
  50. data/specs_e2e/rails_6_1/bin/yarn +17 -0
  51. data/specs_e2e/rails_6_1/config/application.rb +34 -0
  52. data/specs_e2e/rails_6_1/config/boot.rb +4 -0
  53. data/specs_e2e/rails_6_1/config/cable.yml +10 -0
  54. data/specs_e2e/rails_6_1/config/credentials.yml.enc +1 -0
  55. data/specs_e2e/{rails_5_2 → rails_6_1}/config/database.yml +7 -0
  56. data/specs_e2e/{rails_5_2 → rails_6_1}/config/environment.rb +1 -1
  57. data/specs_e2e/{rails_5_2 → rails_6_1}/config/environments/development.rb +22 -5
  58. data/specs_e2e/rails_6_1/config/environments/production.rb +120 -0
  59. data/specs_e2e/{rails_5_2 → rails_6_1}/config/environments/test.rb +24 -7
  60. data/specs_e2e/rails_6_1/config/initializers/backtrace_silencers.rb +8 -0
  61. data/specs_e2e/{rails_5_2 → rails_6_1}/config/initializers/content_security_policy.rb +5 -0
  62. data/specs_e2e/{rails_4_2 → rails_6_1}/config/initializers/filter_parameter_logging.rb +3 -1
  63. data/specs_e2e/rails_6_1/config/initializers/permissions_policy.rb +11 -0
  64. data/specs_e2e/{rails_3_2 → rails_6_1}/config/initializers/wrap_parameters.rb +5 -1
  65. data/specs_e2e/{rails_5_2 → rails_6_1}/config/locales/en.yml +1 -1
  66. data/specs_e2e/rails_6_1/config/master.key +1 -0
  67. data/specs_e2e/rails_6_1/config/puma.rb +43 -0
  68. data/specs_e2e/rails_6_1/config/storage.yml +34 -0
  69. data/specs_e2e/{rails_5_2 → rails_6_1}/config.ru +2 -1
  70. data/specs_e2e/{rails_5_2 → rails_6_1}/db/migrate/20180621085832_create_posts.rb +1 -1
  71. data/specs_e2e/rails_6_1/package.json +8 -0
  72. data/specs_e2e/rails_6_1/playwright-report/index.html +71 -0
  73. data/specs_e2e/rails_6_1/public/robots.txt +1 -0
  74. data/specs_e2e/rails_6_1/test-results/.last-run.json +4 -0
  75. data/specs_e2e/{rails_4_2 → rails_6_1}/test.sh +22 -15
  76. data/specs_e2e/rails_7_2/.gitattributes +9 -0
  77. data/specs_e2e/rails_7_2/.gitignore +16 -0
  78. data/specs_e2e/rails_7_2/.rubocop.yml +8 -0
  79. data/specs_e2e/rails_7_2/Gemfile +11 -0
  80. data/specs_e2e/{rails_4_2 → rails_7_2}/Rakefile +1 -1
  81. data/specs_e2e/rails_7_2/app/assets/stylesheets/application.css +15 -0
  82. data/specs_e2e/rails_7_2/app/controllers/application_controller.rb +4 -0
  83. data/specs_e2e/rails_7_2/app/controllers/posts_controller.rb +58 -0
  84. data/specs_e2e/rails_7_2/app/helpers/posts_helper.rb +2 -0
  85. data/specs_e2e/rails_7_2/app/jobs/application_job.rb +7 -0
  86. data/specs_e2e/rails_7_2/app/models/application_record.rb +3 -0
  87. data/specs_e2e/rails_7_2/app/models/post.rb +2 -0
  88. data/specs_e2e/rails_7_2/app/views/layouts/application.html.erb +22 -0
  89. data/specs_e2e/rails_7_2/app/views/posts/_form.html.erb +32 -0
  90. data/specs_e2e/rails_7_2/app/views/posts/edit.html.erb +6 -0
  91. data/specs_e2e/rails_7_2/app/views/posts/index.html.erb +31 -0
  92. data/specs_e2e/rails_7_2/app/views/posts/new.html.erb +5 -0
  93. data/specs_e2e/rails_7_2/app/views/posts/show.html.erb +19 -0
  94. data/specs_e2e/rails_7_2/bin/brakeman +7 -0
  95. data/specs_e2e/rails_7_2/bin/bundle +109 -0
  96. data/specs_e2e/rails_7_2/bin/importmap +4 -0
  97. data/specs_e2e/rails_7_2/bin/rails +4 -0
  98. data/specs_e2e/rails_7_2/bin/rake +4 -0
  99. data/specs_e2e/rails_7_2/bin/setup +37 -0
  100. data/specs_e2e/rails_7_2/config/application.rb +37 -0
  101. data/specs_e2e/rails_7_2/config/boot.rb +4 -0
  102. data/specs_e2e/rails_7_2/config/cable.yml +10 -0
  103. data/specs_e2e/rails_7_2/config/credentials.yml.enc +1 -0
  104. data/specs_e2e/rails_7_2/config/database.yml +32 -0
  105. data/specs_e2e/{rails_4_2 → rails_7_2}/config/environment.rb +1 -1
  106. data/specs_e2e/rails_7_2/config/environments/development.rb +54 -0
  107. data/specs_e2e/rails_7_2/config/environments/production.rb +105 -0
  108. data/specs_e2e/rails_7_2/config/environments/test.rb +45 -0
  109. data/specs_e2e/rails_7_2/config/importmap.rb +7 -0
  110. data/specs_e2e/rails_7_2/config/initializers/content_security_policy.rb +25 -0
  111. data/specs_e2e/rails_7_2/config/initializers/filter_parameter_logging.rb +8 -0
  112. data/specs_e2e/{rails_5_2 → rails_7_2}/config/initializers/inflections.rb +4 -4
  113. data/specs_e2e/rails_7_2/config/initializers/permissions_policy.rb +13 -0
  114. data/specs_e2e/rails_7_2/config/locales/en.yml +31 -0
  115. data/specs_e2e/rails_7_2/config/master.key +1 -0
  116. data/specs_e2e/rails_7_2/config/puma.rb +34 -0
  117. data/specs_e2e/rails_7_2/config/routes.rb +5 -0
  118. data/specs_e2e/rails_7_2/config/storage.yml +34 -0
  119. data/specs_e2e/{rails_4_2 → rails_7_2}/config.ru +3 -1
  120. data/specs_e2e/rails_7_2/db/migrate/20180621085832_create_posts.rb +11 -0
  121. data/specs_e2e/rails_7_2/db/seeds.rb +9 -0
  122. data/specs_e2e/rails_7_2/db/test.sqlite3-shm +0 -0
  123. data/specs_e2e/rails_7_2/db/test.sqlite3-wal +0 -0
  124. data/specs_e2e/rails_7_2/package.json +8 -0
  125. data/specs_e2e/rails_7_2/playwright-report/index.html +71 -0
  126. data/specs_e2e/{rails_4_2 → rails_7_2}/public/404.html +6 -6
  127. data/specs_e2e/rails_7_2/public/406-unsupported-browser.html +66 -0
  128. data/specs_e2e/{rails_4_2 → rails_7_2}/public/422.html +6 -6
  129. data/specs_e2e/{rails_4_2 → rails_7_2}/public/500.html +6 -6
  130. data/specs_e2e/rails_7_2/public/icon.png +0 -0
  131. data/specs_e2e/rails_7_2/public/icon.svg +3 -0
  132. data/specs_e2e/rails_7_2/public/robots.txt +1 -0
  133. data/specs_e2e/rails_7_2/storage/test.sqlite3 +0 -0
  134. data/specs_e2e/rails_7_2/test/controllers/posts_controller_test.rb +48 -0
  135. data/specs_e2e/rails_7_2/test/cypress_fixtures/posts.yml +11 -0
  136. data/specs_e2e/rails_7_2/test/fixtures/posts.yml +11 -0
  137. data/specs_e2e/rails_7_2/test/models/post_test.rb +7 -0
  138. data/specs_e2e/rails_7_2/test-results/.last-run.json +4 -0
  139. data/specs_e2e/rails_7_2/test.sh +57 -0
  140. data/specs_e2e/rails_8/.gitattributes +9 -0
  141. data/specs_e2e/rails_8/.gitignore +16 -0
  142. data/specs_e2e/rails_8/.rubocop.yml +8 -0
  143. data/specs_e2e/rails_8/Gemfile +20 -0
  144. data/specs_e2e/{rails_3_2 → rails_8}/Rakefile +2 -3
  145. data/specs_e2e/rails_8/app/assets/stylesheets/application.css +10 -0
  146. data/specs_e2e/rails_8/app/controllers/application_controller.rb +4 -0
  147. data/specs_e2e/rails_8/app/controllers/posts_controller.rb +58 -0
  148. data/specs_e2e/rails_8/app/helpers/posts_helper.rb +2 -0
  149. data/specs_e2e/rails_8/app/jobs/application_job.rb +7 -0
  150. data/specs_e2e/rails_8/app/models/application_record.rb +3 -0
  151. data/specs_e2e/rails_8/app/models/post.rb +2 -0
  152. data/specs_e2e/rails_8/app/views/layouts/application.html.erb +27 -0
  153. data/specs_e2e/rails_8/app/views/posts/_form.html.erb +32 -0
  154. data/specs_e2e/rails_8/app/views/posts/edit.html.erb +6 -0
  155. data/specs_e2e/rails_8/app/views/posts/index.html.erb +31 -0
  156. data/specs_e2e/rails_8/app/views/posts/new.html.erb +5 -0
  157. data/specs_e2e/rails_8/app/views/posts/show.html.erb +19 -0
  158. data/specs_e2e/rails_8/bin/brakeman +7 -0
  159. data/specs_e2e/rails_8/bin/bundle +109 -0
  160. data/specs_e2e/rails_8/bin/dev +2 -0
  161. data/specs_e2e/rails_8/bin/importmap +4 -0
  162. data/specs_e2e/rails_8/bin/rails +4 -0
  163. data/specs_e2e/rails_8/bin/rake +4 -0
  164. data/specs_e2e/rails_8/bin/setup +34 -0
  165. data/specs_e2e/rails_8/bin/thrust +5 -0
  166. data/specs_e2e/rails_8/config/application.rb +27 -0
  167. data/specs_e2e/rails_8/config/boot.rb +4 -0
  168. data/specs_e2e/rails_8/config/cable.yml +17 -0
  169. data/specs_e2e/rails_8/config/cache.yml +16 -0
  170. data/specs_e2e/rails_8/config/credentials.yml.enc +1 -0
  171. data/specs_e2e/rails_8/config/database.yml +41 -0
  172. data/specs_e2e/rails_8/config/deploy.yml +116 -0
  173. data/specs_e2e/rails_8/config/environment.rb +5 -0
  174. data/specs_e2e/rails_8/config/environments/development.rb +57 -0
  175. data/specs_e2e/rails_8/config/environments/production.rb +90 -0
  176. data/specs_e2e/rails_8/config/environments/test.rb +45 -0
  177. data/specs_e2e/rails_8/config/importmap.rb +7 -0
  178. data/specs_e2e/rails_8/config/initializers/content_security_policy.rb +25 -0
  179. data/specs_e2e/rails_8/config/initializers/filter_parameter_logging.rb +8 -0
  180. data/specs_e2e/rails_8/config/initializers/inflections.rb +16 -0
  181. data/specs_e2e/rails_8/config/locales/en.yml +31 -0
  182. data/specs_e2e/rails_8/config/master.key +1 -0
  183. data/specs_e2e/rails_8/config/puma.rb +41 -0
  184. data/specs_e2e/rails_8/config/queue.yml +18 -0
  185. data/specs_e2e/rails_8/config/recurring.yml +10 -0
  186. data/specs_e2e/rails_8/config/routes.rb +5 -0
  187. data/specs_e2e/rails_8/config/storage.yml +34 -0
  188. data/specs_e2e/rails_8/config.ru +6 -0
  189. data/specs_e2e/rails_8/db/cable_schema.rb +11 -0
  190. data/specs_e2e/rails_8/db/cache_schema.rb +14 -0
  191. data/specs_e2e/rails_8/db/migrate/20180621085832_create_posts.rb +11 -0
  192. data/specs_e2e/rails_8/db/queue_schema.rb +129 -0
  193. data/specs_e2e/rails_8/db/seeds.rb +9 -0
  194. data/specs_e2e/rails_8/package.json +8 -0
  195. data/specs_e2e/rails_8/playwright-report/index.html +71 -0
  196. data/specs_e2e/rails_8/public/400.html +114 -0
  197. data/specs_e2e/rails_8/public/404.html +114 -0
  198. data/specs_e2e/rails_8/public/406-unsupported-browser.html +114 -0
  199. data/specs_e2e/rails_8/public/422.html +114 -0
  200. data/specs_e2e/rails_8/public/500.html +114 -0
  201. data/specs_e2e/rails_8/public/icon.png +0 -0
  202. data/specs_e2e/rails_8/public/icon.svg +3 -0
  203. data/specs_e2e/rails_8/public/robots.txt +1 -0
  204. data/specs_e2e/rails_8/storage/test.sqlite3 +0 -0
  205. data/specs_e2e/rails_8/storage/test.sqlite3-shm +0 -0
  206. data/specs_e2e/rails_8/storage/test.sqlite3-wal +0 -0
  207. data/specs_e2e/rails_8/test/application_system_test_case.rb +5 -0
  208. data/specs_e2e/rails_8/test/controllers/posts_controller_test.rb +48 -0
  209. data/specs_e2e/rails_8/test/cypress_fixtures/posts.yml +11 -0
  210. data/specs_e2e/rails_8/test/fixtures/posts.yml +11 -0
  211. data/specs_e2e/rails_8/test/models/post_test.rb +7 -0
  212. data/specs_e2e/rails_8/test/test_helper.rb +15 -0
  213. data/specs_e2e/rails_8/test-results/.last-run.json +4 -0
  214. data/specs_e2e/{rails_5_2 → rails_8}/test.sh +1 -1
  215. metadata +246 -150
  216. data/lib/cypress_on_rails/vcr_middleware.rb +0 -73
  217. data/spec/cypress_on_rails/vcr_middleware_spec.rb +0 -119
  218. data/specs_e2e/rails_3_2/.gitignore +0 -9
  219. data/specs_e2e/rails_3_2/.ruby_version +0 -1
  220. data/specs_e2e/rails_3_2/Gemfile +0 -7
  221. data/specs_e2e/rails_3_2/README.rdoc +0 -261
  222. data/specs_e2e/rails_3_2/app/assets/stylesheets/application.css +0 -13
  223. data/specs_e2e/rails_3_2/app/controllers/application_controller.rb +0 -3
  224. data/specs_e2e/rails_3_2/app/controllers/welcome_controller.rb +0 -4
  225. data/specs_e2e/rails_3_2/app/helpers/application_helper.rb +0 -2
  226. data/specs_e2e/rails_3_2/app/models/post.rb +0 -21
  227. data/specs_e2e/rails_3_2/app/views/layouts/application.html.erb +0 -13
  228. data/specs_e2e/rails_3_2/app/views/welcome/index.html.erb +0 -24
  229. data/specs_e2e/rails_3_2/bin/rails +0 -6
  230. data/specs_e2e/rails_3_2/config/application.rb +0 -68
  231. data/specs_e2e/rails_3_2/config/boot.rb +0 -6
  232. data/specs_e2e/rails_3_2/config/environment.rb +0 -5
  233. data/specs_e2e/rails_3_2/config/environments/development.rb +0 -31
  234. data/specs_e2e/rails_3_2/config/environments/production.rb +0 -64
  235. data/specs_e2e/rails_3_2/config/environments/test.rb +0 -35
  236. data/specs_e2e/rails_3_2/config/initializers/backtrace_silencers.rb +0 -7
  237. data/specs_e2e/rails_3_2/config/initializers/inflections.rb +0 -15
  238. data/specs_e2e/rails_3_2/config/initializers/mime_types.rb +0 -5
  239. data/specs_e2e/rails_3_2/config/initializers/secret_token.rb +0 -7
  240. data/specs_e2e/rails_3_2/config/initializers/session_store.rb +0 -8
  241. data/specs_e2e/rails_3_2/config/locales/en.yml +0 -5
  242. data/specs_e2e/rails_3_2/config/routes.rb +0 -60
  243. data/specs_e2e/rails_3_2/config.ru +0 -4
  244. data/specs_e2e/rails_3_2/public/404.html +0 -26
  245. data/specs_e2e/rails_3_2/public/422.html +0 -26
  246. data/specs_e2e/rails_3_2/public/500.html +0 -25
  247. data/specs_e2e/rails_3_2/public/robots.txt +0 -5
  248. data/specs_e2e/rails_3_2/test.sh +0 -50
  249. data/specs_e2e/rails_4_2/.gitignore +0 -12
  250. data/specs_e2e/rails_4_2/Gemfile +0 -11
  251. data/specs_e2e/rails_4_2/README.rdoc +0 -28
  252. data/specs_e2e/rails_4_2/app/assets/javascripts/using_vcr.js +0 -2
  253. data/specs_e2e/rails_4_2/app/assets/stylesheets/using_vcr.css +0 -4
  254. data/specs_e2e/rails_4_2/app/controllers/application_controller.rb +0 -5
  255. data/specs_e2e/rails_4_2/app/controllers/using_vcr_controller.rb +0 -10
  256. data/specs_e2e/rails_4_2/app/controllers/welcome_controller.rb +0 -4
  257. data/specs_e2e/rails_4_2/app/models/post.rb +0 -23
  258. data/specs_e2e/rails_4_2/app/views/layouts/application.html.erb +0 -12
  259. data/specs_e2e/rails_4_2/app/views/using_vcr/index.html.erb +0 -6
  260. data/specs_e2e/rails_4_2/app/views/using_vcr/record_cats.html.erb +0 -7
  261. data/specs_e2e/rails_4_2/app/views/welcome/index.html.erb +0 -24
  262. data/specs_e2e/rails_4_2/bin/bundle +0 -3
  263. data/specs_e2e/rails_4_2/bin/rails +0 -4
  264. data/specs_e2e/rails_4_2/bin/rake +0 -4
  265. data/specs_e2e/rails_4_2/bin/setup +0 -29
  266. data/specs_e2e/rails_4_2/config/application.rb +0 -32
  267. data/specs_e2e/rails_4_2/config/boot.rb +0 -3
  268. data/specs_e2e/rails_4_2/config/environments/development.rb +0 -25
  269. data/specs_e2e/rails_4_2/config/environments/production.rb +0 -64
  270. data/specs_e2e/rails_4_2/config/environments/test.rb +0 -42
  271. data/specs_e2e/rails_4_2/config/initializers/backtrace_silencers.rb +0 -7
  272. data/specs_e2e/rails_4_2/config/initializers/cookies_serializer.rb +0 -3
  273. data/specs_e2e/rails_4_2/config/initializers/session_store.rb +0 -3
  274. data/specs_e2e/rails_4_2/config/initializers/to_time_preserves_timezone.rb +0 -10
  275. data/specs_e2e/rails_4_2/config/initializers/wrap_parameters.rb +0 -9
  276. data/specs_e2e/rails_4_2/config/locales/en.yml +0 -23
  277. data/specs_e2e/rails_4_2/config/routes.rb +0 -61
  278. data/specs_e2e/rails_4_2/config/secrets.yml +0 -22
  279. data/specs_e2e/rails_4_2/package.json +0 -12
  280. data/specs_e2e/rails_4_2/playwright-report/index.html +0 -62
  281. data/specs_e2e/rails_4_2/public/favicon.ico +0 -0
  282. data/specs_e2e/rails_4_2/public/robots.txt +0 -5
  283. data/specs_e2e/rails_4_2/spec/fixtures/vcr_cassettes/cats.yml +0 -63
  284. data/specs_e2e/rails_5_2/Gemfile +0 -15
  285. data/specs_e2e/rails_5_2/app/assets/javascripts/posts.js +0 -2
  286. data/specs_e2e/rails_5_2/app/assets/stylesheets/posts.css +0 -4
  287. data/specs_e2e/rails_5_2/app/assets/stylesheets/scaffold.css +0 -80
  288. data/specs_e2e/rails_5_2/app/jobs/application_job.rb +0 -2
  289. data/specs_e2e/rails_5_2/app/views/welcome/index.html.erb +0 -5
  290. data/specs_e2e/rails_5_2/bin/bundle +0 -3
  291. data/specs_e2e/rails_5_2/bin/rails +0 -4
  292. data/specs_e2e/rails_5_2/bin/rake +0 -4
  293. data/specs_e2e/rails_5_2/bin/update +0 -25
  294. data/specs_e2e/rails_5_2/config/application.rb +0 -33
  295. data/specs_e2e/rails_5_2/config/boot.rb +0 -4
  296. data/specs_e2e/rails_5_2/config/credentials.yml.enc +0 -1
  297. data/specs_e2e/rails_5_2/config/environments/production.rb +0 -68
  298. data/specs_e2e/rails_5_2/config/initializers/backtrace_silencers.rb +0 -7
  299. data/specs_e2e/rails_5_2/config/initializers/filter_parameter_logging.rb +0 -4
  300. data/specs_e2e/rails_5_2/config/initializers/mime_types.rb +0 -4
  301. data/specs_e2e/rails_5_2/config/initializers/wrap_parameters.rb +0 -9
  302. data/specs_e2e/rails_5_2/config/master.key +0 -1
  303. data/specs_e2e/rails_5_2/public/favicon.ico +0 -0
  304. data/specs_e2e/rails_5_2/public/robots.txt +0 -1
  305. /data/specs_e2e/{rails_5_2 → rails_6_1}/.gitignore +0 -0
  306. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/controllers/application_controller.rb +0 -0
  307. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/controllers/posts_controller.rb +0 -0
  308. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/helpers/posts_helper.rb +0 -0
  309. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/models/application_record.rb +0 -0
  310. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/models/post.rb +0 -0
  311. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/_form.html.erb +0 -0
  312. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/edit.html.erb +0 -0
  313. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/index.html.erb +0 -0
  314. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/new.html.erb +0 -0
  315. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/show.html.erb +0 -0
  316. /data/specs_e2e/{rails_5_2 → rails_6_1}/config/initializers/application_controller_renderer.rb +0 -0
  317. /data/specs_e2e/{rails_5_2 → rails_6_1}/config/initializers/cookies_serializer.rb +0 -0
  318. /data/specs_e2e/{rails_4_2 → rails_6_1}/config/initializers/inflections.rb +0 -0
  319. /data/specs_e2e/{rails_4_2 → rails_6_1}/config/initializers/mime_types.rb +0 -0
  320. /data/specs_e2e/{rails_5_2 → rails_6_1}/config/routes.rb +0 -0
  321. /data/specs_e2e/{rails_5_2 → rails_6_1}/public/404.html +0 -0
  322. /data/specs_e2e/{rails_5_2 → rails_6_1}/public/422.html +0 -0
  323. /data/specs_e2e/{rails_5_2 → rails_6_1}/public/500.html +0 -0
  324. /data/specs_e2e/{rails_5_2 → rails_6_1}/public/apple-touch-icon-precomposed.png +0 -0
  325. /data/specs_e2e/{rails_5_2 → rails_6_1}/public/apple-touch-icon.png +0 -0
  326. /data/specs_e2e/{rails_3_2 → rails_6_1}/public/favicon.ico +0 -0
  327. /data/specs_e2e/{rails_5_2 → rails_6_1}/test/controllers/posts_controller_test.rb +0 -0
  328. /data/specs_e2e/{rails_5_2 → rails_6_1}/test/cypress_fixtures/posts.yml +0 -0
  329. /data/specs_e2e/{rails_5_2 → rails_6_1}/test/fixtures/posts.yml +0 -0
  330. /data/specs_e2e/{rails_5_2 → rails_6_1}/test/models/post_test.rb +0 -0
  331. /data/specs_e2e/{rails_3_2/log → rails_6_1/vendor}/.keep +0 -0
  332. /data/specs_e2e/{rails_3_2/tmp → rails_7_2/vendor}/.keep +0 -0
  333. /data/specs_e2e/{rails_4_2/spec → rails_7_2/vendor/javascript}/.keep +0 -0
  334. /data/specs_e2e/{rails_5_2 → rails_8}/README.md +0 -0
  335. /data/specs_e2e/{rails_4_2/vendor → rails_8/storage}/.keep +0 -0
  336. /data/specs_e2e/{rails_5_2 → rails_8}/vendor/.keep +0 -0
  337. /data/specs_e2e/{rails_3_2/vendor/.gitkeep → rails_8/vendor/javascript/.keep} +0 -0
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # CypressOnRails
1
+ # Cypress and Playwright on Rails
2
2
 
3
3
  ![Build Status](https://github.com/shakacode/cypress-on-rails/actions/workflows/ruby.yml/badge.svg)
4
4
  [![cypress-on-rails](https://img.shields.io/endpoint?url=https://dashboard.cypress.io/badge/simple/2b6cjr/master&style=plastic&logo=cypress)](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). We focus on React (with TS or ReScript) front-ends, often with Ruby on Rails or Gatsby. See [our recent work](https://www.shakacode.com/recent-work) and [client engagement model](https://www.shakacode.com/blog/client-engagement-model/). 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).
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
- Interested in joining a small team that loves open source? Check our [careers page](https://www.shakacode.com/career/).
11
+ ### ShakaCode Support
12
12
 
13
- Need help with cypress-on-rails? Contact [ShakaCode](mailto:justin@shakacode.com).
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
- # Totally new to Cypress?
18
- Suggest you first learn the basics of Cypress before attempting to integrate with Ruby on Rails
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
- Suggest you first learn the basics of Playwright before attempting to integrate with Ruby on Rails
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 with the goal of controlling state as mentioned in [Cypress Best Practices](https://docs.cypress.io/guides/references/best-practices.html#Organizing-Tests-Logging-In-Controlling-State)
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 context when executing cypress or playwright tests.
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 setup data
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
- ## Resources
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 `cypress_helper.rb`
445
+ Add your VCR configuration to your `config/cypress_on_rails.rb`
338
446
 
339
447
  ```ruby
340
- require 'vcr'
341
- VCR.configure do |config|
342
- config.hook_into :webmock
343
- end
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://www.jetbrains.com">
510
- <img src="https://user-images.githubusercontent.com/4244251/184881139-42e4076b-024b-4b30-8c60-c3cd0e758c0a.png" alt="JetBrains" height="120px">
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
@@ -1,9 +1,6 @@
1
- require 'bundler/gem_tasks'
2
-
3
-
4
1
  require 'rspec/core/rake_task'
5
2
  RSpec::Core::RakeTask.new(:spec) do |t|
6
3
  t.pattern = 'spec/cypress_on_rails/*_spec.rb'
7
4
  end
8
5
 
9
- task default: %w[spec build]
6
+ task default: :spec
@@ -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",