mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
test: visual regression tests POC
This commit is contained in:
parent
debf2ad608
commit
733e45f3a9
11 changed files with 795 additions and 9 deletions
41
playwright/arrows.spec.tsx
Normal file
41
playwright/arrows.spec.tsx
Normal file
|
@ -0,0 +1,41 @@
|
|||
import React from "react";
|
||||
import { test, expect } from "@playwright/experimental-ct-react";
|
||||
|
||||
// package needs to be built first so that packages/excalidraw/dist exists
|
||||
import { Excalidraw } from "../packages/excalidraw";
|
||||
|
||||
import elements_arrowsOne from "./fixtures/arrows-one.json";
|
||||
import elements_arrowsTwo from "./fixtures/arrows-two.json";
|
||||
|
||||
test("elbow arrow visual tests", async ({ mount, page }) => {
|
||||
test.setTimeout(15000);
|
||||
|
||||
await page.setViewportSize({ width: 4080, height: 1920 });
|
||||
|
||||
const component = await mount(
|
||||
<Excalidraw
|
||||
zenModeEnabled
|
||||
initialData={{
|
||||
elements: elements_arrowsOne,
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
// await expect(component).toContainClass("excalidraw-container");
|
||||
await expect(component).toHaveScreenshot("excalidraw-arrows-one.png");
|
||||
|
||||
// await component.unmount();
|
||||
|
||||
await component.update(
|
||||
<Excalidraw
|
||||
// so that the component remounts and initialData is set again
|
||||
key={Math.random().toString()}
|
||||
zenModeEnabled
|
||||
initialData={{
|
||||
elements: elements_arrowsTwo,
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
await expect(component).toHaveScreenshot("excalidraw-arrows-two.png");
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue