mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +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";
|
||||
|
||||
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);
|
||||
await app.goto();
|
||||
await app.goToNoteInNewTab("Flowchart ELK on");
|
||||
await app.goToNoteInNewTab(noteTitle);
|
||||
|
||||
const svgData = app.currentNoteSplit.locator(".mermaid-render svg");
|
||||
await expect(svgData).toMatchAriaSnapshot(`
|
||||
- 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
|
||||
`);
|
||||
});
|
||||
await expect(svgData).toBeVisible();
|
||||
await expect(svgData).toMatchAriaSnapshot(snapshot);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user