Enhance Jenkinsfile for frontend testing and update Playwright configuration

- Added a new 'E2E (docker compose + Playwright)' stage in the Jenkinsfile to run end-to-end tests using Docker Compose and Playwright.
- Updated the 'Test frontend' stage to utilize the Playwright test image and improved error handling for missing files.
- Modified Playwright configuration to use an environment variable for the base URL, enhancing flexibility in CI environments.
- Expanded TypeScript configuration to include additional test and configuration files for better type checking.
This commit is contained in:
2026-04-24 11:18:57 -05:00
parent 46c98dbc38
commit b8f46d09ae
5 changed files with 116 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
import { defineConfig } from '@playwright/test';
import { fileURLToPath } from 'url';
import path from 'path';
import { fileURLToPath } from 'node:url';
import path from 'node:path';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -13,7 +13,7 @@ export default defineConfig({
forbidOnly: inCI,
timeout: 60000,
use: {
baseURL: 'http://localhost:5173',
baseURL: process.env.PLAYWRIGHT_TEST_BASE_URL || 'http://localhost:5173',
// Sin display en agentes de integración: obligatorio headless
headless: inCI ? true : false
},

View File

@@ -11,7 +11,25 @@
"strict": true,
"moduleResolution": "bundler",
"allowArbitraryExtensions": true
}
},
"include": [
"playwright.config.ts",
"e2e/**/*.ts",
"e2e/**/*.js",
"vitest-setup-client.ts",
"eslint.config.js",
"./.svelte-kit/ambient.d.ts",
"./.svelte-kit/non-ambient.d.ts",
"./.svelte-kit/types/**/$types.d.ts",
"./src/**/*.js",
"./src/**/*.ts",
"./src/**/*.svelte",
"./tests/**/*.js",
"./tests/**/*.ts",
"./tests/**/*.svelte",
"./vite.config.js",
"./vite.config.ts"
]
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
//

View File

@@ -3,11 +3,12 @@ import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vitest/config';
import { sveltekit } from '@sveltejs/kit/vite';
/* Jenkins / CI: sin navegador ni pnpm exec playwright install (Vitest 3+ intenta aun levantar el project "client" si queda en la config). */
const vitestNoBrowser =
process.env.CI === 'true' ||
Boolean(process.env.JENKINS_URL) ||
process.env.VITEST_NO_BROWSER === '1';
/* En CI, por defecto solo Node (evita Chromium). Con JENKINS_VITEST_FULL=1 o VITEST_FULL=1, también @vitest/browser. */
const inCi = process.env.CI === 'true' || Boolean(process.env.JENKINS_URL);
const vitestFull =
process.env.VITEST_FULL === '1' || process.env.JENKINS_VITEST_FULL === '1';
const skipBrowser = process.env.VITEST_NO_BROWSER === '1';
const vitestNoBrowser = (inCi && !vitestFull) || skipBrowser;
const vitestServerProject = {
extends: './vite.config.ts',