mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 11:02:28 +08:00
feat(e2e): test standard flowchart rendering
This commit is contained in:
parent
751adf474f
commit
54bf2ad9ff
@ -1,27 +1,67 @@
|
|||||||
import { test, expect, Page } from "@playwright/test";
|
import { test, expect, Page, BrowserContext } from "@playwright/test";
|
||||||
import App from "../support/app";
|
import App from "../support/app";
|
||||||
|
|
||||||
test("renders ELK flowchart", async ({ page, context }) => {
|
test("renders ELK flowchart", async ({ page, context }) => {
|
||||||
|
await testAriaSnapshot({
|
||||||
|
page, context,
|
||||||
|
noteTitle: "Flowchart ELK on",
|
||||||
|
snapshot: `
|
||||||
|
- document:
|
||||||
|
- paragraph: A
|
||||||
|
- paragraph: B
|
||||||
|
- paragraph: C
|
||||||
|
- paragraph: Guarantee
|
||||||
|
- paragraph: User attributes
|
||||||
|
- paragraph: Master data
|
||||||
|
- paragraph: Exchange Rate
|
||||||
|
- paragraph: Profit Centers
|
||||||
|
- paragraph: Vendor Partners
|
||||||
|
- paragraph: Work Situation
|
||||||
|
- paragraph: Customer
|
||||||
|
- paragraph: Profit Centers
|
||||||
|
- paragraph: Guarantee
|
||||||
|
- text: Interfaces for B
|
||||||
|
`
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
test("renders standard flowchart", async ({ page, context }) => {
|
||||||
|
await testAriaSnapshot({
|
||||||
|
page, context,
|
||||||
|
noteTitle: "Flowchart ELK off",
|
||||||
|
snapshot: `
|
||||||
|
- document:
|
||||||
|
- paragraph: Guarantee
|
||||||
|
- paragraph: User attributes
|
||||||
|
- paragraph: Master data
|
||||||
|
- paragraph: Exchange Rate
|
||||||
|
- paragraph: Profit Centers
|
||||||
|
- paragraph: Vendor Partners
|
||||||
|
- paragraph: Work Situation
|
||||||
|
- paragraph: Customer
|
||||||
|
- paragraph: Profit Centers
|
||||||
|
- paragraph: Guarantee
|
||||||
|
- paragraph: A
|
||||||
|
- paragraph: B
|
||||||
|
- paragraph: C
|
||||||
|
- text: Interfaces for B
|
||||||
|
`
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
interface AriaTestOpts {
|
||||||
|
page: Page;
|
||||||
|
context: BrowserContext;
|
||||||
|
noteTitle: string;
|
||||||
|
snapshot: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function testAriaSnapshot({ page, context, noteTitle, snapshot }: AriaTestOpts) {
|
||||||
const app = new App(page, context);
|
const app = new App(page, context);
|
||||||
await app.goto();
|
await app.goto();
|
||||||
await app.goToNoteInNewTab("Flowchart ELK on");
|
await app.goToNoteInNewTab(noteTitle);
|
||||||
|
|
||||||
const svgData = app.currentNoteSplit.locator(".mermaid-render svg");
|
const svgData = app.currentNoteSplit.locator(".mermaid-render svg");
|
||||||
await expect(svgData).toMatchAriaSnapshot(`
|
await expect(svgData).toBeVisible();
|
||||||
- document:
|
await expect(svgData).toMatchAriaSnapshot(snapshot);
|
||||||
- paragraph: A
|
}
|
||||||
- paragraph: B
|
|
||||||
- paragraph: C
|
|
||||||
- paragraph: Guarantee
|
|
||||||
- paragraph: User attributes
|
|
||||||
- paragraph: Master data
|
|
||||||
- paragraph: Exchange Rate
|
|
||||||
- paragraph: Profit Centers
|
|
||||||
- paragraph: Vendor Partners
|
|
||||||
- paragraph: Work Situation
|
|
||||||
- paragraph: Customer
|
|
||||||
- paragraph: Profit Centers
|
|
||||||
- paragraph: Guarantee
|
|
||||||
- text: Interfaces for B
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user