Skip to content

Commit

Permalink
playwright improvements (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
ann-kilzer authored Nov 25, 2023
1 parent 8de852d commit e26849e
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 4 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PLAYWRIGHT_BASE_URL=https://annkilzer.net
3 changes: 2 additions & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Playwright Tests
name: Production Playwright Tests
on:
[deployment_status, deployment, workflow_dispatch]
jobs:
test:
timeout-minutes: 60
environment: production
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ html
/playwright-report/
/blob-report/
/playwright/.cache/
.env
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ Install dependencies (and set up Husky)
npm i
```

Set up env vars:
```sh
cp .env.sample .env
```

Run in dev mode
```sh
npm run dev
Expand Down
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@fontsource/lusitana": "5.0.8",
"@fontsource/noto-sans-jp": "5.0.16",
"@mui/material": "5.14.18",
"dotenv": "^16.3.1",
"iconoir-react": "7.0.3",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down Expand Up @@ -54,4 +55,4 @@
"vite": "5.0.0",
"vitest": "0.34.6"
}
}
}
5 changes: 3 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { defineConfig, devices } from '@playwright/test';
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
import dotenv from 'dotenv'
dotenv.config()

/**
* See https://playwright.dev/docs/test-configuration.
Expand All @@ -24,7 +25,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: process.env.CI ? 'https://annkilzer.net' : 'http://localhost:5173/',
baseURL: process.env.PLAYWRIGHT_BASE_URL ?? 'http://localhost:5173/',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
Expand Down

0 comments on commit e26849e

Please sign in to comment.