Skip to content

Commit 65d0969

Browse files
committed
Update Playwright config
1 parent eed9c81 commit 65d0969

File tree

3 files changed

+73
-21
lines changed

3 files changed

+73
-21
lines changed

.github/workflows/playwright.yml

+42-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
name: Playwright Tests
2+
23
on:
34
push:
4-
branches: [ main, master ]
5+
branches:
6+
- master
57
pull_request:
6-
branches: [ main, master ]
8+
types:
9+
- opened
10+
- synchronize
11+
workflow_dispatch:
12+
inputs:
13+
debug_enabled:
14+
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
15+
required: false
16+
default: 'false'
17+
718
jobs:
19+
820
test:
921
timeout-minutes: 60
1022
runs-on: ubuntu-latest
@@ -13,15 +25,42 @@ jobs:
1325
- uses: actions/setup-node@v4
1426
with:
1527
node-version: lts/*
28+
- uses: actions/setup-python@v5
29+
with:
30+
python-version: '3.10'
31+
- name: Setup tmate session
32+
uses: mxschmitt/action-tmate@v3
33+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
34+
with:
35+
limit-access-to-actor: true
1636
- name: Install dependencies
1737
run: npm ci
38+
working-directory: frontend
1839
- name: Install Playwright Browsers
1940
run: npx playwright install --with-deps
41+
working-directory: frontend
42+
- run: docker compose build
43+
- run: docker compose down -v --remove-orphans
44+
- run: docker compose up -d
2045
- name: Run Playwright tests
2146
run: npx playwright test
47+
working-directory: frontend
48+
- run: docker compose down -v --remove-orphans
2249
- uses: actions/upload-artifact@v4
2350
if: always()
2451
with:
2552
name: playwright-report
26-
path: playwright-report/
53+
path: frontend/playwright-report/
2754
retention-days: 30
55+
56+
# https://github.com/marketplace/actions/alls-green#why
57+
e2e-alls-green: # This job does nothing and is only used for the branch protection
58+
if: always()
59+
needs:
60+
- test
61+
runs-on: ubuntu-latest
62+
steps:
63+
- name: Decide whether the needed jobs succeeded or failed
64+
uses: re-actors/alls-green@release/v1
65+
with:
66+
jobs: ${{ toJSON(needs) }}

frontend/biome.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"enabled": true
55
},
66
"files": {
7-
"ignore": ["node_modules", "src/routeTree.gen.ts"]
7+
"ignore": ["node_modules", "src/routeTree.gen.ts", "playwright.config.ts"]
88
},
99
"linter": {
1010
"enabled": true,

playwright.config.ts

+30-17
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { defineConfig, devices } from '@playwright/test';
44
* Read environment variables from file.
55
* https://github.com/motdotla/dotenv
66
*/
7-
// import dotenv from 'dotenv';
8-
// dotenv.config({ path: path.resolve(__dirname, '.env') });
7+
// require('dotenv').config();
98

109
/**
1110
* See https://playwright.dev/docs/test-configuration.
@@ -25,28 +24,42 @@ export default defineConfig({
2524
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2625
use: {
2726
/* Base URL to use in actions like `await page.goto('/')`. */
28-
// baseURL: 'http://127.0.0.1:3000',
27+
baseURL: 'http://localhost:5173',
2928

3029
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
3130
trace: 'on-first-retry',
3231
},
3332

3433
/* Configure projects for major browsers */
3534
projects: [
35+
{ name: 'setup', testMatch: /.*\.setup\.ts/ },
36+
3637
{
3738
name: 'chromium',
38-
use: { ...devices['Desktop Chrome'] },
39+
use: {
40+
...devices['Desktop Chrome'],
41+
storageState: 'playwright/.auth/user.json',
42+
},
43+
dependencies: ['setup'],
3944
},
4045

41-
{
42-
name: 'firefox',
43-
use: { ...devices['Desktop Firefox'] },
44-
},
46+
// {
47+
// name: 'firefox',
48+
// use: {
49+
// ...devices['Desktop Firefox'],
50+
// storageState: 'playwright/.auth/user.json',
51+
// },
52+
// dependencies: ['setup'],
53+
// },
4554

46-
{
47-
name: 'webkit',
48-
use: { ...devices['Desktop Safari'] },
49-
},
55+
// {
56+
// name: 'webkit',
57+
// use: {
58+
// ...devices['Desktop Safari'],
59+
// storageState: 'playwright/.auth/user.json',
60+
// },
61+
// dependencies: ['setup'],
62+
// },
5063

5164
/* Test against mobile viewports. */
5265
// {
@@ -70,9 +83,9 @@ export default defineConfig({
7083
],
7184

7285
/* Run your local dev server before starting the tests */
73-
// webServer: {
74-
// command: 'npm run start',
75-
// url: 'http://127.0.0.1:3000',
76-
// reuseExistingServer: !process.env.CI,
77-
// },
86+
webServer: {
87+
command: 'npm run dev',
88+
url: 'http://localhost:5173',
89+
reuseExistingServer: !process.env.CI,
90+
},
7891
});

0 commit comments

Comments
 (0)