Skip to content

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

Tsn440 e2e v3 (#1209)

mladensap13eb90568e96
diff --git a/app/perspectives/grid-perspective/components/CellContent.tsx b/app/perspectives/grid-perspective/components/CellContent.tsx
index 4157e3780..81f7ee242 100644
--- a/app/perspectives/grid-perspective/components/CellContent.tsx
+++ b/app/perspectives/grid-perspective/components/CellContent.tsx
@@ -161,7 +161,7 @@ const CellContent = (props: Props) => {
</div>
<Typography
className={classes.gridCellTitle}
- data-tid="fsEntryName"
+ data-tid={'fsEntryName_' + fsEntry.name}
title={fsEntry.path}
noWrap={true}
variant="body1"
diff --git a/package.json b/package.json
index 7aba16e06..b3fe866c9 100644
--- a/package.json
+++ b/package.json
@@ -79,7 +79,7 @@
"test-e2e-dev": "cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 node --trace-warnings ./tests/runTests.js e2e-dev",
"test-unit": "cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 jest --verbose ./tests/unit/",
"test-all": "yarn build && yarn test-unit && yarn build-e2e && yarn test-e2e",
- "test-one": "jest --config=jest.config.js -t 'show_sub_folders' --verbose ./tests/e2e/",
+ "test-one": "jest --config=jest.config.js -t 'generate_thumbnail_URL' --verbose ./tests/e2e/",
"test-e2e-electron": "node -r @babel/register ./internals/scripts/CheckBuiltsExist.js && cross-env NODE_ENV=test jest --config=jest.config.js -t 'electron' --verbose ./tests/e2e/",
"test-e2e-electron-minio": "node -r @babel/register ./internals/scripts/CheckBuiltsExist.js && cross-env NODE_JEST=test_minio jest --verbose ./tests/e2e/",
"test-e2e-web": "yarn prepare-web && cross-env NODE_JEST=test_web jest -t 'web' --verbose ./tests/e2e/",
diff --git a/tests/e2e/filetypes.spec.js b/tests/e2e/filetypes.spec.js
index e4a8dd14d..6f974bafe 100644
--- a/tests/e2e/filetypes.spec.js
+++ b/tests/e2e/filetypes.spec.js
@@ -5,7 +5,7 @@ import {
defaultLocationPath,
openLocation
} from './location.helpers';
-import { openSettings } from './general.spec';
+import { openSettings } from './general.е2е';
const testLocationName = '' + new Date().getTime();
diff --git a/tests/e2e/folder.e2e.js b/tests/e2e/folder.e2e.js
new file mode 100644
index 000000000..25ed25897
--- /dev/null
+++ b/tests/e2e/folder.e2e.js
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2016-present - TagSpaces UG (Haftungsbeschraenkt). All rights reserved.
+ */
+import { delay, clearLocalStorage } from './hook';
+import {
+ createLocation,
+ openLocation,
+ defaultLocationPath,
+ defaultLocationName,
+ closeFileProperties,
+ createMinioLocation
+} from './location.helpers';
+import {
+ reloadDirectory,
+ openEntry,
+ disableTrashBin,
+ openDirectoryMenu,
+ createNewDirectory,
+ deleteDirectory,
+ returnDirectoryBack
+} from './general.helpers';
+import { renameFolder, openParentDir } from './test-utils.spec';
+
+export const firstFile = '/span';
+export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';
+const testFolder = 'testFolder';
+const newDirectoryName = 'newDirectory';
+
+describe('TST01 - Folder management [electron]', () => {
+ beforeEach(async () => {
+ await clearLocalStorage();
+ // await delay(500);
+ //await closeWelcome();
+ //await delay(500);
+ if (global.isMinio) {
+ await createMinioLocation('', defaultLocationName, true);
+ } else {
+ await createLocation(defaultLocationPath, defaultLocationName, true);
+ }
+ // await delay(500);
+ await openLocation(defaultLocationName);
+ // await delay(500);
+ await closeFileProperties();
+ });
+
+ it('TST0101 - Create subfolder [electron]', async () => {
+ await delay(500);
+ await openDirectoryMenu();
+ await delay(500);
+ await createNewDirectory();
+ await delay(500);
+ await openEntry(testFolder);
+ await delay(500);
+ await deleteDirectory();
+ });
+
+ it('TST0102 - Reload folder [electron]', async () => {
+ await delay(500);
+ await openDirectoryMenu();
+ await delay(500);
+ await createNewDirectory();
+ await delay(500);
+ await openEntry(testFolder);
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await deleteDirectory();
+ });
+
+ it('TST0103 - Rename folder [electron]', async () => {
+ await delay(500);
+ await openDirectoryMenu();
+ await delay(500);
+ await createNewDirectory();
+ await delay(500);
+ await openEntry(testFolder);
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await renameFolder();
+ await delay(500);
+ // await reloadDirectory();
+ // await delay(500);
+ await openParentDir();
+ await deleteDirectory();
+ });
+
+ it('TST0104 - Delete empty folder [electron]', async () => {
+ await delay(500);
+ await disableTrashBin();
+ await delay(500);
+ await openDirectoryMenu();
+ await delay(500);
+ await createNewDirectory();
+ await delay(500);
+ await openEntry(testFolder);
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await deleteDirectory();
+ });
+
+ it('TST0106 - Show folder tags [electron]', async () => {
+ await delay(500);
+ await openDirectoryMenu();
+ await delay(500);
+ await createNewDirectory();
+ await delay(500);
+ });
+
+ it('TST51** - Return directory back [electron]', async () => {
+ const file = await global.client.$(
+ '//*[@data-tid="perspectiveGridFileTable"]/span'
+ );
+ expect(await file.isDisplayed()).toBe(true);
+ //Open folder
+ const folder = await global.client.$(
+ '//*[@data-tid="perspectiveGridFileTable"]/div'
+ );
+
+ await folder.doubleClick();
+ expect(await file.isDisplayed()).toBe(false);
+ const backButton = await global.client.$(
+ '[data-tid=gridPerspectiveOnBackButton]'
+ );
+ await backButton.click();
+ await delay(500);
+ expect(await file.isDisplayed()).toBe(true);
+ });
+});
diff --git a/tests/e2e/folder.spec.js b/tests/e2e/folder.spec.js
index e00ba8a6d..fec30d541 100644
--- a/tests/e2e/folder.spec.js
+++ b/tests/e2e/folder.spec.js
@@ -53,7 +53,7 @@ describe('TST01+TST02 - Folder tests', () => {
await openDirectoryMenu('[data-tid=deleteDirectory]');
});
- it.only('TST0201 - Should create a folder in alternative navigation', async () => {
+ it('TST0201 - Should create a folder in alternative navigation', async () => {
await openDirectoryMenu('newSubDirectory');
// set new dir name
await delay(1500);
diff --git a/tests/e2e/general.e2e.js b/tests/e2e/general.e2e.js
new file mode 100644
index 000000000..9d12ecc77
--- /dev/null
+++ b/tests/e2e/general.e2e.js
@@ -0,0 +1,358 @@
+/*
+ * Copyright (c) 2016-present - TagSpaces UG (Haftungsbeschraenkt). All rights reserved.
+ */
+import { delay, clearLocalStorage } from './hook';
+import {
+ createLocation,
+ openLocation,
+ defaultLocationPath,
+ defaultLocationName,
+ closeFileProperties,
+ createMinioLocation
+} from './location.helpers';
+import {
+ openSettingsDialog,
+ closeSettingsDialog,
+ reloadDirectory,
+ openEntry,
+ tsFolder,
+ openDirectoryMenu,
+ createNewDirectory,
+ newHTMLFile,
+ newMDFile,
+ newTEXTFile,
+ closeOpenedFile,
+ deleteDirectory,
+ returnDirectoryBack
+} from './general.helpers';
+import { searchEngine } from './search.spec';
+
+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('TST51 - Perspective Grid [general]', () => {
+ beforeEach(async () => {
+ await clearLocalStorage();
+ // await delay(500);
+ //await closeWelcome();
+ //await delay(500);
+ if (global.isMinio) {
+ await createMinioLocation('', defaultLocationName, true);
+ } else {
+ await createLocation(defaultLocationPath, defaultLocationName, true);
+ }
+ // await delay(500);
+ await openLocation(defaultLocationName);
+ // await delay(500);
+ await closeFileProperties();
+ });
+
+ it('TST0501 - Create HTML file [electron]', async () => {
+ await delay(500);
+ await openDirectoryMenu();
+ await delay(500);
+ await createNewDirectory();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(testFolder);
+ await delay(500);
+ await openDirectoryMenu();
+ await delay(500);
+ await createNewDirectory();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(testFolder);
+ // create new file
+ await newHTMLFile();
+ await delay(500);
+ await closeOpenedFile();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await returnDirectoryBack();
+ // delete directory
+ await deleteDirectory(testFolder);
+ await delay(500);
+ });
+
+ it('TST0502 - Create MD file [electron]', async () => {
+ await delay(500);
+ await openDirectoryMenu();
+ await delay(500);
+ await createNewDirectory();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(testFolder);
+ await delay(500);
+ await openDirectoryMenu();
+ await delay(500);
+ await createNewDirectory();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(testFolder);
+ // create new file
+ await newMDFile();
+ await delay(500);
+ await closeOpenedFile();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await returnDirectoryBack();
+ // delete directory
+ await deleteDirectory(testFolder);
+ await delay(500);
+ });
+
+ it('TST0502 - Create TEXT file [electron]', async () => {
+ await delay(500);
+ await openDirectoryMenu();
+ await delay(500);
+ await createNewDirectory();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(testFolder);
+ await delay(500);
+ await openDirectoryMenu();
+ await delay(500);
+ await createNewDirectory();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(testFolder);
+ // create new file
+ await newTEXTFile();
+ await delay(500);
+ await closeOpenedFile();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await returnDirectoryBack();
+ // delete directory
+ await deleteDirectory(testFolder);
+ await delay(500);
+ });
+
+ it('TST0510 - Generate thumbnail from Images [electron]', async () => {
+ // let filename = 'sample.jpg';
+ await delay(500);
+ await openSettingsDialog();
+ // activate 'Show Hidden File' functionality in the general settings
+ const showUnixHiddenEntries = await global.client.$(
+ '[data-tid=settingsSetShowUnixHiddenEntries]'
+ );
+ await showUnixHiddenEntries.waitForDisplayed();
+ await showUnixHiddenEntries.click();
+ await closeSettingsDialog();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(tsFolder);
+ await delay(500);
+ await searchEngine('jpg');
+ // await openEntry('sample.jpg');
+ // await openFile();
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await closeOpenedFile();
+ // const file = await global.client.$(
+ // perspectiveGridTable + firstFile
+ // );
+ // expect(file).toBe(filename);
+ });
+
+ it('TST0511 - Generate thumbnail from Videos [electron]', async () => {
+ await delay(500);
+ await openSettingsDialog();
+ // activate 'Show Hidden File' functionality in the general settings
+ const showUnixHiddenEntries = await global.client.$(
+ '[data-tid=settingsSetShowUnixHiddenEntries]'
+ );
+ await showUnixHiddenEntries.waitForDisplayed();
+ await showUnixHiddenEntries.click();
+ await closeSettingsDialog();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(tsFolder);
+ await delay(500);
+ await searchEngine('mp4');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await closeOpenedFile();
+ });
+
+ it('TST0516 - Generate thumbnail from PDF [electron]', async () => {
+ await delay(500);
+ await openSettingsDialog();
+ // activate 'Show Hidden File' functionality in the general settings
+ const showUnixHiddenEntries = await global.client.$(
+ '[data-tid=settingsSetShowUnixHiddenEntries]'
+ );
+ await showUnixHiddenEntries.waitForDisplayed();
+ await showUnixHiddenEntries.click();
+ await closeSettingsDialog();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(tsFolder);
+ await delay(500);
+ await searchEngine('pdf');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await closeOpenedFile();
+ });
+
+ it('TST0517 - Generate thumbnail from ODT [electron]', async () => {
+ await delay(500);
+ await openSettingsDialog();
+ // activate 'Show Hidden File' functionality in the general settings
+ const showUnixHiddenEntries = await global.client.$(
+ '[data-tid=settingsSetShowUnixHiddenEntries]'
+ );
+ await showUnixHiddenEntries.waitForDisplayed();
+ await showUnixHiddenEntries.click();
+ await closeSettingsDialog();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(tsFolder);
+ await delay(500);
+ await searchEngine('odt');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await closeOpenedFile();
+ });
+
+ it('TST0519 - Generate thumbnail from TIFF [electron]', async () => {
+ await delay(500);
+ await openSettingsDialog();
+ // activate 'Show Hidden File' functionality in the general settings
+ const showUnixHiddenEntries = await global.client.$(
+ '[data-tid=settingsSetShowUnixHiddenEntries]'
+ );
+ await showUnixHiddenEntries.waitForDisplayed();
+ await showUnixHiddenEntries.click();
+ await closeSettingsDialog();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(tsFolder);
+ await delay(500);
+ await searchEngine('tiff');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await closeOpenedFile();
+ });
+
+ it('TST0520 - Generate thumbnail from PSD [electron]', async () => {
+ await delay(500);
+ await openSettingsDialog();
+ // activate 'Show Hidden File' functionality in the general settings
+ const showUnixHiddenEntries = await global.client.$(
+ '[data-tid=settingsSetShowUnixHiddenEntries]'
+ );
+ await showUnixHiddenEntries.waitForDisplayed();
+ await showUnixHiddenEntries.click();
+ await closeSettingsDialog();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(tsFolder);
+ await delay(500);
+ await searchEngine('psd');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await closeOpenedFile();
+ });
+
+ it('TST0524 - Generate thumbnail from TXT [electron]', async () => {
+ await delay(500);
+ await openSettingsDialog();
+ // activate 'Show Hidden File' functionality in the general settings
+ const showUnixHiddenEntries = await global.client.$(
+ '[data-tid=settingsSetShowUnixHiddenEntries]'
+ );
+ await showUnixHiddenEntries.waitForDisplayed();
+ await showUnixHiddenEntries.click();
+ await closeSettingsDialog();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(tsFolder);
+ await delay(500);
+ await searchEngine('txt');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await closeOpenedFile();
+ });
+
+ it('TST0523 - Generate thumbnail from HTML [electron]', async () => {
+ await delay(500);
+ await openSettingsDialog();
+ // activate 'Show Hidden File' functionality in the general settings
+ const showUnixHiddenEntries = await global.client.$(
+ '[data-tid=settingsSetShowUnixHiddenEntries]'
+ );
+ await showUnixHiddenEntries.waitForDisplayed();
+ await showUnixHiddenEntries.click();
+ await closeSettingsDialog();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(tsFolder);
+ await delay(500);
+ await searchEngine('html');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await closeOpenedFile();
+ });
+
+ it('TST0522 - Generate thumbnail from URL [electron]', async () => {
+ await delay(500);
+ await openSettingsDialog();
+ // activate 'Show Hidden File' functionality in the general settings
+ const showUnixHiddenEntries = await global.client.$(
+ '[data-tid=settingsSetShowUnixHiddenEntries]'
+ );
+ await showUnixHiddenEntries.waitForDisplayed();
+ await showUnixHiddenEntries.click();
+ await closeSettingsDialog();
+ await delay(500);
+ await reloadDirectory();
+ await delay(500);
+ await openEntry(tsFolder);
+ await delay(500);
+ await searchEngine('url');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await closeOpenedFile();
+ });
+});
diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.js
new file mode 100644
index 000000000..363c50665
--- /dev/null
+++ b/tests/e2e/general.helpers.js
@@ -0,0 +1,216 @@
+/* Copyright (c) 2016-present - TagSpaces UG (Haftungsbeschraenkt). All rights reserved. */
+import { delay } from './hook';
+import { firstFile, checkFilenameForExist } from './test-utils.spec';
+
+export const defaultLocationPath =
+ './testdata/file-structure/supported-filestypes';
+export const defaultLocationName = 'supported-filestypes';
+export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';
+export const newLocationName = 'Location Name Changed';
+export const tsFolder = '\\.ts';
+
+// const newHTMLFileName = 'newHTMLFile.html';
+const testFolder = 'testFolder';
+
+export async function createLocation(
+ locationPath,
+ locationName,
+ isDefault = false
+) {
+ // locationPerspective = locationPerspective || 'Grid';
+ const locationManagerMenu = await global.client.$(
+ '[data-tid=locationManagerPanel]'
+ );
+ await locationManagerMenu.click();
+ const elem = await global.client.$('[data-tid=createNewLocation]');
+ await elem.click();
+ const lPath = await global.client.$('[data-tid=locationPath]');
+ await lPath.click();
+ const locationPathInput = await global.client.$(
+ '[data-tid=locationPath] input'
+ );
+ await locationPathInput.keys(locationPath || defaultLocationPath);
+ // keys is workarround for not working setValue await global.client.$('[data-tid=locationPath] input').setValue(locationPath || defaultLocationPath);
+ const lName = await global.client.$('[data-tid=locationName]');
+ await lName.click();
+ const locationNameInput = await global.client.$(
+ '[data-tid=locationName] input'
+ );
+ locationNameInput.keys(
+ locationName || 'Test Location' + new Date().getTime()
+ );
+ if (isDefault) {
+ await delay(1000);
+ const locationIsDefault = await global.client.$(
+ '[data-tid=locationIsDefault]'
+ );
+ await locationIsDefault.click();
+ }
+ const confirmLocationCreation = await global.client.$(
+ '[data-tid=confirmLocationCreation]'
+ );
+ await confirmLocationCreation.waitForDisplayed();
+ await confirmLocationCreation.click();
+}
+
+export async function openSettingsDialog() {
+ await delay(500);
+ const openSettings = await global.client.$('[data-tid=settings]');
+ await openSettings.waitForDisplayed();
+ await openSettings.click();
+ await delay(500);
+}
+
+export async function closeSettingsDialog() {
+ await delay(500);
+ const closeSettings = await global.client.$('[data-tid=closeSettingsDialog]');
+ await closeSettings.waitForDisplayed();
+ await closeSettings.click();
+ await delay(500);
+}
+
+export async function reloadDirectory() {
+ await delay(500);
+ const openDirMenu = await global.client.$(
+ '[data-tid=folderContainerOpenDirMenu]'
+ );
+ await openDirMenu.waitForDisplayed();
+ await openDirMenu.click();
+ await delay(500);
+ const reloadDirectory = await global.client.$('[data-tid=reloadDirectory]');
+ await reloadDirectory.waitForDisplayed();
+ await reloadDirectory.click();
+ await delay(500);
+}
+
+export async function openEntry(entryName) {
+ await delay(500);
+ const eName = await global.client.$(
+ '[data-tid=fsEntryName_' + entryName + ']'
+ );
+ await eName.waitForDisplayed();
+ await eName.doubleClick();
+ await delay(500);
+}
+
+export async function openDirectoryMenu() {
+ const openDirMenu = await global.client.$(
+ '[data-tid=folderContainerOpenDirMenu]'
+ );
+ await openDirMenu.waitForDisplayed();
+ await openDirMenu.click();
+ await delay(500);
+}
+
+export async function createNewDirectory() {
+ const newSubDirectoty = await global.client.$('[data-tid=newSubDirectory]');
+ await newSubDirectoty.waitForDisplayed();
+ await delay(500);
+ await newSubDirectoty.click();
+ await delay(1500);
+ // set new dir name
+ const directoryName = await global.client.$('[data-tid=directoryName] input');
+ await delay(500);
+ await directoryName.keys(testFolder);
+ await directoryName.click();
+ await delay(1500);
+ const confirmCreateNewDirectory = await global.client.$(
+ '[data-tid=confirmCreateNewDirectory]'
+ );
+ await delay(1500);
+ await confirmCreateNewDirectory.waitForDisplayed();
+ await confirmCreateNewDirectory.click();
+}
+
+export async function newHTMLFile() {
+ const newFile = await global.client.$('[data-tid=locationManager]');
+ await newFile.waitForDisplayed();
+ await newFile.click();
+ await delay(500);
+ const newNoteFile = await global.client.$(
+ '[data-tid=createRichTextFileButton]'
+ );
+ await newNoteFile.waitForDisplayed();
+ await newNoteFile.click();
+ await delay(500);
+}
+
+export async function newMDFile() {
+ const newFile = await global.client.$('[data-tid=locationManager]');
+ await newFile.waitForDisplayed();
+ await newFile.click();
+ await delay(500);
+ const newNoteFile = await global.client.$('[data-tid=createMarkdownButton]');
+ await newNoteFile.waitForDisplayed();
+ await newNoteFile.click();
+ await delay(500);
+}
+
+export async function newTEXTFile() {
+ const newFile = await global.client.$('[data-tid=locationManager]');
+ await newFile.waitForDisplayed();
+ await newFile.click();
+ await delay(500);
+ const newNoteFile = await global.client.$('[data-tid=createTextFileButton]');
+ await newNoteFile.waitForDisplayed();
+ await newNoteFile.click();
+ await delay(500);
+}
+
+export async function closeOpenedFile() {
+ const closeFile = await global.client.$(
+ '[data-tid=fileContainerCloseOpenedFile]'
+ );
+ await closeFile.waitForDisplayed();
+ await closeFile.click();
+ await delay(500);
+}
+
+export async function deleteDirectory() {
+ await openDirectoryMenu();
+ await delay(500);
+ const deleteDirectory = await global.client.$('[data-tid=deleteDirectory]');
+ await deleteDirectory.waitForDisplayed();
+ await delay(500);
+ await deleteDirectory.click();
+ const confirmDeleteDirectory = await global.client.$(
+ '[data-tid=confirmDeleteDirectoryDialog]'
+ );
+ await confirmDeleteDirectory.waitForDisplayed();
+ await delay(500);
+ await confirmDeleteDirectory.click();
+ await delay(500);
+}
+
+export async function disableTrashBin() {
+ await openSettingsDialog();
+ await delay(500);
+ const disableTrashBin = await global.client.$(
+ '[data-tid=settingsSetUseTrashCan]'
+ );
+ await disableTrashBin.waitForDisplayed();
+ await disableTrashBin.click();
+ await delay(500);
+ await closeSettingsDialog();
+}
+
+export async function returnDirectoryBack() {
+ await delay(500);
+ const backButton = await global.client.$(
+ '[data-tid=gridPerspectiveOnBackButton]'
+ );
+ await backButton.click();
+ await delay(500);
+}
+
+export async function toHaveText() {
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ console.log(file.getText());
+ expect(file).toBe(filename);
+ // const classNameAndText = await global.client.$('<img>');
+ // await checkFilenameForExist(filename, selector)
+ // expect(file).toEquale(expect.toHaveTextContaining('jpg'));
+ // expect.stringContaining('jpg');
+ // expect(text1==text2).toBe(true);
+}
diff --git a/tests/e2e/location.e2e.js b/tests/e2e/location.e2e.js
index 25b0d8584..f7745b4a2 100644
--- a/tests/e2e/location.e2e.js
+++ b/tests/e2e/location.e2e.js
@@ -9,7 +9,8 @@ import {
defaultLocationName,
openLocation,
closeFileProperties,
- clearInputValue
+ clearInputValue,
+ startupLocation
} from './location.helpers';
export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';
@@ -121,7 +122,7 @@ describe('TST03 - Testing locations:', () => {
it('TST0305 - Set as startup location [web,electron]', async () => {
await openLocationMenu(testLocationName);
- await delay(1500);
+ await delay(500);
// await global.client.waitForVisible('[data-tid=editLocation]');
// await global.client.click('[data-tid=editLocation]');
// await delay(1500);
@@ -131,6 +132,11 @@ describe('TST03 - Testing locations:', () => {
// await global.client.waitForVisible('[data-tid=confirmEditLocationDialog]');
// await global.client.click('[data-tid=confirmEditLocationDialog]');
// await delay(1500);
+ await startupLocation();
+ await openLocationMenu(testLocationName);
+ await delay(500);
+ await startupLocation();
+ await delay(500);
const startupIndication = await global.client.$(
'[data-tid=startupIndication]'
);
diff --git a/tests/e2e/location.helpers.js b/tests/e2e/location.helpers.js
index 0113f477f..bf79391ab 100644
--- a/tests/e2e/location.helpers.js
+++ b/tests/e2e/location.helpers.js
@@ -282,3 +282,23 @@ export async function aboutDialogExt(title, ext) {
.waitForVisible('#closeAboutDialogButton')
.click('#closeAboutDialogButton');
}
+
+export async function startupLocation() {
+ await delay(500);
+ const editLocation = await global.client.$('[data-tid=editLocation]');
+ await editLocation.waitForDisplayed();
+ await editLocation.click();
+ await delay(1500);
+ const defaultLocation = await global.client.$(
+ '[data-tid=editStartupLocation]'
+ );
+ await defaultLocation.waitForDisplayed();
+ await defaultLocation.click();
+ await delay(1500);
+ const closeEditLocationDialog = await global.client.$(
+ '[data-tid=confirmEditLocationDialog]'
+ );
+ await closeEditLocationDialog.waitForDisplayed();
+ await closeEditLocationDialog.click();
+ await delay(1500);
+}
diff --git a/tests/e2e/test-utils.spec.js b/tests/e2e/test-utils.spec.js
index f19d39d31..53779afa2 100644
--- a/tests/e2e/test-utils.spec.js
+++ b/tests/e2e/test-utils.spec.js
@@ -6,11 +6,14 @@ import {
createLocation,
defaultLocationName,
defaultLocationPath,
- openLocation
+ openLocation,
+ clearInputValue
} from './location.helpers';
+import { openDirectoryMenu } from './general.helpers';
const winMinio = pathLib.resolve(__dirname, '../bin/minio.exe');
const unixMinio = 'minio';
+const newDirectoryName = 'newDirectory';
export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';
export const firstFile = '/span';
export const firstFileName = '/span/div/div/div/p';
@@ -115,15 +118,15 @@ export async function openFile(perspectiveSelector, inDepth) {
await fileSelector.click();
}
-export async function openDirectoryMenu(menuOperation) {
- // menuOption is selector for current menu operation
- const folderContainerOpenDirMenu = await global.client.$(
- '[data-tid=folderContainerOpenDirMenu]'
- );
- await folderContainerOpenDirMenu.click();
- const menuElem = await global.client.$('[data-tid=' + menuOperation + ']');
- menuElem.click();
-}
+// export async function openDirectoryMenu(menuOperation) {
+// // menuOption is selector for current menu operation
+// const folderContainerOpenDirMenu = await global.client.$(
+// '[data-tid=folderContainerOpenDirMenu]'
+// );
+// await folderContainerOpenDirMenu.click();
+// const menuElem = await global.client.$('[data-tid=' + menuOperation + ']');
+// menuElem.click();
+// }
export async function openContextEntryMenu(selector, menuOperation) {
await delay(500);
@@ -162,3 +165,37 @@ export function toContainTID(text) {
});
return pass;
}
+
+export async function renameFolder() {
+ await delay(500);
+ await openDirectoryMenu();
+ const renameDirectory = await global.client.$('[data-tid=renameDirectory]');
+ await renameDirectory.waitForDisplayed();
+ await delay(500);
+ await renameDirectory.click();
+ await delay(500);
+ // set new dir name
+ const renameDirectoryDialogInput = await global.client.$(
+ '[data-tid=renameDirectoryDialogInput] input'
+ );
+ await delay(500);
+ await renameDirectoryDialogInput.waitForDisplayed();
+ await clearInputValue(renameDirectoryDialogInput);
+ await delay(500);
+ await renameDirectoryDialogInput.keys(newDirectoryName);
+ const confirmRenameDirectoryDialog = await global.client.$(
+ '[data-tid=confirmRenameDirectory]'
+ );
+ await confirmRenameDirectoryDialog.waitForDisplayed();
+ await confirmRenameDirectoryDialog.click();
+}
+
+export async function openParentDir() {
+ await delay(500);
+ const openParentDirectory = await global.client.$(
+ '[data-tid=gridPerspectiveOnBackButton]'
+ );
+ await openParentDirectory.waitForDisplayed();
+ await delay(500);
+ await openParentDirectory.click();
+}
diff --git a/tests/e2e/viewer-html.e2e.js b/tests/e2e/viewer-html.e2e.js
new file mode 100644
index 000000000..fb85b524e
--- /dev/null
+++ b/tests/e2e/viewer-html.e2e.js
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2016-present - TagSpaces UG (Haftungsbeschraenkt). All rights reserved.
+ */
+import { delay, clearLocalStorage } from './hook';
+import {
+ createLocation,
+ openLocation,
+ defaultLocationPath,
+ defaultLocationName,
+ closeFileProperties,
+ createMinioLocation,
+ aboutDialogExt
+} from './location.helpers';
+import { closeOpenedFile } from './general.helpers';
+import { searchEngine } from './search.spec';
+
+export const firstFile = '/span';
+export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';
+
+// export async function aboutDialogExt(title, ext) {
+// await delay(500);
+// // should switch focus to iFrame
+// const switchFocus = await global.client.$('#viewer').frame(0);
+// // await global.client.waitForExist('#viewer').frame(0);
+// await switchFocus.waitForDisplayed();
+// await switchFocus.click();
+// const viewMainMenuButton = await global.client.$('#viewerMainMenuButton');
+// await viewMainMenuButton.waitForDisplayed();
+// await viewMainMenuButton.click();
+// await delay(500);
+// await global.client.waitForVisible('#aboutButton').click('#aboutButton');
+// await delay(1500);
+// const getTitle = await global.client
+// .waitForVisible('h4=' + title)
+// .getText('h4=' + title);
+// // should eventually equals('About HTML Viewer');
+// expect(getTitle).toBe(title);
+// await delay(1500);
+// await global.client
+// .waitForVisible('#closeAboutDialogButton')
+// .click('#closeAboutDialogButton');
+// }
+
+describe('TST65 - HTML viewer [electron]', () => {
+ beforeEach(async () => {
+ await clearLocalStorage();
+ if (global.isMinio) {
+ await createMinioLocation('', defaultLocationName, true);
+ } else {
+ await createLocation(defaultLocationPath, defaultLocationName, true);
+ }
+ await openLocation(defaultLocationName);
+ await closeFileProperties();
+ });
+
+ it('TST6501 - Open HTML [electron]', async () => {
+ await delay(500);
+ await searchEngine('html');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await delay(500);
+ await closeOpenedFile();
+ });
+
+ it('TST6501 - Open HTML in reader mode []', async () => {
+ await delay(500);
+ await searchEngine('html');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await delay(1500);
+ // const editFile = await global.client.$('data-tid=fileContainerEditFile');
+ // await editFile.waitForDisplayed();
+ // await editFile.doubleClick();
+ // const viewMainMenuButton = await global.client.$('#viewerMainMenuButton');
+ // await viewMainMenuButton.waitForDisplayed();
+ // await viewMainMenuButton.click();
+ // await delay(500);
+ // await global.client.waitForVisible('#aboutButton').click('#aboutButton');
+ // await delay(1500);
+ await aboutDialogExt();
+ });
+});
diff --git a/tests/e2e/viewer-image.e2e.js b/tests/e2e/viewer-image.e2e.js
new file mode 100644
index 000000000..3b35d85c4
--- /dev/null
+++ b/tests/e2e/viewer-image.e2e.js
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2016-present - TagSpaces UG (Haftungsbeschraenkt). All rights reserved.
+ */
+import { delay, clearLocalStorage } from './hook';
+import {
+ createLocation,
+ openLocation,
+ defaultLocationPath,
+ defaultLocationName,
+ closeFileProperties,
+ createMinioLocation
+} from './location.helpers';
+import { closeOpenedFile } from './general.helpers';
+import { searchEngine } from './search.spec';
+
+export const firstFile = '/span';
+export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';
+
+// export async function aboutDialogExt(title, ext) {
+// await delay(500);
+// // should switch focus to iFrame
+// const switchFocus = await global.client.$('#viewer').frame(0);
+// // await global.client.waitForExist('#viewer').frame(0);
+// await switchFocus.waitForDisplayed();
+// await switchFocus.click();
+// const viewMainMenuButton = await global.client.$('#viewerMainMenuButton');
+// await viewMainMenuButton.waitForDisplayed();
+// await viewMainMenuButton.click();
+// await delay(500);
+// await global.client.waitForVisible('#aboutButton').click('#aboutButton');
+// await delay(1500);
+// const getTitle = await global.client
+// .waitForVisible('h4=' + title)
+// .getText('h4=' + title);
+// // should eventually equals('About HTML Viewer');
+// expect(getTitle).toBe(title);
+// await delay(1500);
+// await global.client
+// .waitForVisible('#closeAboutDialogButton')
+// .click('#closeAboutDialogButton');
+// }
+
+describe('TST53 - Image viewer [electron, web]', () => {
+ beforeEach(async () => {
+ await clearLocalStorage();
+ if (global.isMinio) {
+ await createMinioLocation('', defaultLocationName, true);
+ } else {
+ await createLocation(defaultLocationPath, defaultLocationName, true);
+ }
+ await openLocation(defaultLocationName);
+ await closeFileProperties();
+ });
+
+ it('TST5301 - Open JPG [web,electron]', async () => {
+ await delay(500);
+ await searchEngine('_exif');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await delay(500);
+ await closeOpenedFile();
+ // TODO test for finding a text in the exif
+ });
+
+ it('TST5302 - Open BMP [web,electron]', async () => {
+ await delay(500);
+ await searchEngine('bmp');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await delay(500);
+ await closeOpenedFile();
+ });
+
+ it('TST5303 - Open GIF [web,electron]', async () => {
+ await delay(500);
+ await searchEngine('gif');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await delay(500);
+ await closeOpenedFile();
+ });
+
+ it('TST5305 - Open WEBP [web,electron]', async () => {
+ await delay(500);
+ await searchEngine('webp');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await delay(500);
+ await closeOpenedFile();
+ });
+
+ it('TST5306 - Open SVG [web,electron]', async () => {
+ await delay(500);
+ await searchEngine('svg');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await delay(500);
+ await closeOpenedFile();
+ });
+
+ it('TST5307 - Open PNG [web,electron]', async () => {
+ await delay(500);
+ await searchEngine('png');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await delay(500);
+ await closeOpenedFile();
+ });
+
+ it('TST5308 - Open PSD [web,electron]', async () => {
+ await delay(500);
+ await searchEngine('psd');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await delay(500);
+ await closeOpenedFile();
+ });
+
+ it('TST5309 - Open TIFF [web,electron]', async () => {
+ await delay(500);
+ await searchEngine('tiff');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await delay(500);
+ await closeOpenedFile();
+
+ // TODO Open and close About dialog
+
+ // const openViewerMenu = await global.client('#viewerMainMenuButton');
+ // await openViewerMenu.waitForDisplayed();
+ // await openViewerMenu.click();
+ // await delay(555500);
+ // await aboutDialogExt();
+ });
+});
diff --git a/tests/e2e/viewer-markdown.e2e.js b/tests/e2e/viewer-markdown.e2e.js
new file mode 100644
index 000000000..c91ca69c4
--- /dev/null
+++ b/tests/e2e/viewer-markdown.e2e.js
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2016-present - TagSpaces UG (Haftungsbeschraenkt). All rights reserved.
+ */
+import { delay, clearLocalStorage } from './hook';
+import {
+ createLocation,
+ openLocation,
+ defaultLocationPath,
+ defaultLocationName,
+ closeFileProperties,
+ createMinioLocation
+} from './location.helpers';
+import { closeOpenedFile } from './general.helpers';
+import { searchEngine } from './search.spec';
+
+export const firstFile = '/span';
+export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';
+
+// export async function aboutDialogExt(title, ext) {
+// await delay(500);
+// // should switch focus to iFrame
+// const switchFocus = await global.client.$('#viewer').frame(0);
+// // await global.client.waitForExist('#viewer').frame(0);
+// await switchFocus.waitForDisplayed();
+// await switchFocus.click();
+// const viewMainMenuButton = await global.client.$('#viewerMainMenuButton');
+// await viewMainMenuButton.waitForDisplayed();
+// await viewMainMenuButton.click();
+// await delay(500);
+// await global.client.waitForVisible('#aboutButton').click('#aboutButton');
+// await delay(1500);
+// const getTitle = await global.client
+// .waitForVisible('h4=' + title)
+// .getText('h4=' + title);
+// // should eventually equals('About HTML Viewer');
+// expect(getTitle).toBe(title);
+// await delay(1500);
+// await global.client
+// .waitForVisible('#closeAboutDialogButton')
+// .click('#closeAboutDialogButton');
+// }
+
+describe('TST54 - Markdown viewer [electron]', () => {
+ beforeEach(async () => {
+ await clearLocalStorage();
+ if (global.isMinio) {
+ await createMinioLocation('', defaultLocationName, true);
+ } else {
+ await createLocation(defaultLocationPath, defaultLocationName, true);
+ }
+ await openLocation(defaultLocationName);
+ await closeFileProperties();
+ });
+
+ it('TST5401 - Open MD [electron]', async () => {
+ await delay(500);
+ await searchEngine('md');
+ await delay(500);
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await file.waitForDisplayed();
+ await file.doubleClick();
+ await delay(500);
+ await closeOpenedFile();
+ });
+});