Skip to content

TagSpaces is an offline, open source, document manager with tagging support

adding tests for the key bindings (#1486)

mladensap107ebe9ea21e
diff --git a/app/components/HelpFeedbackPanel.tsx b/app/components/HelpFeedbackPanel.tsx
index ac8c9cc43..c386f934c 100644
--- a/app/components/HelpFeedbackPanel.tsx
+++ b/app/components/HelpFeedbackPanel.tsx
@@ -236,6 +236,7 @@ const HelpFeedbackPanel = (props: Props) => {
button
onClick={toggleAboutDialog}
title="Opens the about dialog"
+ data-tid="aboutDialog"
>
<ListItemIcon>
<AboutIcon />
diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.js
index 3e9e290ec..14022fd44 100644
--- a/tests/e2e/general.helpers.js
+++ b/tests/e2e/general.helpers.js
@@ -38,6 +38,10 @@ export async function clickOn(selector, options = {}) {
}
}
+export async function rightClickOn(selector) {
+ const options = { button: 'right' };
+ return clickOn(selector, options);
+}
/*export async function waitUntilOpen(element) {
// const element = await global.client.$(selector);
await element.waitUntil(async () => await this.isOpen());
@@ -631,25 +635,11 @@ export async function reloadDirectory() {
export async function createNewDirectory(dirName = testFolder) {
await clickOn('[data-tid=folderContainerOpenDirMenu]');
- await global.client.pause(500); // TODO the Menu is always in HTML
await clickOn('[data-tid=newSubDirectory]');
- await global.client.pause(500);
// set new dir name
await setInputKeys('directoryName', dirName);
- /*const directoryName = await global.client.$('[data-tid=directoryName] input');
- await delay(500);
- await directoryName.keys(testFolder);
- await directoryName.click();
- await delay(1500);*/
await clickOn('[data-tid=confirmCreateNewDirectory]');
- /*const confirmCreateNewDirectory = await global.client.$(
- '[data-tid=confirmCreateNewDirectory]'
- );
- await delay(1500);
- await confirmCreateNewDirectory.waitForDisplayed();
- await confirmCreateNewDirectory.click();*/
await waitForNotification();
- // await global.client.pause(500); // minio
return dirName;
}
@@ -689,22 +679,10 @@ export async function closeOpenedFile() {
}
export async function deleteDirectory() {
- await global.client.pause(500);
await clickOn('[data-tid=folderContainerOpenDirMenu]');
await clickOn('[data-tid=deleteDirectory]');
- /*const deleteDirectory = await global.client.$('[data-tid=deleteDirectory]');
- await deleteDirectory.waitForDisplayed();
- await delay(500);
- await deleteDirectory.click();*/
await clickOn('[data-tid=confirmDeleteFileDialog]');
await waitForNotification();
- /*const confirmDeleteDirectory = await global.client.$(
- '[data-tid=confirmDeleteDirectoryDialog]'
- );
- await confirmDeleteDirectory.waitForDisplayed();
- await delay(500);
- await confirmDeleteDirectory.click();
- await delay(500);*/
}
export async function toHaveText() {
diff --git a/tests/e2e/general.pw.e2e.js b/tests/e2e/general.pw.e2e.js
new file mode 100644
index 000000000..665be02da
--- /dev/null
+++ b/tests/e2e/general.pw.e2e.js
@@ -0,0 +1,325 @@
+/*
+ * Copyright (c) 2016-present - TagSpaces UG (Haftungsbeschraenkt). All rights reserved.
+ */
+import {
+ createLocation,
+ defaultLocationPath,
+ defaultLocationName,
+ closeFileProperties,
+ createMinioLocation
+} from './location.helpers';
+import {
+ reloadDirectory,
+ tsFolder,
+ createNewDirectory,
+ newHTMLFile,
+ newMDFile,
+ newTEXTFile,
+ closeOpenedFile,
+ deleteDirectory,
+ clickOn,
+ expectElementExist,
+ selectorFile,
+ setSettings,
+ doubleClickOn
+} from './general.helpers';
+import { searchEngine } from './search.helpers';
+
+export const firstFile = '/span';
+export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';
+const subFolderName = '/test-perspective-grid';
+const subFolderContentExtractionPath =
+ defaultLocationPath + '/content-extraction';
+const subFolderThumbnailsPath = defaultLocationPath + '/thumbnails';
+const testFolder = 'testFolder';
+
+describe('TST07 - General', () => {
+ beforeEach(async () => {
+ await clearLocalStorage();
+ await delay(500);
+ });
+
+ it.skip('TST0701 - Open About TagSpaces', async () => {
+ await global.client.waitForVisible('[data-tid=aboutTagSpaces]');
+ await global.client.click('[data-tid=aboutTagSpaces]');
+ await global.client.waitForVisible('[data-tid=closeAboutDialog]');
+ await global.client.click('[data-tid=closeAboutDialog]');
+ });
+
+ it.skip('TST0705 - Open Settings Dialog', async () => {
+ await global.client.waitForVisible('[data-tid=settings]');
+ await global.client.click('[data-tid=settings]');
+ await checkForIdExist('settingsDialog');
+ await global.client.waitForVisible('[data-tid=closeSettingsDialog]');
+ await global.client.click('[data-tid=closeSettingsDialog]');
+ });
+
+ it.skip('TST07** - Change theme color', async () => {
+ await global.client.waitForVisible('[data-tid=settings]');
+ await global.client.click('[data-tid=settings]');
+ await delay(500);
+ // activate dark theme
+ await global.client.waitForVisible('[data-tid=settingsSetCurrentTheme]');
+ await global.client.selectByValue(
+ '[data-tid=settingsSetCurrentTheme]/div/select',
+ 'dark'
+ );
+ await delay(500);
+ // const style = await global.client.getAttribute('//button[contains(., "done")]', 'style');
+ // await delay(500);
+ // expect(style).toContain('rgb(208, 107, 100)');
+ // await global.client.waitForVisible('[data-tid=closeSettingsDialog]');
+ // await global.client.click('[data-tid=closeSettingsDialog]');
+ });
+
+ /* it('TST10** - Desktop Mode', async () => {
+ await createLocation(defaultLocationPath, testLocationName, false);
+ await checkForIdExist('folderContainerLocationChooser');
+ await delay(500);
+ await global.client.waitForVisible('[data-tid=settings]');
+ await global.client.click('[data-tid=settings]');
+ await global.client.waitForVisible('[data-tid=settingsSetDesktopMode]');
+ await global.client.click('[data-tid=settingsSetDesktopMode]');
+ await delay(2000);
+ await global.client.waitForVisible('[data-tid=closeSettingsDialog]');
+ await global.client.click('[data-tid=closeSettingsDialog]');
+ // set desktop mode and check for desktop text / Location Chooser bottom in Toolbar
+ const isDesktopMode = await global.client.element('[data-tid=folderContainerLocationChooser]');
+ await delay(500);
+ expect(isDesktopMode.selector).not.toBe('[data-tid=folderContainerLocationChooser]');
+ }); */
+
+ // it('TST1003 - Checkbox in the settings to open the tag library on startup', async () => {
+ //
+ // });
+});
+
+describe('TST51 - Perspective Grid [general]', () => {
+ beforeEach(async () => {
+ //await closeWelcome();
+ //await delay(500);
+ if (global.isMinio) {
+ await createMinioLocation('', defaultLocationName, true);
+ } else {
+ await createLocation(defaultLocationPath, defaultLocationName, true);
+ }
+ // openLocation
+ await clickOn('[data-tid=location_' + defaultLocationName + ']');
+ // If its have opened file
+ await closeFileProperties();
+ });
+
+ it('TST0501 - Create HTML file [electron]', async () => {
+ /*await createNewDirectory();
+ await reloadDirectory();
+ // await global.client.pause(500);
+ await expectElementExist('[data-tid=fsEntryName_' + testFolder + ']');
+ await doubleClickOn('[data-tid=fsEntryName_' + testFolder + ']');*/
+
+ //await setSettings('[data-tid=settingsSetUseTrashCan]');
+ //await global.client.pause(500);
+ await createNewDirectory();
+ // await reloadDirectory();
+ // await global.client.pause(500);
+ await doubleClickOn('[data-tid=fsEntryName_' + testFolder + ']');
+ // create new file
+ await newHTMLFile();
+ await closeOpenedFile();
+ // await reloadDirectory();
+ await expectElementExist(selectorFile, true);
+ /*await global.client.pause(500);*/
+ // delete directory
+
+ // await deleteFirstFile();
+ await deleteDirectory(testFolder);
+ await expectElementExist(
+ '[data-tid=fsEntryName_' + testFolder + ']',
+ false
+ );
+ });
+
+ it('TST0502 - Create MD file [electron]', async () => {
+ await createNewDirectory();
+ // await reloadDirectory();
+ // await global.client.pause(500);
+ await doubleClickOn('[data-tid=fsEntryName_' + testFolder + ']');
+
+ // create new file
+ await newMDFile();
+ await closeOpenedFile();
+ // await reloadDirectory();
+ await expectElementExist(selectorFile, true);
+ await global.client.pause(500);
+
+ // await deleteFirstFile();
+ await deleteDirectory(testFolder);
+ await expectElementExist(
+ '[data-tid=fsEntryName_' + testFolder + ']',
+ false
+ );
+ });
+
+ it('TST0502 - Create TEXT file [electron]', async () => {
+ await createNewDirectory();
+ // await reloadDirectory();
+ // await global.client.pause(500);
+ await doubleClickOn('[data-tid=fsEntryName_' + testFolder + ']');
+
+ // create new file
+ await newTEXTFile();
+ await closeOpenedFile();
+ // await reloadDirectory();
+ await expectElementExist(selectorFile, true);
+ await global.client.pause(500);
+
+ // await deleteFirstFile();
+ await deleteDirectory(testFolder);
+ await expectElementExist(
+ '[data-tid=fsEntryName_' + testFolder + ']',
+ false
+ );
+ });
+
+ it('TST0510 - Generate thumbnail from Images', async () => {
+ // let filename = 'sample.jpg';
+ // activate 'Show Hidden File' functionality in the general settings
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
+ await global.client.pause(500);
+ await reloadDirectory();
+ await global.client.pause(500);
+ await doubleClickOn('[data-tid=fsEntryName_' + tsFolder + ']');
+
+ await searchEngine('jpg');
+ // await openEntry('sample.jpg');
+ // await openFile();
+ await doubleClickOn(perspectiveGridTable + firstFile);
+ await closeOpenedFile();
+ //TODO expect
+ // const file = await global.client.$(
+ // perspectiveGridTable + firstFile
+ // );
+ // expect(file).toBe(filename);
+ });
+
+ it('TST0511 - Generate thumbnail from Videos', async () => {
+ // activate 'Show Hidden File' functionality in the general settings
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
+ await global.client.pause(500);
+ await reloadDirectory();
+ await global.client.pause(500);
+ await doubleClickOn('[data-tid=fsEntryName_' + tsFolder + ']');
+
+ await searchEngine('mp4');
+ await doubleClickOn(perspectiveGridTable + firstFile);
+ await closeOpenedFile();
+ //TODO expect
+ });
+
+ it('TST0516 - Generate thumbnail from PDF', async () => {
+ // activate 'Show Hidden File' functionality in the general settings
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
+ await global.client.pause(500);
+ await reloadDirectory();
+ await global.client.pause(500);
+ await doubleClickOn('[data-tid=fsEntryName_' + tsFolder + ']');
+
+ await searchEngine('pdf');
+ await doubleClickOn(perspectiveGridTable + firstFile);
+ await closeOpenedFile();
+ //TODO expect
+ });
+
+ it('TST0517 - Generate thumbnail from ODT', async () => {
+ // activate 'Show Hidden File' functionality in the general settings
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
+ await global.client.pause(500);
+ await reloadDirectory();
+ await global.client.pause(500);
+ await doubleClickOn('[data-tid=fsEntryName_' + tsFolder + ']');
+
+ await searchEngine('odt');
+ await doubleClickOn(perspectiveGridTable + firstFile);
+ await closeOpenedFile();
+ //TODO expect
+ });
+
+ it('TST0519 - Generate thumbnail from TIFF', async () => {
+ // activate 'Show Hidden File' functionality in the general settings
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
+ await global.client.pause(500);
+ await reloadDirectory();
+ await global.client.pause(500);
+ await doubleClickOn('[data-tid=fsEntryName_' + tsFolder + ']');
+
+ await searchEngine('tiff');
+ // await openEntry('sample.jpg');
+ // await openFile();
+ await doubleClickOn(perspectiveGridTable + firstFile);
+ await closeOpenedFile();
+ //TODO expect
+ });
+
+ it('TST0520 - Generate thumbnail from PSD', async () => {
+ // activate 'Show Hidden File' functionality in the general settings
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
+ await global.client.pause(500);
+ await reloadDirectory();
+ await global.client.pause(500);
+ await doubleClickOn('[data-tid=fsEntryName_' + tsFolder + ']');
+
+ await searchEngine('psd');
+ // await openEntry('sample.jpg');
+ // await openFile();
+ await doubleClickOn(perspectiveGridTable + firstFile);
+ await closeOpenedFile();
+ //TODO expect
+ });
+
+ it('TST0524 - Generate thumbnail from TXT', async () => {
+ // activate 'Show Hidden File' functionality in the general settings
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
+ await global.client.pause(500);
+ await reloadDirectory();
+ await global.client.pause(500);
+ await doubleClickOn('[data-tid=fsEntryName_' + tsFolder + ']');
+
+ await searchEngine('txt');
+ // await openEntry('sample.jpg');
+ // await openFile();
+ await doubleClickOn(perspectiveGridTable + firstFile);
+ await closeOpenedFile();
+ //TODO expect
+ });
+
+ it('TST0523 - Generate thumbnail from HTML', async () => {
+ // activate 'Show Hidden File' functionality in the general settings
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
+ await global.client.pause(500);
+ await reloadDirectory();
+ await global.client.pause(500);
+ await doubleClickOn('[data-tid=fsEntryName_' + tsFolder + ']');
+
+ await searchEngine('html');
+ // await openEntry('sample.jpg');
+ // await openFile();
+ await doubleClickOn(perspectiveGridTable + firstFile);
+ await closeOpenedFile();
+ //TODO expect
+ });
+
+ it('TST0522 - Generate thumbnail from URL', async () => {
+ // activate 'Show Hidden File' functionality in the general settings
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
+ await global.client.pause(500);
+ await reloadDirectory();
+ await global.client.pause(500);
+ await doubleClickOn('[data-tid=fsEntryName_' + tsFolder + ']');
+
+ await searchEngine('url');
+ // await openEntry('sample.jpg');
+ // await openFile();
+ await doubleClickOn(perspectiveGridTable + firstFile);
+ await closeOpenedFile();
+ //TODO expect
+ });
+});
diff --git a/tests/e2e/key-bindings.pw.e2e.js b/tests/e2e/key-bindings.pw.e2e.js
new file mode 100644
index 000000000..aa056f183
--- /dev/null
+++ b/tests/e2e/key-bindings.pw.e2e.js
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2016-present - TagSpaces UG (Haftungsbeschraenkt). All rights reserved.
+ */
+import {
+ createLocation,
+ defaultLocationPath,
+ defaultLocationName,
+ closeFileProperties,
+ createMinioLocation,
+ createPwMinioLocation,
+ createPwLocation
+} from './location.helpers';
+import {
+ clickOn,
+ expectElementExist,
+ selectorFile,
+ setInputValue
+} from './general.helpers';
+
+describe('TST13 - Settings Key Bindings [electron]', () => {
+ beforeEach(async () => {
+ // if (global.isMinio) {
+ // await createPwMinioLocation('', defaultLocationName, true);
+ // } else {
+ // await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ // }
+ await clickOn('[data-tid=location_' + defaultLocationName + ']');
+ // If its have opened file
+ // await closeFileProperties();
+ });
+
+ it('TST1311 - Test show search [electron]', async () => {
+ await clickOn(selectorFile);
+ await global.client.keyboard.press('Control+KeyF');
+ await expectElementExist('[data-tid=searchMenu]', true);
+ });
+
+ it('TST1312 - Test rename file [electron]', async () => {
+ const newTitle = 'renamed.txt';
+ await clickOn(selectorFile);
+ await global.client.keyboard.press('F2');
+ await setInputValue('[data-tid=renameEntryDialogInput] input', newTitle);
+ await clickOn('[data-tid=closeRenameEntryDialog]');
+ });
+
+ it('TST1313 - Test open file [electron]', async () => {
+ await clickOn(selectorFile);
+ await global.client.keyboard.press('Enter');
+ await expectElementExist('[data-tid=fileContainerToggleProperties]', true);
+ });
+
+ it('TST1315 - Test delete file [electron]', async () => {
+ await clickOn(selectorFile);
+ await global.client.keyboard.press('Delete');
+ await clickOn('[data-tid=confirmDeleteFileDialog]');
+ // await expectElementExist('[data-tid=confirmDeleteFileDialog]', true);
+ });
+
+ it('TST1316 - Show help and feedback panel in the left [electron]', async () => {
+ await clickOn(selectorFile);
+ await global.client.keyboard.press('F1');
+ await expectElementExist('[data-tid=aboutDialog]', true);
+ });
+
+ it.skip('TST1301 - Change a key binding [electron]', async () => {});
+
+ it.skip('TST1302 - Test select all [electron]', async () => {});
+
+ it.skip('TST1303 - Test reload of document [electron]', async () => {});
+
+ it.skip('TST1304 - Test close document [electron]', async () => {});
+
+ it.skip('TST1305 - Test document properties [electron]', async () => {});
+
+ it.skip('TST1306 - Test save document [electron]', async () => {});
+
+ it.skip('TST1307 - Test show next document [electron]', async () => {});
+
+ it.skip('TST1308 - Test show previous document [electron]', async () => {});
+
+ it.skip('TST1309 - Test edit document [electron]', async () => {});
+
+ it.skip('TST1310 - Test add / remove tags [electron]', async () => {});
+
+ it.skip('TST1314 - Test open file externally [electron]', async () => {});
+});