mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 03:29:02 +01:00 
			
		
		
		
	feat(e2e): test standard flowchart rendering
This commit is contained in:
		
							parent
							
								
									751adf474f
								
							
						
					
					
						commit
						54bf2ad9ff
					
				| @ -1,13 +1,11 @@ | |||||||
| 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 }) => { | ||||||
|     const app = new App(page, context); |     await testAriaSnapshot({ | ||||||
|     await app.goto(); |         page, context, | ||||||
|     await app.goToNoteInNewTab("Flowchart ELK on"); |         noteTitle: "Flowchart ELK on", | ||||||
| 
 |         snapshot: ` | ||||||
|     const svgData = app.currentNoteSplit.locator(".mermaid-render svg"); |  | ||||||
|     await expect(svgData).toMatchAriaSnapshot(` |  | ||||||
|             - document: |             - document: | ||||||
|                 - paragraph: A |                 - paragraph: A | ||||||
|                 - paragraph: B |                 - paragraph: B | ||||||
| @ -23,5 +21,47 @@ test("renders ELK flowchart", async ({ page, context }) => { | |||||||
|                 - paragraph: Profit Centers |                 - paragraph: Profit Centers | ||||||
|                 - paragraph: Guarantee |                 - paragraph: Guarantee | ||||||
|                 - text: Interfaces for B |                 - 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(noteTitle); | ||||||
|  | 
 | ||||||
|  |     const svgData = app.currentNoteSplit.locator(".mermaid-render svg"); | ||||||
|  |     await expect(svgData).toBeVisible(); | ||||||
|  |     await expect(svgData).toMatchAriaSnapshot(snapshot); | ||||||
|  | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran