e2e: config Playwright + test smoke; CI: installer et exécuter E2E; docs TESTING mise à jour
Some checks failed
CI/CD Pipeline / test (push) Failing after 8s
CI/CD Pipeline / security (push) Has been skipped
CI/CD Pipeline / integration-test (push) Has been skipped

This commit is contained in:
Your Name 2025-08-26 07:03:08 +02:00
parent 288209a529
commit 8a94c57c2a
5 changed files with 33 additions and 2 deletions

View File

@ -46,6 +46,12 @@ jobs:
- name: Build application - name: Build application
run: npm run build run: npm run build
- name: Install Playwright browsers
run: npm run e2e:install
- name: Run E2E tests
run: npm run test:e2e
- name: Test Docker build (artefacts) - name: Test Docker build (artefacts)
run: | run: |
docker build -t ihm-client:dist . docker build -t ihm-client:dist .

View File

@ -13,17 +13,20 @@ Cette page décrit la stratégie de test, loutillage et les conventions. Aucu
- Test runner: Jest 29 (environnement `jsdom`). - Test runner: Jest 29 (environnement `jsdom`).
- TypeScript: `ts-jest` (transform TS). - TypeScript: `ts-jest` (transform TS).
- Setup global: `tests/setup.ts` (polyfills Web, mocks réseau et stockage). - Setup global: `tests/setup.ts` (polyfills Web, mocks réseau et stockage).
- E2E: Playwright (Chromium headless) avec `playwright.config.ts`.
## Organisation ## Organisation
- `tests/unit/` : tests unitaires ciblés, rapides. - `tests/unit/` : tests unitaires ciblés, rapides.
- `tests/integration/` : réservé aux interactions WASM/services (à compléter si besoin). - `tests/integration/` : réservé aux interactions WASM/services (à compléter si besoin).
- `tests/e2e/` : tests de bout en bout (smoke tests).
## Exécution ## Exécution
- Lancer tous les tests: `npm run test` - Lancer tous les tests: `npm run test`
- Couverture: `npm run test:coverage` - Couverture: `npm run test:coverage`
- Veille interactive: `npm run test:watch` - Veille interactive: `npm run test:watch`
- E2E: `npm run e2e:install` puis `npm run test:e2e`
## Conventions ## Conventions

View File

@ -17,7 +17,9 @@
"prettify": "prettier --config ./.prettierrc --write \"src/**/*{.ts,.html,.css,.js}\"", "prettify": "prettier --config ./.prettierrc --write \"src/**/*{.ts,.html,.css,.js}\"",
"build:dist": "tsc -p tsconfig.build.json", "build:dist": "tsc -p tsconfig.build.json",
"lint": "prettier -c \"src/**/*{.ts,.html,.css,.js}\"", "lint": "prettier -c \"src/**/*{.ts,.html,.css,.js}\"",
"type-check": "tsc -p tsconfig.json --noEmit" "type-check": "tsc -p tsconfig.json --noEmit",
"e2e:install": "npx playwright install --with-deps",
"test:e2e": "playwright test"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
@ -40,7 +42,8 @@
"vite-plugin-static-copy": "^1.0.6", "vite-plugin-static-copy": "^1.0.6",
"webpack": "^5.90.3", "webpack": "^5.90.3",
"webpack-cli": "^5.1.4", "webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.2" "webpack-dev-server": "^5.0.2",
"@playwright/test": "^1.46.0"
}, },
"dependencies": { "dependencies": {
"@angular/elements": "^19.0.1", "@angular/elements": "^19.0.1",

13
playwright.config.ts Normal file
View File

@ -0,0 +1,13 @@
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests/e2e',
timeout: 30000,
use: {
baseURL: 'http://localhost:3000',
headless: true,
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
],
});

6
tests/e2e/smoke.spec.ts Normal file
View File

@ -0,0 +1,6 @@
import { test, expect } from '@playwright/test';
test('charge la page daccueil', async ({ page }) => {
await page.goto('/');
await expect(page.locator('#containerId')).toBeVisible();
});