Files
liqa/server/test/__mocks__/playwright.ts
T
Andrii Arsenin 7418adf385 feat(import): add central yaml import for all exportable kinds
- add POST /import, an import page and the import_yaml mcp tool; items
  are validated up front and imported in dependency order
- switch list page import buttons to the central import
- write scenario exports as separate --- yaml documents per entity
- give each test app its own files dir to avoid cross-suite races
- use node: prefix for node built-in imports
- bump version to 1.18.0
2026-09-30 19:25:03 +03:00

37 lines
1.1 KiB
TypeScript

const makePage = () => ({
goto: jest.fn(),
content: jest.fn().mockResolvedValue("<html></html>"),
title: jest.fn().mockReturnValue(""),
url: jest.fn().mockReturnValue(""),
evaluate: jest.fn(),
close: jest.fn(),
});
const makeContext = () => ({
newPage: jest.fn().mockResolvedValue(makePage()),
cookies: jest.fn().mockResolvedValue([]),
addCookies: jest.fn().mockResolvedValue(undefined),
addInitScript: jest.fn().mockResolvedValue(undefined),
tracing: {
start: jest.fn().mockResolvedValue(undefined),
// Mimic Playwright writing the trace archive when a path is given
stop: jest.fn().mockImplementation(async (opts?: { path?: string }) => {
if (opts?.path) {
// eslint-disable-next-line @typescript-eslint/no-require-imports
await require("node:fs/promises").writeFile(opts.path, "fake trace zip");
}
}),
},
});
const makeBrowser = () => ({
newContext: jest
.fn()
.mockImplementation(() => Promise.resolve(makeContext())),
close: jest.fn(),
});
export const chromium = {
launch: jest.fn().mockImplementation(() => Promise.resolve(makeBrowser())),
};