Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

refactor: 💡 Improve e2e test stability #1457

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion e2e/note_types/text.spec.ts
Original file line number Diff line number Diff line change
@@ -61,8 +61,24 @@ test("Displays math popup", async ({ page, context }) => {
const mathForm = page.locator(".ck-math-form");
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"]');
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");
});