Skip to content

Commit

Permalink
chore(e2e): test eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
eliandoran committed Jan 11, 2025
1 parent db66998 commit 74b2643
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions e2e/note_types/code.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit 74b2643

Please sign in to comment.