Skip to content

Build your personal knowledge base with Trilium Notes

test(e2e): pick the note rows the note autocomplete now lists first

Claudefc0a21dbdf65
diff --git a/packages/trilium-e2e/src/layout/split_pane.spec.ts b/packages/trilium-e2e/src/layout/split_pane.spec.ts
index 82a97b54e4..cf573afb95 100644
--- a/packages/trilium-e2e/src/layout/split_pane.spec.ts
+++ b/packages/trilium-e2e/src/layout/split_pane.spec.ts
@@ -31,11 +31,12 @@ test("Open the note in the correct split pane", async ({ page, context }) => {
await expect(noteContent.locator("p")).toBeVisible();
await noteContent.focus();
- // Click the search result in the second split.
+ // Click the search result in the second split. The notes come ahead of the search and
+ // creation rows, which also carry the title.
await resultsSelector.locator(".aa-suggestion", { hasText: CODE_NOTE_TITLE })
- .nth(1).click();
+ .first().click();
- await expect(split2).toContainText(CODE_NOTE_TITLE);
+ await expect(split2.locator(".note-title").first()).toHaveValue(CODE_NOTE_TITLE);
});
test("Can directly focus the autocomplete input within the split", async ({ page, context }) => {
diff --git a/packages/trilium-e2e/src/support/app.ts b/packages/trilium-e2e/src/support/app.ts
index 2cb001649b..bc28f97198 100644
--- a/packages/trilium-e2e/src/support/app.ts
+++ b/packages/trilium-e2e/src/support/app.ts
@@ -121,13 +121,13 @@ export default class App {
await autocomplete.clear();
await autocomplete.pressSequentially(noteTitle);
- // The best candidate follows the two creation suggestions ("Create note" and
- // "Create child note"). Asserting on the suggestion itself (instead of the parent
- // `.note-detail-empty-results`, which also contains the recent-notes
- // list) ensures the dropdown actually opened.
+ // The notes come first, ahead of the search and creation rows, which also carry the
+ // title. Asserting on the suggestion itself (instead of the parent
+ // `.note-detail-empty-results`, which also contains the recent-notes list) ensures the
+ // dropdown actually opened.
const suggestionSelector = this.currentNoteSplit
.locator(".note-detail-empty-results .aa-suggestion")
- .nth(2);
+ .first();
await expect(suggestionSelector).toContainText(noteTitle);
await suggestionSelector.click();
}