diff --git a/apps/web/__e2e__/colors.test.ts b/apps/web/__e2e__/colors.test.ts index a4e7a2177..0ae1d9cc1 100644 --- a/apps/web/__e2e__/colors.test.ts +++ b/apps/web/__e2e__/colors.test.ts @@ -40,10 +40,12 @@ test("remove color", async ({ page }) => { const notes = await app.goToNotes(); const note = await notes.createNote(NOTE); await note?.contextMenu.newColor({ title: "red", color: "#ff0000" }); + await app.navigation.waitForItem("red"); const colorItem = await app.navigation.findItem("red"); await colorItem?.removeColor(); + await expect(colorItem!.locator).toBeHidden(); expect(await app.navigation.findItem("red")).toBeUndefined(); expect(await note?.contextMenu.isColored("red")).toBe(false); }); @@ -54,6 +56,7 @@ test("rename color", async ({ page }) => { const notes = await app.goToNotes(); const note = await notes.createNote(NOTE); await note?.contextMenu.newColor({ title: "red", color: "#ff0000" }); + await app.navigation.waitForItem("red"); const colorItem = await app.navigation.findItem("red"); await colorItem?.renameColor("priority-33"); diff --git a/apps/web/__e2e__/drag-drop.test.ts b/apps/web/__e2e__/drag-drop.test.ts index 3af5fcd40..50d0fd8c6 100644 --- a/apps/web/__e2e__/drag-drop.test.ts +++ b/apps/web/__e2e__/drag-drop.test.ts @@ -20,31 +20,12 @@ along with this program. If not, see . import { expect, test } from "@playwright/test"; import { AppModel } from "./models/app.model"; import { NotesViewModel } from "./models/notes-view.model"; -import { getTestId } from "./utils"; for (const item of [ { id: "notebooks", title: "Notebooks" }, { id: "tags", title: "Tags" } ]) { - test(`drag & hover over ${item.id} should navigate inside`, async ({ - page - }) => { - const app = new AppModel(page); - await app.goto(); - const notes = await app.goToNotes(); - const note = await notes.createNote({ - title: `Test note` - }); - const navigationItem = await app.navigation.findItem(item.title); - - await note?.locator.hover(); - await page.mouse.down(); - await navigationItem?.locator.hover(); - await navigationItem?.locator.hover(); - await page.waitForTimeout(1000); - - await expect(app.routeHeader).toHaveText(item.title); - }); + test.skip(`drag & hover over ${item.id} should navigate inside`, () => {}); } test(`drag & drop note over Favorites should make the note favorite`, async ({ @@ -85,24 +66,20 @@ test(`drag & drop note over a notebook should get assigned to the notebook`, asy }) => { const app = new AppModel(page); await app.goto(); - const notebooks = await app.goToNotebooks(); - const notebook = await notebooks.createNotebook({ title: "Test notebook" }); const notes = await app.goToNotes(); const note = await notes.createNote({ title: `Test note` }); - const navigationItem = await app.navigation.findItem("Notebooks"); + const notebooks = await app.goToNotebooks(); + const notebook = await notebooks.createNotebook({ title: "Test notebook" }); await note?.locator.hover(); await page.mouse.down(); - await navigationItem?.locator.hover(); - await navigationItem?.locator.hover(); - await page.waitForTimeout(1000); await notebook?.locator.hover(); await notebook?.locator.hover(); await page.mouse.up(); - const { notes: notebookNotes } = (await notebook?.openNotebook()) || {}; + const notebookNotes = await notebook?.openNotebook(); expect(await notebookNotes?.findNote({ title: "Test note" })).toBeDefined(); }); @@ -111,19 +88,15 @@ test(`drag & drop note over a tag should get assigned to the tag`, async ({ }) => { const app = new AppModel(page); await app.goto(); - const tags = await app.goToTags(); - const tag = await tags.createItem({ title: "Tag" }); const notes = await app.goToNotes(); const note = await notes.createNote({ title: `Test note` }); - const navigationItem = await app.navigation.findItem("Tags"); + const tags = await app.goToTags(); + const tag = await tags.createItem({ title: "Tag" }); await note?.locator.hover(); await page.mouse.down(); - await navigationItem?.locator.hover(); - await navigationItem?.locator.hover(); - await page.waitForTimeout(1000); await tag?.locator.hover(); await tag?.locator.hover(); await page.mouse.up(); @@ -185,25 +158,20 @@ test(`drag & drop note over a nested notebook should get assigned to the noteboo }) => { const app = new AppModel(page); await app.goto(); - const notebooks = await app.goToNotebooks(); - const notebook = await notebooks.createNotebook({ - title: "Test notebook", - subNotebooks: [{ title: "Nested notebook" }] - }); - const nestedNotebook = await ( - await notebook?.openNotebook() - )?.subNotebooks.createNotebook({ title: "Nested notebook" }); const notes = await app.goToNotes(); const note = await notes.createNote({ title: `Test note` }); - const navigationItem = await app.navigation.findItem("Notebooks"); + const notebooks = await app.goToNotebooks(); + const notebook = await notebooks.createNotebook({ + title: "Test notebook" + }); + const nestedNotebook = await notebook?.createSubnotebook({ + title: "Nested notebook" + }); await note?.locator.hover(); await page.mouse.down(); - await navigationItem?.locator.hover(); - await navigationItem?.locator.hover(); - await page.waitForTimeout(1000); await nestedNotebook?.locator.hover(); await nestedNotebook?.locator.hover(); await page.mouse.up(); @@ -212,46 +180,3 @@ test(`drag & drop note over a nested notebook should get assigned to the noteboo const notebookNotes = new NotesViewModel(page, "notebook", "notes"); expect(await notebookNotes?.findNote({ title: "Test note" })).toBeDefined(); }); - -test(`drag & hover over a nested notebook should navigate inside`, async ({ - page -}) => { - const app = new AppModel(page); - await app.goto(); - const notebooks = await app.goToNotebooks(); - const notebook = await notebooks.createNotebook({ - title: "Test notebook", - subNotebooks: [{ title: "Nested notebook" }] - }); - const nestedNotebook = await ( - await notebook?.openNotebook() - )?.subNotebooks.createNotebook({ title: "Nested notebook" }); - const notes = await app.goToNotes(); - const note = await notes.createNote({ - title: `Test note` - }); - const navigationItem = await app.navigation.findItem("Notebooks"); - await navigationItem?.click(); - await navigationItem?.click(); - await app.goToNotes(); - - await note?.locator.hover(); - await page.mouse.down(); - await navigationItem?.locator.hover(); - await navigationItem?.locator.hover(); - await page.waitForTimeout(1000); - await notebook?.locator.hover(); - await notebook?.locator.hover(); - await page.waitForTimeout(1000); - await nestedNotebook?.locator.hover(); - await nestedNotebook?.locator.hover(); - await page.waitForTimeout(1000); - await page.keyboard.press("Escape"); - - expect( - await page - .locator(getTestId("notebook-header")) - .locator(getTestId("notebook-title")) - .textContent() - ).toBe("Nested notebook"); -}); diff --git a/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-darwin.jpg b/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-darwin.jpg index 059f60f00..e877abdc3 100644 Binary files a/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-darwin.jpg and b/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-darwin.jpg differ diff --git a/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-linux.jpg b/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-linux.jpg index 059f60f00..e877abdc3 100644 Binary files a/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-linux.jpg and b/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-linux.jpg differ diff --git a/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-win32.jpg b/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-win32.jpg index 059f60f00..e877abdc3 100644 Binary files a/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-win32.jpg and b/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-win32.jpg differ diff --git a/apps/web/__e2e__/models/app.model.ts b/apps/web/__e2e__/models/app.model.ts index d27db453e..ff2a0796e 100644 --- a/apps/web/__e2e__/models/app.model.ts +++ b/apps/web/__e2e__/models/app.model.ts @@ -30,6 +30,7 @@ import { SearchViewModel } from "./search-view-model"; import { SettingsViewModel } from "./settings-view.model"; import { ToastsModel } from "./toasts.model"; import { TrashViewModel } from "./trash-view.model"; +import { ContextMenuModel } from "./context-menu.model"; export class AppModel { readonly page: Page; @@ -38,6 +39,7 @@ export class AppModel { readonly auth: AuthModel; readonly checkout: CheckoutModel; readonly routeHeader: Locator; + private readonly profileDropdown: ContextMenuModel; constructor(page: Page) { this.page = page; @@ -46,56 +48,72 @@ export class AppModel { this.auth = new AuthModel(page); this.checkout = new CheckoutModel(page); this.routeHeader = this.page.locator(getTestId("routeHeader")); + this.profileDropdown = new ContextMenuModel(this.page); } async goto(isLoggedIn = false) { await this.page.goto("/"); await this.routeHeader.waitFor({ state: "visible" }); - if (!isLoggedIn) await this.navigation.waitForItem("Login"); - } - - goBack() { - const goBackButton = this.page.locator(getTestId("route-go-back")); - return goBackButton.click(); + if (!isLoggedIn) + await this.page + .locator(getTestId("logged-in")) + .waitFor({ state: "hidden" }); } async goToNotes() { + await this.page.locator(getTestId("tab-home")).click(); await this.navigateTo("Notes"); return new NotesViewModel(this.page, "home", "home"); } async goToNotebooks() { - await this.navigateTo("Notebooks"); - return new NotebooksViewModel(this.page); + await this.page.locator(getTestId("tab-notebooks")).click(); + const model = new NotebooksViewModel(this.page); + await model.waitForList(); + return model; } async goToFavorites() { + await this.page.locator(getTestId("tab-home")).click(); await this.navigateTo("Favorites"); return new NotesViewModel(this.page, "notes", "favorites"); } async goToReminders() { + await this.page.locator(getTestId("tab-home")).click(); await this.navigateTo("Reminders"); return new RemindersViewModel(this.page); } async goToTags() { - await this.navigateTo("Tags"); - return new ItemsViewModel(this.page); + await this.page.locator(getTestId("tab-tags")).click(); + const model = new ItemsViewModel(this.page); + await model.waitForList(); + return model; + } + + async goToHome() { + await this.page.locator(getTestId("tab-home")).click(); } async goToColor(color: string) { + await this.page.locator(getTestId("tab-home")).click(); await this.navigateTo(color); return new NotesViewModel(this.page, "notes", "notes"); } async goToTrash() { + await this.page.locator(getTestId("tab-home")).click(); await this.navigateTo("Trash"); return new TrashViewModel(this.page); } async goToSettings() { - await this.navigateTo("Settings"); + await this.profileDropdown.open( + this.page.locator(getTestId("profile-dropdown")), + "left" + ); + await this.profileDropdown.clickOnItem("settings"); return new SettingsViewModel(this.page); } @@ -111,7 +129,7 @@ export class AppModel { async getRouteHeader() { if (!(await this.routeHeader.isVisible())) return; - return await this.routeHeader.innerText(); + return await this.routeHeader.getAttribute("data-header"); } async isSynced() { diff --git a/apps/web/__e2e__/models/base-view.model.ts b/apps/web/__e2e__/models/base-view.model.ts index d62db5af2..43be533a0 100644 --- a/apps/web/__e2e__/models/base-view.model.ts +++ b/apps/web/__e2e__/models/base-view.model.ts @@ -51,7 +51,11 @@ export class BaseViewModel { .locator(getTestId("group-header")); for await (const item of iterateList(locator)) { - if ((await item.locator(getTestId("title")).textContent()) === groupName) + if ( + ( + await item.locator(getTestId("title")).textContent() + )?.toLowerCase() === groupName.toLowerCase() + ) return item; } return undefined; @@ -95,7 +99,9 @@ export class BaseViewModel { // } async press(key: string) { - const itemList = this.list.locator(getTestId(`virtuoso-item-list`, "data-testid")); + const itemList = this.list.locator( + getTestId(`virtuoso-item-list`, "data-testid") + ); await itemList.press(key); await this.page.waitForTimeout(300); } diff --git a/apps/web/__e2e__/models/editor.model.ts b/apps/web/__e2e__/models/editor.model.ts index bdc647b13..cc35e9378 100644 --- a/apps/web/__e2e__/models/editor.model.ts +++ b/apps/web/__e2e__/models/editor.model.ts @@ -93,7 +93,6 @@ export class EditorModel { } async waitForUnloading() { - await this.page.waitForURL(/#\/notes\/?.+\/create/gm); await this.searchButton.isDisabled(); await this.page .locator(".active") @@ -105,7 +104,6 @@ export class EditorModel { } async waitForSaving() { - await this.page.waitForURL(/#\/notes\/?.+\/edit/gm); await this.page.locator(".active").locator(getTestId("tags")).waitFor(); await this.searchButton.waitFor(); await this.wordCountText.waitFor(); diff --git a/apps/web/__e2e__/models/items-view.model.ts b/apps/web/__e2e__/models/items-view.model.ts index 25d3c9753..a35ed719a 100644 --- a/apps/web/__e2e__/models/items-view.model.ts +++ b/apps/web/__e2e__/models/items-view.model.ts @@ -28,25 +28,22 @@ export class ItemsViewModel extends BaseViewModel { private readonly createButton: Locator; constructor(page: Page) { super(page, "tags", "tags"); - this.createButton = page.locator(getTestId(`tags-action-button`)); + this.createButton = page.locator(getTestId(`create-tag-button`)); } async createItem(item: Item) { - const titleToCompare = `#${item.title}`; - await this.createButton.first().click(); await fillItemDialog(this.page, item); - await this.waitForItem(titleToCompare); + await this.waitForItem(item.title); return await this.findItem(item); } async findItem(item: Item) { - const titleToCompare = `#${item.title}`; for await (const _item of this.iterateItems()) { const itemModel = new ItemModel(_item, "tag"); const title = await itemModel.getTitle(); - if (title === titleToCompare) return itemModel; + if (title === item.title) return itemModel; } return undefined; } diff --git a/apps/web/__e2e__/models/note-properties.model.ts b/apps/web/__e2e__/models/note-properties.model.ts index 576bf5d92..d2d183555 100644 --- a/apps/web/__e2e__/models/note-properties.model.ts +++ b/apps/web/__e2e__/models/note-properties.model.ts @@ -134,14 +134,14 @@ abstract class BaseProperties { export class NotePropertiesModel extends BaseProperties { private readonly propertiesButton: Locator; - private readonly propertiesCloseButton: Locator; + private readonly generalSection: Locator; private readonly readonlyToggle: ToggleModel; private readonly sessionItems: Locator; constructor(page: Page, noteLocator: Locator) { super(page, noteLocator, "properties"); this.propertiesButton = page.locator(getTestId("Properties")); - this.propertiesCloseButton = page.locator(getTestId("properties-close")); + this.generalSection = page.locator(getTestId("general-section")); this.readonlyToggle = new ToggleModel(page, `properties-readonly`); this.sessionItems = page.locator(getTestId("session-item")); } @@ -183,12 +183,11 @@ export class NotePropertiesModel extends BaseProperties { async open() { await this.propertiesButton.click(); - await this.propertiesCloseButton.waitFor(); - await this.page.waitForTimeout(1000); + await this.generalSection.waitFor(); } async close() { - await this.propertiesCloseButton.click(); + await this.propertiesButton.click(); } async getSessionHistory() { diff --git a/apps/web/__e2e__/models/notebook-item.model.ts b/apps/web/__e2e__/models/notebook-item.model.ts index 9ef686344..c437de1e5 100644 --- a/apps/web/__e2e__/models/notebook-item.model.ts +++ b/apps/web/__e2e__/models/notebook-item.model.ts @@ -25,21 +25,21 @@ import { Notebook } from "./types"; import { confirmDialog, fillNotebookDialog } from "./utils"; import { NotesViewModel } from "./notes-view.model"; import { getTestId } from "../utils"; -import { SubnotebooksViewModel } from "./subnotebooks-view.model"; +import { NotebooksViewModel } from "./notebooks-view.model"; export class NotebookItemModel extends BaseItemModel { private readonly contextMenu: ContextMenuModel; - constructor(locator: Locator) { + constructor( + locator: Locator, + private readonly notebooks: NotebooksViewModel + ) { super(locator); this.contextMenu = new ContextMenuModel(this.page); } async openNotebook() { await this.locator.click(); - return { - subNotebooks: new SubnotebooksViewModel(this.page), - notes: new NotesViewModel(this.page, "notebook", "notes") - }; + return new NotesViewModel(this.page, "notebook", "notes"); } async editNotebook(notebook: Notebook) { @@ -49,6 +49,16 @@ export class NotebookItemModel extends BaseItemModel { await fillNotebookDialog(this.page, notebook); } + async createSubnotebook(notebook: Notebook) { + await this.contextMenu.open(this.locator); + await this.contextMenu.clickOnItem("add"); + + await fillNotebookDialog(this.page, notebook); + + await this.notebooks.waitForItem(notebook.title); + return await this.notebooks.findNotebook(notebook); + } + async moveToTrash(deleteContainedNotes = false) { await this.contextMenu.open(this.locator); await this.contextMenu.clickOnItem("movetotrash"); diff --git a/apps/web/__e2e__/models/notebooks-view.model.ts b/apps/web/__e2e__/models/notebooks-view.model.ts index 0367149b4..5d3a4ad74 100644 --- a/apps/web/__e2e__/models/notebooks-view.model.ts +++ b/apps/web/__e2e__/models/notebooks-view.model.ts @@ -30,7 +30,7 @@ export class NotebooksViewModel extends BaseViewModel { constructor(page: Page) { super(page, "notebooks", "notebooks"); this.createButton = page - .locator(getTestId("notebooks-action-button")) + .locator(getTestId("create-notebook-button")) .first(); } @@ -45,7 +45,7 @@ export class NotebooksViewModel extends BaseViewModel { async findNotebook(notebook: Partial) { for await (const item of this.iterateItems()) { - const notebookModel = new NotebookItemModel(item); + const notebookModel = new NotebookItemModel(item, this); if ((await notebookModel.getTitle()) === notebook.title) return notebookModel; } diff --git a/apps/web/__e2e__/models/notes-view.model.ts b/apps/web/__e2e__/models/notes-view.model.ts index 3c7de4528..790d2b8c4 100644 --- a/apps/web/__e2e__/models/notes-view.model.ts +++ b/apps/web/__e2e__/models/notes-view.model.ts @@ -38,10 +38,7 @@ export class NotesViewModel extends BaseViewModel { listType: string ) { super(page, pageId, listType); - this.createButton = page.locator( - // TODO: - getTestId(`notes-action-button`) - ); + this.createButton = page.locator(getTestId(`create-new-note`)); this.editor = new EditorModel(page); } diff --git a/apps/web/__e2e__/models/reminders-view.model.ts b/apps/web/__e2e__/models/reminders-view.model.ts index fa8798200..6748cff84 100644 --- a/apps/web/__e2e__/models/reminders-view.model.ts +++ b/apps/web/__e2e__/models/reminders-view.model.ts @@ -30,7 +30,7 @@ export class RemindersViewModel extends BaseViewModel { constructor(page: Page) { super(page, "reminders", "reminders"); this.createButton = page - .locator(getTestId("reminders-action-button")) + .locator(getTestId("create-reminder-button")) .first(); } diff --git a/apps/web/__e2e__/models/settings-view.model.ts b/apps/web/__e2e__/models/settings-view.model.ts index 727ffc03d..80dcc0e52 100644 --- a/apps/web/__e2e__/models/settings-view.model.ts +++ b/apps/web/__e2e__/models/settings-view.model.ts @@ -56,8 +56,8 @@ export class SettingsViewModel { await confirmDialog(this.page.locator(getTestId("confirm-dialog"))); await this.page - .locator(getTestId("not-logged-in")) - .waitFor({ state: "visible" }); + .locator(getTestId("logged-in")) + .waitFor({ state: "hidden" }); } async getRecoveryKey(password: string) { diff --git a/apps/web/__e2e__/navigation.test.ts b/apps/web/__e2e__/navigation.test.ts index 0d94d86f2..041e362e0 100644 --- a/apps/web/__e2e__/navigation.test.ts +++ b/apps/web/__e2e__/navigation.test.ts @@ -27,11 +27,9 @@ function createRoute(key: string, header: string) { const routes = [ createRoute("notes", "Notes"), - createRoute("notebooks", "Notebooks"), createRoute("favorites", "Favorites"), createRoute("monographs", "Monographs"), createRoute("reminders", "Reminders"), - createRoute("tags", "Tags"), createRoute("trash", "Trash") ]; diff --git a/apps/web/__e2e__/notebooks.test.ts b/apps/web/__e2e__/notebooks.test.ts index 38456e5f9..0ece43166 100644 --- a/apps/web/__e2e__/notebooks.test.ts +++ b/apps/web/__e2e__/notebooks.test.ts @@ -43,7 +43,8 @@ test("create a note inside a notebook", async ({ page }) => { await app.goto(); const notebooks = await app.goToNotebooks(); const notebook = await notebooks.createNotebook(NOTEBOOK); - const { notes } = (await notebook?.openNotebook()) || {}; + const notes = await notebook?.openNotebook(); + await notes?.waitForList(); const note = await notes?.createNote(NOTE); @@ -55,11 +56,10 @@ test("create a note inside a subnotebook", async ({ page }) => { await app.goto(); const notebooks = await app.goToNotebooks(); const notebook = await notebooks.createNotebook(NOTEBOOK); - const { subNotebooks } = (await notebook?.openNotebook()) || {}; - const subNotebook = await subNotebooks?.createNotebook({ + const subNotebook = await notebook?.createSubnotebook({ title: "Subnotebook 1" }); - const { notes } = (await subNotebook?.openNotebook()) || {}; + const notes = await subNotebook?.openNotebook(); const note = await notes?.createNote(NOTE); @@ -80,7 +80,6 @@ test("edit a notebook", async ({ page }) => { const editedNotebook = await notebooks.findNotebook(item); expect(editedNotebook).toBeDefined(); - expect(await editedNotebook?.getDescription()).toBe(item.description); }); test("delete a notebook", async ({ page }) => { @@ -129,29 +128,6 @@ test("permanently delete a notebook", async ({ page }) => { await expect(trashItem.locator).toBeHidden(); }); -test("pin a notebook", async ({ page }) => { - const app = new AppModel(page); - await app.goto(); - const notebooks = await app.goToNotebooks(); - const notebook = await notebooks.createNotebook(NOTEBOOK); - - await notebook?.pin(); - - expect(await notebook?.isPinned()).toBe(true); -}); - -test("unpin a notebook", async ({ page }) => { - const app = new AppModel(page); - await app.goto(); - const notebooks = await app.goToNotebooks(); - const notebook = await notebooks.createNotebook(NOTEBOOK); - await notebook?.pin(); - - await notebook?.unpin(); - - expect(await notebook?.isPinned()).toBe(false); -}); - test("create shortcut of a notebook", async ({ page }) => { const app = new AppModel(page); await app.goto(); @@ -161,8 +137,8 @@ test("create shortcut of a notebook", async ({ page }) => { await notebook?.createShortcut(); expect(await notebook?.isShortcut()).toBe(true); - const allShortcuts = await app.navigation.getShortcuts(); - expect(allShortcuts.includes(NOTEBOOK.title)).toBeTruthy(); + await app.goToHome(); + expect(await app.navigation.findItem(NOTEBOOK.title)).toBeDefined(); }); test("remove shortcut of a notebook", async ({ page }) => { @@ -184,14 +160,13 @@ test("delete all notes within a notebook", async ({ page }) => { await app.goto(); const notebooks = await app.goToNotebooks(); const notebook = await notebooks.createNotebook(NOTEBOOK); - let { notes } = (await notebook?.openNotebook()) || {}; + let notes = await notebook?.openNotebook(); for (let i = 0; i < 2; ++i) { await notes?.createNote({ title: `Note ${i}`, content: NOTE.content }); } - await app.goBack(); await notebook?.moveToTrash(true); @@ -254,20 +229,17 @@ test(`sort notebooks`, async ({ page }, info) => { await notebooks.createNotebook(NOTEBOOK); } - for (const groupBy of groupByOptions) { - for (const sortBy of sortByOptions) { - for (const orderBy of orderByOptions) { - await test.step(`group by ${groupBy}, sort by ${sortBy}, order by ${orderBy}`, async () => { - const sortResult = await notebooks?.sort({ - groupBy, - orderBy, - sortBy - }); - if (!sortResult) return; - - await expect(notebooks.items).toHaveCount(titles.length); + for (const sortBy of sortByOptions) { + for (const orderBy of orderByOptions) { + await test.step(`sort by ${sortBy}, order by ${orderBy}`, async () => { + const sortResult = await notebooks?.sort({ + orderBy, + sortBy }); - } + if (!sortResult) return; + + await expect(notebooks.items).toHaveCount(titles.length); + }); } } }); diff --git a/apps/web/__e2e__/tags.test.ts b/apps/web/__e2e__/tags.test.ts index a124ae6aa..bac1cf91a 100644 --- a/apps/web/__e2e__/tags.test.ts +++ b/apps/web/__e2e__/tags.test.ts @@ -99,8 +99,8 @@ test("create shortcut of a tag", async ({ page }) => { await tag?.createShortcut(); expect(await tag?.isShortcut()).toBe(true); - const allShortcuts = await app.navigation.getShortcuts(); - expect(allShortcuts.includes("hello-world")).toBeTruthy(); + await app.goToHome(); + expect(await app.navigation.findItem("hello-world")).toBeDefined(); }); test("remove shortcut of a tag", async ({ page }) => { @@ -204,20 +204,17 @@ test(`sort tags`, async ({ page }, info) => { if (!tag) continue; } - for (const groupBy of groupByOptions) { - for (const sortBy of sortByOptions) { - for (const orderBy of orderByOptions) { - await test.step(`group by ${groupBy}, sort by ${sortBy}, order by ${orderBy}`, async () => { - const sortResult = await tags?.sort({ - groupBy, - orderBy, - sortBy - }); - if (!sortResult) return; - - await expect(tags.items).toHaveCount(titles.length); + for (const sortBy of sortByOptions) { + for (const orderBy of orderByOptions) { + await test.step(`sort by ${sortBy}, order by ${orderBy}`, async () => { + const sortResult = await tags?.sort({ + orderBy, + sortBy }); - } + if (!sortResult) return; + + await expect(tags.items).toHaveCount(titles.length); + }); } } }); diff --git a/apps/web/src/components/editor/action-bar.tsx b/apps/web/src/components/editor/action-bar.tsx index 469e542c7..dee87bc56 100644 --- a/apps/web/src/components/editor/action-bar.tsx +++ b/apps/web/src/components/editor/action-bar.tsx @@ -26,8 +26,10 @@ import { Lock, NewTab, Note, + NoteAdd, NoteRemove, Pin, + Plus, Properties, Publish, Published, @@ -78,6 +80,7 @@ import { strings } from "@notesnook/intl"; import { getWindowControls } from "../title-bar"; import useTablet from "../../hooks/use-tablet"; import { isMac } from "../../utils/platform"; +import { CREATE_BUTTON_MAP } from "../../common"; export function EditorActionBar() { const { isMaximized, isFullscreen, hasNativeWindowControls } = @@ -265,6 +268,14 @@ const TabStrip = React.memo(function TabStrip() { }} onDoubleClick={(e) => e.stopPropagation()} > + @@ -360,10 +361,10 @@ function NavigationMenu({ onExpand }: { onExpand?: () => void }) { Menu.openMenu(await getSidebarItemsAsMenuItems()); }} > - + - + @@ -720,6 +721,7 @@ function NavigationDropdown() { ); }} variant="columnCenter" + data-test-id="profile-dropdown" sx={{ bg: "background-secondary", size: 30, diff --git a/apps/web/src/components/navigation-menu/navigation-item.tsx b/apps/web/src/components/navigation-menu/navigation-item.tsx index 2cddb3380..b38f0c71c 100644 --- a/apps/web/src/components/navigation-menu/navigation-item.tsx +++ b/apps/web/src/components/navigation-menu/navigation-item.tsx @@ -88,10 +88,10 @@ function NavigationItem( AppEventManager.publish(AppEvents.toggleSideMenu, false); if (onClick) onClick(); }} + data-test-id={`navigation-item`} title={title} > // )} // {titlePromise.status === "fulfilled" && titlePromise.value && ( - // - // {titlePromise.value} - // + // + // {titlePromise.value} + // // )} // // @@ -264,22 +281,22 @@ function Header(props: RouteContainerProps) { // // )} // {!isMobile && buttons?.create && ( - // + // // )} // // diff --git a/apps/web/src/components/status-bar/index.tsx b/apps/web/src/components/status-bar/index.tsx index d6e24ceff..8295051f2 100644 --- a/apps/web/src/components/status-bar/index.tsx +++ b/apps/web/src/components/status-bar/index.tsx @@ -80,6 +80,7 @@ function StatusBar() { size={7} color={"var(--icon-success)"} sx={{ p: "small" }} + data-test-id="logged-in" /> ) : (