0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 00:10:11 -05:00
penpot/frontend/playwright/helpers/MockAPI.js
2024-05-07 11:59:33 +02:00

17 lines
510 B
JavaScript

export const interceptRPC = (page, path, jsonFilename) =>
page.route(`**/api/rpc/command/${path}`, (route) =>
route.fulfill({
status: 200,
contentType: "application/transit+json",
path: `playwright/fixtures/${jsonFilename}`,
}),
);
export const interceptRPCByRegex = (page, regex, jsonFilename) =>
page.route(regex, (route) =>
route.fulfill({
status: 200,
contentType: "application/transit+json",
path: `playwright/fixtures/${jsonFilename}`,
}),
);