cypress-on-rails 1.20.0 → 1.20.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c135e18e23ddeea1d0d2bbd246de9147b9ce42969bd862e51f1e3dec39abbe0
4
- data.tar.gz: a295806731243324fbfda475ec6be6a6c4bce60651755b278431afd722501cab
3
+ metadata.gz: 03e4421f8ff1e369df5164505021ef31262e063d1ce1933af39e8904d5f682a2
4
+ data.tar.gz: c5d25bca33e634bfd510cca6f3f038f509f2b46a2cac04930066f01b35b53c67
5
5
  SHA512:
6
- metadata.gz: 501aebab098ec19fbec53e3f7ea0ef8adc966c0d4ec2d60a0c424c45e369ad652899270b5e411376f5e582ef8a29acc3d02814cccee85654fe989bdc0aad9c1f
7
- data.tar.gz: f833268a8c93e4853fbb28d5b26f653ae741817c4314756975ebd46cac69b6791ca0d436a1d4ab20c9f0be88d4e14b4e399d3d59326cbaf01fb4f2d0b57f24d4
6
+ metadata.gz: 6a43f0a617482954a081168eed51481ae04b627fe3696825a5a8f4f0ed342874e7dc19eb2f0efac7485ba2932d02d9586035b010e8015a2a6ab1d0faa731d69b
7
+ data.tar.gz: b4753c4997d497a6e641285824123efac710f8e8850fd84c5cde3ca96735ca540647ca5931d797fa38bc88425128a25b7813f4cf2111d76fbce594926e07127d
@@ -0,0 +1,9 @@
1
+ # Non-command agent-workflow configuration for portable shared skills.
2
+ base_branch: master
3
+ changelog: "CHANGELOG.md - user-visible changes only; version-stamp via bundle exec rake update_changelog[release|rc|beta|VERSION]; PR links use [PR N](https://github.com/shakacode/cypress-playwright-on-rails/pull/N) by [username](https://github.com/username)."
4
+ follow_up_prefix: "Follow-up:"
5
+ review_gate: "Ruby workflow green on the PR, local bundle exec rake evidence, and all review threads resolved."
6
+ approval_exempt: "docs, workflow text, helper scripts, and focused release-process edits with tests."
7
+ coordination_backend: "private shakacode/agent-coordination (claims/heartbeats namespaced by full repo name)"
8
+ hosted_ci_trigger: "CI runs on every PR."
9
+ ci_parity_environment: "Use .github/workflows/ruby.yml; reproduce failures with bundle exec rake plus the matching specs_e2e/*/test.sh job when needed."
@@ -0,0 +1,71 @@
1
+ # Update Changelog
2
+
3
+ You are helping update `CHANGELOG.md` for `shakacode/cypress-playwright-on-rails`.
4
+
5
+ ## Arguments
6
+
7
+ This command accepts an optional argument: `$ARGUMENTS`
8
+
9
+ - No argument: add missing user-visible entries to `## [Unreleased]`.
10
+ - `release`: add entries, then stamp the next stable version with `bundle exec rake update_changelog[release]`.
11
+ - `rc`: add entries, then stamp the next release candidate with `bundle exec rake update_changelog[rc]`.
12
+ - `beta`: add entries, then stamp the next beta with `bundle exec rake update_changelog[beta]`.
13
+ - Explicit version such as `1.21.0.rc.0`: add entries, then stamp that exact version with `bundle exec rake update_changelog[1.21.0.rc.0]`.
14
+
15
+ After the changelog PR merges, the release task reads the newest stamped changelog version automatically:
16
+
17
+ ```bash
18
+ bundle exec rake release
19
+ ```
20
+
21
+ ## Core Rules
22
+
23
+ - Add entries only for user-visible changes: features, bug fixes, breaking changes, deprecations, performance improvements, security fixes, and public API/configuration changes.
24
+ - Skip linting, formatting, internal refactors, test-only changes, CI changes, and docs-only changes unless the docs correct public behavior.
25
+ - Do not ask the user for PR details. Use git history and GitHub.
26
+ - Use the repo's current changelog shape:
27
+ - Version headers: `## [1.21.0.rc.0] - YYYY-MM-DD`
28
+ - Category headings: `### Added`, `### Changed`, `### Improved`, `### Fixed`, etc.
29
+ - PR links: `[PR 219](https://github.com/shakacode/cypress-playwright-on-rails/pull/219) by [username](https://github.com/username)`.
30
+
31
+ ## Release Flow
32
+
33
+ 1. Fetch current branch, base branch, and tags:
34
+
35
+ ```bash
36
+ git fetch origin master --tags
37
+ ```
38
+
39
+ 2. Inspect merged PRs since the latest release tag:
40
+
41
+ ```bash
42
+ git tag -l 'v*' --sort=-v:refname | head -10
43
+ git log --oneline LATEST_TAG..origin/master
44
+ ```
45
+
46
+ 3. Add missing user-visible entries under `## [Unreleased]`, merging into existing category headings.
47
+
48
+ 4. If `$ARGUMENTS` asks for a release stamp, run the rake task:
49
+
50
+ ```bash
51
+ bundle exec rake "update_changelog[release]"
52
+ bundle exec rake "update_changelog[rc]"
53
+ bundle exec rake "update_changelog[beta]"
54
+ bundle exec rake "update_changelog[1.21.0.rc.0]"
55
+ ```
56
+
57
+ 5. Verify:
58
+
59
+ ```bash
60
+ bundle exec rake
61
+ ```
62
+
63
+ 6. Commit the changelog update on a branch and open a PR. Once merged, release with:
64
+
65
+ ```bash
66
+ git switch master
67
+ git pull --ff-only
68
+ bundle exec rake release
69
+ ```
70
+
71
+ The release task bumps `lib/cypress_on_rails/version.rb`, updates `Gemfile.lock`, commits, tags, pushes, publishes the gem, and creates or updates the GitHub release from the stamped changelog section.
@@ -2,56 +2,45 @@ name: Claude Code Review
2
2
 
3
3
  on:
4
4
  pull_request:
5
- types: [opened, synchronize]
6
- # Optional: Only run on specific file changes
7
- # paths:
8
- # - "src/**/*.ts"
9
- # - "src/**/*.tsx"
10
- # - "src/**/*.js"
11
- # - "src/**/*.jsx"
5
+ types: [opened, synchronize, ready_for_review, reopened]
12
6
 
13
7
  jobs:
14
8
  claude-review:
15
- # Optional: Filter by PR author
16
- # if: |
17
- # github.event.pull_request.user.login == 'external-contributor' ||
18
- # github.event.pull_request.user.login == 'new-developer' ||
19
- # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20
-
21
9
  runs-on: ubuntu-latest
22
10
  permissions:
23
11
  contents: read
24
- pull-requests: read
25
- issues: read
12
+ pull-requests: write
13
+ issues: write
26
14
  id-token: write
27
-
15
+
28
16
  steps:
29
17
  - name: Checkout repository
30
- uses: actions/checkout@v4
18
+ uses: actions/checkout@v6
31
19
  with:
32
20
  fetch-depth: 1
33
21
 
34
22
  - name: Run Claude Code Review
35
23
  id: claude-review
36
24
  uses: anthropics/claude-code-action@v1
25
+ env:
26
+ CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
37
27
  with:
38
28
  claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39
29
  prompt: |
40
30
  REPO: ${{ github.repository }}
41
31
  PR NUMBER: ${{ github.event.pull_request.number }}
42
32
 
43
- Please review this pull request and provide feedback on:
33
+ Please review this pull request with a focus on:
44
34
  - Code quality and best practices
45
35
  - Potential bugs or issues
36
+ - Security implications
46
37
  - Performance considerations
47
- - Security concerns
48
- - Test coverage
49
-
50
- Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
51
38
 
52
- Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
53
-
54
- # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
55
- # or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
56
- claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
39
+ Note: The PR branch is already checked out in the current working directory.
40
+
41
+ Use `gh pr comment` for top-level feedback.
42
+ Use `mcp__github_inline_comment__create_inline_comment` to highlight specific code issues.
43
+ Only post GitHub comments - don't submit review text as messages.
57
44
 
45
+ claude_args: |
46
+ --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
@@ -11,19 +11,112 @@ on:
11
11
  types: [submitted]
12
12
 
13
13
  jobs:
14
- claude:
14
+ authorize_claude_actor:
15
15
  if: |
16
16
  (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17
17
  (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18
18
  (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19
19
  (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20
20
  runs-on: ubuntu-latest
21
+ permissions:
22
+ contents: read
23
+ outputs:
24
+ authorized: ${{ steps.permission-gate.outputs.authorized }}
25
+ steps:
26
+ - name: Verify actor can run Claude
27
+ id: permission-gate
28
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
29
+ with:
30
+ script: |
31
+ const owner = context.repo.owner;
32
+ const repo = context.repo.repo;
33
+ const permissionByLogin = new Map();
34
+
35
+ function claudeRequester() {
36
+ if (
37
+ context.eventName === 'issue_comment' ||
38
+ context.eventName === 'pull_request_review_comment'
39
+ ) {
40
+ return context.payload.comment?.user?.login;
41
+ }
42
+
43
+ if (context.eventName === 'pull_request_review') {
44
+ return context.payload.review?.user?.login;
45
+ }
46
+
47
+ if (context.eventName === 'issues') {
48
+ return context.payload.issue?.user?.login;
49
+ }
50
+
51
+ return null;
52
+ }
53
+
54
+ async function hasWriteAccessFor(username) {
55
+ if (!username) {
56
+ return false;
57
+ }
58
+
59
+ if (permissionByLogin.has(username)) {
60
+ return permissionByLogin.get(username);
61
+ }
62
+
63
+ let hasWriteAccess = false;
64
+ try {
65
+ const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({
66
+ owner,
67
+ repo,
68
+ username
69
+ });
70
+ hasWriteAccess = ['admin', 'write'].includes(permission.permission);
71
+ } catch (error) {
72
+ core.warning(
73
+ `Unable to verify ${username} write permission for Claude; ` +
74
+ `treating the Claude request as untrusted: ${error.message || error}`
75
+ );
76
+ }
77
+
78
+ permissionByLogin.set(username, hasWriteAccess);
79
+ return hasWriteAccess;
80
+ }
81
+
82
+ const actor = context.actor;
83
+ const requester = claudeRequester();
84
+
85
+ if (!requester) {
86
+ core.setOutput('authorized', 'false');
87
+ core.setFailed('Unable to run Claude because the requester could not be determined.');
88
+ return;
89
+ }
90
+
91
+ if (!(await hasWriteAccessFor(actor))) {
92
+ core.setOutput('authorized', 'false');
93
+ core.setFailed(`Unable to run Claude because ${actor} does not have write/admin repository permission.`);
94
+ return;
95
+ }
96
+
97
+ if (!(await hasWriteAccessFor(requester))) {
98
+ core.setOutput('authorized', 'false');
99
+ core.setFailed(
100
+ `Unable to run Claude because requester ${requester} does not have write/admin repository permission.`
101
+ );
102
+ return;
103
+ }
104
+
105
+ core.setOutput('authorized', 'true');
106
+ core.info(`Authorized ${actor} and Claude requester ${requester} to run Claude.`);
107
+
108
+ claude:
109
+ needs: authorize_claude_actor
110
+ if: needs.authorize_claude_actor.outputs.authorized == 'true'
111
+ runs-on: ubuntu-latest
21
112
  permissions:
22
113
  contents: read
23
114
  pull-requests: read
24
115
  issues: read
25
116
  id-token: write
26
117
  actions: read # Required for Claude to read CI results on PRs
118
+ checks: read
119
+ statuses: read
27
120
  steps:
28
121
  - name: Checkout repository
29
122
  uses: actions/checkout@v4
@@ -33,12 +126,17 @@ jobs:
33
126
  - name: Run Claude Code
34
127
  id: claude
35
128
  uses: anthropics/claude-code-action@v1
129
+ env:
130
+ CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
36
131
  with:
132
+ github_token: ${{ github.token }}
37
133
  claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38
134
 
39
135
  # This is an optional setting that allows Claude to read CI results on PRs
40
136
  additional_permissions: |
41
137
  actions: read
138
+ checks: read
139
+ statuses: read
42
140
 
43
141
  # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44
142
  # prompt: 'Update the pull request description to include a summary of changes.'
data/CHANGELOG.md CHANGED
@@ -7,9 +7,25 @@ This project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.20.1] - 2026-07-10
11
+
12
+ ### Fixed
13
+ - **Rails 8.1 compatibility**: Required ActiveSupport delegation explicitly so the railtie loads under Rails 8.1. [PR 207](https://github.com/shakacode/cypress-playwright-on-rails/pull/207) by [justin808](https://github.com/justin808).
14
+ - **Playwright helper JSON responses**: Updated generated `appCommands`, `appVcrInsertCassette`, and `appVcrEjectCassette` helpers to return parsed JSON rather than a `Buffer`. [PR 219](https://github.com/shakacode/cypress-playwright-on-rails/pull/219) by [justin808](https://github.com/justin808). Original fix by [helio3197](https://github.com/helio3197) in [PR 168](https://github.com/shakacode/cypress-playwright-on-rails/pull/168).
15
+ - **Configured Rails environment**: Preserved an existing `RAILS_ENV` when starting the managed test server, allowing E2E runs to target a configured environment. [PR 210](https://github.com/shakacode/cypress-playwright-on-rails/pull/210) by [arielj](https://github.com/arielj).
16
+
17
+ ---
18
+
19
+ ## [1.20.0] - 2025-10-21
20
+ [Compare](https://github.com/shakacode/cypress-playwright-on-rails/compare/v1.19.0...v1.20.0)
21
+
10
22
  ### Fixed
11
23
  * **BREAKING: Generator folder structure**: Fixed install generator to create `e2e_helper.rb` and `app_commands/` at the install folder root (e.g., `e2e/`) instead of inside the framework subdirectory (e.g., `e2e/cypress/`). This ensures compatibility between Cypress/Playwright config file location and middleware expectations. [#201]
12
24
 
25
+ ### Changed
26
+ * Improved server process cleanup and readiness checks. [PR 199](https://github.com/shakacode/cypress-playwright-on-rails/pull/199)
27
+ * Gem description now mentions Playwright support. [PR 200](https://github.com/shakacode/cypress-playwright-on-rails/pull/200)
28
+
13
29
  ### Migration Guide for Folder Structure Change
14
30
 
15
31
  #### Breaking Change Notice
@@ -515,6 +531,9 @@ If migrating from the `cypress-rails` gem:
515
531
  [#201]: https://github.com/shakacode/cypress-playwright-on-rails/issues/201
516
532
 
517
533
  <!-- Version diff reference list -->
534
+ [unreleased]: https://github.com/shakacode/cypress-playwright-on-rails/compare/v1.20.1...master
535
+ [1.20.1]: https://github.com/shakacode/cypress-playwright-on-rails/compare/v1.20.0...v1.20.1
536
+ [1.20.0]: https://github.com/shakacode/cypress-playwright-on-rails/compare/v1.19.0...v1.20.0
518
537
  [1.19.0]: https://github.com/shakacode/cypress-playwright-on-rails/compare/v1.18.0...v1.19.0
519
538
  [1.18.0]: https://github.com/shakacode/cypress-playwright-on-rails/compare/v1.17.0...v1.18.0
520
539
  [1.17.0]: https://github.com/shakacode/cypress-playwright-on-rails/compare/v1.16.0...v1.17.0
data/CLAUDE.md ADDED
@@ -0,0 +1,69 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## ⚠️ CRITICAL REQUIREMENTS
6
+
7
+ **BEFORE EVERY COMMIT/PUSH:**
8
+
9
+ 1. **ALWAYS ensure files end with a newline character**
10
+ 2. **ALWAYS run tests before pushing**
11
+
12
+ These requirements are non-negotiable. CI will fail if not followed.
13
+
14
+ ## Development Commands
15
+
16
+ ### Essential Commands
17
+
18
+ - **Install dependencies**: `bundle`
19
+ - **Run tests**:
20
+ - Ruby tests: `bundle exec rspec`
21
+ - All tests: `bundle exec rake` (default task runs tests)
22
+ - **⚠️ MANDATORY BEFORE GIT PUSH**: Ensure tests pass + ensure trailing newlines
23
+
24
+ ## Changelog
25
+
26
+ - **Update CHANGELOG.md for user-visible changes only** (features, bug fixes, breaking changes, deprecations, performance improvements)
27
+ - **Do NOT add entries for**: linting, formatting, refactoring, tests, or documentation fixes
28
+ - **Format**: `[PR 123](https://github.com/shakacode/cypress-on-rails/pull/123) by [username](https://github.com/username)` (no hash in PR number)
29
+ - **Use `/update-changelog` command** for guided changelog updates with automatic formatting
30
+ - **Version management**: Run `bundle exec rake update_changelog` after releases to update version headers (if rake task exists)
31
+ - **Examples**: Run `grep -A 3 "^#### " CHANGELOG.md | head -30` to see real formatting examples
32
+
33
+ ## Project Architecture
34
+
35
+ ### Core Components
36
+
37
+ This is a Ruby gem that provides integration between Cypress/Playwright and Rails applications.
38
+
39
+ #### Ruby Side (`lib/cypress_on_rails/`)
40
+
41
+ - **`middleware.rb`**: Rack middleware for handling Cypress/Playwright commands
42
+ - **`configuration.rb`**: Global configuration management
43
+ - **Generators**: Located in `lib/generators/cypress_on_rails/`
44
+
45
+ #### Test Framework Support
46
+
47
+ - **Cypress**: JavaScript-based E2E testing framework
48
+ - **Playwright**: Modern browser automation framework
49
+ - Both frameworks share the same Ruby backend commands
50
+
51
+ ### Build System
52
+
53
+ - **Ruby**: Standard gemspec-based build
54
+ - **Testing**: RSpec for Ruby tests
55
+ - **Linting**: RuboCop for Ruby
56
+
57
+ ### Examples and Testing
58
+
59
+ - **Specs**: `spec/` - RSpec tests for the gem
60
+ - **E2E Examples**: `specs_e2e/` - End-to-end test examples
61
+ - **Rake tasks**: Defined in `rakelib/` for various development operations
62
+
63
+ ## Important Notes
64
+
65
+ - Server-side commands are executed via Rack middleware
66
+ - Commands can use factory_bot, database_cleaner, and other test helpers
67
+ - VCR integration available for HTTP mocking
68
+ - Supports both Cypress and Playwright frameworks
69
+ - Configuration is done in `config/initializers/cypress_on_rails.rb`
data/CONTEXT.md ADDED
@@ -0,0 +1,26 @@
1
+ # Context
2
+
3
+ Canonical vocabulary for this project. If a term here conflicts with usage in
4
+ an issue, PR, or doc, this file wins; update it deliberately, not incidentally.
5
+
6
+ ## Naming (resolved 2026-07-04, see ADR-0001 + ADR-0002)
7
+
8
+ | Term | Meaning |
9
+ |---|---|
10
+ | **E2E on Rails** | The public/brand name of the project (ADR-0002). Tagline: "The Rails test bridge for Cypress and Playwright." |
11
+ | `cypress-on-rails` | The published gem name through the 1.x line. Canonical in Gemfiles until 2.0, then the compatibility shim. |
12
+ | `e2e_on_rails` | Thin wrapper gem, not yet published (#226 tracks it); the canonical gem from 2.0. 2.0 is scheduled right after the v1.22 line ships. |
13
+ | `CypressOnRails` | The Ruby module namespace through 1.x. Renames to `E2eOnRails` (with a `CypressOnRails` deprecation alias) at 2.0. |
14
+ | `cypress-playwright-on-rails` | Current GitHub repository name; renames to `shakacode/e2e-on-rails` immediately after v1.21.0 ships (GitHub redirects). Never a gem name. |
15
+ | `e2eonrails.com` | Purchased 2026-07-04. Canonical docs + landing page at the apex (no `docs.` subdomain, no defensive variants). Supersedes the earlier testing.shakastack.com plan. |
16
+
17
+ ## Core domain terms
18
+
19
+ | Term | Meaning |
20
+ |---|---|
21
+ | install folder | The app-side directory (config `install_folder`) holding `e2e_helper.rb`, `app_commands/`, and framework config. The install **generator** defaults it to `e2e/`; the gem's `Configuration#reset` defaults to `spec/e2e` for apps configured without the generator. Since v1.20.0, helper and commands live at its **root**, not inside `cypress/`. |
22
+ | app command | A Ruby file in `app_commands/` executed in the Rails process when a test calls `cy.app(...)` / `app(...)`. The middleware's unit of remote execution. |
23
+ | scenario | An app command under `app_commands/scenarios/` that seeds a named state, invoked via `cy.appScenario(...)`. |
24
+ | middleware | `CypressOnRails::Middleware`, mounted outside production only, serving the `__e2e__` (legacy `__cypress__`) API prefix. Executes arbitrary Ruby by design — see README security model and issue #13. |
25
+ | managed server | The Rails server started/stopped by the `cypress:*` / `playwright:*` rake tasks (since v1.19.0), with lifecycle hooks (`before_server_start`, …, `before_server_stop`). |
26
+ | transactional server | `transactional_server` mode wrapping the run in a rolled-back DB transaction, reset via `/cypress_rails_reset_state` (cypress-rails-compatible endpoint). |