A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: add tests for pinned tabs
Abdullah Attac45539dea6b5
diff --git a/apps/web/__e2e__/models/tab-item.model.ts b/apps/web/__e2e__/models/tab-item.model.tsindex 66f3c4164..88f29ab3e 100644--- a/apps/web/__e2e__/models/tab-item.model.ts+++ b/apps/web/__e2e__/models/tab-item.model.ts@@ -19,11 +19,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.import { Locator, Page } from "@playwright/test";import { getTestId } from "../utils";+import { ContextMenuModel } from "./context-menu.model";export class TabItemModel {private readonly closeButton: Locator;+ readonly contextMenu: TabContextMenuModel;+constructor(private readonly locator: Locator, page: Page) {this.closeButton = locator.locator(getTestId("tab-close-button"));+ this.contextMenu = new TabContextMenuModel(page, locator);}async getId() {@@ -48,3 +52,19 @@ export class TabItemModel {return this.closeButton.click();}}++class TabContextMenuModel {+ private readonly menu: ContextMenuModel;+ constructor(page: Page, private readonly tabLocator: Locator) {+ this.menu = new ContextMenuModel(page);+ }++ async pin() {+ await this.open();+ await this.menu.clickOnItem("pin");+ }++ async open() {+ await this.menu.open(this.tabLocator);+ }+}diff --git a/apps/web/__e2e__/tabs.test.ts b/apps/web/__e2e__/tabs.test.tsindex 9fa55517d..8beecb028 100644--- a/apps/web/__e2e__/tabs.test.ts+++ b/apps/web/__e2e__/tabs.test.ts@@ -252,5 +252,48 @@ test("open a note in 2 tabs then open another note and navigate back", async ({expect(await tabs[1].title()).toBe("Note 1");});+test("shouldn't be possible to open a note in a pinned tab", async ({+ page+}) => {+ const app = new AppModel(page);+ await app.goto();+ const notes = await app.goToNotes();+ const note = await notes.createNote({+ title: "Note 1"+ });+ await notes.createNote({+ title: "Note 2"+ });+ let tabs = await notes.editor.getTabs();+ await tabs[0].contextMenu.pin();++ await note?.click();+ await notes.editor.waitForLoading();++ tabs = await notes.editor.getTabs();+ expect(tabs.length).toBe(2);+ expect(await tabs[1].isActive()).toBe(true);+ expect(await tabs[1].title()).toBe("Note 1");+});++test("shouldn't be possible to create a new note in a pinned tab", async ({+ page+}) => {+ const app = new AppModel(page);+ await app.goto();+ const notes = await app.goToNotes();+ await notes.createNote({+ title: "Note 1"+ });+ let tabs = await notes.editor.getTabs();+ await tabs[0].contextMenu.pin();++ await notes.newNote();++ tabs = await notes.editor.getTabs();+ expect(tabs.length).toBe(2);+ expect(await tabs[1].isActive()).toBe(true);+});+test.skip("TODO: open a locked note, switch to another note and navigate back", () => {});test.skip("TODO: open a locked note, switch to another note, unlock the note and navigate back", () => {});