mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
🔧 Make mockAsset to accept an array of asset ids too
This commit is contained in:
@@ -24,15 +24,19 @@ export class BasePage {
|
||||
}
|
||||
|
||||
static async mockAsset(page, assetId, assetFilename, options) {
|
||||
const url = `**/assets/by-file-media-id/${assetId}`;
|
||||
const ids = Array.isArray(assetId) ? assetId : [assetId];
|
||||
|
||||
return page.route(url, (route) =>
|
||||
route.fulfill({
|
||||
path: `playwright/data/${assetFilename}`,
|
||||
status: 200,
|
||||
...options,
|
||||
}),
|
||||
);
|
||||
for (const id of ids) {
|
||||
const url = `**/assets/by-file-media-id/${id}`;
|
||||
|
||||
await page.route(url, (route) =>
|
||||
route.fulfill({
|
||||
path: `playwright/data/${assetFilename}`,
|
||||
status: 200,
|
||||
...options,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static async mockConfigFlags(page, flags) {
|
||||
|
||||
Reference in New Issue
Block a user