Skip to content

Commit

Permalink
Support snapshots in pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
mikestopcontinues committed Feb 27, 2024
1 parent 3b97f21 commit 4a62d7e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 26 deletions.
Binary file removed .DS_Store
Binary file not shown.
40 changes: 32 additions & 8 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@ on:
push:
branches:
- "*"

pull_request:
branches:
- "*"

permissions:
actions: read
contents: read
packages: read
workflow_call:
inputs:
update-snapshots:
description: "Update snapshots?"
type: boolean

workflow_dispatch:
inputs:
update-snapshots:
description: "Update snapshots?"
type: boolean

env:
BROWSERCAT_API_KEY: ${{secrets.BROWSERCAT_API_KEY}}
Expand All @@ -26,7 +34,7 @@ jobs:
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up PNPM
uses: pnpm/action-setup@v2
Expand All @@ -40,18 +48,34 @@ jobs:
node-version-file: .nvmrc
check-latest: true

- name: Install Deps
- name: Install deps
run: |
pnpm install --frozen-lockfile
- name: Set up cache
id: cache
uses: actions/cache@v4
with:
key: cache/${{github.repository}}/${{github.ref}}
restore-keys: cache/${{github.repository}}/refs/heads/master
path: .test/**

- name: Initialize snapshots
if: ${{steps.cache.outputs.cache-hit != 'true' || inputs.update-snapshots == 'true'}}
run: |
pnpm run test:bcat --update-snapshots
- name: Test
continue-on-error: true
run: |
pnpm run test:bcat
- name: Upload Report
uses: actions/upload-artifact@v3
- name: Upload test report
id: report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: .test/spec/results/
retention-days: 30
overwrite: true
33 changes: 15 additions & 18 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,30 @@ export default defineConfig({
maxFailures: useBC && !isCI ? 0 : 3,
forbidOnly: isCI,

ignoreSnapshots: isCI,
expect: {
toMatchSnapshot: {
maxDiffPixelRatio: 0.05,
},
},

outputDir: '.test/spec/output',
snapshotDir: '.test/spec/snaps',
snapshotPathTemplate: '{snapshotDir}/{projectName}/{testFilePath}/{arg}{ext}',

snapshotPathTemplate: '.test/spec/snaps/{projectName}/{testFilePath}/{arg}{ext}',
testMatch: '*.spec.{ts,tsx}',

use: {
trace: 'on-first-retry',
},
reporter: [
['json', {outputFile: '.test/spec/results.json'}],
['html', {outputFolder: '.test/spec/results', open: 'never'}],
isCI ? ['github'] : ['line'],
],

reportSlowTests: {
max: 5,
threshold: 1000 * 15,
},

reporter: [
['json', {outputFile: '.test/spec/results.json'}],
['html', {outputFolder: '.test/spec/results', open: 'never'}],
isCI ? ['github'] : ['line'],
],
expect: {
toMatchSnapshot: {
maxDiffPixelRatio: 0.05,
},
},

use: {
trace: 'on-first-retry',
},

projects: [
{
Expand Down

0 comments on commit 4a62d7e

Please sign in to comment.