Files
tom goriunovandGitHub 57e4b6dc3c Playwright tests refactoring, pt.1 (#1744)
* abort all requests for external resources and single mock for text ad

* render and mockApiResponse fixtures

* move fixtures into separate files

* rewrite Blocks test

* refactor mockApiResponse signature

* test with auth

* rewrite test with other API domains

* fix test

* separate script for installing deps in pw docker
2024-04-01 14:48:30 +02:00

16 lines
405 B
TypeScript

import type { TestFixture, Page } from '@playwright/test';
export type MockAssetResponseFixture = (url: string, path: string) => Promise<void>;
const fixture: TestFixture<MockAssetResponseFixture, { page: Page }> = async({ page }, use) => {
await use(async(url, path) => {
await page.route(url, (route) => route.fulfill({
status: 200,
path,
}));
});
};
export default fixture;