Skip to content

feat: GitHub Actions artifact integration with inline HTML report#171

Merged
pftg merged 3 commits intomasterfrom
feat/ci-artifact-integration
Apr 12, 2026
Merged

feat: GitHub Actions artifact integration with inline HTML report#171
pftg merged 3 commits intomasterfrom
feat/ci-artifact-integration

Conversation

@pftg
Copy link
Copy Markdown
Collaborator

@pftg pftg commented Apr 12, 2026

Summary

  • Upload HTML report with archive: false (upload-artifact@v7) for inline preview in Actions UI
  • Upload full report directory as zip for offline review with images
  • PR comment with link to artifact (find-comment + create-or-update-comment to avoid spam)
  • Updated README with copy-paste CI setup snippets

How it works

Inline preview (2 clicks):

  1. Test fails → click "Artifacts" → click screenshot-report → HTML renders in browser

Full review (download):

  1. Test fails → download screenshot-report-full → open locally with images

Research findings

  • archive: false only supports single files (v7.0.0 release)
  • So we upload the single HTML file with archive: false (inline preview) AND the full directory as zip (images included)
  • PR comment uses peter-evans/find-comment@v3 + create-or-update-comment@v5 to update existing comment instead of creating new ones

Customer setup (zero friction)

Add to test helper:

require 'capybara_screenshot_diff/reporters/html'

Add to workflow — copy-paste from README.

Test plan

  • Unit tests pass (179 runs, 0 failures)
  • Trigger CI failure to verify artifact upload + inline rendering
  • Verify PR comment appears with link

Generated with Claude Code

Summary by Sourcery

Add GitHub Actions HTML screenshot report artifacts with inline preview support and PR comment integration for failed test runs.

New Features:

  • Provide inline HTML screenshot diff report artifact and full downloadable report in GitHub Actions, including required test helper setup.
  • Introduce a composite GitHub Action to upload screenshot diffs, Capybara failure screenshots, and HTML reports with configurable paths and retention.

Enhancements:

  • Document streamlined GitHub Actions setup, including optional PR comments linking directly to report artifacts.
  • Enhance test workflow to post or update a single PR comment with links to inline and full HTML screenshot reports on failures.

Summary by CodeRabbit

  • New Features

    • CI now uploads an inline HTML screenshot preview plus a separate full report when present
    • PR comment lifecycle updates to report "diffs detected" / "diffs resolved"
    • Artifact name, report path, and retention period are configurable (default retention increased)
  • Documentation

    • README condensed; new docs for CI integration, configuration, drivers, reporters, framework setup, organization, and Docker testing
  • Bug Fixes

    • More reliable CI report detection and sample-report output location fixed

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 12, 2026

Reviewer's Guide

Adds first-class GitHub Actions support for the HTML screenshot diff report, including inline artifact rendering, full downloadable report, reusable composite action improvements, and an optional PR comment with a stable link to the report.

Sequence diagram for GitHub Actions failure handling and screenshot report artifacts

sequenceDiagram
  actor Developer
  participant GitHubActions
  participant TestJob
  participant UploadScreenshotsAction
  participant UploadArtifact
  participant FindCommentAction
  participant CreateOrUpdateCommentAction
  participant GitHubPR

  Developer->>GitHubActions: Push changes / open pull request
  GitHubActions->>TestJob: Run tests with HTML reporter enabled
  TestJob-->>GitHubActions: Test status failure

  GitHubActions->>UploadScreenshotsAction: Run upload SnapDiff screenshots (if failure)
  UploadScreenshotsAction->>UploadArtifact: Upload name-diffs (screenshot diffs)
  UploadScreenshotsAction->>UploadArtifact: Upload name-capybara-fails
  UploadScreenshotsAction->>UploadArtifact: Upload name-report (index.html, archive false)
  UploadScreenshotsAction->>UploadArtifact: Upload name-report-full (full HTML report directory)
  UploadArtifact-->>GitHubActions: Artifacts available in run

  GitHubActions->>FindCommentAction: find-comment (on pull_request failure)
  FindCommentAction-->>GitHubActions: Existing comment id or empty
  GitHubActions->>CreateOrUpdateCommentAction: create-or-update-comment with artifacts link
  CreateOrUpdateCommentAction->>GitHubPR: Create or replace PR comment with stable report link

  Developer->>GitHubPR: Open PR and follow report link
  Developer->>GitHubActions: Open run artifacts to view inline or full report
Loading

File-Level Changes

Change Details Files
Document GitHub Actions integration for inline HTML report preview, full report upload, and optional PR comment.
  • Add requirement to load the HTML reporter in the test helper via a Ruby require
  • Switch README CI example to use upload-artifact@v7 with archive:false for a single HTML file that renders inline
  • Add a second artifact upload example for the full report directory with images for offline review
  • Add optional workflow snippet that posts or updates a PR comment with a link to the run’s artifacts, using find-comment and create-or-update-comment
README.md
Enhance the reusable composite action to upload HTML report artifacts alongside existing screenshots using upload-artifact@v7.
  • Rename and reword the composite action to reflect SnapDiff report upload responsibilities
  • Add inputs for an artifact name prefix, HTML report directory path, and artifact retention days
  • Upgrade existing screenshot artifact uploads to upload-artifact@v7 and wire them to the new retention-days input
  • Add conditional upload of the single HTML report file with archive:false for inline preview when index.html exists
  • Add conditional upload of the full HTML report directory as a separate artifact for complete downloads when index.html exists
.github/actions/upload-screenshots/action.yml
Wire PR comment integration into the test workflow to surface HTML report links on failures.
  • Insert find-comment step in the test workflow to locate an existing bot comment that mentions screenshot diffs
  • Add create-or-update-comment step that either creates or replaces a bot comment with links to the Actions run artifacts
  • Document expected artifact names for inline and full reports in the PR comment body
.github/workflows/test.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 12, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Updates GitHub Actions and a composite upload action to conditionally upload SnapDiff HTML reports and artifacts with configurable report path and retention; adds PR comment lifecycle for screenshot diffs; expands workflow triggers/permissions; adds many docs pages; and makes small VCS/test and reporter return-value adjustments.

Changes

Cohort / File(s) Summary
Composite action
.github/actions/upload-screenshots/action.yml
Renamed action, changed description, added report-path & retention-days inputs, switched to actions/upload-artifact@v7, made retention configurable, set if-no-files-found: ignore, added check for index.html and conditional inline + full report uploads.
Workflows
.github/workflows/test.yml
Added path filters; renamed pull_request.types; added job permissions; changed screenshot uploads to run on failure(); added PR comment search/create/update flow; added test-report-upload job invoking composite action.
Documentation
README.md, docs/ci-integration.md, docs/configuration.md, docs/drivers.md, docs/framework-setup.md, docs/organization.md, docs/reporters.md, docs/docker-testing.md
Rewrote README to a concise quick-start; added CI integration guidance (HTML reporter, artifact upload patterns, composite-action usage, PR-comment snippet); added comprehensive configuration, drivers, reporters, framework setup, organization, and Docker testing docs.
VCS & tests
lib/capybara/screenshot/diff/vcs.rb, test/unit/vcs_test.rb
Resolve VCS file paths relative to repository root and use HEAD:... for git show; test setup now ensures screenshot output dir exists.
Reporter changes
lib/capybara_screenshot_diff/reporters/html.rb
#finalize now returns output_path (Pathname) when writing a report (nil otherwise); path handling expanded to absolute paths; at_exit logging checks for Pathname result.
Scripts / sample
scripts/generate_sample_report.rb
Changed sample report output to ../tmp/snap_diff/index.html.
Docs minor / project files
README.md, .gitignore
README trimmed and reorganized; .gitignore now ignores .qwen/ and .claude/.

Sequence Diagram(s)

sequenceDiagram
    participant Runner as CI Runner
    participant UploadAction as Upload Action (composite)
    participant ArtifactStore as GitHub Artifacts
    participant GitHubAPI as GitHub PR API

    Runner->>UploadAction: invoke (inputs: report-path, retention-days) after tests
    UploadAction->>UploadAction: check `${{ inputs.report-path }}/index.html` exists
    alt index.html exists
        UploadAction->>ArtifactStore: upload `index.html` (archive:false, retention: ${{ inputs.retention-days }})
    end
    UploadAction->>ArtifactStore: upload full `${{ inputs.report-path }}/` (retention: ${{ inputs.retention-days }})
    Runner->>GitHubAPI: search for PR comment containing "Screenshot diffs"
    GitHubAPI-->>Runner: return comment id (found / not found)
    Runner->>GitHubAPI: create or update PR comment linking to artifacts (detected / resolved)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • donv

Poem

🐇 I hopped through CI with screenshots in tow,
I found an index and wrapped it up neat,
Inline for quick eyes, a full zip below,
I nudged the PR comment to point to each feat,
Carrots, pixels, and green checks — hop, repeat.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main feature: GitHub Actions artifact integration with inline HTML report support, which is the primary change across the workflow, composite action, and documentation updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ci-artifact-integration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The PR comment logic for screenshot reports is duplicated between the README example and .github/workflows/test.yml; consider extracting this into a small reusable composite/action or a single reusable workflow snippet to avoid drift and make future changes easier.
  • In the composite action, both report upload steps gate on hashFiles(format('{0}/index.html', inputs.report-path)) != ''; if you expect non-standard report layouts in future, you may want to key this check off the directory itself or make the report filename configurable to avoid tightly coupling to index.html.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The PR comment logic for screenshot reports is duplicated between the README example and `.github/workflows/test.yml`; consider extracting this into a small reusable composite/action or a single reusable workflow snippet to avoid drift and make future changes easier.
- In the composite action, both report upload steps gate on `hashFiles(format('{0}/index.html', inputs.report-path)) != ''`; if you expect non-standard report layouts in future, you may want to key this check off the directory itself or make the report filename configurable to avoid tightly coupling to `index.html`.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@pftg pftg force-pushed the feat/ci-artifact-integration branch from eb0913c to 081bbbf Compare April 12, 2026 13:26
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
.github/actions/upload-screenshots/action.yml (1)

17-30: Add if-no-files-found handling for non-screenshot failures.

If tests fail before screenshot generation, Line 22 and Line 29 paths may be absent and produce noisy artifact warnings. Consider making these uploads explicitly tolerant.

♻️ Suggested patch
     - name: Upload screenshot diffs
       uses: actions/upload-artifact@v7
       with:
         name: ${{ inputs.name }}-diffs
         retention-days: ${{ inputs.retention-days }}
         path: test/fixtures/app/doc/screenshots/
+        if-no-files-found: ignore

     - name: Upload Capybara failure screenshots
       uses: actions/upload-artifact@v7
       with:
         name: ${{ inputs.name }}-capybara-fails
         retention-days: ${{ inputs.retention-days }}
         path: tmp/capybara/screenshots-diffs/
+        if-no-files-found: ignore
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/actions/upload-screenshots/action.yml around lines 17 - 30, The
artifact upload steps "Upload screenshot diffs" and "Upload Capybara failure
screenshots" currently emit warnings when the specified paths are missing;
update each actions/upload-artifact@v7 usage in the action.yml (the steps named
"Upload screenshot diffs" and "Upload Capybara failure screenshots") to include
the with key if-no-files-found: ignore so these uploads tolerate absent paths
(add the if-no-files-found: ignore entry under the existing with block for both
steps).
README.md (1)

890-900: Consider naming the two artifact labels in the PR comment snippet.

Adding the exact artifact names reduces ambiguity for first-time users following the README.

📝 Suggested wording tweak
     body: |
       ### Screenshot diffs detected
       [View report](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts)
+      Click `screenshot-report` for inline preview, or download `screenshot-report-full` for images.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 890 - 900, Update the PR comment body used by the
"Comment PR with report link" step (uses:
peter-evans/create-or-update-comment@v5) to explicitly name the two artifacts
when constructing the report links; modify the multi-line body under the body: |
block so the markdown lists the artifact names (e.g., "Screenshot diffs report"
and "Full artifacts archive") and uses those labels in the links instead of a
generic "View report" to remove ambiguity for first-time users.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/actions/upload-screenshots/action.yml:
- Around line 17-30: The artifact upload steps "Upload screenshot diffs" and
"Upload Capybara failure screenshots" currently emit warnings when the specified
paths are missing; update each actions/upload-artifact@v7 usage in the
action.yml (the steps named "Upload screenshot diffs" and "Upload Capybara
failure screenshots") to include the with key if-no-files-found: ignore so these
uploads tolerate absent paths (add the if-no-files-found: ignore entry under the
existing with block for both steps).

In `@README.md`:
- Around line 890-900: Update the PR comment body used by the "Comment PR with
report link" step (uses: peter-evans/create-or-update-comment@v5) to explicitly
name the two artifacts when constructing the report links; modify the multi-line
body under the body: | block so the markdown lists the artifact names (e.g.,
"Screenshot diffs report" and "Full artifacts archive") and uses those labels in
the links instead of a generic "View report" to remove ambiguity for first-time
users.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f23b869e-6cb0-4a0b-a32e-c232b1606753

📥 Commits

Reviewing files that changed from the base of the PR and between c1a53c3 and eb0913c.

📒 Files selected for processing (3)
  • .github/actions/upload-screenshots/action.yml
  • .github/workflows/test.yml
  • README.md

@pftg pftg force-pushed the feat/ci-artifact-integration branch from 081bbbf to a56e392 Compare April 12, 2026 13:29
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/test.yml (1)

95-100: Avoid hardcoded artifact names in the PR message (and fix Line 98 length warning).

The message assumes base-screenshots-*; if the upload prefix changes, the instructions become stale. Recommend centralizing the prefix in one variable and reusing it in both upload and comment text.

Proposed refactor
   functional-test:
     name: Functional Test
     runs-on: ubuntu-latest
     timeout-minutes: 5
     permissions:
       contents: read
       pull-requests: write
+    env:
+      SCREENSHOT_ARTIFACT_PREFIX: base-screenshots

@@
       - uses: ./.github/actions/upload-screenshots
         if: failure()
         with:
-          name: base-screenshots
+          name: ${{ env.SCREENSHOT_ARTIFACT_PREFIX }}

@@
       - name: Comment PR with report link
         if: failure() && github.event_name == 'pull_request'
         uses: peter-evans/create-or-update-comment@v5
         with:
@@
           body: |
             ### Screenshot diffs detected

-            [View HTML report](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts) in Actions artifacts.
+            [View HTML report](
+            ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts
+            ) in Actions artifacts.

-            Click `base-screenshots-report` for inline preview, or download `base-screenshots-report-full` for images.
+            Click `${{ env.SCREENSHOT_ARTIFACT_PREFIX }}-report` for inline preview, or download `${{ env.SCREENSHOT_ARTIFACT_PREFIX }}-report-full` for images.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/test.yml around lines 95 - 100, Centralize the artifact
upload prefix into a single variable/output and reference that variable in the
comment body instead of hardcoding "base-screenshots-report" and
"base-screenshots-report-full"; update the upload step (e.g., the step that
creates the artifacts) to set an output or env like screenshots_prefix and then
interpolate that variable into the workflow job comment body where the artifacts
are referenced, and shorten or wrap the comment line that includes the artifact
link to resolve the line-length warning (the multi-line YAML string for body
should reference the variable and be reformatted to keep lines under the limit).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/actions/upload-screenshots/action.yml:
- Around line 31-35: The step with name "Check for HTML report" and id
check-report uses a chained &&/|| shell command that can produce incorrect
outputs; replace the single-line test with a short explicit if/then/else block
in the run script that tests for the file ("${{ inputs.report-path
}}/index.html") and writes "exists=true" or "exists=false" to $GITHUB_OUTPUT
accordingly (using echo "exists=..." >> "$GITHUB_OUTPUT"), ensuring each branch
is its own command and the line length is short.

---

Nitpick comments:
In @.github/workflows/test.yml:
- Around line 95-100: Centralize the artifact upload prefix into a single
variable/output and reference that variable in the comment body instead of
hardcoding "base-screenshots-report" and "base-screenshots-report-full"; update
the upload step (e.g., the step that creates the artifacts) to set an output or
env like screenshots_prefix and then interpolate that variable into the workflow
job comment body where the artifacts are referenced, and shorten or wrap the
comment line that includes the artifact link to resolve the line-length warning
(the multi-line YAML string for body should reference the variable and be
reformatted to keep lines under the limit).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c71b16eb-d1ca-43c1-81e0-aff40d7d5250

📥 Commits

Reviewing files that changed from the base of the PR and between eb0913c and 081bbbf.

📒 Files selected for processing (3)
  • .github/actions/upload-screenshots/action.yml
  • .github/workflows/test.yml
  • README.md
✅ Files skipped from review due to trivial changes (1)
  • README.md

Comment thread .github/actions/upload-screenshots/action.yml
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 12, 2026

Screenshot diffs resolved

All screenshots match their baselines. Previous diffs have been fixed.

@pftg pftg force-pushed the feat/ci-artifact-integration branch 5 times, most recently from aa885f5 to 86e0468 Compare April 12, 2026 14:09
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

♻️ Duplicate comments (1)
.github/actions/upload-screenshots/action.yml (1)

33-37: ⚠️ Potential issue | 🟡 Minor

Replace chained && ... || ... with explicit if/else.

This pattern is brittle and was already flagged earlier; it can emit the wrong output if the “true branch” command fails.

Proposed fix
-    - name: Check for HTML report
-      id: check-report
-      shell: bash
-      run: test -f "${{ inputs.report-path }}/index.html" && echo "exists=true" >> "$GITHUB_OUTPUT" || echo "exists=false" >> "$GITHUB_OUTPUT"
+    - name: Check for HTML report
+      id: check-report
+      shell: bash
+      run: |
+        if test -f "${{ inputs.report-path }}/index.html"; then
+          echo "exists=true" >> "$GITHUB_OUTPUT"
+        else
+          echo "exists=false" >> "$GITHUB_OUTPUT"
+        fi
#!/bin/bash
set -euo pipefail

# Demonstrates &&/|| hazard: condition is true, but a failing true-branch command
# still triggers the false branch.
tmp="$(mktemp)"
bash -c 'test -f /etc/passwd && { false; } || echo "exists=false" >> "$1"' _ "$tmp"
echo "Observed output:"
cat "$tmp"
rm -f "$tmp"

# Inspect current workflow line
rg -n 'run:\s*test -f .*&&.*\|\|.*' .github/actions/upload-screenshots/action.yml
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/actions/upload-screenshots/action.yml around lines 33 - 37, The step
named "Check for HTML report" (id: check-report) uses a brittle chained `test
... && ... || ...` pattern; replace its run script with an explicit if/else
block that tests for the file and writes the appropriate value to
$GITHUB_OUTPUT, e.g. use `if [ -f "${{ inputs.report-path }}/index.html" ]; then
echo "exists=true" >> "$GITHUB_OUTPUT"; else echo "exists=false" >>
"$GITHUB_OUTPUT"; fi`; keep `shell: bash` and consider adding `set -euo
pipefail` at the top of the script for strictness.
🧹 Nitpick comments (1)
docs/organization.md (1)

23-29: Fix markdownlint issues in code blocks.

Add language identifiers to fenced blocks (e.g., text) and convert the indented code block at Line 34 into fenced style to satisfy MD040/MD046.

Also applies to: 34-34, 56-63, 93-100, 157-170, 185-198

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/organization.md` around lines 23 - 29, Convert the indented code block
showing the site tree (the block starting with ``` and containing "doc
screenshots action_performed feature_index welcome_index") into a fenced code
block with a language identifier (use "text"), and similarly add language
identifiers ("text") to the other fenced blocks referenced (the blocks at the
other locations containing similar directory/tree listings). Ensure all formerly
indented blocks are replaced with triple-backtick fenced blocks and each fenced
block begins with ```text to satisfy MD040/MD046.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/test.yml:
- Line 16: In the GitHub Actions workflow (.github/workflows/test.yml) the
pull_request trigger uses the invalid key "type" instead of "types"; update the
trigger key name from "type" to "types" and keep the array of event types
(opened, synchronize, reopened, review_requested) so the pull_request event
filtering works correctly.

In `@docs/configuration.md`:
- Around line 80-84: The example assigns ENV['TAKE_SCREENSHOTS'] directly to
Capybara::Screenshot.enabled which treats any non-empty string (including
"false" or "0") as truthy; change to parse the environment value to a real
boolean before assignment (e.g., use a boolean casting helper or normalize and
check against allowed true values) so Capybara::Screenshot.enabled only becomes
true for explicit truthy strings; apply the same fix to the analogous diffs
example referenced around lines 94–98.

In `@docs/organization.md`:
- Around line 60-63: Update the sequence filename examples to use an underscore
after the numeric counter to match the formatter `%02i_%s`; replace entries like
"00-welcome_index", "98-99" style examples and similar occurrences with
"00_welcome_index" (and analogous fixes for the examples around lines referenced
such as 98–99, 162–164, 190–192, 196–197) so all sample filenames follow the
"NN_name" pattern (e.g., 00_welcome_index, 01_feature_index,
02_action_performed).
- Around line 65-66: The docs incorrectly state that screenshot_group deletes
files; update the documentation to say that screenshot_group only sets the group
name (the method screenshot_group in lib/capybara_screenshot_diff/dsl.rb) and
does not perform deletion, and either (a) document the separate deletion
behavior provided by the deletion method in
lib/capybara_screenshot_diff/screenshot_namer.rb (the method that actually
removes files) or (b) change the implementation to call that deletion method
from screenshot_group if automatic deletion is intended—adjust the docs
accordingly to reflect the actual behavior.

In `@README.md`:
- Around line 51-54: The fenced code block containing the screenshot mismatch
message for 'homepage' is missing a language tag; update that fenced block (the
triple-backtick block showing "Screenshot does not match for 'homepage':
({"area_size":1250,...})") to include a language such as text (change ``` to
```text) so markdownlint MD040 is satisfied.

---

Duplicate comments:
In @.github/actions/upload-screenshots/action.yml:
- Around line 33-37: The step named "Check for HTML report" (id: check-report)
uses a brittle chained `test ... && ... || ...` pattern; replace its run script
with an explicit if/else block that tests for the file and writes the
appropriate value to $GITHUB_OUTPUT, e.g. use `if [ -f "${{ inputs.report-path
}}/index.html" ]; then echo "exists=true" >> "$GITHUB_OUTPUT"; else echo
"exists=false" >> "$GITHUB_OUTPUT"; fi`; keep `shell: bash` and consider adding
`set -euo pipefail` at the top of the script for strictness.

---

Nitpick comments:
In `@docs/organization.md`:
- Around line 23-29: Convert the indented code block showing the site tree (the
block starting with ``` and containing "doc screenshots action_performed
feature_index welcome_index") into a fenced code block with a language
identifier (use "text"), and similarly add language identifiers ("text") to the
other fenced blocks referenced (the blocks at the other locations containing
similar directory/tree listings). Ensure all formerly indented blocks are
replaced with triple-backtick fenced blocks and each fenced block begins with
```text to satisfy MD040/MD046.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d00420ef-b462-4ed5-acef-7a907e2e2297

📥 Commits

Reviewing files that changed from the base of the PR and between 081bbbf and 870cd28.

📒 Files selected for processing (10)
  • .github/actions/upload-screenshots/action.yml
  • .github/workflows/test.yml
  • README.md
  • docs/ci-integration.md
  • docs/configuration.md
  • docs/docker-testing.md
  • docs/drivers.md
  • docs/framework-setup.md
  • docs/organization.md
  • docs/reporters.md
✅ Files skipped from review due to trivial changes (5)
  • docs/docker-testing.md
  • docs/framework-setup.md
  • docs/reporters.md
  • docs/drivers.md
  • docs/ci-integration.md

Comment thread .github/workflows/test.yml Outdated
Comment thread docs/configuration.md
Comment thread docs/organization.md Outdated
Comment thread docs/organization.md Outdated
Comment thread README.md Outdated
@pftg pftg force-pushed the feat/ci-artifact-integration branch 3 times, most recently from 4bbb450 to a08ee63 Compare April 12, 2026 14:45
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/configuration.md`:
- Line 218: Replace the misspelled metric name "eucledian" with the correct
spelling "euclidean" in the documentation sentence that currently reads "The
difference is calculated as the eucledian distance. You can also set this
globally:"—search for the literal token "eucledian" and update it to "euclidean"
so the distance metric name is spelled correctly.
- Around line 274-290: The DSL docs incorrectly describe the `crop` and
`skip_area` tuples as `[x, y, width, height]`; change the wording in
lib/capybara_screenshot_diff/dsl.rb (around the current lines 41–42) to state
they are edge coordinates in `[left, top, right, bottom]` (matching
Region.from_edge_coordinates and area_calculator.rb), and update any example and
explanatory text for both `crop` and `skip_area` to use the edge-coordinate
terminology and format so the DSL docs align with the implementation.

In `@lib/capybara/screenshot/diff/vcs.rb`:
- Around line 12-13: git_root is being resolved outside the method's
Dir.chdir(root) and uses a hardcoded "2>/dev/null" redirection; change
resolution to run git rev-parse inside the repository root and avoid shell
redirection so SILENCE_ERRORS can control error output. Specifically, inside the
block that uses root (the same scope that will later compute vcs_file_path from
screenshot_path), run the git command from that directory (e.g., via
Dir.chdir(root) { ... } or an equivalent) and capture stderr in a cross-platform
way (Open3.capture3 or similar) so you can conditionally suppress or log errors
based on SILENCE_ERRORS; then build git_root from the captured stdout and
compute vcs_file_path relative to that git_root.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: df29f756-ee88-493c-9918-ccb73b0e3612

📥 Commits

Reviewing files that changed from the base of the PR and between 870cd28 and facc34c.

📒 Files selected for processing (14)
  • .github/actions/upload-screenshots/action.yml
  • .github/workflows/test.yml
  • .gitignore
  • README.md
  • docs/ci-integration.md
  • docs/configuration.md
  • docs/docker-testing.md
  • docs/drivers.md
  • docs/framework-setup.md
  • docs/organization.md
  • docs/reporters.md
  • lib/capybara/screenshot/diff/vcs.rb
  • scripts/generate_sample_report.rb
  • test/unit/vcs_test.rb
✅ Files skipped from review due to trivial changes (8)
  • .gitignore
  • scripts/generate_sample_report.rb
  • docs/docker-testing.md
  • docs/reporters.md
  • docs/drivers.md
  • docs/framework-setup.md
  • README.md
  • docs/ci-integration.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/actions/upload-screenshots/action.yml

Comment thread docs/configuration.md Outdated
Comment thread docs/configuration.md
Comment thread lib/capybara/screenshot/diff/vcs.rb Outdated
@pftg pftg force-pushed the feat/ci-artifact-integration branch 5 times, most recently from 5934456 to b6382aa Compare April 12, 2026 15:28
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
docs/configuration.md (1)

233-233: Update test name to match the section context.

The test is in the "Allowed shift distance" section but is named 'color threshold'. For consistency and clarity, it should be named 'shift threshold'.

📝 Proposed fix
-test 'color threshold' do
+test 'shift threshold' do
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/configuration.md` at line 233, The test name string is incorrect for the
"Allowed shift distance" section—rename the test declaration test 'color
threshold' do to test 'shift threshold' do so the test name matches the section
context; update the test declaration (the test 'color threshold' do block) to
use 'shift threshold' without changing the test body or assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/configuration.md`:
- Line 227: Replace the misspelled library name "jquer-tablesorter" with the
correct "jquery-tablesorter" in the docs content (look for the string
"jquer-tablesorter" in the text around the example about allowing small
movements in images) so the documentation references the proper library name.

In `@lib/capybara_screenshot_diff/reporters/html.rb`:
- Around line 99-110: The at_exit registration is currently placed inside the
guard that only adds a new CapybaraScreenshotDiff::Reporters::HTML when none
exists, so if an HTML reporter is already registered the at_exit block never
gets installed; move the at_exit block out of the unless block so it always
registers regardless of whether CapybaraScreenshotDiff::Reporters::HTML was
newly appended, keeping the logic that iterates
CapybaraScreenshotDiff.reporters, calls reporter.finalize, prints the Pathname
result via $stdout.puts and rescues/logs failures (warn ...) unchanged and still
referencing CapybaraScreenshotDiff.reporters and
CapybaraScreenshotDiff::Reporters::HTML.

---

Nitpick comments:
In `@docs/configuration.md`:
- Line 233: The test name string is incorrect for the "Allowed shift distance"
section—rename the test declaration test 'color threshold' do to test 'shift
threshold' do so the test name matches the section context; update the test
declaration (the test 'color threshold' do block) to use 'shift threshold'
without changing the test body or assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7c6a0722-1ace-4955-916a-d45baed11c6e

📥 Commits

Reviewing files that changed from the base of the PR and between facc34c and 5934456.

📒 Files selected for processing (16)
  • .github/actions/upload-screenshots/action.yml
  • .github/workflows/test.yml
  • .gitignore
  • README.md
  • docs/ci-integration.md
  • docs/configuration.md
  • docs/docker-testing.md
  • docs/drivers.md
  • docs/framework-setup.md
  • docs/organization.md
  • docs/reporters.md
  • lib/capybara/screenshot/diff/vcs.rb
  • lib/capybara_screenshot_diff/dsl.rb
  • lib/capybara_screenshot_diff/reporters/html.rb
  • scripts/generate_sample_report.rb
  • test/unit/vcs_test.rb
✅ Files skipped from review due to trivial changes (9)
  • .gitignore
  • scripts/generate_sample_report.rb
  • test/unit/vcs_test.rb
  • lib/capybara_screenshot_diff/dsl.rb
  • docs/docker-testing.md
  • docs/reporters.md
  • docs/drivers.md
  • docs/framework-setup.md
  • docs/ci-integration.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • lib/capybara/screenshot/diff/vcs.rb
  • .github/workflows/test.yml
  • README.md
  • .github/actions/upload-screenshots/action.yml

Comment thread docs/configuration.md Outdated
Comment thread lib/capybara_screenshot_diff/reporters/html.rb
@pftg pftg force-pushed the feat/ci-artifact-integration branch 3 times, most recently from 7fa5cfc to 16de749 Compare April 12, 2026 16:44
pftg and others added 3 commits April 12, 2026 19:12
- upload-screenshots action: v6→v7, base64 HTML report with archive:
  false, direct artifact-url outputs for PR comment links
- test.yml: PR comment with direct artifact URLs (find+update, no spam),
  resolves on success, path filters on push, workflow_dispatch test job
- Sample report: bin/rake 'report:sample[embed]' for base64 images

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
README: 970→149 lines with docs/ folder (7 files). Quick Start with
single include + git commit step. Failure message before file table.
Tuning Flaky Tests after Next Steps. CI fail_if_new note.

Reporter: embed_images option (base64 in CI, relative paths locally).
Convention over configuration — require auto-registers at_exit hook.
Fix crop/skip_area YARD docs to edge coordinates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
expand_path before Dir.chdir, git rev-parse inside chdir, early return
when not in git repo. Fixes mixed absolute/relative path errors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant