|
| 1 | +import { defineConfig, devices } from '@playwright/test' |
| 2 | +// import dotenv from 'dotenv' |
| 3 | +// import path from 'path' |
| 4 | + |
| 5 | +// Read from ".env" file. |
| 6 | +// dotenv.config({ path: path.resolve(__dirname, '.env') }) |
| 7 | + |
| 8 | +/** |
| 9 | + * Read environment variables from file. |
| 10 | + * https://github.com/motdotla/dotenv |
| 11 | + */ |
| 12 | +// import dotenv from 'dotenv'; |
| 13 | +// dotenv.config({ path: path.resolve(__dirname, '.env') }); |
| 14 | + |
| 15 | +/** |
| 16 | + * See https://playwright.dev/docs/test-configuration. |
| 17 | + */ |
| 18 | +export default defineConfig({ |
| 19 | + testDir: './tests', |
| 20 | + /* Run tests in files in parallel */ |
| 21 | + fullyParallel: false, |
| 22 | + /* Fail the build on CI if you accidentally left test.only in the source code. */ |
| 23 | + forbidOnly: !!process.env.CI, |
| 24 | + /* Retry on CI only */ |
| 25 | + retries: process.env.CI ? 2 : 0, |
| 26 | + /* Opt out of parallel tests on CI. */ |
| 27 | + workers: process.env.CI ? 1 : undefined, |
| 28 | + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ |
| 29 | + reporter: 'html', |
| 30 | + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ |
| 31 | + use: { |
| 32 | + baseURL: process.env.SERVER_BASE_URL, |
| 33 | + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ |
| 34 | + trace: 'on-first-retry', |
| 35 | + headless: true, // Exécuter tous les tests en mode headless |
| 36 | + ignoreHTTPSErrors: true, // Ignorer les erreurs HTTPS |
| 37 | + }, |
| 38 | + projects: [ |
| 39 | + { |
| 40 | + name: 'chromium', |
| 41 | + use: { ...devices['Desktop Chrome'] }, |
| 42 | + }, |
| 43 | + ], |
| 44 | + |
| 45 | + /* Run your local dev server before starting the tests */ |
| 46 | + // webServer: { |
| 47 | + // command: 'npm run start', |
| 48 | + // url: 'http://127.0.0.1:3000', |
| 49 | + // reuseExistingServer: !process.env.CI, |
| 50 | + // }, |
| 51 | +}) |
0 commit comments