test: adding playwright chromatic + initial test #1161
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Chromatic | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# paths: | |
# - "stories/**" | |
# - "packages/**" | |
# - "website/**" | |
jobs: | |
playwright: | |
name: Playwright Tests | |
runs-on: ubuntu-latest | |
container: | |
image: mcr.microsoft.com/playwright:v1.49.0-jammy | |
steps: | |
- name: Wait for Deployment | |
uses: patrickedqvist/[email protected] | |
id: deployment | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
max_timeout: 600 | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/setup | |
with: | |
node-version: 18.x | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Install Test Dependencies | |
run: pnpm install | |
- name: Install Playwright | |
run: pnpm playwright install --with-deps | |
- name: Run Playwright Tests | |
run: npx playwright test | |
env: | |
PLAYWRIGHT_TEST_BASE_URL: ${{ steps.deployment.outputs.url }} | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-results | |
path: ./test-results | |
retention-days: 30 | |
chromatic: | |
name: Run Chromatic | |
needs: playwright | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/setup | |
with: | |
node-version: 18.x | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Download Playwright test results | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-results | |
path: ./test-results | |
- name: Run Chromatic | |
uses: chromaui/action@latest | |
with: | |
playwright: true | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |