Skip to content

Commit 97316a2

Browse files
committed
improve config
1 parent 024d9a5 commit 97316a2

File tree

4 files changed

+47
-2
lines changed

4 files changed

+47
-2
lines changed

.github/workflows/validate.yml

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
- name: ⬣ ESLint
3636
run: npm run lint
3737

38+
- name: 🧪 In-browser tests
39+
run: npm --prefix epicshop test
40+
3841
deploy:
3942
name: 🚀 Deploy
4043
runs-on: ubuntu-latest

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ workspace/
44
**/.cache/
55
**/build/
66
**/public/build
7-
**/playwright-report
8-
data.db
97
/playground
108
**/tsconfig.tsbuildinfo
119

epicshop/in-browser-tests.spec.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { dirname, resolve } from 'path'
2+
import { fileURLToPath } from 'url'
3+
import { setupInBrowserTests } from '@epic-web/workshop-utils/playwright.server'
4+
5+
const __dirname = dirname(fileURLToPath(import.meta.url))
6+
process.env.EPICSHOP_CONTEXT_CWD = resolve(__dirname, '..')
7+
8+
setupInBrowserTests()

epicshop/playwright.config.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import os from 'os'
2+
import path from 'path'
3+
import { defineConfig, devices } from '@playwright/test'
4+
5+
const PORT = process.env.PORT || '5639'
6+
const tmpDir = path.join(os.tmpdir(), 'epicreact-server-components')
7+
8+
export default defineConfig({
9+
outputDir: path.join(tmpDir, 'playwright-test-output'),
10+
reporter: [
11+
[
12+
'html',
13+
{ open: 'never', outputFolder: path.join(tmpDir, 'playwright-report') },
14+
],
15+
],
16+
use: {
17+
baseURL: `http://localhost:${PORT}/`,
18+
trace: 'retain-on-failure',
19+
},
20+
21+
projects: [
22+
{
23+
name: 'chromium',
24+
use: { ...devices['Desktop Chrome'] },
25+
},
26+
],
27+
28+
webServer: {
29+
command: 'cd .. && npm start',
30+
port: Number(PORT),
31+
reuseExistingServer: !process.env.CI,
32+
stdout: 'pipe',
33+
stderr: 'pipe',
34+
env: { PORT },
35+
},
36+
})

0 commit comments

Comments
 (0)