mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 17:28:28 +00:00
perf(test): cut setup/import overhead in hot suites
This commit is contained in:
@@ -28,10 +28,7 @@ const sessionMocks = vi.hoisted(() => ({
|
||||
}));
|
||||
|
||||
vi.mock("./pw-session.js", () => sessionMocks);
|
||||
|
||||
async function importModule() {
|
||||
return await import("./pw-tools-core.js");
|
||||
}
|
||||
const mod = await import("./pw-tools-core.js");
|
||||
|
||||
describe("pw-tools-core", () => {
|
||||
beforeEach(() => {
|
||||
@@ -57,7 +54,6 @@ describe("pw-tools-core", () => {
|
||||
screenshot: vi.fn(async () => Buffer.from("P")),
|
||||
};
|
||||
|
||||
const mod = await importModule();
|
||||
const res = await mod.takeScreenshotViaPlaywright({
|
||||
cdpUrl: "http://127.0.0.1:18792",
|
||||
targetId: "T1",
|
||||
@@ -78,7 +74,6 @@ describe("pw-tools-core", () => {
|
||||
screenshot: vi.fn(async () => Buffer.from("P")),
|
||||
};
|
||||
|
||||
const mod = await importModule();
|
||||
const res = await mod.takeScreenshotViaPlaywright({
|
||||
cdpUrl: "http://127.0.0.1:18792",
|
||||
targetId: "T1",
|
||||
@@ -99,8 +94,6 @@ describe("pw-tools-core", () => {
|
||||
screenshot: vi.fn(async () => Buffer.from("P")),
|
||||
};
|
||||
|
||||
const mod = await importModule();
|
||||
|
||||
await expect(
|
||||
mod.takeScreenshotViaPlaywright({
|
||||
cdpUrl: "http://127.0.0.1:18792",
|
||||
@@ -127,7 +120,6 @@ describe("pw-tools-core", () => {
|
||||
keyboard: { press: vi.fn(async () => {}) },
|
||||
};
|
||||
|
||||
const mod = await importModule();
|
||||
await mod.armFileUploadViaPlaywright({
|
||||
cdpUrl: "http://127.0.0.1:18792",
|
||||
targetId: "T1",
|
||||
@@ -151,7 +143,6 @@ describe("pw-tools-core", () => {
|
||||
keyboard: { press },
|
||||
};
|
||||
|
||||
const mod = await importModule();
|
||||
await mod.armFileUploadViaPlaywright({
|
||||
cdpUrl: "http://127.0.0.1:18792",
|
||||
paths: [],
|
||||
|
||||
Reference in New Issue
Block a user