WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Tweak CAPI multiple card layout for mobile (#513) #451

Tweak CAPI multiple card layout for mobile (#513)

Tweak CAPI multiple card layout for mobile (#513) #451

name: Visual regression
on:
push:
branches:
- main
workflow_dispatch:
pull_request:
permissions:
contents: read
pull-requests: write
jobs:
test:
name: Visual regression
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- run: corepack enable
shell: bash
- uses: actions/[email protected]
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
shell: bash
- name: Install Playwright Browsers
run: pnpm playwright install --with-deps chromium
- name: Start Commercial Templates
run: pnpm dev & npx wait-on -v -i 1000 http://localhost:7777
- name: Run Playwright
continue-on-error: true
run: pnpm playwright test
- name: Construct results table
run: node scripts/analyse-visual-results
- uses: actions/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const { readFileSync, resolve } = require('fs');
const resultsTable = readFileSync('./test-results/visual-regression-results-table.txt', 'utf8');
const body = `### Visual regression testing results 🔍
If any tests are failing, please check that any visual changes are intentional before merging your PR.
${resultsTable}`
if (context.eventName === 'pull_request') {
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
const existingComment = comments.data.find(comment => comment.body.includes('Visual regression testing results'));
if (existingComment) {
await github.rest.issues.updateComment({
comment_id: existingComment.id,
owner: context.repo.owner,
repo: context.repo.repo,
body
});
return;
} else {
const { data } = await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body
});
}
}
- uses: actions/[email protected]
if: always()
with:
name: visual-regression-report
path: ./test-results/
retention-days: 5