mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 21:19:01 +01:00 
			
		
		
		
	refactor: 💡 Improve e2e test stability
This commit is contained in:
		
							parent
							
								
									16cc543d59
								
							
						
					
					
						commit
						464084ebf4
					
				@ -61,8 +61,24 @@ test("Displays math popup", async ({ page, context }) => {
 | 
				
			|||||||
    const mathForm = page.locator(".ck-math-form");
 | 
					    const mathForm = page.locator(".ck-math-form");
 | 
				
			||||||
    await expect(mathForm).toBeVisible();
 | 
					    await expect(mathForm).toBeVisible();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await mathForm.locator(".ck-input").first().fill("e=mc^2");
 | 
					    const input = mathForm.locator(".ck-input").first();
 | 
				
			||||||
 | 
					    await input.click();
 | 
				
			||||||
 | 
					    await input.fill("e=mc^2");
 | 
				
			||||||
 | 
					    await page.waitForTimeout(100);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const preview = page.locator('[id^="math-preview"]');
 | 
					    const preview = page.locator('[id^="math-preview"]');
 | 
				
			||||||
 | 
					    await preview.waitFor({
 | 
				
			||||||
 | 
					        state: 'visible',
 | 
				
			||||||
 | 
					        timeout: 5000
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    await page.waitForFunction((): boolean => {
 | 
				
			||||||
 | 
					        const preview = document.querySelector('[id^="math-preview"]');
 | 
				
			||||||
 | 
					        if (!preview) return false;
 | 
				
			||||||
 | 
					        const katex = preview.querySelector('.katex');
 | 
				
			||||||
 | 
					        return !!katex && window.getComputedStyle(preview).display !== 'none';
 | 
				
			||||||
 | 
					    }, { timeout: 5000 });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    await expect(preview.locator('.katex')).toBeVisible();
 | 
				
			||||||
    await expect(preview).toMatchAriaSnapshot("- math: e = m c 2");
 | 
					    await expect(preview).toMatchAriaSnapshot("- math: e = m c 2");
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user