chore(e2e): test eslint errors

This commit is contained in:
Elian Doran 2025-01-11 12:54:43 +02:00
parent db66998107
commit 74b2643c28
No known key found for this signature in database

View File

@ -5,10 +5,9 @@ test("Displays lint warnings for backend script", async ({ page }) => {
const app = new App(page);
await app.goto();
await app.closeAllTabs();
await app.goToNoteInNewTab("Backend script with lint warning");
await app.goToNoteInNewTab("Backend script with lint warnings");
const codeEditor = app.currentNoteSplit.locator(".CodeMirror");
expect(await app.currentNoteSplit.locator(".note-title").inputValue()).toBe("Backend script with lint warnings");
// Expect two warning signs in the gutter.
expect(codeEditor.locator(".CodeMirror-gutter-wrapper .CodeMirror-lint-marker-warning")).toHaveCount(2);
@ -22,6 +21,22 @@ test("Displays lint warnings for backend script", async ({ page }) => {
await expectTooltip(page, "'world' is defined but never used.");
});
test("Displays lint errors for backend script", async ({ page }) => {
const app = new App(page);
await app.goto();
await app.closeAllTabs();
await app.goToNoteInNewTab("Backend script with lint errors");
const codeEditor = app.currentNoteSplit.locator(".CodeMirror");
// Expect two warning signs in the gutter.
expect(codeEditor.locator(".CodeMirror-gutter-wrapper .CodeMirror-lint-marker-error")).toHaveCount(1);
// Hover over hello
await codeEditor.getByText("world").first().hover();
await expectTooltip(page, "Parsing error: Unexpected token world");
});
async function expectTooltip(page: Page, tooltip: string) {
await expect(page.locator(".CodeMirror-lint-tooltip:visible", {
"hasText": tooltip