Merge pull request #24 from gh-productivity-workshops/mishmanners-REA… #24
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: Playwright Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
url: | |
description: URL to test | |
required: false | |
default: http://localhost:5114/ | |
env: | |
TEST_URL: ${{ github.event.inputs.url || 'http://localhost:5114/' }} | |
jobs: | |
test: | |
name: Run Playwright tests | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Cache Playwright Browsers | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/ms-playwright | |
key: ${{ runner.os }}-node-${{ hashFiles('tests/playwright/package.json') }}-${{ hashFiles('tests/playwright/playwright.config.ts') }} | |
- name: Dapr tool installer | |
if: ${{ env.TEST_URL == 'http://localhost:5114/' }} | |
uses: dapr/setup-dapr@v1 | |
- name: Setup app locally | |
if: ${{ env.TEST_URL == 'http://localhost:5114/'}} | |
run: scripts/setup | |
- name: Install dependencies | |
run: | | |
cd tests/playwright | |
npm ci | |
- name: Install Playwright Browsers | |
run: | | |
cd tests/playwright | |
npx playwright install --with-deps | |
- name: Start app | |
if: ${{ env.TEST_URL == 'http://localhost:5114/' }} | |
run: | | |
scripts/dev & | |
npx wait-on tcp:5114 | |
- name: Run Playwright tests | |
run: | | |
cd tests/playwright | |
npx playwright test | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: tests/playwright/playwright-report/ | |
retention-days: 30 |