Skip to content

Build your personal knowledge base with Trilium Notes

test(server/e2e): flaky test

Elian Dorana3ba5ca1097c
diff --git a/apps/server-e2e/src/layout/tab_bar.spec.ts b/apps/server-e2e/src/layout/tab_bar.spec.ts
index cb82f8f829..4ac282e711 100644
--- a/apps/server-e2e/src/layout/tab_bar.spec.ts
+++ b/apps/server-e2e/src/layout/tab_bar.spec.ts
@@ -72,6 +72,7 @@ test("Tabs are restored in right order", async ({ page, context }) => {
// Select the mid one.
await app.getTab(1).click();
+ await expect(app.noteTreeActiveNote).toContainText("Text notes");
// Refresh the page and check the order.
await app.goto( { preserveTabs: true });
diff --git a/apps/server-e2e/src/support/app.ts b/apps/server-e2e/src/support/app.ts
index 137c026e9a..391d458c56 100644
--- a/apps/server-e2e/src/support/app.ts
+++ b/apps/server-e2e/src/support/app.ts
@@ -65,9 +65,12 @@ export default class App {
async goToNoteInNewTab(noteTitle: string) {
const autocomplete = this.currentNoteSplit.locator(".note-autocomplete");
await autocomplete.fill(noteTitle);
- await expect(this.currentNoteSplit.locator(".note-detail-empty-results")).toContainText(noteTitle);
- await autocomplete.press("ArrowDown");
- await autocomplete.press("Enter");
+
+ const resultsSelector = this.currentNoteSplit.locator(".note-detail-empty-results");
+ await expect(resultsSelector).toContainText(noteTitle);
+ await resultsSelector.locator(".aa-suggestion", { hasText: noteTitle })
+ .nth(1) // Select the second one, as the first one is "Create a new note"
+ .click();
}
async goToSettings() {