Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(e2e): test eslint warnings
Elian Dorandb66998107c4
diff --git a/e2e/note_types/code.spec.ts b/e2e/note_types/code.spec.tsnew file mode 100644index 0000000000..31445e6db9--- /dev/null+++ b/e2e/note_types/code.spec.ts@@ -0,0 +1,29 @@+import { test, expect, Page } from "@playwright/test";+import App from "../support/app";++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");++ 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);++ // Hover over hello+ await codeEditor.getByText("hello").first().hover();+ await expectTooltip(page, "'hello' is defined but never used.");++ // Hover over world+ await codeEditor.getByText("world").first().hover();+ await expectTooltip(page, "'world' is defined but never used.");+});++async function expectTooltip(page: Page, tooltip: string) {+ await expect(page.locator(".CodeMirror-lint-tooltip:visible", {+ "hasText": tooltip+ })).toBeVisible();+}diff --git a/e2e/support/app.ts b/e2e/support/app.tsindex c693473a65..92cbe55e9a 100644--- a/e2e/support/app.ts+++ b/e2e/support/app.ts@@ -5,11 +5,13 @@ export default class App {readonly tabBar: Locator;readonly noteTree: Locator;+ readonly currentNoteSplit: Locator;constructor(page: Page) {this.page = page;this.tabBar = page.locator(".tab-row-widget-container");this.noteTree = page.locator(".tree-wrapper");+ this.currentNoteSplit = page.locator(".note-split:not(.hidden-ext)")}async goto() {@@ -20,6 +22,13 @@ export default class App {.toContainText("Trilium Integration Test");}+ async goToNoteInNewTab(noteTitle: string) {+ const autocomplete = this.currentNoteSplit.locator(".note-autocomplete");+ await autocomplete.fill(noteTitle);+ await autocomplete.press("ArrowDown");+ await autocomplete.press("Enter");+ }+getTab(tabIndex: number) {return this.tabBar.locator(".note-tab-wrapper").nth(tabIndex);}diff --git a/integration-tests/db/document.db b/integration-tests/db/document.dbindex 7694416751..da7b5158b3 100644Binary files a/integration-tests/db/document.db and b/integration-tests/db/document.db differ