Merge pull request #7729 from penpot/ladybenko-12514-fix-font-variants
🐛 Fix downloading wrong font variant
|
After Width: | Height: | Size: 9.7 KiB |
@@ -23,11 +23,18 @@ export class BasePage {
|
||||
);
|
||||
}
|
||||
|
||||
static async mockFileMediaAsset(page, assetId, assetFilename, options) {
|
||||
static async mockFileMediaAsset(
|
||||
page,
|
||||
assetId,
|
||||
assetFilename,
|
||||
assetThumbnailFilename,
|
||||
options,
|
||||
) {
|
||||
const ids = Array.isArray(assetId) ? assetId : [assetId];
|
||||
|
||||
for (const id of ids) {
|
||||
const url = `**/assets/by-file-media-id/${id}`;
|
||||
const thumbnailUrl = `${url}/thumbnail`;
|
||||
|
||||
await page.route(url, (route) =>
|
||||
route.fulfill({
|
||||
@@ -36,6 +43,16 @@ export class BasePage {
|
||||
...options,
|
||||
}),
|
||||
);
|
||||
|
||||
if (assetThumbnailFilename) {
|
||||
await page.route(thumbnailUrl, (route) =>
|
||||
route.fulfill({
|
||||
path: `playwright/data/${assetThumbnailFilename}`,
|
||||
status: 200,
|
||||
...options,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,22 +72,6 @@ export class BasePage {
|
||||
}
|
||||
}
|
||||
|
||||
static async mockFileMediaAsset(page, assetId, assetFilename, options) {
|
||||
const ids = Array.isArray(assetId) ? assetId : [assetId];
|
||||
|
||||
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) {
|
||||
const url = "**/js/config.js?ts=*";
|
||||
return await page.route(url, (route) =>
|
||||
@@ -100,11 +101,17 @@ export class BasePage {
|
||||
return BasePage.mockConfigFlags(this.page, flags);
|
||||
}
|
||||
|
||||
async mockFileMediaAsset(assetId, assetFilename, options) {
|
||||
async mockFileMediaAsset(
|
||||
assetId,
|
||||
assetFilename,
|
||||
assetThumbnailFilename,
|
||||
options,
|
||||
) {
|
||||
return BasePage.mockFileMediaAsset(
|
||||
this.page,
|
||||
assetId,
|
||||
assetFilename,
|
||||
assetThumbnailFilename,
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ test("Renders a file with solid, gradient and image fills", async ({
|
||||
"1ebcea38-f1bf-8101-8006-4c8f579da49c",
|
||||
],
|
||||
"render-wasm/assets/penguins.jpg",
|
||||
"render-wasm/assets/pattern-thumbnail.png", // FIXME: get real thumbnail
|
||||
);
|
||||
await workspace.mockGetFile("render-wasm/get-file-shapes-fills.json");
|
||||
|
||||
@@ -58,6 +59,7 @@ test("Renders a file with strokes", async ({ page }) => {
|
||||
"202c1104-9385-81d3-8006-507560ce29e3",
|
||||
],
|
||||
"render-wasm/assets/penguins.jpg",
|
||||
"render-wasm/assets/pattern-thumbnail.png", // FIXME: get real thumbnail
|
||||
);
|
||||
await workspace.mockGetFile("render-wasm/get-file-shapes-strokes.json");
|
||||
|
||||
@@ -88,6 +90,11 @@ test("Renders a file with shapes with multiple fills", async ({ page }) => {
|
||||
const workspace = new WasmWorkspacePage(page);
|
||||
await workspace.setupEmptyFile();
|
||||
await workspace.mockGetFile("render-wasm/get-file-multiple-fills.json");
|
||||
await workspace.mockFileMediaAsset(
|
||||
["c0939f58-37bc-805d-8006-51cda84a405a"],
|
||||
"render-wasm/assets/penguins.jpg",
|
||||
"render-wasm/assets/pattern-thumbnail.png", // FIXME: get real thumbnail
|
||||
);
|
||||
|
||||
await workspace.goToWorkspace({
|
||||
id: "c0939f58-37bc-805d-8006-51cd3a51c255",
|
||||
@@ -127,6 +134,7 @@ test("Renders shapes with exif rotated images fills and strokes", async ({
|
||||
"27270c45-35b4-80f3-8006-63a3ea82557f",
|
||||
],
|
||||
"render-wasm/assets/landscape.jpg",
|
||||
"render-wasm/assets/pattern-thumbnail.png", // FIXME: get real thumbnail
|
||||
);
|
||||
await workspace.mockGetFile(
|
||||
"render-wasm/get-file-shapes-exif-rotated-fills.json",
|
||||
@@ -170,6 +178,15 @@ test("Renders a file with blurs applied to any kind of shape", async ({
|
||||
const workspace = new WasmWorkspacePage(page);
|
||||
await workspace.setupEmptyFile();
|
||||
await workspace.mockGetFile("render-wasm/get-file-blurs.json");
|
||||
await workspace.mockFileMediaAsset(
|
||||
[
|
||||
"aa0a383a-7553-808a-8006-ae13a3c575eb",
|
||||
"aa0a383a-7553-808a-8006-ae13c84d6e3a",
|
||||
"aa0a383a-7553-808a-8006-ae131157fc26",
|
||||
],
|
||||
"render-wasm/assets/pattern.png",
|
||||
"render-wasm/assets/pattern-thumbnail.png", // FIXME: get real thumbnail
|
||||
);
|
||||
|
||||
await workspace.goToWorkspace({
|
||||
id: "aa0a383a-7553-808a-8006-ae1237b52cf9",
|
||||
@@ -212,10 +229,7 @@ test("Renders a file with a closed path shape with multiple segments using strok
|
||||
await expect(workspace.canvas).toHaveScreenshot();
|
||||
});
|
||||
|
||||
|
||||
test("Renders a file with paths and svg attrs", async ({
|
||||
page,
|
||||
}) => {
|
||||
test("Renders a file with paths and svg attrs", async ({ page }) => {
|
||||
const workspace = new WasmWorkspacePage(page);
|
||||
await workspace.setupEmptyFile();
|
||||
await workspace.mockGetFile("render-wasm/get-file-svg-attrs.json");
|
||||
@@ -234,7 +248,9 @@ test("Renders a file with nested frames with inherited blur", async ({
|
||||
}) => {
|
||||
const workspace = new WasmWorkspacePage(page);
|
||||
await workspace.setupEmptyFile();
|
||||
await workspace.mockGetFile("render-wasm/get-file-frame-with-nested-blur.json");
|
||||
await workspace.mockGetFile(
|
||||
"render-wasm/get-file-frame-with-nested-blur.json",
|
||||
);
|
||||
|
||||
await workspace.goToWorkspace({
|
||||
id: "58c5cc60-d124-81bd-8007-0ee4e5030609",
|
||||
|
||||
|
Before Width: | Height: | Size: 248 KiB After Width: | Height: | Size: 318 KiB |
|
Before Width: | Height: | Size: 322 KiB After Width: | Height: | Size: 335 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 44 KiB |
@@ -141,6 +141,7 @@ test("Renders a file with texts with images", async ({ page }) => {
|
||||
"4f89252d-ebbc-813e-8006-8699e4170e18",
|
||||
],
|
||||
"render-wasm/assets/pattern.png",
|
||||
"render-wasm/assets/pattern-thumbnail.png",
|
||||
);
|
||||
await mockGetEmojiFont(workspace);
|
||||
await mockGetJapaneseFont(workspace);
|
||||
@@ -179,6 +180,7 @@ test("Renders a file with text decoration", async ({ page }) => {
|
||||
await workspace.mockFileMediaAsset(
|
||||
["d6c33e7b-7b64-80f3-8006-78509a3a2d21"],
|
||||
"render-wasm/assets/pattern.png",
|
||||
"render-wasm/assets/pattern-thumbnail.png",
|
||||
);
|
||||
await mockGetEmojiFont(workspace);
|
||||
await mockGetJapaneseFont(workspace);
|
||||
@@ -281,14 +283,10 @@ test("Renders a file with different text shadows combinations", async ({
|
||||
await expect(workspace.canvas).toHaveScreenshot();
|
||||
});
|
||||
|
||||
test("Renders a file with multiple text shadows in order", async ({
|
||||
page,
|
||||
}) => {
|
||||
test("Renders a file with multiple text shadows in order", async ({ page }) => {
|
||||
const workspace = new WasmWorkspacePage(page);
|
||||
await workspace.setupEmptyFile();
|
||||
await workspace.mockGetFile(
|
||||
"render-wasm/get-file-text-shadows-order.json",
|
||||
);
|
||||
await workspace.mockGetFile("render-wasm/get-file-text-shadows-order.json");
|
||||
|
||||
await workspace.goToWorkspace({
|
||||
id: "48ffa82f-6950-81b5-8006-e49a2a39657f",
|
||||
@@ -337,7 +335,9 @@ test("Renders a file with texts with with text spans of different sizes", async
|
||||
}) => {
|
||||
const workspace = new WasmWorkspacePage(page);
|
||||
await workspace.setupEmptyFile();
|
||||
await workspace.mockGetFile("render-wasm/get-file-text-spans-different-sizes.json");
|
||||
await workspace.mockGetFile(
|
||||
"render-wasm/get-file-text-spans-different-sizes.json",
|
||||
);
|
||||
|
||||
await workspace.goToWorkspace({
|
||||
id: "a0b1a70e-0d02-8082-8006-ff6d160f15ce",
|
||||
@@ -347,9 +347,8 @@ test("Renders a file with texts with with text spans of different sizes", async
|
||||
await expect(workspace.canvas).toHaveScreenshot();
|
||||
});
|
||||
|
||||
test("Renders a file with texts with tabs", async ({
|
||||
page,
|
||||
}) => {
|
||||
// TODO: enable this test once we use the wasm renderer in the new editor
|
||||
test.skip("Renders a file with texts with tabs", async ({ page }) => {
|
||||
const workspace = new WasmWorkspacePage(page);
|
||||
await workspace.setupEmptyFile();
|
||||
await workspace.mockGetFile("render-wasm/get-file-text-tabs.json");
|
||||
@@ -367,9 +366,8 @@ test("Renders a file with texts with tabs", async ({
|
||||
await expect(workspace.canvas).toHaveScreenshot();
|
||||
});
|
||||
|
||||
test("Renders a file with texts with empty lines", async ({
|
||||
page,
|
||||
}) => {
|
||||
// TODO: enable this test once we use the wasm renderer in the new editor
|
||||
test.skip("Renders a file with texts with empty lines", async ({ page }) => {
|
||||
const workspace = new WasmWorkspacePage(page);
|
||||
await workspace.setupEmptyFile();
|
||||
await workspace.mockGetFile("render-wasm/get-file-empty-lines.json");
|
||||
@@ -387,9 +385,8 @@ test("Renders a file with texts with empty lines", async ({
|
||||
await expect(workspace.canvas).toHaveScreenshot();
|
||||
});
|
||||
|
||||
test("Renders a file with texts with breaking words", async ({
|
||||
page,
|
||||
}) => {
|
||||
// TODO: enable this test once we use the wasm renderer in the new editor
|
||||
test.skip("Renders a file with texts with breaking words", async ({ page }) => {
|
||||
const workspace = new WasmWorkspacePage(page);
|
||||
await workspace.setupEmptyFile();
|
||||
await workspace.mockGetFile("render-wasm/get-file-empty-lines.json");
|
||||
|
||||
|
Before Width: | Height: | Size: 246 KiB After Width: | Height: | Size: 247 KiB |
|
Before Width: | Height: | Size: 216 KiB After Width: | Height: | Size: 216 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 104 KiB |