Coder Social home page Coder Social logo

designtips / lost-pixel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lost-pixel/lost-pixel

0.0 1.0 0.0 9.06 MB

Holistic visual regression testing framework for modern web ๐Ÿ–ผ First class integration with Storybook, Ladle & other frontend libraries.

License: MIT License

Shell 1.62% JavaScript 2.44% TypeScript 95.66% Dockerfile 0.28%

lost-pixel's Introduction

Lost Pixel

Holistic visual regression testing solution



Documentation ย ย โ€ขย ย  Quickstart ย ย โ€ขย ย  Examples

What is Lost Pixel โ“

Lost Pixel is an open source visual regression testing tool. Run visual regression tests on your Storybook and Ladle stories and on your application pages.

Provider Status Description
Storybook โœ… First class integration. Provide your storybook build - Lost Pixel does the rest.
Ladle โœ… First class integration. Provide your ladle build - Lost Pixel does the rest.
Pages โœ… Visual tests for modern frontend apps like Next, Gatsby, Remix. Run your app - provide Lost Pixel with paths to test.
Custom shots โœ… Take care of taking screenshots on your side - provide Lost Pixel with path to directory with images. Best suitable for custom Cypress/Playwright integrations

Lost Pixel consists of two products:

  • lost-pixel (open BETA) - the core engine driving the visual regression test runs. It could be used standalone and the main use-cases are outlined in the documentation
What machine sees ๐Ÿค– What human sees ๐Ÿ‘€
ezgif-5-e71eb0773d ezgif-5-43091ece5d
  • lost-pixel-platform (closed BETA) - the UI and CI helpers that allow you to use lost-pixel's managed version. This includes specified regression UI, collaboration with team members and easy approval/rejection process for the snapshots. Configure it just once and enjoy hassle free visual regression tests integrated into your GitHub actions pipeline.


Quick start โšก

Storybook ๐Ÿ–ผ

Assuming you are using basic example of Storybook. This setup will run visual regression tests against all the storybook stories on every push.

You can find more examples in the examples repository. You can learn more about Lost Pixel workflow and get more useful recipes in documentation.

Add lostpixel.config.ts at the root of the project:

import { CustomProjectConfig } from 'lost-pixel';

export const config: CustomProjectConfig = {
  storybookShots: {
    storybookUrl: './storybook-static',
  },
  generateOnly: true,
  failOnDifference: true,
};

Add GitHub action .github/workflows/lost-pixel-run.yml

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Node
        uses: actions/setup-node@v2
        with:
          node-version: 16.x
          cache: 'npm'

      - name: Install dependencies
        run: npm ci

      - name: Build Storybook
        run: npm run build-storybook

      - name: Lost Pixel
        uses: lost-pixel/[email protected]
Ladle example ๐Ÿฅ„

Assuming you are using basic example of Ladle. This setup will run visual regression tests against all the ladle stories on every push.

You can find more examples in the examples repository. You can learn more about Lost Pixel workflow and get more useful recipes in documentation.

Add lostpixel.config.ts at the root of the project:

import { CustomProjectConfig } from "lost-pixel";

export const config: CustomProjectConfig = {
  ladleShots: {
    ladleUrl: "http://172.17.0.1:61000",
  },
  generateOnly: true,
  failOnDifference: true
};

Update package.json with following scripts:

 "scripts": {
    "serve": "npx serve build -p 61000",
    "build": "ladle build"
  },

Add GitHub action .github/workflows/lost-pixel-run.yml

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Node
        uses: actions/setup-node@v2
        with:
          node-version: 16.x
          cache: "npm"

      - name: Install dependencies
        run: npm install

      - name: Build ladle
        run: npm run build

      - name: Serve ladle
        run: npm run serve &

      - name: Lost Pixel
        uses: lost-pixel/[email protected]
Pages example(next.js) โš›๏ธ

Assuming you are using basic example of Next.js. This setup will run visual regression tests against selected pages on every push.

You can find more examples in the examples repository. You can learn more about Lost Pixel workflow and get more useful recipes in documentation.

Add lostpixel.config.ts at the root of the project:

import { CustomProjectConfig } from 'lost-pixel';

export const config: CustomProjectConfig = {
  pageShots: {
    pages: [
      { path: '/app', name: 'app' },
    ],
    pageUrl: 'http://localhost:3000',
  },
  generateOnly: true,
  failOnDifference: true,
};

Add GitHub action .github/workflows/lost-pixel-run.yml

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Node
        uses: actions/setup-node@v2
        with:
          node-version: 16.x
          cache: "npm"

      - name: Install dependencies
        run: npm ci

      - name: Build Next app
        run: npm run build

      - name: Run Next app
        run: npm run start &

      - name: Lost Pixel
        uses: lost-pixel/[email protected]

Support ๐Ÿ‘จ๐Ÿผโ€๐Ÿ’ป

Ask a question about Lost Pixel

You can ask questions and initiate discussions about Lost Pixel.

โ“ Ask a question

Create a bug report for Lost Pixel

If you see an error message or run into an issue, help us with creating a bug report!

๐Ÿ› Create bug report

Submit a feature request

If Lost Pixel at the moment doesn't support some mode or does not have a feature we would appreciate your thoughts!

๐Ÿ†• Submit feature request


Contributing ๐Ÿ—๏ธ

Lost Pixel is open source in it's heart and welcomes any external contribution. You can refer to CONTRIBUTING.md to get going with the project locally in couple of minutes.

lost-pixel's People

Contributors

chriskalmar avatar d-ivashchuk avatar renovate[bot] avatar dependabot[bot] avatar snyk-bot avatar renovate-bot avatar tkdodo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.