diff --git a/frontend/playwright/data/render-wasm/assets/pattern-thumbnail.png b/frontend/playwright/data/render-wasm/assets/pattern-thumbnail.png new file mode 100644 index 0000000000..3d24f4ba3b Binary files /dev/null and b/frontend/playwright/data/render-wasm/assets/pattern-thumbnail.png differ diff --git a/frontend/playwright/ui/pages/BasePage.js b/frontend/playwright/ui/pages/BasePage.js index e4cea55f8b..cedb93f78b 100644 --- a/frontend/playwright/ui/pages/BasePage.js +++ b/frontend/playwright/ui/pages/BasePage.js @@ -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, ); } diff --git a/frontend/playwright/ui/render-wasm-specs/shapes.spec.js b/frontend/playwright/ui/render-wasm-specs/shapes.spec.js index f4e6822ed6..7661974477 100644 --- a/frontend/playwright/ui/render-wasm-specs/shapes.spec.js +++ b/frontend/playwright/ui/render-wasm-specs/shapes.spec.js @@ -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", diff --git a/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-blurs-applied-to-any-kind-of-shape-1.png b/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-blurs-applied-to-any-kind-of-shape-1.png index 333e7e9780..de3fd45317 100644 Binary files a/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-blurs-applied-to-any-kind-of-shape-1.png and b/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-blurs-applied-to-any-kind-of-shape-1.png differ diff --git a/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-shadows-applied-to-any-kind-of-shape-1.png b/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-shadows-applied-to-any-kind-of-shape-1.png index eb1f4f5242..fff5f37a26 100644 Binary files a/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-shadows-applied-to-any-kind-of-shape-1.png and b/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-shadows-applied-to-any-kind-of-shape-1.png differ diff --git a/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-shapes-with-multiple-fills-1.png b/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-shapes-with-multiple-fills-1.png index 5f0e40d500..47d8a5c323 100644 Binary files a/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-shapes-with-multiple-fills-1.png and b/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-shapes-with-multiple-fills-1.png differ diff --git a/frontend/playwright/ui/render-wasm-specs/texts.spec.js b/frontend/playwright/ui/render-wasm-specs/texts.spec.js index 26484a990e..a917eee8e5 100644 --- a/frontend/playwright/ui/render-wasm-specs/texts.spec.js +++ b/frontend/playwright/ui/render-wasm-specs/texts.spec.js @@ -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"); diff --git a/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-different-text-leaves-decoration-1.png b/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-different-text-leaves-decoration-1.png index c9b5ca2fe5..25dab21adc 100644 Binary files a/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-different-text-leaves-decoration-1.png and b/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-different-text-leaves-decoration-1.png differ diff --git a/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-multiple-emoji-1.png b/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-multiple-emoji-1.png index c2bdd891a0..cfa91e281b 100644 Binary files a/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-multiple-emoji-1.png and b/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-multiple-emoji-1.png differ diff --git a/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-texts-with-empty-lines-1.png b/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-texts-with-empty-lines-1.png index ca87b05546..4d75953095 100644 Binary files a/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-texts-with-empty-lines-1.png and b/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-texts-with-empty-lines-1.png differ diff --git a/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-texts-with-tabs-1.png b/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-texts-with-tabs-1.png index dee605a1b0..99945695ce 100644 Binary files a/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-texts-with-tabs-1.png and b/frontend/playwright/ui/render-wasm-specs/texts.spec.js-snapshots/Renders-a-file-with-texts-with-tabs-1.png differ