- Replaced `POSOrderReference.vue` with `OrderAttachmentsActionButton.vue` and added new features like attachment preview, upload, and management. - Introduced `POSOrderCustomerWishes.vue` for handling customer wishes fields with autosave behavior. - Added Playwright global setup/teardown scripts for managing dev server lifecycle during tests. - Enhanced booking flow test utilities and adjusted visibility rules in `bookingFlow.ts`.
45 lines
1013 B
JavaScript
45 lines
1013 B
JavaScript
import fs from "node:fs/promises";
|
|
import path from "node:path";
|
|
import { execFile } from "node:child_process";
|
|
import { promisify } from "node:util";
|
|
|
|
const execFileAsync = promisify(execFile);
|
|
const pidFile = path.resolve(process.cwd(), "output/playwright/dev-server.json");
|
|
|
|
async function killProcessTree(pid) {
|
|
if (!pid) {
|
|
return;
|
|
}
|
|
|
|
if (process.platform === "win32") {
|
|
await execFileAsync("taskkill", ["/PID", String(pid), "/T", "/F"], { cwd: process.cwd() }).catch(() => {});
|
|
return;
|
|
}
|
|
|
|
try {
|
|
process.kill(-pid, "SIGTERM");
|
|
} catch {
|
|
try {
|
|
process.kill(pid, "SIGTERM");
|
|
} catch {
|
|
// ignore
|
|
}
|
|
}
|
|
}
|
|
|
|
export default async function globalTeardown() {
|
|
if (process.env.PLAYWRIGHT_BASE_URL) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const file = await fs.readFile(pidFile, "utf8");
|
|
const { pid } = JSON.parse(file);
|
|
await killProcessTree(pid);
|
|
} catch {
|
|
// ignore missing or malformed state
|
|
}
|
|
|
|
await fs.rm(pidFile, { force: true }).catch(() => {});
|
|
}
|