Introduce Edge Gateway management pages and implement WebSocket session handling
This commit is contained in:
@@ -12,8 +12,6 @@ const runtimeNamespace = String(process.env.PLAYWRIGHT_ARTIFACT_NAMESPACE || `po
|
||||
.trim()
|
||||
.replace(/[^a-zA-Z0-9._-]+/g, "-");
|
||||
const pidFile = path.resolve(process.cwd(), "output/playwright", `dev-server-${runtimeNamespace}.json`);
|
||||
const posViewsDirectory = path.resolve(process.cwd(), "src/views/dashboards/departmentDashboard/modules/Pos");
|
||||
const shopComponentsDirectory = path.resolve(process.cwd(), "src/components/shop");
|
||||
const serverOutputLimit = 80;
|
||||
|
||||
async function getListeningProcessOnWindows(port) {
|
||||
@@ -243,38 +241,25 @@ async function waitForServerReady(url, serverProcess, stdoutLines, stderrLines,
|
||||
}
|
||||
|
||||
async function buildWarmupTargets() {
|
||||
const [posViewFiles, shopComponentFiles] = await Promise.all([
|
||||
fs.readdir(posViewsDirectory),
|
||||
fs.readdir(shopComponentsDirectory),
|
||||
]);
|
||||
|
||||
return [
|
||||
{ pathname: "/admin/12/modules/pos?step=1", expectedContentType: "text/html" },
|
||||
{ pathname: "/admin/12/modules/pos/orders/54518", expectedContentType: "text/html" },
|
||||
{ pathname: "/@vite/client", expectedContentType: "javascript" },
|
||||
{ pathname: "/src/main.js", expectedContentType: "javascript" },
|
||||
{ pathname: "/src/router.js", expectedContentType: "javascript" },
|
||||
...posViewFiles
|
||||
.filter((fileName) => fileName.endsWith(".vue"))
|
||||
.map((fileName) => ({
|
||||
pathname: `/src/views/dashboards/departmentDashboard/modules/Pos/${fileName}`,
|
||||
expectedContentType: "javascript",
|
||||
})),
|
||||
...shopComponentFiles
|
||||
.filter((fileName) => fileName.endsWith(".vue"))
|
||||
.map((fileName) => ({
|
||||
pathname: `/src/components/shop/${fileName}`,
|
||||
expectedContentType: "javascript",
|
||||
})),
|
||||
];
|
||||
}
|
||||
|
||||
async function warmUpAsset(url, expectedContentType, timeoutMs = 120_000) {
|
||||
const deadline = Date.now() + timeoutMs;
|
||||
const perRequestTimeoutMs = 10_000;
|
||||
|
||||
while (Date.now() < deadline) {
|
||||
try {
|
||||
const response = await fetch(url, { redirect: "manual" });
|
||||
const response = await fetch(url, {
|
||||
redirect: "manual",
|
||||
signal: AbortSignal.timeout(perRequestTimeoutMs),
|
||||
});
|
||||
const contentType = response.headers.get("content-type") || "";
|
||||
|
||||
if (response.ok && contentType.toLowerCase().includes(expectedContentType)) {
|
||||
@@ -318,7 +303,7 @@ export default async function globalSetup() {
|
||||
|
||||
const serverProcess =
|
||||
process.platform === "win32"
|
||||
? spawn("cmd.exe", ["/d", "/s", "/c", `npm.cmd run dev -- --host ${devHost} --port ${devPort} --strictPort`], {
|
||||
? spawn("cmd.exe", ["/d", "/s", "/c", `npm.cmd run dev -- --force --host ${devHost} --port ${devPort} --strictPort`], {
|
||||
cwd: process.cwd(),
|
||||
detached: true,
|
||||
env: {
|
||||
@@ -328,7 +313,7 @@ export default async function globalSetup() {
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
windowsHide: true,
|
||||
})
|
||||
: spawn("npm", ["run", "dev", "--", "--host", devHost, "--port", String(devPort), "--strictPort"], {
|
||||
: spawn("npm", ["run", "dev", "--", "--force", "--host", devHost, "--port", String(devPort), "--strictPort"], {
|
||||
cwd: process.cwd(),
|
||||
detached: true,
|
||||
env: {
|
||||
@@ -341,6 +326,7 @@ export default async function globalSetup() {
|
||||
const stderrLines = [];
|
||||
const stdoutReader = captureProcessOutput(serverProcess.stdout, stdoutLines);
|
||||
const stderrReader = captureProcessOutput(serverProcess.stderr, stderrLines);
|
||||
serverProcess.unref();
|
||||
|
||||
await fs.writeFile(pidFile, JSON.stringify({ pid: serverProcess.pid, port: devPort }), "utf8");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user