fix(runs): disable playwright traces by default, bump to 1.16.1
- default PLAYWRIGHT_TRACE_MODE to off since traces often reach ~10 MB per run; traces can still be enabled per run or via the setting
This commit is contained in:
1 parent
ff83b6c7da
commit
84dba6d670
10 files changed
+40
-23
No files matched your search
@@ -56,7 +56,8 @@ export class AppConfig {
|
||||
FILE_CLEANUP_CRON: string = "0 3 * * *";
|
||||
|
||||
@IsEnum(TraceMode)
|
||||
PLAYWRIGHT_TRACE_MODE: TraceMode = TraceMode.On;
|
||||
// Off by default: traces with screenshots and snapshots easily reach ~10 MB per run
|
||||
PLAYWRIGHT_TRACE_MODE: TraceMode = TraceMode.Off;
|
||||
}
|
||||
|
||||
export function validateAppConfig(config: Record<string, unknown>): AppConfig {
|
||||
|
||||
@@ -593,12 +593,8 @@ describe("McpController", () => {
|
||||
total: number;
|
||||
};
|
||||
|
||||
// The script's artifact plus the run's Playwright trace
|
||||
expect(list.total).toBe(2);
|
||||
expect(list.items.map((f) => f.name).sort()).toEqual([
|
||||
"artifact.bin",
|
||||
"trace.zip",
|
||||
]);
|
||||
// Traces are off by default, so the script's artifact is the only file
|
||||
expect(list.total).toBe(1);
|
||||
const artifact = list.items.find((f) => f.name === "artifact.bin")!;
|
||||
expect(artifact.mimeType).toBe("application/octet-stream");
|
||||
expect(artifact.expiresAt).not.toBeNull();
|
||||
|
||||
@@ -111,14 +111,17 @@ describe("ScenarioSchedulerService Playwright traces", () => {
|
||||
expect(await traceArtifacts(runId)).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("stores the configured default trace mode when none is given", async () => {
|
||||
const runId = await runScenario("trace-default", "return 1;");
|
||||
it("stores the configured default trace mode (off) when none is given", async () => {
|
||||
const runId = await runScenario(
|
||||
"trace-default",
|
||||
"throw new Error('boom');",
|
||||
);
|
||||
const [row] = await dataSource.query(
|
||||
`SELECT traceMode FROM scenario_runs WHERE id = ?`,
|
||||
[runId],
|
||||
);
|
||||
expect(row.traceMode).toBe("on");
|
||||
expect(await traceArtifacts(runId)).toHaveLength(1);
|
||||
expect(row.traceMode).toBe("off");
|
||||
expect(await traceArtifacts(runId)).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("falls back to the configured mode for runs without a stored trace mode", async () => {
|
||||
@@ -128,7 +131,13 @@ describe("ScenarioSchedulerService Playwright traces", () => {
|
||||
const env = await envRepo.save(
|
||||
envRepo.create({ name: "trace-null-mode-env", data: {} }),
|
||||
);
|
||||
const run = await scenarioService.createRun(sc.id, env.id);
|
||||
const run = await scenarioService.createRun(
|
||||
sc.id,
|
||||
env.id,
|
||||
false,
|
||||
TraceMode.On,
|
||||
);
|
||||
// Legacy runs have no stored mode; they must use the configured default (off)
|
||||
await dataSource.query(
|
||||
`UPDATE scenario_runs SET traceMode = NULL WHERE id = ?`,
|
||||
[run.id],
|
||||
@@ -141,7 +150,7 @@ describe("ScenarioSchedulerService Playwright traces", () => {
|
||||
while (activeRuns.has(run.id) && Date.now() < deadline) {
|
||||
await new Promise((r) => setTimeout(r, 20));
|
||||
}
|
||||
expect(await traceArtifacts(run.id)).toHaveLength(1);
|
||||
expect(await traceArtifacts(run.id)).toHaveLength(0);
|
||||
});
|
||||
|
||||
describe("HTTP", () => {
|
||||
@@ -150,7 +159,7 @@ describe("ScenarioSchedulerService Playwright traces", () => {
|
||||
"/scenarios/run-defaults",
|
||||
);
|
||||
expect(res.status).toBe(200);
|
||||
expect(res.body).toEqual({ traceMode: "on" });
|
||||
expect(res.body).toEqual({ traceMode: "off" });
|
||||
});
|
||||
|
||||
it("POST /scenarios/:id/run stores the requested trace mode", async () => {
|
||||
|
||||
Reference in new issue
Block a user