Skip to content

Commit d24b765

Browse files
committedSep 18, 2024
make it easier to run tests
1 parent bf57ef6 commit d24b765

File tree

5 files changed

+56
-74
lines changed

5 files changed

+56
-74
lines changed
 

‎.github/workflows/validate.yml

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

38+
# TODO: get this working again
39+
# - name: ⬇️ Install Playwright
40+
# run: npm --prefix epicshop run test:setup
41+
42+
# - name: 🧪 In-browser tests
43+
# run: npm --prefix epicshop test
44+
3845
deploy:
3946
name: 🚀 Deploy
4047
runs-on: ubuntu-latest

‎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

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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(
7+
os.tmpdir(),
8+
'epicshop-playwright',
9+
path.basename(new URL('../', import.meta.url).pathname),
10+
)
11+
12+
export default defineConfig({
13+
workers: process.env.CI ? 1 : undefined,
14+
outputDir: path.join(tmpDir, 'playwright-test-output'),
15+
reporter: [
16+
[
17+
'html',
18+
{ open: 'never', outputFolder: path.join(tmpDir, 'playwright-report') },
19+
],
20+
],
21+
use: {
22+
baseURL: `http://localhost:${PORT}/`,
23+
trace: 'retain-on-failure',
24+
},
25+
26+
projects: [
27+
{
28+
name: 'chromium',
29+
use: { ...devices['Desktop Chrome'] },
30+
},
31+
],
32+
33+
webServer: {
34+
command: 'cd .. && npm start',
35+
port: Number(PORT),
36+
reuseExistingServer: !process.env.CI,
37+
stdout: 'pipe',
38+
stderr: 'pipe',
39+
env: { PORT },
40+
},
41+
})

‎epicshop/playwright.config.ts

-64
This file was deleted.

‎epicshop/tests/in-browser-tests.spec.ts

-10
This file was deleted.

0 commit comments

Comments
 (0)