Skip to content

Add Lost pixel for visual testing #351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
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
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on: [push]
jobs:
build:
runs-on: ubuntu-latest

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

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "yarn"

- name: Install dependencies
run: yarn install

- name: Build NextJS
run: yarn build

- name: Serve NextJS
run: yarn start &

- name: Lost Pixel
uses: lost-pixel/[email protected]
39 changes: 39 additions & 0 deletions .github/workflows/update-baselines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on: workflow_dispatch

jobs:
lost-pixel-update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Install dependencies
run: yarn install

- name: Build NextJS
run: yarn build

- name: Serve NextJS
run: yarn start &

- name: Lost Pixel
id: lp
uses: lost-pixel/[email protected]
env:
LOST_PIXEL_MODE: update
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
if: ${{ failure() && steps.lp.conclusion == 'failure' }}
with:
token: ${{ secrets.GH_TOKEN }}
commit-message: update lost-pixel baselines
delete-branch: true
branch: "lost-pixel-update/${{ github.ref_name }}"
title: "Lost Pixel update - ${{ github.ref_name }}"
body: Automated baseline update PR created by Lost Pixel
13 changes: 13 additions & 0 deletions lostpixel.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { CustomProjectConfig } from "lost-pixel";

export const config: CustomProjectConfig = {
pageShots: {
pages: [
{ path: "/", name: "app" },
{ path: "/calibrate", name: "calibrate" },
],
baseUrl: "http://172.17.0.1:3000",
},
generateOnly: true,
failOnDifference: true,
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"eslint-config-prettier": "^9.1.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lost-pixel": "^3.21.0",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "3.2.5",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"**/*.tsx",
".next/types/**/*.ts",
"types/**/*.ts",
"global.d.ts"
"global.d.ts",
"lostpixel.config.ts"
],
"exclude": ["node_modules"]
}
Loading
Loading