mirror of
https://github.com/penpot/penpot.git
synced 2025-06-18 02:01:37 +02:00
🔧 Make mockAsset to accept an array of asset ids too
This commit is contained in:
parent
479406b884
commit
971b92a75b
2 changed files with 21 additions and 22 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue