Enable Playwright e2e tests in dev container and CI pipeline
This commit is contained in:
@@ -3,9 +3,22 @@
|
|||||||
|
|
||||||
FROM mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm
|
FROM mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm
|
||||||
|
|
||||||
# Install system deps if needed (none required for static site)
|
# Install system deps for static site tooling + Playwright (e2e tests)
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
curl \
|
curl \
|
||||||
|
# Playwright browser dependencies (so e2e tests run inside devcontainer)
|
||||||
|
libnspr4 \
|
||||||
|
libnss3 \
|
||||||
|
libatk1.0-0 \
|
||||||
|
libdbus-1-3 \
|
||||||
|
libatspi2.0-0 \
|
||||||
|
libxcomposite1 \
|
||||||
|
libxdamage1 \
|
||||||
|
libxfixes3 \
|
||||||
|
libxrandr2 \
|
||||||
|
libgbm1 \
|
||||||
|
libxkbcommon0 \
|
||||||
|
libasound2 \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Ensure workspace dir exists (mount point)
|
# Ensure workspace dir exists (mount point)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
"dockerFile": "Dockerfile",
|
"dockerFile": "Dockerfile",
|
||||||
"workspaceFolder": "/workspaces/mifi-ventures-landing",
|
"workspaceFolder": "/workspaces/mifi-ventures-landing",
|
||||||
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/mifi-ventures-landing,type=bind",
|
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/mifi-ventures-landing,type=bind",
|
||||||
|
"postCreateCommand": "pnpm install && pnpm exec playwright install chromium",
|
||||||
"forwardPorts": [5173, 4173],
|
"forwardPorts": [5173, 4173],
|
||||||
"portsAttributes": {
|
"portsAttributes": {
|
||||||
"5173": {
|
"5173": {
|
||||||
@@ -18,7 +19,10 @@
|
|||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"esbenp.prettier-vscode"
|
"esbenp.prettier-vscode",
|
||||||
|
"rvest.vs-code-prettier-eslint",
|
||||||
|
"yoavbls.pretty-ts-errors",
|
||||||
|
"svelte.svelte-vscode"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
|
|||||||
@@ -33,3 +33,13 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- corepack enable && corepack prepare pnpm@10.28.2 --activate
|
- corepack enable && corepack prepare pnpm@10.28.2 --activate
|
||||||
- pnpm test
|
- pnpm test
|
||||||
|
|
||||||
|
- name: test e2e
|
||||||
|
image: mcr.microsoft.com/playwright:v1.58.0-noble
|
||||||
|
commands:
|
||||||
|
- corepack enable && corepack prepare pnpm@10.28.2 --activate
|
||||||
|
- pnpm install --frozen-lockfile || pnpm install
|
||||||
|
- pnpm run build
|
||||||
|
- npx serve dist -p 4173 &
|
||||||
|
- sleep 2
|
||||||
|
- CI=1 pnpm run test:e2e
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ export default [
|
|||||||
'node_modules/**',
|
'node_modules/**',
|
||||||
'site/**',
|
'site/**',
|
||||||
'static/**',
|
'static/**',
|
||||||
'build.mjs'
|
'build.mjs',
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
js.configs.recommended,
|
js.configs.recommended,
|
||||||
...tseslint.configs.recommended,
|
...tseslint.configs.recommended,
|
||||||
@@ -27,19 +27,19 @@ export default [
|
|||||||
parser: tseslint.parser,
|
parser: tseslint.parser,
|
||||||
projectService: true,
|
projectService: true,
|
||||||
extraFileExtensions: ['.svelte'],
|
extraFileExtensions: ['.svelte'],
|
||||||
svelteConfig
|
svelteConfig,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ['**/*.mjs', 'build.mjs'],
|
files: ['**/*.mjs', 'build.mjs'],
|
||||||
languageOptions: { globals: { console: 'readonly', process: 'readonly' } }
|
languageOptions: { globals: { console: 'readonly', process: 'readonly' } },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rules: {
|
rules: {
|
||||||
'svelte/no-at-html-tags': 'warn',
|
'svelte/no-at-html-tags': 'warn',
|
||||||
'svelte/require-each-key': 'off',
|
'svelte/require-each-key': 'off',
|
||||||
'svelte/no-navigation-without-resolve': 'off'
|
'svelte/no-navigation-without-resolve': 'off',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
BIN
tests/visual.spec.ts-snapshots/home-chromium-linux.png
Normal file
BIN
tests/visual.spec.ts-snapshots/home-chromium-linux.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 565 KiB |
Reference in New Issue
Block a user