- Add smoke-post-deploy.spec.ts for health checks - Add playwright.config.smoke.ts (no webServer) - Add smoke-post-deploy job to cd.yml (runs when STAGING_URL set) - Document procedure in e2e/README.md
36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
/**
|
|
* Post-deployment smoke tests.
|
|
* Run against a deployed environment (staging/production) via PLAYWRIGHT_BASE_URL.
|
|
* Does NOT start the dev server - expects the target to be already running.
|
|
*
|
|
* Usage:
|
|
* PLAYWRIGHT_BASE_URL=https://staging.veza.com npx playwright test e2e/tests/smoke-post-deploy.spec.ts
|
|
* VITE_FRONTEND_URL=https://app.veza.com npx playwright test e2e/tests/smoke-post-deploy.spec.ts
|
|
*/
|
|
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
const BASE_URL = process.env.PLAYWRIGHT_BASE_URL || process.env.VITE_FRONTEND_URL || 'http://localhost:5173';
|
|
|
|
test.describe('Post-deploy smoke checks', () => {
|
|
test('homepage loads', async ({ page }) => {
|
|
const response = await page.goto(BASE_URL, { waitUntil: 'domcontentloaded', timeout: 15000 });
|
|
expect(response?.status()).toBeLessThan(500);
|
|
});
|
|
|
|
test('login page loads', async ({ page }) => {
|
|
const response = await page.goto(`${BASE_URL}/login`, { waitUntil: 'domcontentloaded', timeout: 15000 });
|
|
expect(response?.status()).toBeLessThan(500);
|
|
});
|
|
|
|
test('API health check', async ({ request }) => {
|
|
const origin = new URL(BASE_URL).origin;
|
|
const apiUrl = `${origin}/api/v1/health`;
|
|
try {
|
|
const response = await request.get(apiUrl, { timeout: 10000 });
|
|
expect(response.status()).toBeLessThan(500);
|
|
} catch {
|
|
test.skip(true, 'API health endpoint may not be reachable from this context');
|
|
}
|
|
});
|
|
});
|