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: fix all e2e tests
Abdullah Attaa0579278c957
diff --git a/apps/web/__e2e__/models/context-menu.model.ts b/apps/web/__e2e__/models/context-menu.model.tsindex ebb0ad41e..ea81d880a 100644--- a/apps/web/__e2e__/models/context-menu.model.ts+++ b/apps/web/__e2e__/models/context-menu.model.ts@@ -21,13 +21,9 @@ import { Page, Locator } from "@playwright/test";import { getTestId } from "../utils";export class ContextMenuModel {- readonly titleText: Locator;+ readonly menuContainer: Locator;constructor(private readonly page: Page) {- this.titleText = this.page.locator(getTestId(`menu-title`));- }-- async title() {- return await this.titleText.textContent();+ this.menuContainer = this.page.locator(getTestId(`menu-container`));}async open(@@ -35,7 +31,7 @@ export class ContextMenuModel {button: "left" | "right" | "middle" | undefined = "right") {await locator.click({ button });- await this.titleText.waitFor();+ await this.menuContainer.waitFor();}async clickOnItem(id: string) {diff --git a/apps/web/__e2e__/models/note-properties.model.ts b/apps/web/__e2e__/models/note-properties.model.tsindex 627154351..c6ea79ea1 100644--- a/apps/web/__e2e__/models/note-properties.model.ts+++ b/apps/web/__e2e__/models/note-properties.model.ts@@ -250,7 +250,9 @@ export class NoteContextMenuModel extends BaseProperties {async addToNotebook(notebook: Notebook) {await this.open();- await this.menu.clickOnItem("addtonotebook");++ await this.menu.clickOnItem("notebooks");+ await this.menu.clickOnItem("link-notebooks");const filterInput = this.page.locator(getTestId("filter-input"));await filterInput.type(notebook.title);@@ -263,14 +265,15 @@ export class NoteContextMenuModel extends BaseProperties {const notebookItems = this.page.locator(getTestId("notebook"));for await (const item of iterateList(notebookItems)) {- const treeItem = item.locator(getTestId(`tree-item`));- const title = treeItem.locator(getTestId("title"));- const newItemButton = treeItem.locator(getTestId("tree-item-new"));+ await item.locator(getTestId("notebook-tools")).click();+ const title = item.locator(getTestId("notebook-title"));+ const createTopicButton = item.locator(getTestId("create-topic"));+ const notebookTitle = await title.textContent();- if ((await title.textContent()) === notebook.title) {+ if (notebookTitle?.includes(notebook.title)) {for (const topic of notebook.topics) {- await newItemButton.click();- const newItemInput = item.locator(getTestId("new-tree-item-input"));+ await createTopicButton.click();+ const newItemInput = item.locator(getTestId("new-topic-input"));await newItemInput.waitFor({ state: "visible" });await newItemInput.fill(topic);@@ -281,8 +284,9 @@ export class NoteContextMenuModel extends BaseProperties {const topicItems = item.locator(getTestId("topic"));for await (const topicItem of iterateList(topicItems)) {- const treeItem = topicItem.locator(getTestId(`tree-item`));- await treeItem.click();+ await this.page.keyboard.down("Control");+ await topicItem.click();+ await this.page.keyboard.up("Control");}}}@@ -299,10 +303,6 @@ export class NoteContextMenuModel extends BaseProperties {async close() {await this.menu.close();}-- title() {- return this.menu.title();- }}class SessionHistoryItemModel {diff --git a/apps/web/__e2e__/models/toasts.model.ts b/apps/web/__e2e__/models/toasts.model.tsindex c8f57c9aa..ac06832ac 100644--- a/apps/web/__e2e__/models/toasts.model.ts+++ b/apps/web/__e2e__/models/toasts.model.ts@@ -22,7 +22,6 @@ import { getTestId } from "../utils";export class ToastsModel {private readonly toasts: Locator;- private readonly toastMessage: Locator;constructor(page: Page) {this.toasts = page.locator(".toasts-container > div");diff --git a/apps/web/__e2e__/notes.test.ts b/apps/web/__e2e__/notes.test.tsindex 4d7703061..7aa5fe7d4 100644--- a/apps/web/__e2e__/notes.test.ts+++ b/apps/web/__e2e__/notes.test.ts@@ -95,7 +95,11 @@ test("add a note to notebook", async ({ page }) => {topics: ["Hello", "World", "Did", "what"]});- expect(await app.toasts.waitForToast("Added 1 note to 4 topics")).toBe(true);+ expect(+ await app.toasts.waitForToast(+ "1 note added to 4 topics & removed from 0 topics."+ )+ ).toBe(true);});const actors = ["contextMenu", "properties"] as const;diff --git a/apps/web/src/components/dialogs/add-notebook-dialog.js b/apps/web/src/components/dialogs/add-notebook-dialog.jsindex fb702cf23..70d8cf66b 100644--- a/apps/web/src/components/dialogs/add-notebook-dialog.js+++ b/apps/web/src/components/dialogs/add-notebook-dialog.js@@ -137,8 +137,8 @@ class AddNotebookDialog extends React.Component {this.createNotebook();}}}- onClose={props.onClose}- negativeButton={{ text: "Cancel", onClick: props.onClose }}+ onClose={() => props.onClose(false)}+ negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}><Flex sx={{ overflowY: "auto", flexDirection: "column" }}><Fielddiff --git a/apps/web/src/components/dialogs/confirm.js b/apps/web/src/components/dialogs/confirm.jsindex 44a4e92b6..fbb6b97ac 100644--- a/apps/web/src/components/dialogs/confirm.js+++ b/apps/web/src/components/dialogs/confirm.js@@ -28,16 +28,16 @@ function Confirm(props) {icon={props.icon}width={props.width}description={props.subtitle}- onClose={props.onNo}+ onClose={() => props.onNo(false)}positiveButton={props.yesText && {text: props.yesText,- onClick: props.onYes,+ onClick: () => props.onYes(true),autoFocus: !!props.yesText}}negativeButton={- props.noText && { text: props.noText, onClick: props.onNo }+ props.noText && { text: props.noText, onClick: () => props.onNo(false) }}><Box pb={!props.noText && !props.yesText ? 2 : 0}>diff --git a/apps/web/src/components/dialogs/email-verification-dialog.js b/apps/web/src/components/dialogs/email-verification-dialog.jsindex 30d3c4129..5d497e194 100644--- a/apps/web/src/components/dialogs/email-verification-dialog.js+++ b/apps/web/src/components/dialogs/email-verification-dialog.js@@ -63,7 +63,7 @@ function EmailVerificationDialog(props) {description={"Check your spam folder if you haven't received an email yet."}- onClose={props.onCancel}+ onClose={() => props.onCancel(false)}positiveButton={{text: canSendAgain || isSending ? "Resend" : `Resend (${resetTimer})`,onClick: async () => {@@ -82,7 +82,7 @@ function EmailVerificationDialog(props) {}}negativeButton={{text: "Cancel",- onClick: props.onCancel,+ onClick: () => props.onCancel(true),disabled: isSending}}>diff --git a/apps/web/src/components/dialogs/item-dialog.js b/apps/web/src/components/dialogs/item-dialog.jsindex 84ca1ff17..4a124c762 100644--- a/apps/web/src/components/dialogs/item-dialog.js+++ b/apps/web/src/components/dialogs/item-dialog.js@@ -28,14 +28,12 @@ function ItemDialog(props) {title={props.title}description={props.subtitle}positiveButton={{- props: {- form: "itemForm",- type: "submit"- },+ form: "itemForm",+ type: "submit",text: props.title}}- onClose={props.onClose}- negativeButton={{ text: "Cancel", onClick: props.onClose }}+ onClose={() => props.onClose(false)}+ negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}><Boxas="form"diff --git a/apps/web/src/components/dialogs/move-note-dialog.tsx b/apps/web/src/components/dialogs/move-note-dialog.tsxindex d27a1a35c..461c70fa7 100644--- a/apps/web/src/components/dialogs/move-note-dialog.tsx+++ b/apps/web/src/components/dialogs/move-note-dialog.tsx@@ -232,7 +232,7 @@ function NotebookItem(props: {const isSelected = isNotebookSelected(notebook, selected);return (- <Box as="li">+ <Box as="li" data-test-id="notebook"><Boxas="details"sx={{@@ -272,6 +272,7 @@ function NotebookItem(props: {<SelectedCheck size={20} selected={isSelected} /><TextclassName="title"+ data-test-id="notebook-title"variant="subtitle"sx={{ fontWeight: "body" }}>@@ -282,10 +283,11 @@ function NotebookItem(props: {</Text></Text></Flex>- <Flex sx={{ alignItems: "center" }}>+ <Flex data-test-id="notebook-tools" sx={{ alignItems: "center" }}><Buttonvariant="tool"className="create-topic"+ data-test-id="create-topic"sx={{ display: "none", p: 1, mr: 1 }}><Icon.Plus@@ -328,7 +330,7 @@ function NotebookItem(props: {<SelectedCheck selected={false} /><Inputvariant="clean"- data-test-id={`new-tree-item-input`}+ data-test-id={`new-topic-input`}autoFocussx={{bg: "bgSecondary",@@ -369,6 +371,7 @@ function TopicItem(props: { topic: Topic }) {<Flexas="li"key={topic.id}+ data-test-id="topic"sx={{alignItems: "center",p: "small",diff --git a/apps/web/src/components/dialogs/password-dialog.js b/apps/web/src/components/dialogs/password-dialog.jsindex 42dc99f64..538fdacc4 100644--- a/apps/web/src/components/dialogs/password-dialog.js+++ b/apps/web/src/components/dialogs/password-dialog.js@@ -55,17 +55,15 @@ function PasswordDialog(props) {title={props.title}description={props.subtitle}icon={props.icon}- onClose={props.onClose}+ onClose={() => props.onClose(false)}positiveButton={{- props: {- form: "passwordForm",- type: "submit"- },+ form: "passwordForm",+ type: "submit",text: props.positiveButtonText,loading: isLoading,disabled: isLoading}}- negativeButton={{ text: "Cancel", onClick: props.onClose }}+ negativeButton={{ text: "Cancel", onClick: () => props.onClose(false) }}><Boxid="passwordForm"diff --git a/apps/web/src/components/dialogs/reminder-dialog.js b/apps/web/src/components/dialogs/reminder-dialog.jsindex ca7f5f2f0..997699465 100644--- a/apps/web/src/components/dialogs/reminder-dialog.js+++ b/apps/web/src/components/dialogs/reminder-dialog.js@@ -98,7 +98,7 @@ function ReminderDialog(props) {<DialogisOpen={true}title={reminder.title}- onClose={props.onClose}+ onClose={() => props.onClose(false)}showCloseButtondescription={reminder.description}alignment="center"diff --git a/apps/web/src/components/dialogs/tracking-details-dialog.js b/apps/web/src/components/dialogs/tracking-details-dialog.jsindex 221646475..77a9c2063 100644--- a/apps/web/src/components/dialogs/tracking-details-dialog.js+++ b/apps/web/src/components/dialogs/tracking-details-dialog.js@@ -31,10 +31,10 @@ function TrackingDetailsDialog(props) {description={"List of all the events we send to our servers for diagnostics and analytics. The data is transmitted over SSL (fully encrypted) and does not pass through any 3rd party server. Furthermore, the data does not contain any personal info - not even your user id."}- onClose={props.onClose}+ onClose={() => props.onClose(false)}positiveButton={{text: "Okay",- onClick: props.onClose+ onClick: () => props.onClose(true)}}><Box sx={{ overflowY: "auto" }}>diff --git a/apps/web/src/components/menu/index.js b/apps/web/src/components/menu/index.jsindex f3f12d7cc..0a1a44f57 100644--- a/apps/web/src/components/menu/index.js+++ b/apps/web/src/components/menu/index.js@@ -211,10 +211,11 @@ function Menu({ items, data, title, closeMenu }) {}export default React.memo(Menu);-function MenuContainer({ title, children }) {+function MenuContainer({ children }) {return (<FlexclassName="menuContainer"+ data-test-id="menu-container"tabIndex={-1}py={1}sx={{