Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"plugins": [
{
"name": "visualci",
"version": "0.1.34",
"version": "0.1.35",
"description": "Visual regression and snapshot review for PDFs, screenshots, JSON, HTML and text: VisualCI's MCP server and its skills for each CI provider and test tool.",
"author": { "name": "DocSpring", "url": "https://visualci.com" },
"homepage": "https://visualci.com/docs/skills/",
Expand Down
2 changes: 1 addition & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "visualci",
"version": "0.1.34",
"version": "0.1.35",
"description": "Visual regression and snapshot review for PDFs, screenshots, JSON, HTML and text: VisualCI's MCP server and its skills for each CI provider and test tool.",
"author": { "name": "DocSpring", "url": "https://visualci.com" },
"homepage": "https://visualci.com/docs/skills/",
Expand Down
2 changes: 1 addition & 1 deletion .cursor-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "visualci",
"displayName": "VisualCI",
"version": "0.1.34",
"version": "0.1.35",
"description": "Visual regression and snapshot review for PDFs, screenshots, JSON, HTML and text: VisualCI's MCP server and its skills for each CI provider and test tool.",
"author": {
"name": "DocSpring"
Expand Down
2 changes: 1 addition & 1 deletion gemini-extension.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "visualci",
"version": "0.1.34",
"version": "0.1.35",
"description": "Visual regression and snapshot review for PDFs, screenshots, JSON, HTML and text: VisualCI's MCP server and its skills for each CI provider and test tool.",
"mcpServers": {
"visualci": {
Expand Down
2 changes: 1 addition & 1 deletion server/frontend/content/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A change doesn't fail the build. The pull request's GitHub check waits while you

## What you can send

- **Snapshot tests** that your test framework already writes: [Jest](/docs/snapshots/jest/), [Vitest](/docs/snapshots/vitest/), [insta](/docs/snapshots/insta/), [syrupy](/docs/snapshots/syrupy/) and [rspec-snapshot](/docs/snapshots/rspec-snapshot/).
- **Snapshot tests** that your test framework already writes: [Jest](/docs/snapshots/jest/), [Vitest](/docs/snapshots/vitest/), [insta](/docs/snapshots/insta/), [syrupy](/docs/snapshots/syrupy/), [rspec-snapshot](/docs/snapshots/rspec-snapshot/) and [Laravel Rust](/docs/snapshots/laravel-rust/) (screenshots too).
- **[Screenshots](/docs/screenshots/)** from browsers and mobile apps.
- **[PDFs](/docs/pdfs/)**, rendered page by page on VisualCI's servers.

Expand Down
100 changes: 100 additions & 0 deletions server/frontend/content/docs/snapshots/laravel-rust.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
title: Laravel Rust
description: Screenshot and snapshot tests for Laravel Rust apps with snapshot-testing-laravel, reviewed on VisualCI instead of committed as files.
skill: visualci-laravel-rust
skill_description: Sets up VisualCI for a Laravel Rust app's tests with the snapshot-testing-laravel crate: browser screenshots and HTML, JSON and text snapshots of responses, run under `visualci test -- cargo test`, with names, platforms, ignore rules and thresholds as VisualCI sees them. Use when a Laravel Rust project uses snapshot-testing-laravel, or wants screenshot or snapshot tests with VisualCI. Not for other Rust projects (see visualci-insta) or other frameworks.
---

[snapshot-testing-laravel](https://github.com/DocSpring/snapshot-testing-laravel-rs) is snapshot testing for [Laravel Rust](https://laravel.com/rust) apps: browser screenshots, plus HTML, JSON and text snapshots of your responses. On its own it keeps baselines as files in your repository. With `VISUALCI_TOKEN` set, it sends every snapshot to VisualCI instead, through the `visualci` CLI, and changes wait for review there.

```rust
use laravel::testing::prelude::*;
use snapshot_testing_laravel::prelude::*;

#[laravel::test]
async fn the_pricing_page_looks_right(app: Application) -> laravel::Result<()> {
let browser = app.browse().await?;
browser.visit("/pricing").await?.assert_see("Pro").await?;
browser.assert_screenshot("pricing/desktop").await?;
browser.resize(390, 844).await?.assert_screenshot("pricing/mobile").await?;
Ok(())
}

#[laravel::test]
async fn the_api_matches_its_snapshot(app: Application) {
app.get("/api/users/1")
.await
.assert_ok()
.assert_matches_snapshot_ignoring("api/users/show", ["$.updated_at"]);
}
```

The crate's [README](https://github.com/DocSpring/snapshot-testing-laravel-rs#readme) covers writing the tests: browser steps, element screenshots, the snapshot assertions and the example app. This page covers running them with VisualCI.

## 1. Install

```toml
[dev-dependencies]
snapshot-testing-laravel = "0.1"
```

Browser tests need Chrome or Chromium. Screenshots change a little between Chrome versions, so pin one, the same locally and in CI:

```sh
npx playwright@1.65.2 install --with-deps --only-shell chromium
```

For snapshots without a browser, `default-features = false` leaves the browser out.

Then the CLI, and a project token (see [Quick start](/docs/quick-start/)):

```sh
curl -fsSL https://visualci.com/install.sh | VISUALCI_VERSION=0.2.10 sh
export VISUALCI_TOKEN=vci_...
```

## 2. Run the tests under visualci test

```sh
visualci test -- cargo test
```

`cargo test` runs each file in `tests/` as its own process. [`visualci test`](/docs/reference/cli/#visualci-test) creates one build for the whole run, so every one of them adds to it, and finalizes the build when `cargo test` ends, even when tests fail. It exits with `cargo test`'s status when that failed.

- **In CI**, a changed snapshot doesn't fail its test: the pull request's VisualCI check waits until the change is reviewed.
- **On your machine**, each test fails once, listing every snapshot it changed with a link to review it. Approving it there makes it your branch's baseline. `SNAPSHOT_FAIL_FAST=1` (or `VISUALCI_FAIL_FAST=1`) fails a browser test at its first changed screenshot instead.

The crate tells the two apart by `VISUALCI_MODE` (`local` or `ci`), which `visualci test` sets from CLI 0.2.12 on, and otherwise by whether `CI` is set. Plain `cargo test` with `VISUALCI_TOKEN` set works too, but each test process then makes its own local build: `visualci test` puts the whole run in one.

With `VISUALCI_TOKEN` set, nothing is written to `tests/__snapshots__` or `tests/__screenshots__`: the baselines live on VisualCI. If you kept them in git before, remove those folders. The first build becomes the baseline, or in a project that already has builds, the snapshots show as added once, to approve. `VISUALCI_DISABLED=1` compares with the files again, without sending anything.

On GitHub Actions:

```yaml
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npx -y playwright@1.65.2 install --with-deps --only-shell chromium
- run: |
curl -fsSL https://visualci.com/install.sh | VISUALCI_VERSION=0.2.10 VISUALCI_INSTALL_DIR="$HOME/bin" sh
echo "$HOME/bin" >> "$GITHUB_PATH"
- run: visualci test -- cargo test --locked
env:
VISUALCI_TOKEN: ${{ secrets.VISUALCI_TOKEN }}
```

The crate runs `visualci` from the `PATH` (or `VISUALCI_CLI`). Check out with `fetch-depth: 0` so VisualCI can find each commit's baseline (see [GitHub Actions](/docs/ci/github-actions/)).

## How snapshots appear on VisualCI

- **Names** are the names in your tests, as they are: `assert_screenshot("settings/billing/390-dark")` is `settings/billing/390-dark` on VisualCI. Keep them stable and readable, never a counter or a timestamp.
- **Text snapshots** (HTML, JSON and text) have no platform. VisualCI compares HTML with attributes sorted and JSON with keys sorted, as the crate does, and shows JSON changes by path (`items[3].price: 10 → 12`).
- **Screenshots** carry the crate's platform, `chromium-linux`, `chromium-mac` or `chromium-windows` (`SNAPSHOT_PLATFORM` or `BrowserOptions::platform` sets another), so each platform keeps its own baselines. VisualCI also keeps separate sets for CI and for local runs on a Mac or Linux (see [Local runs](/docs/local-runs/#environments)).
- **Ignore rules** given in a test (`.ignoring(["$.created_at", r"ord_[0-9a-z]{24}"])`, rules starting with `$` are JSON paths and the rest regular expressions) go with that snapshot, and VisualCI applies them before comparing. Rules for many snapshots at once go in [`visualci.yml`](/docs/reference/config/).
- **`BrowserOptions::threshold(0.1)`** goes with each screenshot as its own threshold, VisualCI's perceptual colour threshold. Whether anti-aliased pixels count follows the project's setting.

For screenshots that don't change on every run (fixed fake data, a frozen clock with `app.travel_to(..)`, no fonts or images from other sites), see [Deterministic screenshots](/docs/screenshots/deterministic/).

## Reviewing the changes

When something changed, your coding agent reads it over VisualCI's MCP server (`get_build`, then `get_snapshot`) or with `visualci build show`, checks it against the code, and approves it or fixes the code. See [Coding agents](/docs/agents/).
2 changes: 2 additions & 0 deletions server/frontend/public/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Look at the repository and list what it already produces:
rspec-snapshot `.snap`;
- screenshots: Playwright, Cypress, Capybara or other browser tests that save images;
- PDFs a test suite generates.
- a Laravel Rust app: its tests can take screenshots and snapshots with the snapshot-testing-laravel crate
(https://visualci.com/docs/snapshots/laravel-rust.md).

Prefer what exists. If there's nothing, propose a handful of screenshots of the main screens, and ask the person before
adding tests.
Expand Down
2 changes: 1 addition & 1 deletion server/frontend/src/docs/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const docsSections: DocsSection[] = [
},
{
title: 'Snapshot tests',
slugs: ['snapshots/jest', 'snapshots/vitest', 'snapshots/insta', 'snapshots/syrupy', 'snapshots/rspec-snapshot'],
slugs: ['snapshots/jest', 'snapshots/vitest', 'snapshots/insta', 'snapshots/syrupy', 'snapshots/rspec-snapshot', 'snapshots/laravel-rust'],
},
{
title: 'Visual tests',
Expand Down
107 changes: 107 additions & 0 deletions skills/visualci-laravel-rust/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
name: visualci-laravel-rust
description: "Sets up VisualCI for a Laravel Rust app's tests with the snapshot-testing-laravel crate: browser screenshots and HTML, JSON and text snapshots of responses, run under `visualci test -- cargo test`, with names, platforms, ignore rules and thresholds as VisualCI sees them. Use when a Laravel Rust project uses snapshot-testing-laravel, or wants screenshot or snapshot tests with VisualCI. Not for other Rust projects (see visualci-insta) or other frameworks."
license: Apache-2.0
metadata:
docs: https://visualci.com/docs/snapshots/laravel-rust.md
---

<!-- Generated from server/frontend/content/docs/snapshots/laravel-rust.md by server/frontend/scripts/skills.mjs. Edit the page. -->

# Laravel Rust

[snapshot-testing-laravel](https://github.com/DocSpring/snapshot-testing-laravel-rs) is snapshot testing for [Laravel Rust](https://laravel.com/rust) apps: browser screenshots, plus HTML, JSON and text snapshots of your responses. On its own it keeps baselines as files in your repository. With `VISUALCI_TOKEN` set, it sends every snapshot to VisualCI instead, through the `visualci` CLI, and changes wait for review there.

```rust
use laravel::testing::prelude::*;
use snapshot_testing_laravel::prelude::*;

#[laravel::test]
async fn the_pricing_page_looks_right(app: Application) -> laravel::Result<()> {
let browser = app.browse().await?;
browser.visit("/pricing").await?.assert_see("Pro").await?;
browser.assert_screenshot("pricing/desktop").await?;
browser.resize(390, 844).await?.assert_screenshot("pricing/mobile").await?;
Ok(())
}

#[laravel::test]
async fn the_api_matches_its_snapshot(app: Application) {
app.get("/api/users/1")
.await
.assert_ok()
.assert_matches_snapshot_ignoring("api/users/show", ["$.updated_at"]);
}
```

The crate's [README](https://github.com/DocSpring/snapshot-testing-laravel-rs#readme) covers writing the tests: browser steps, element screenshots, the snapshot assertions and the example app. This page covers running them with VisualCI.

## 1. Install

```toml
[dev-dependencies]
snapshot-testing-laravel = "0.1"
```

Browser tests need Chrome or Chromium. Screenshots change a little between Chrome versions, so pin one, the same locally and in CI:

```sh
npx playwright@1.65.2 install --with-deps --only-shell chromium
```

For snapshots without a browser, `default-features = false` leaves the browser out.

Then the CLI, and a project token (see [Quick start](https://visualci.com/docs/quick-start.md)):

```sh
curl -fsSL https://visualci.com/install.sh | VISUALCI_VERSION=0.2.10 sh
export VISUALCI_TOKEN=vci_...
```

## 2. Run the tests under visualci test

```sh
visualci test -- cargo test
```

`cargo test` runs each file in `tests/` as its own process. [`visualci test`](https://visualci.com/docs/reference/cli.md#visualci-test) creates one build for the whole run, so every one of them adds to it, and finalizes the build when `cargo test` ends, even when tests fail. It exits with `cargo test`'s status when that failed.

- **In CI**, a changed snapshot doesn't fail its test: the pull request's VisualCI check waits until the change is reviewed.
- **On your machine**, each test fails once, listing every snapshot it changed with a link to review it. Approving it there makes it your branch's baseline. `SNAPSHOT_FAIL_FAST=1` (or `VISUALCI_FAIL_FAST=1`) fails a browser test at its first changed screenshot instead.

The crate tells the two apart by `VISUALCI_MODE` (`local` or `ci`), which `visualci test` sets from CLI 0.2.12 on, and otherwise by whether `CI` is set. Plain `cargo test` with `VISUALCI_TOKEN` set works too, but each test process then makes its own local build: `visualci test` puts the whole run in one.

With `VISUALCI_TOKEN` set, nothing is written to `tests/__snapshots__` or `tests/__screenshots__`: the baselines live on VisualCI. If you kept them in git before, remove those folders. The first build becomes the baseline, or in a project that already has builds, the snapshots show as added once, to approve. `VISUALCI_DISABLED=1` compares with the files again, without sending anything.

On GitHub Actions:

```yaml
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npx -y playwright@1.65.2 install --with-deps --only-shell chromium
- run: |
curl -fsSL https://visualci.com/install.sh | VISUALCI_VERSION=0.2.10 VISUALCI_INSTALL_DIR="$HOME/bin" sh
echo "$HOME/bin" >> "$GITHUB_PATH"
- run: visualci test -- cargo test --locked
env:
VISUALCI_TOKEN: ${{ secrets.VISUALCI_TOKEN }}
```

The crate runs `visualci` from the `PATH` (or `VISUALCI_CLI`). Check out with `fetch-depth: 0` so VisualCI can find each commit's baseline (see [GitHub Actions](https://visualci.com/docs/ci/github-actions.md)).

## How snapshots appear on VisualCI

- **Names** are the names in your tests, as they are: `assert_screenshot("settings/billing/390-dark")` is `settings/billing/390-dark` on VisualCI. Keep them stable and readable, never a counter or a timestamp.
- **Text snapshots** (HTML, JSON and text) have no platform. VisualCI compares HTML with attributes sorted and JSON with keys sorted, as the crate does, and shows JSON changes by path (`items[3].price: 10 → 12`).
- **Screenshots** carry the crate's platform, `chromium-linux`, `chromium-mac` or `chromium-windows` (`SNAPSHOT_PLATFORM` or `BrowserOptions::platform` sets another), so each platform keeps its own baselines. VisualCI also keeps separate sets for CI and for local runs on a Mac or Linux (see [Local runs](https://visualci.com/docs/local-runs.md#environments)).
- **Ignore rules** given in a test (`.ignoring(["$.created_at", r"ord_[0-9a-z]{24}"])`, rules starting with `$` are JSON paths and the rest regular expressions) go with that snapshot, and VisualCI applies them before comparing. Rules for many snapshots at once go in [`visualci.yml`](https://visualci.com/docs/reference/config.md).
- **`BrowserOptions::threshold(0.1)`** goes with each screenshot as its own threshold, VisualCI's perceptual colour threshold. Whether anti-aliased pixels count follows the project's setting.

For screenshots that don't change on every run (fixed fake data, a frozen clock with `app.travel_to(..)`, no fonts or images from other sites), see [Deterministic screenshots](https://visualci.com/docs/screenshots/deterministic.md).

## Reviewing the changes

When something changed, your coding agent reads it over VisualCI's MCP server (`get_build`, then `get_snapshot`) or with `visualci build show`, checks it against the code, and approves it or fixes the code. See [Coding agents](https://visualci.com/docs/agents.md).

This skill is the page https://visualci.com/docs/snapshots/laravel-rust.md. All of VisualCI's documentation: https://visualci.com/llms.txt
1 change: 1 addition & 0 deletions skills/visualci/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Load the one for the user's CI provider and test tools:
- `visualci-insta`: Send insta snapshot files to VisualCI, so a changed snapshot waits for review instead of failing cargo test.
- `visualci-jenkins`: Send VisualCI builds from a Jenkins pipeline. The CLI reads the commit, branch and pull request from the Git plugin and multibranch pipelines.
- `visualci-jest`: Send Jest snapshot files to VisualCI, so a changed snapshot waits for review instead of failing the build.
- `visualci-laravel-rust`: Screenshot and snapshot tests for Laravel Rust apps with snapshot-testing-laravel, reviewed on VisualCI instead of committed as files.
- `visualci-local-runs`: Run your tests on a laptop against VisualCI's baselines, fail each test once with every snapshot it changed, and approve local changes so CI matches them.
- `visualci-mobile`: Send iOS, Android, React Native and Flutter screenshots to VisualCI, from XCUITest, swift-snapshot-testing, Espresso, Paparazzi, Maestro, Detox and Flutter golden tests.
- `visualci-pdfs`: How VisualCI renders, fingerprints and compares PDFs, page by page, in one pinned environment.
Expand Down
Loading