Skip to content

AI-native design editor. Open-source Figma alternative.

Skip stability check: toMatchSnapshot, 2.1s → 1.3s

Danila Poyarkovc1fbf57df26f
diff --git a/playwright.config.ts b/playwright.config.ts
index 31b6487a9..75981f58b 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -7,6 +7,10 @@ export default defineConfig({
toHaveScreenshot: {
maxDiffPixelRatio: 0.01,
threshold: 0.3
+ },
+ toMatchSnapshot: {
+ maxDiffPixelRatio: 0.01,
+ threshold: 0.3
}
},
use: {
diff --git a/tests/e2e/create-shapes.spec.ts b/tests/e2e/create-shapes.spec.ts
index c143ef31f..a1081f742 100644
--- a/tests/e2e/create-shapes.spec.ts
+++ b/tests/e2e/create-shapes.spec.ts
@@ -22,18 +22,23 @@ test.beforeEach(async () => {
await canvas.clearCanvas()
})
+async function expectCanvas(name: string) {
+ const buffer = await canvas.canvas.screenshot()
+ expect(buffer).toMatchSnapshot(`${name}.png`)
+}
+
test('empty canvas', async () => {
- await expect(canvas.canvas).toHaveScreenshot({ timeout: 3000 })
+ await expectCanvas('empty-canvas')
})
test('draw rectangle', async () => {
await canvas.drawRect(100, 100, 200, 150)
- await expect(canvas.canvas).toHaveScreenshot({ timeout: 3000 })
+ await expectCanvas('draw-rectangle')
})
test('draw ellipse', async () => {
await canvas.drawEllipse(100, 100, 200, 150)
- await expect(canvas.canvas).toHaveScreenshot({ timeout: 3000 })
+ await expectCanvas('draw-ellipse')
})
test('draw rectangle then move it', async () => {
@@ -41,17 +46,17 @@ test('draw rectangle then move it', async () => {
await canvas.selectTool('select')
await canvas.drag(200, 175, 400, 300)
await canvas.waitForRender()
- await expect(canvas.canvas).toHaveScreenshot({ timeout: 3000 })
+ await expectCanvas('draw-rectangle-then-move-it')
})
test('draw and delete', async () => {
await canvas.drawRect(100, 100, 200, 150)
await canvas.deleteSelection()
- await expect(canvas.canvas).toHaveScreenshot({ timeout: 3000 })
+ await expectCanvas('draw-and-delete')
})
test('draw and undo', async () => {
await canvas.drawRect(100, 100, 200, 150)
await canvas.undo()
- await expect(canvas.canvas).toHaveScreenshot({ timeout: 3000 })
+ await expectCanvas('draw-and-undo')
})
diff --git a/tests/e2e/create-shapes.spec.ts-snapshots/draw-and-delete-1-openpencil-darwin.png b/tests/e2e/create-shapes.spec.ts-snapshots/draw-and-delete-1-openpencil-darwin.png
deleted file mode 100644
index a96c28bf1..000000000
Binary files a/tests/e2e/create-shapes.spec.ts-snapshots/draw-and-delete-1-openpencil-darwin.png and /dev/null differ
diff --git a/tests/e2e/create-shapes.spec.ts-snapshots/draw-and-delete-openpencil-darwin.png b/tests/e2e/create-shapes.spec.ts-snapshots/draw-and-delete-openpencil-darwin.png
new file mode 100644
index 000000000..c9081c3fd
Binary files /dev/null and b/tests/e2e/create-shapes.spec.ts-snapshots/draw-and-delete-openpencil-darwin.png differ
diff --git a/tests/e2e/create-shapes.spec.ts-snapshots/draw-and-undo-1-openpencil-darwin.png b/tests/e2e/create-shapes.spec.ts-snapshots/draw-and-undo-1-openpencil-darwin.png
deleted file mode 100644
index a96c28bf1..000000000
Binary files a/tests/e2e/create-shapes.spec.ts-snapshots/draw-and-undo-1-openpencil-darwin.png and /dev/null differ
diff --git a/tests/e2e/create-shapes.spec.ts-snapshots/draw-and-undo-openpencil-darwin.png b/tests/e2e/create-shapes.spec.ts-snapshots/draw-and-undo-openpencil-darwin.png
new file mode 100644
index 000000000..a39e5f55d
Binary files /dev/null and b/tests/e2e/create-shapes.spec.ts-snapshots/draw-and-undo-openpencil-darwin.png differ
diff --git a/tests/e2e/create-shapes.spec.ts-snapshots/draw-ellipse-1-openpencil-darwin.png b/tests/e2e/create-shapes.spec.ts-snapshots/draw-ellipse-1-openpencil-darwin.png
deleted file mode 100644
index b615cdea1..000000000
Binary files a/tests/e2e/create-shapes.spec.ts-snapshots/draw-ellipse-1-openpencil-darwin.png and /dev/null differ
diff --git a/tests/e2e/create-shapes.spec.ts-snapshots/draw-ellipse-openpencil-darwin.png b/tests/e2e/create-shapes.spec.ts-snapshots/draw-ellipse-openpencil-darwin.png
new file mode 100644
index 000000000..3199413be
Binary files /dev/null and b/tests/e2e/create-shapes.spec.ts-snapshots/draw-ellipse-openpencil-darwin.png differ
diff --git a/tests/e2e/create-shapes.spec.ts-snapshots/draw-rectangle-1-openpencil-darwin.png b/tests/e2e/create-shapes.spec.ts-snapshots/draw-rectangle-1-openpencil-darwin.png
deleted file mode 100644
index 5d0aab530..000000000
Binary files a/tests/e2e/create-shapes.spec.ts-snapshots/draw-rectangle-1-openpencil-darwin.png and /dev/null differ
diff --git a/tests/e2e/create-shapes.spec.ts-snapshots/draw-rectangle-openpencil-darwin.png b/tests/e2e/create-shapes.spec.ts-snapshots/draw-rectangle-openpencil-darwin.png
new file mode 100644
index 000000000..dd66a8836
Binary files /dev/null and b/tests/e2e/create-shapes.spec.ts-snapshots/draw-rectangle-openpencil-darwin.png differ
diff --git a/tests/e2e/create-shapes.spec.ts-snapshots/draw-rectangle-then-move-it-1-openpencil-darwin.png b/tests/e2e/create-shapes.spec.ts-snapshots/draw-rectangle-then-move-it-1-openpencil-darwin.png
deleted file mode 100644
index 4a382df4e..000000000
Binary files a/tests/e2e/create-shapes.spec.ts-snapshots/draw-rectangle-then-move-it-1-openpencil-darwin.png and /dev/null differ
diff --git a/tests/e2e/create-shapes.spec.ts-snapshots/draw-rectangle-then-move-it-openpencil-darwin.png b/tests/e2e/create-shapes.spec.ts-snapshots/draw-rectangle-then-move-it-openpencil-darwin.png
new file mode 100644
index 000000000..cc5f82143
Binary files /dev/null and b/tests/e2e/create-shapes.spec.ts-snapshots/draw-rectangle-then-move-it-openpencil-darwin.png differ
diff --git a/tests/e2e/create-shapes.spec.ts-snapshots/empty-canvas-1-openpencil-darwin.png b/tests/e2e/create-shapes.spec.ts-snapshots/empty-canvas-1-openpencil-darwin.png
deleted file mode 100644
index a96c28bf1..000000000
Binary files a/tests/e2e/create-shapes.spec.ts-snapshots/empty-canvas-1-openpencil-darwin.png and /dev/null differ
diff --git a/tests/e2e/create-shapes.spec.ts-snapshots/empty-canvas-openpencil-darwin.png b/tests/e2e/create-shapes.spec.ts-snapshots/empty-canvas-openpencil-darwin.png
new file mode 100644
index 000000000..59ae3914b
Binary files /dev/null and b/tests/e2e/create-shapes.spec.ts-snapshots/empty-canvas-openpencil-darwin.png differ