🥊 Mocky Balboa
A network mocking library for your SSR applications. Fixture http network requests on your server-side application for browser automation testing without having to modify your application logic.
Getting started
Check out the documentation to get started.
Server integrations
Browser automation tool support
Custom integrations
Don't see your framework? Create a custom server integration or a custom client integration. Alternatively submit a pull request or report an issue to add support for your framework.
Examples
Playwright example
import { expect } from "@playwright/test";
import { test } from "@mocky-balboa/playwright";
test("a route that performs server and client network requests", async ({ page, mocky }) => {
mocky.route("**/api/endpoint", (route) => {
return route.fulfill({
status: 200,
body: JSON.stringify({ message: "Hello, World!" }),
headers: { "Content-Type": "application/json" },
});
}, {
});
await page.goto("http://localhost:3000");
});
More examples
See examples for example projects.
Contributing
See contributing for more information.