Skip to content

Commit

Permalink
Update Playwright workflow and configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
genu committed Nov 25, 2023
1 parent aade4a7 commit 37dc79b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 23 deletions.
62 changes: 44 additions & 18 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,53 @@
name: Playwright Tests
on:
push:
branches: [ main, master ]
branches: [main, master]
pull_request:
branches: [ main, master ]
branches: [main, master]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

env:
DATABASE_URL: postgresql://test:test@localhost:5432/test
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm install -g pnpm && pnpm install
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
- name: Run Playwright tests
run: pnpm exec playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20

- uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- name: Install dependencies
run: |
npm install -g pnpm
pnpm install
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps

- name: Run Playwright tests
run: pnpm exec playwright test

- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
10 changes: 5 additions & 5 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ export default defineConfig({
],

/* Run your local dev server before starting the tests */
// webServer: {
// command: 'pnpm build && pnpm start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
webServer: {
command: 'pnpm build && pnpm start',
url: 'http://127.0.0.1:3000',
reuseExistingServer: !process.env.CI,
},
})

0 comments on commit 37dc79b

Please sign in to comment.