PSA/ee/server/playwright.global-teardown.ts
Hermes 284313f908
Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Initial import of AlgaPSA codebase from PSA server
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz

Source: /opt/alga-psa on psa.joliet.tech
2026-06-22 16:12:17 -05:00

69 lines
2.2 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Global teardown for Playwright tests in EE server
* This runs once after all tests complete
*/
import { execSync } from 'child_process';
import path from 'path';
import fs from 'node:fs';
async function globalTeardown() {
const keepDeps =
process.env.PW_KEEP_DEPS === 'true' ||
process.env.PW_SKIP_TEARDOWN === 'true';
if (keepDeps) {
console.log('🧹 Skipping Playwright global teardown (PW_KEEP_DEPS/PW_SKIP_TEARDOWN enabled).');
return;
}
console.log('🧹 Starting Playwright global teardown...');
// Stop and remove workflow deps (postgres/redis/worker) used by Playwright runs.
console.log('🗑️ Stopping Playwright workflow deps...');
try {
const projectRoot = path.resolve(__dirname, '../..');
const envFile = fs.existsSync(path.resolve(__dirname, '.env'))
? 'ee/server/.env'
: 'ee/server/.env.test';
execSync(
`docker compose -f docker-compose.playwright-workflow-deps.yml -p alga-psa-playwright-workflow --env-file ${envFile} down -v`,
{ cwd: projectRoot, stdio: 'inherit' }
);
console.log('✅ Playwright workflow deps stopped and removed');
} catch (error) {
console.error('❌ Failed to stop Playwright workflow deps:', error);
// Don't throw - allow teardown to continue
}
// Stop and remove test MinIO container
console.log('🗑️ Stopping test MinIO container...');
try {
const marker = path.resolve(__dirname, '.playwright', 'minio-owned');
const isOwnedByThisRun = fs.existsSync(marker);
if (!isOwnedByThisRun) {
console.log(' MinIO container was reused; skipping teardown.');
return;
}
const projectRoot = path.resolve(__dirname, '../..');
execSync('docker compose -f docker-compose.playwright.yml down -v', {
cwd: projectRoot,
stdio: 'inherit',
});
try {
fs.unlinkSync(marker);
} catch {
// ignore
}
console.log('✅ MinIO test container stopped and removed');
} catch (error) {
console.error('❌ Failed to stop MinIO container:', error);
// Don't throw - allow tests to complete even if cleanup fails
}
console.log('✅ Playwright teardown complete');
}
export default globalTeardown;