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): use different mechanism for closing all tabs
Elian Doran89d700d5edec
diff --git a/e2e/support/app.ts b/e2e/support/app.tsindex 08d1ebb772..d0d443b277 100644--- a/e2e/support/app.ts+++ b/e2e/support/app.ts@@ -60,19 +60,36 @@ export default class App {return this.tabBar.locator(".note-tab[active]");}+ /**+ * Closes all the tabs in the client by issuing a command.+ */async closeAllTabs() {- await this.getTab(0).click({ button: "right" });- await this.page.waitForTimeout(500); // TODO: context menu won't dismiss otherwise- await this.page.getByText("Close all tabs").click({ force: true });- await this.page.waitForTimeout(500); // TODO: context menu won't dismiss otherwise+ await this.triggerCommand("closeAllTabs");}+ /**+ * Adds a new tab by cliking on the + button near the tab bar.+ */async addNewTab() {await this.page.locator('[data-trigger-command="openNewTab"]').click();}+ /**+ * Looks for a given title in the note tree and clicks on it. Useful for selecting option pages in settings in a similar fashion as the user.+ * @param title the title of the note to click, as displayed in the note tree.+ */async clickNoteOnNoteTreeByTitle(title: string) {- this.noteTree.getByText(title).click();+ await this.noteTree.getByText(title).click();+ }++ /**+ * Executes any Trilium command on the client.+ * @param command the command to send.+ */+ async triggerCommand(command: string) {+ await this.page.evaluate(async (command: string) => {+ await (window as any).glob.appContext.triggerCommand(command);+ }, command);}}