Skip to content

Testing setup

Testing setup #21

name: Visual Regression Tests
on:
pull_request:
branches:
- patch
concurrency: ${{ github.workflow }}-${{ github.ref || github.run_id }}
jobs:
visual-tests:
name: Test for accordion --single
runs-on: macos-13
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install Dependencies and build the project
run: |
yarn
yarn playwright install --with-deps
yarn build
- name: Create storybook build
run: |
cd example/storybook
yarn build-storybook
- name: Run test
run: |
cd example/storybook
yarn test:screenshot --accordion=single
- uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report
path: example/storybook/playwright-report/
overwrite: true
retention-days: 10
- name: Download artifact
if: failure()
uses: actions/download-artifact@v2
with:
name: playwright-report
- name: Extract files
if: failure()
run: unzip playwright-report.zip
- name: Push to GitHub Pages
if: failure()
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./playwright-report
- name: Comment PR
if: failure()
uses: actions/github-script@v4
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issueComment = `Playwright report is available [here](https://${{ github.repository }}.github.io/playwright-report/index.html)`
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: issueComment,
})