Skip to content

Commit d094872

Browse files
authoredMar 19, 2025
Merge pull request #1457 from TriliumNext/e2e_fix
refactor: 💡 Improve e2e test stability
2 parents 716f8ec + 464084e commit d094872

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed
 

‎e2e/note_types/text.spec.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,24 @@ test("Displays math popup", async ({ page, context }) => {
6161
const mathForm = page.locator(".ck-math-form");
6262
await expect(mathForm).toBeVisible();
6363

64-
await mathForm.locator(".ck-input").first().fill("e=mc^2");
64+
const input = mathForm.locator(".ck-input").first();
65+
await input.click();
66+
await input.fill("e=mc^2");
67+
await page.waitForTimeout(100);
6568

6669
const preview = page.locator('[id^="math-preview"]');
70+
await preview.waitFor({
71+
state: 'visible',
72+
timeout: 5000
73+
});
74+
75+
await page.waitForFunction((): boolean => {
76+
const preview = document.querySelector('[id^="math-preview"]');
77+
if (!preview) return false;
78+
const katex = preview.querySelector('.katex');
79+
return !!katex && window.getComputedStyle(preview).display !== 'none';
80+
}, { timeout: 5000 });
81+
82+
await expect(preview.locator('.katex')).toBeVisible();
6783
await expect(preview).toMatchAriaSnapshot("- math: e = m c 2");
6884
});

0 commit comments

Comments
 (0)