Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: add ctrl+click selection tests (#1510)

Muhammad Ali4eed06c91f43
diff --git a/apps/web/__e2e__/keyboard-list-navigation.test.ts b/apps/web/__e2e__/keyboard-list-navigation.test.ts
index dac660c97..84502e6b7 100644
--- a/apps/web/__e2e__/keyboard-list-navigation.test.ts
+++ b/apps/web/__e2e__/keyboard-list-navigation.test.ts
@@ -255,3 +255,58 @@ test("select notes using Shift+Click upwards", async ({ page }, info) => {
}
expect(await notesList[0].isFocused()).toBeTruthy();
});
+
+test("Ctrl+Click to select/unselect notes", async ({ page }, info) => {
+ info.setTimeout(60 * 1000);
+ const { notesList, notes } = await populateList(page, 10);
+ await notes.focus();
+
+ await page.keyboard.down("Control");
+ for (let i = 2; i < 10; i += 2) {
+ await notesList[i].click();
+ }
+ await page.keyboard.up("Control");
+
+ for (let i = 2; i < 10; i += 2) {
+ expect(await notesList[i].isSelected()).toBeTruthy();
+ }
+
+ const selectedNote = notesList[2];
+ await selectedNote.contextMenu.open();
+ expect(
+ (await selectedNote.contextMenu.title()) === `5 items selected`
+ ).toBeTruthy();
+ await selectedNote.contextMenu.close();
+
+ await page.keyboard.down("Control");
+ for (let i = 2; i < 10; i += 2) {
+ await notesList[i].click();
+ }
+ await page.keyboard.up("Control");
+
+ for (let i = 2; i < 10; i += 2) {
+ expect(await notesList[i].isSelected()).toBeFalsy();
+ }
+
+ await selectedNote.contextMenu.open();
+ expect(
+ (await selectedNote.contextMenu.title()) === (await selectedNote.getTitle())
+ ).toBeTruthy();
+});
+
+test("opening a note & right clicking on another note should show note properties menu", async ({
+ page
+}, info) => {
+ info.setTimeout(60 * 1000);
+ const { notesList, notes } = await populateList(page, 10);
+ await notes.focus();
+
+ const noteSelected = 4;
+ const selectedNote = notesList[noteSelected];
+
+ await notesList[0].click();
+ await selectedNote.contextMenu.open();
+ expect(
+ (await selectedNote.contextMenu.title()) === (await selectedNote.getTitle())
+ ).toBeTruthy();
+});