e2e: config Playwright + test smoke; CI: installer et exécuter E2E; docs TESTING mise à jour
This commit is contained in:
parent
288209a529
commit
8a94c57c2a
@ -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 .
|
||||||
|
@ -13,17 +13,20 @@ Cette page décrit la stratégie de test, l’outillage 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
|
||||||
|
|
||||||
|
@ -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
13
playwright.config.ts
Normal 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
6
tests/e2e/smoke.spec.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import { test, expect } from '@playwright/test';
|
||||||
|
|
||||||
|
test('charge la page d’accueil', async ({ page }) => {
|
||||||
|
await page.goto('/');
|
||||||
|
await expect(page.locator('#containerId')).toBeVisible();
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user