Skip to content

Commit 7243681

Browse files
committed
feat: Added action + refactored playwright config url
1 parent 5fdb33c commit 7243681

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

.github/workflows/playwright.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Testing for visual regression on old theme
2+
3+
# Run the workflow when code is pushed or when a pull request is created
4+
on:
5+
push:
6+
branches:
7+
- '**'
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
playwright:
14+
name: Run Playwright
15+
runs-on: ubuntu-latest
16+
steps:
17+
# Checkout the repository so the workflow has access to the code
18+
- name: Checkout code
19+
uses: actions/checkout@v3
20+
- name: Run tests
21+
run: |
22+
make tests

tests/playwright.config.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { defineConfig, devices } from '@playwright/test';
22

3+
const BASE_URL = 'http://127.0.0.1';
4+
const PORT = 1313;
35
export default defineConfig({
46
testDir: './src',
57
fullyParallel: true,
@@ -8,7 +10,7 @@ export default defineConfig({
810
snapshotPathTemplate: '{testDir}/__screenshots__/{testFilePath}/{arg}{ext}',
911
reporter: [['html', { outputFolder: './playwright-report' }]],
1012
use: {
11-
baseURL: 'http://127.0.0.1:1314',
13+
baseURL: `${BASE_URL}:${PORT}`,
1214
screenshots: 'only-on-failure',
1315
video: 'retain-on-failure',
1416
trace: 'on-first-retry',
@@ -32,9 +34,8 @@ export default defineConfig({
3234
},
3335
],
3436
webServer: {
35-
command:
36-
'cd ../exampleSite && hugo mod get && hugo --gc -e production && hugo serve --port 1314',
37-
url: 'http://127.0.0.1:1314',
37+
command: `cd ../exampleSite && hugo mod get && hugo --gc -e production && hugo serve --port ${PORT}`,
38+
url: `${BASE_URL}:${PORT}`,
3839
stdout: 'ignore',
3940
},
4041
expect: {

0 commit comments

Comments
 (0)