Skip to content

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

Add e2e tests for file & folder properties (#1275)

Stanimir7c0392e1e227
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsx
index 11b13c58d..b6ade41cc 100644
--- a/app/components/EntryContainer.tsx
+++ b/app/components/EntryContainer.tsx
@@ -765,6 +765,7 @@ const EntryContainer = (props: Props) => {
) */}
{!props.isReadOnlyMode && (
<IconButton
+ data-tid="deleteEntryTID"
title={i18n.t('core:deleteEntry')}
aria-label={i18n.t('core:deleteEntry')}
onClick={() => setDeleteEntryModalOpened(true)}
@@ -773,6 +774,7 @@ const EntryContainer = (props: Props) => {
</IconButton>
)}
<IconButton
+ data-tid="reloadFileTID"
title={i18n.t('core:reloadFile')}
aria-label={i18n.t('core:reloadFile')}
onClick={reloadDocument}
@@ -780,6 +782,7 @@ const EntryContainer = (props: Props) => {
<RefreshIcon />
</IconButton>
<IconButton
+ data-tid="openInFullWidthTID"
title={i18n.t('core:openInFullWidth')}
aria-label={i18n.t('core:openInFullWidth')}
onClick={props.toggleEntryFullWidth}
@@ -962,91 +965,99 @@ const EntryContainer = (props: Props) => {
// reloadDocument: settings.keyBindings.reloadDocument,
}}
>
- <ConfirmDialog
- open={isSaveBeforeCloseConfirmDialogOpened}
- onClose={() => {
- setSaveBeforeCloseConfirmDialogOpened(false);
- }}
- title={i18n.t('core:confirm')}
- content={i18n.t('core:saveFileBeforeClosingFile')}
- confirmCallback={result => {
- if (result) {
- startSavingFile();
- } else {
- closeFile();
+ {isSaveBeforeCloseConfirmDialogOpened && (
+ <ConfirmDialog
+ open={isSaveBeforeCloseConfirmDialogOpened}
+ onClose={() => {
setSaveBeforeCloseConfirmDialogOpened(false);
- }
- }}
- cancelDialogTID="cancelSaveBeforeCloseDialog"
- confirmDialogTID="confirmSaveBeforeCloseDialog"
- confirmDialogContentTID="confirmDialogContent"
- />
- <ConfirmDialog
- open={isSaveBeforeReloadConfirmDialogOpened}
- onClose={() => {
- setSaveBeforeReloadConfirmDialogOpened(false);
- }}
- title={i18n.t('core:confirm')}
- content="File was modified, do you want to save the changes?"
- confirmCallback={result => {
- if (result) {
- setSaveBeforeReloadConfirmDialogOpened(false);
- startSavingFile();
- } else {
- // isChanged = false;
- // shouldReload = true;
+ }}
+ title={i18n.t('core:confirm')}
+ content={i18n.t('core:saveFileBeforeClosingFile')}
+ confirmCallback={result => {
+ if (result) {
+ startSavingFile();
+ } else {
+ closeFile();
+ setSaveBeforeCloseConfirmDialogOpened(false);
+ }
+ }}
+ cancelDialogTID="cancelSaveBeforeCloseDialog"
+ confirmDialogTID="confirmSaveBeforeCloseDialog"
+ confirmDialogContentTID="confirmDialogContent"
+ />
+ )}
+ {isSaveBeforeReloadConfirmDialogOpened && (
+ <ConfirmDialog
+ open={isSaveBeforeReloadConfirmDialogOpened}
+ onClose={() => {
setSaveBeforeReloadConfirmDialogOpened(false);
- props.updateOpenedFile(openedFile.path, {
- ...openedFile,
- editMode: false,
- changed: false,
- shouldReload: true
- });
+ }}
+ title={i18n.t('core:confirm')}
+ content="File was modified, do you want to save the changes?"
+ confirmCallback={result => {
+ if (result) {
+ setSaveBeforeReloadConfirmDialogOpened(false);
+ startSavingFile();
+ } else {
+ // isChanged = false;
+ // shouldReload = true;
+ setSaveBeforeReloadConfirmDialogOpened(false);
+ props.updateOpenedFile(openedFile.path, {
+ ...openedFile,
+ editMode: false,
+ changed: false,
+ shouldReload: true
+ });
+ }
+ }}
+ cancelDialogTID="cancelSaveBeforeCloseDialog"
+ confirmDialogTID="confirmSaveBeforeCloseDialog"
+ confirmDialogContentTID="confirmDialogContent"
+ />
+ )}
+ {isDeleteEntryModalOpened && (
+ <ConfirmDialog
+ open={isDeleteEntryModalOpened}
+ onClose={() => {
+ setDeleteEntryModalOpened(false);
+ }}
+ title={
+ openedFile.isFile
+ ? i18n.t('core:deleteConfirmationTitle')
+ : i18n.t('core:deleteDirectory')
}
- }}
- cancelDialogTID="cancelSaveBeforeCloseDialog"
- confirmDialogTID="confirmSaveBeforeCloseDialog"
- confirmDialogContentTID="confirmDialogContent"
- />
- <ConfirmDialog
- open={isDeleteEntryModalOpened}
- onClose={() => {
- setDeleteEntryModalOpened(false);
- }}
- title={
- openedFile.isFile
- ? i18n.t('core:deleteConfirmationTitle')
- : i18n.t('core:deleteDirectory')
- }
- content={
- openedFile.isFile
- ? i18n.t('core:doYouWantToDeleteFile')
- : i18n.t('core:deleteDirectoryContentConfirm', {
- dirPath: openedFile.path
- ? extractDirectoryName(
- openedFile.path,
- PlatformIO.getDirSeparator()
- )
- : ''
- })
- }
- confirmCallback={result => {
- if (result) {
- props.deleteFile(openedFile.path);
+ content={
+ openedFile.isFile
+ ? i18n.t('core:doYouWantToDeleteFile')
+ : i18n.t('core:deleteDirectoryContentConfirm', {
+ dirPath: openedFile.path
+ ? extractDirectoryName(
+ openedFile.path,
+ PlatformIO.getDirSeparator()
+ )
+ : ''
+ })
}
- }}
- cancelDialogTID="cancelSaveBeforeCloseDialog"
- confirmDialogTID="confirmSaveBeforeCloseDialog"
- confirmDialogContentTID="confirmDialogContent"
- />
- <AddRemoveTagsDialog
- open={isEditTagsModalOpened}
- onClose={() => setEditTagsModalOpened(false)}
- addTags={props.addTags}
- removeTags={props.removeTags}
- removeAllTags={props.removeAllTags}
- selectedEntries={openedFile ? [openedFile] : []}
- />
+ confirmCallback={result => {
+ if (result) {
+ props.deleteFile(openedFile.path);
+ }
+ }}
+ cancelDialogTID="cancelSaveBeforeCloseDialog"
+ confirmDialogTID="confirmSaveBeforeCloseDialog"
+ confirmDialogContentTID="confirmDialogContent"
+ />
+ )}
+ {isEditTagsModalOpened && (
+ <AddRemoveTagsDialog
+ open={isEditTagsModalOpened}
+ onClose={() => setEditTagsModalOpened(false)}
+ addTags={props.addTags}
+ removeTags={props.removeTags}
+ removeAllTags={props.removeAllTags}
+ selectedEntries={openedFile ? [openedFile] : []}
+ />
+ )}
<a href="#" id="downloadFile">
&nbsp;
</a>
@@ -1240,6 +1251,7 @@ const EntryContainer = (props: Props) => {
<div ref={fileViewerContainer} className={classes.fileContent}>
{isFullscreen && (
<Fab
+ data-tid="fullscreenTID"
color="primary"
style={{
position: 'absolute',
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index eefa7bc94..7accdfef9 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -681,6 +681,7 @@ const EntryProperties = (props: Props) => {
{editName !== undefined ? (
<div>
<Button
+ data-tid="cancelRenameEntryTID"
color="primary"
className={classes.button}
onClick={deactivateEditNameField}
@@ -688,6 +689,7 @@ const EntryProperties = (props: Props) => {
{i18n.t('core:cancel')}
</Button>
<Button
+ data-tid="confirmRenameEntryTID"
color="primary"
className={classes.button}
onClick={renameEntry}
@@ -697,6 +699,7 @@ const EntryProperties = (props: Props) => {
</div>
) : (
<Button
+ data-tid="startRenameEntryTID"
color="primary"
className={classes.button}
onClick={activateEditNameField}
diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsx
index f82213c12..081f09cff 100644
--- a/app/components/FolderContainer.tsx
+++ b/app/components/FolderContainer.tsx
@@ -459,7 +459,7 @@ const FolderContainer = (props: Props) => {
' entries.';
}
return (
- <div>
+ <div data-tid="folderContainerTID">
<div className={classes.mainPanel}>
<div className={classes.topPanel}>
<div className={classes.toolbar}>
diff --git a/app/components/Search.tsx b/app/components/Search.tsx
index 9183fd67d..08009c9ef 100644
--- a/app/components/Search.tsx
+++ b/app/components/Search.tsx
@@ -452,7 +452,12 @@ const Search = React.memo((props: Props) => {
title={i18n.t('core:searchWordsWithInterval')}
endAdornment={
<InputAdornment position="end">
- <IconButton onClick={clearSearch} size="small" edge="end">
+ <IconButton
+ id="clearSearchID"
+ onClick={clearSearch}
+ size="small"
+ edge="end"
+ >
<ClearSearchIcon />
</IconButton>
</InputAdornment>
@@ -491,6 +496,7 @@ const Search = React.memo((props: Props) => {
title={i18n.t('core:enableIndexingBySearch')}
control={
<Switch
+ data-tid="forceIndexingTID"
checked={forceIndexing}
onChange={() => setForceIndexing(!forceIndexing)}
name="forceIndexing"
diff --git a/tests/e2e/file.properties.helpers.js b/tests/e2e/file.properties.helpers.js
new file mode 100644
index 000000000..bd156d5bb
--- /dev/null
+++ b/tests/e2e/file.properties.helpers.js
@@ -0,0 +1,48 @@
+/* Copyright (c) 2020-present - TagSpaces UG (Haftungsbeschraenkt). All rights reserved. */
+
+import { addInputKeys, removeTagFromTagMenu } from './general.helpers';
+import { getPropertiesTags } from './location.helpers';
+
+/**
+ * Add and then Remove tags from file/folder Properties (open Properties first)
+ * @param tagNames
+ * @param options
+ * @returns {Promise<void>}
+ * @constructor
+ */
+export async function AddRemovePropertiesTags(
+ tagNames = ['test-props-tag'], // TODO fix camelCase tag name
+ options = { add: true, remove: true }
+) {
+ if (options.add) {
+ for (let i = 0; i < tagNames.length; i++) {
+ const tagName = tagNames[i];
+ const propsTags = await getPropertiesTags();
+ expect(propsTags.includes(tagName)).toBe(false);
+ await addInputKeys('PropertiesTagsSelectTID', tagName);
+ await global.client.keys('Enter');
+ await global.client.pause(500);
+ const propsNewTags = await getPropertiesTags();
+ expect(propsNewTags.includes(tagName)).toBe(true);
+ }
+ }
+
+ if (options.remove) {
+ for (let i = 0; i < tagNames.length; i++) {
+ const tagName = tagNames[i];
+ await removeTagFromTagMenu(tagName);
+ await global.client.pause(500);
+ const propsNewTags = await getPropertiesTags();
+ expect(propsNewTags.includes(tagName)).toBe(false);
+ }
+ }
+}
+
+export async function getPropertiesFileName() {
+ const propsFileNameInput = await global.client.$(
+ '[data-tid=fileNameProperties] input'
+ );
+ await propsFileNameInput.waitForDisplayed({ timeout: 10000 });
+ const fileName = await propsFileNameInput.getValue();
+ return fileName.replace(/ *\[[^\]]*]/, '');
+}
diff --git a/tests/e2e/fileopener.e2e.js b/tests/e2e/fileopener.e2e.js
index c6ff073a7..333c94990 100644
--- a/tests/e2e/fileopener.e2e.js
+++ b/tests/e2e/fileopener.e2e.js
@@ -3,14 +3,29 @@ import {
createLocation,
createMinioLocation,
defaultLocationName,
- defaultLocationPath,
- getPropertiesTags
+ defaultLocationPath
} from './location.helpers';
-import { addInputKeys, clickOn } from './general.helpers';
+import {
+ clickOn,
+ createTxtFile,
+ expectElementExist,
+ getGridFileName,
+ selectorFile,
+ setInputKeys,
+ setSettings,
+ waitForNotification
+} from './general.helpers';
+import {
+ AddRemovePropertiesTags,
+ getPropertiesFileName
+} from './file.properties.helpers';
import { searchEngine } from './search.spec';
-import { firstFile, perspectiveGridTable } from './test-utils.spec';
-
-const testTagName = 'test-tag'; // TODO fix camelCase tag name
+import {
+ firstFile,
+ firstFolder,
+ openContextEntryMenu,
+ perspectiveGridTable
+} from './test-utils.spec';
describe('TST08 - File / folder properties', () => {
beforeEach(async () => {
@@ -25,32 +40,186 @@ describe('TST08 - File / folder properties', () => {
await closeFileProperties();
});
+ it('TST0801 - Arrow keys select next/prev file (keybindings) [TST0801,web,minio,electron]', async () => {
+ const firstFileName = await getGridFileName(0);
+
+ // open fileProperties
+ await clickOn(perspectiveGridTable + firstFile);
+ //Toggle Properties
+ await clickOn('[data-tid=fileContainerToggleProperties]');
+
+ const propsFileName = await getPropertiesFileName();
+ expect(firstFileName).toBe(propsFileName);
+
+ await global.client.keys('ArrowDown');
+ const propsNextFileName = await getPropertiesFileName();
+
+ const secondFileName = await getGridFileName(1);
+ expect(secondFileName).toBe(propsNextFileName);
+
+ await global.client.keys('ArrowUp');
+ const propsPrevFileName = await getPropertiesFileName();
+ expect(propsPrevFileName).toBe(propsFileName);
+ });
+
+ it('TST0802 - Open next file buttons [TST0802,web,minio,electron]', async () => {
+ const firstFileName = await getGridFileName(0);
+
+ // open fileProperties
+ await clickOn(perspectiveGridTable + firstFile);
+ //Toggle Properties
+ await clickOn('[data-tid=fileContainerToggleProperties]');
+
+ const propsFileName = await getPropertiesFileName();
+ expect(firstFileName).toBe(propsFileName);
+
+ await clickOn('[data-tid=fileContainerNextFile]');
+ const propsNextFileName = await getPropertiesFileName();
+
+ const secondFileName = await getGridFileName(1);
+ expect(secondFileName).toBe(propsNextFileName);
+ });
+
+ it('TST0803 - Open previous files buttons [TST0803,web,minio,electron]', async () => {
+ const firstFileName = await getGridFileName(0);
+
+ // open fileProperties
+ await clickOn(perspectiveGridTable + firstFile);
+ //Toggle Properties
+ await clickOn('[data-tid=fileContainerToggleProperties]');
+
+ const propsFileName = await getPropertiesFileName();
+ expect(firstFileName).toBe(propsFileName);
+
+ await clickOn('[data-tid=fileContainerPrevFile]');
+ const propsNextFileName = await getPropertiesFileName();
+
+ const lastFileName = await getGridFileName(-1);
+ expect(lastFileName).toBe(propsNextFileName);
+ });
+
+ // TODO the last button full width is not visible (maybe its need to add scroll)
+ it('TST0804 - Open file in full width [TST0804]', async () => {
+ // open fileProperties
+ await clickOn(perspectiveGridTable + firstFile);
+ await global.client.pause(500);
+ await clickOn('[data-tid=openInFullWidthTID]'); // dummy click -first click in openInFullWidthTID dont work
+ await clickOn('[data-tid=openInFullWidthTID]');
+ await expectElementExist('[data-tid=folderContainerTID]', false);
+ });
+
+ it('TST0805 - Rename opened file [TST0805,web,minio,electron]', async () => {
+ const newTile = 'fileRenamed.txt';
+ await searchEngine('txt');
+ // open fileProperties
+ await clickOn(perspectiveGridTable + firstFile);
+ //Toggle Properties
+ await clickOn('[data-tid=fileContainerToggleProperties]');
+
+ const propsFileName = await getPropertiesFileName();
+ await clickOn('[data-tid=startRenameEntryTID]');
+ await setInputKeys('fileNameProperties', newTile);
+ await clickOn('[data-tid=confirmRenameEntryTID]');
+ await waitForNotification();
+ const propsNewFileName = await getPropertiesFileName();
+ expect(propsFileName).not.toBe(propsNewFileName);
+
+ //turn fileName back
+ await clickOn('[data-tid=startRenameEntryTID]');
+ await setInputKeys('fileNameProperties', propsFileName);
+ await clickOn('[data-tid=confirmRenameEntryTID]');
+ await waitForNotification();
+ const propsOldFileName = await getPropertiesFileName();
+ expect(propsOldFileName).toBe(propsFileName);
+ });
+
+ it('TST0807 - Rename opened folder [TST0807,web,minio,electron]', async () => {
+ const newTile = 'folderRenamed';
+ // open folderProperties
+ await openContextEntryMenu(
+ perspectiveGridTable + firstFolder,
+ 'showProperties'
+ );
+
+ const propsFolderName = await getPropertiesFileName();
+ await clickOn('[data-tid=startRenameEntryTID]');
+ await setInputKeys('fileNameProperties', newTile);
+ await clickOn('[data-tid=confirmRenameEntryTID]');
+ await waitForNotification();
+ const propsNewFolderName = await getPropertiesFileName();
+ expect(propsFolderName).not.toBe(propsNewFolderName);
+
+ //turn folderName back
+ await clickOn('[data-tid=startRenameEntryTID]');
+ await setInputKeys('fileNameProperties', propsFolderName);
+ await clickOn('[data-tid=confirmRenameEntryTID]');
+ await waitForNotification();
+ const propsOldFileName = await getPropertiesFileName();
+ expect(propsOldFileName).toBe(propsFolderName);
+ });
+
it('TST0808 - Add and remove tags to a file (file names) [TST0808,web,minio,electron]', async () => {
await searchEngine('bmp');
+ // open fileProperties
+ await clickOn(perspectiveGridTable + firstFile);
+ //Toggle Properties
+ await clickOn('[data-tid=fileContainerToggleProperties]');
+ await AddRemovePropertiesTags(['test-tag1', 'test-tag2']);
+ });
+
+ it('TST0809 - Add and remove tag to a file (sidecar files) [TST0809,web,minio,electron]', async () => {
+ await setSettings('[data-tid=settingsSetPersistTagsInSidecarFile]');
+ await searchEngine('bmp');
// open fileProperties
await clickOn(perspectiveGridTable + firstFile);
//Toggle Properties
await clickOn('[data-tid=fileContainerToggleProperties]');
+ await AddRemovePropertiesTags(['test-tag1', 'test-tag2']);
+ });
- const propsTags = await getPropertiesTags();
+ it('TST3002 - Add and remove tag to a folder [TST3002,web,minio,electron]', async () => {
+ await openContextEntryMenu(
+ perspectiveGridTable + firstFolder,
+ 'showProperties'
+ );
+ await AddRemovePropertiesTags(['test-tag1', 'test-tag2']);
+ });
- expect(propsTags.includes(testTagName)).toBe(false);
+ it('TST0812 - Reload file [TST0812,web,minio,electron]', async () => {
+ // open fileProperties
+ await clickOn(perspectiveGridTable + firstFile);
+ //Toggle Properties
+ await clickOn('[data-tid=fileContainerToggleProperties]');
+ await clickOn('[data-tid=reloadFileTID]');
+ // TODO externally change the file to check if its reloaded
+ });
- await addInputKeys('PropertiesTagsSelectTID', testTagName);
- await global.client.keys('Enter');
- await global.client.pause(500);
- let propsNewTags = await getPropertiesTags();
+ it('TST0813 - Delete file [TST0813,web,minio,electron]', async () => {
+ await createTxtFile();
+ await searchEngine('note');
- expect(propsNewTags.includes(testTagName)).toBe(true);
+ await expectElementExist(selectorFile, true);
- await clickOn('[data-tid=tagMoreButton_' + testTagName + ']');
- await global.client.pause(500);
- await clickOn('[data-tid=deleteTagMenu]');
- await global.client.pause(500);
- await clickOn('[data-tid=confirmRemoveTagFromFile]');
- await global.client.pause(500);
- propsNewTags = await getPropertiesTags();
- expect(propsNewTags.includes(testTagName)).toBe(false);
+ // open fileProperties
+ await clickOn(selectorFile);
+ //Toggle Properties
+ await clickOn('[data-tid=fileContainerToggleProperties]');
+
+ const propsFileName = await getPropertiesFileName();
+ await clickOn('[data-tid=deleteEntryTID]');
+ await clickOn('[data-tid=confirmSaveBeforeCloseDialog]');
+ await waitForNotification();
+ const firstFileName = await getGridFileName(0);
+ expect(propsFileName).not.toBe(firstFileName);
+ });
+
+ it('TST0814 - Open file fullscreen and exit with close button [TST0813,web,minio,electron]', async () => {
+ // open fileProperties
+ await clickOn(perspectiveGridTable + firstFile);
+ await clickOn('[data-tid=fileContainerSwitchToFullScreen]');
+ await expectElementExist('[data-tid=fullscreenTID]', true);
+ await clickOn('[data-tid=fullscreenTID]');
+ await expectElementExist('[data-tid=fullscreenTID]', false);
});
});
diff --git a/tests/e2e/folder.e2e.js b/tests/e2e/folder.e2e.js
index 4b7198a54..380808de1 100644
--- a/tests/e2e/folder.e2e.js
+++ b/tests/e2e/folder.e2e.js
@@ -11,11 +11,11 @@ import {
import {
reloadDirectory,
openEntry,
- disableTrashBin,
createNewDirectory,
deleteDirectory,
clickOn,
- expectElementExist
+ expectElementExist,
+ setSettings
} from './general.helpers';
import { renameFolder } from './test-utils.spec';
@@ -75,7 +75,7 @@ describe('TST01 - Folder management [electron]', () => {
});
it('TST0104 - Delete empty folder [TST0104,electron]', async () => {
- await disableTrashBin();
+ await setSettings('[data-tid=settingsSetUseTrashCan]');
await global.client.pause(500);
const testFolder = await createNewDirectory();
await expectElementExist('[data-tid=fsEntryName_' + testFolder + ']');
diff --git a/tests/e2e/general.e2e.js b/tests/e2e/general.e2e.js
index 577ad5b57..923717e61 100644
--- a/tests/e2e/general.e2e.js
+++ b/tests/e2e/general.e2e.js
@@ -23,7 +23,7 @@ import {
clickOn,
expectElementExist,
selectorFile,
- settingsSetShowUnixHiddenEntries,
+ setSettings,
doubleClickOn
} from './general.helpers';
import { searchEngine } from './search.spec';
@@ -125,7 +125,7 @@ describe('TST51 - Perspective Grid [general]', () => {
it('TST0510 - Generate thumbnail from Images [electron]', async () => {
// let filename = 'sample.jpg';
// activate 'Show Hidden File' functionality in the general settings
- await settingsSetShowUnixHiddenEntries();
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
await global.client.pause(500);
await reloadDirectory();
await global.client.pause(500);
@@ -145,7 +145,7 @@ describe('TST51 - Perspective Grid [general]', () => {
it('TST0511 - Generate thumbnail from Videos [electron]', async () => {
// activate 'Show Hidden File' functionality in the general settings
- await settingsSetShowUnixHiddenEntries();
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
await global.client.pause(500);
await reloadDirectory();
await global.client.pause(500);
@@ -159,7 +159,7 @@ describe('TST51 - Perspective Grid [general]', () => {
it('TST0516 - Generate thumbnail from PDF [electron]', async () => {
// activate 'Show Hidden File' functionality in the general settings
- await settingsSetShowUnixHiddenEntries();
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
await global.client.pause(500);
await reloadDirectory();
await global.client.pause(500);
@@ -173,7 +173,7 @@ describe('TST51 - Perspective Grid [general]', () => {
it('TST0517 - Generate thumbnail from ODT [electron]', async () => {
// activate 'Show Hidden File' functionality in the general settings
- await settingsSetShowUnixHiddenEntries();
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
await global.client.pause(500);
await reloadDirectory();
await global.client.pause(500);
@@ -187,7 +187,7 @@ describe('TST51 - Perspective Grid [general]', () => {
it('TST0519 - Generate thumbnail from TIFF [electron]', async () => {
// activate 'Show Hidden File' functionality in the general settings
- await settingsSetShowUnixHiddenEntries();
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
await global.client.pause(500);
await reloadDirectory();
await global.client.pause(500);
@@ -203,7 +203,7 @@ describe('TST51 - Perspective Grid [general]', () => {
it('TST0520 - Generate thumbnail from PSD [electron]', async () => {
// activate 'Show Hidden File' functionality in the general settings
- await settingsSetShowUnixHiddenEntries();
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
await global.client.pause(500);
await reloadDirectory();
await global.client.pause(500);
@@ -219,7 +219,7 @@ describe('TST51 - Perspective Grid [general]', () => {
it('TST0524 - Generate thumbnail from TXT [electron]', async () => {
// activate 'Show Hidden File' functionality in the general settings
- await settingsSetShowUnixHiddenEntries();
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
await global.client.pause(500);
await reloadDirectory();
await global.client.pause(500);
@@ -235,7 +235,7 @@ describe('TST51 - Perspective Grid [general]', () => {
it('TST0523 - Generate thumbnail from HTML [electron]', async () => {
// activate 'Show Hidden File' functionality in the general settings
- await settingsSetShowUnixHiddenEntries();
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
await global.client.pause(500);
await reloadDirectory();
await global.client.pause(500);
@@ -251,7 +251,7 @@ describe('TST51 - Perspective Grid [general]', () => {
it('TST0522 - Generate thumbnail from URL [electron]', async () => {
// activate 'Show Hidden File' functionality in the general settings
- await settingsSetShowUnixHiddenEntries();
+ await setSettings('[data-tid=settingsSetShowUnixHiddenEntries]');
await global.client.pause(500);
await reloadDirectory();
await global.client.pause(500);
diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.js
index a78cc53c0..f6b723f1b 100644
--- a/tests/e2e/general.helpers.js
+++ b/tests/e2e/general.helpers.js
@@ -150,14 +150,15 @@ export async function setInputKeys(tid, value) {
);
// await elemInput.clearValue();
- await clearInputValue(elemInput);
+ const oldValue = await clearInputValue(elemInput);
await element.click();
await elemInput.keys(value);
+ return oldValue;
}
export async function clearInputValue(inputElement) {
- const value = await inputElement.getValue();
- const count = value.length;
+ const oldValue = await inputElement.getValue();
+ const count = oldValue.length;
for (let i = 0; i < count; i++) {
const value = await inputElement.getValue();
if (value === '') {
@@ -168,6 +169,7 @@ export async function clearInputValue(inputElement) {
await global.client.keys('Delete');
await inputElement.clearValue();
}
+ return oldValue;
}
/**
@@ -311,6 +313,28 @@ export async function extractTags(selectorElement) {
return arrTags;
}
+export async function removeTagFromTagMenu(tagName) {
+ await clickOn('[data-tid=tagMoreButton_' + tagName + ']');
+ await global.client.pause(500);
+ await clickOn('[data-tid=deleteTagMenu]');
+ await global.client.pause(500);
+ await clickOn('[data-tid=confirmRemoveTagFromFile]');
+}
+
+export async function showFilesWithTag(tagName) {
+ await clickOn('[data-tid=tagMoreButton_' + tagName + ']');
+ await global.client.pause(500);
+ await clickOn('[data-tid=showFilesWithThisTag]');
+}
+
+export async function expectTagsExist(gridElement, arrTagNames, exist = true) {
+ const tags = await extractTags(gridElement);
+ for (let i = 0; i < arrTagNames.length; i++) {
+ const tagName = arrTagNames[i];
+ expect(tags.includes(tagName)).toBe(exist);
+ }
+}
+
export async function waitForNotification(tid = 'notificationTID') {
await global.client.pause(500);
// await expectElementExist('[data-tid=' + tid + ']', true, 8000);
@@ -326,10 +350,10 @@ export async function waitForNotification(tid = 'notificationTID') {
}
}
-export async function settingsSetShowUnixHiddenEntries() {
+export async function setSettings(selector) {
await clickOn('[data-tid=settings]');
await global.client.pause(500);
- await clickOn('[data-tid=settingsSetShowUnixHiddenEntries]');
+ await clickOn(selector);
await clickOn('[data-tid=closeSettingsDialog]');
}
@@ -358,13 +382,13 @@ export async function openEntry(entryName) {
await delay(500);*/
}
-export async function createNewDirectory() {
+export async function createNewDirectory(dirName = testFolder) {
await clickOn('[data-tid=folderContainerOpenDirMenu]');
await global.client.pause(100); // TODO the Menu is always in HTML
await clickOn('[data-tid=newSubDirectory]');
await global.client.pause(500);
// set new dir name
- await setInputKeys('directoryName', testFolder);
+ await setInputKeys('directoryName', dirName);
/*const directoryName = await global.client.$('[data-tid=directoryName] input');
await delay(500);
await directoryName.keys(testFolder);
@@ -377,7 +401,7 @@ export async function createNewDirectory() {
await delay(1500);
await confirmCreateNewDirectory.waitForDisplayed();
await confirmCreateNewDirectory.click();*/
- return testFolder;
+ return dirName;
}
export async function newHTMLFile() {
@@ -432,13 +456,6 @@ export async function deleteDirectory() {
await delay(500);*/
}
-export async function disableTrashBin() {
- await clickOn('[data-tid=settings]');
- await global.client.pause(500);
- await clickOn('[data-tid=settingsSetUseTrashCan]');
- await clickOn('[data-tid=closeSettingsDialog]');
-}
-
export async function returnDirectoryBack() {
await clickOn('[data-tid=gridPerspectiveOnBackButton]');
/*
diff --git a/tests/e2e/location.helpers.js b/tests/e2e/location.helpers.js
index 9f67e2481..a2a7cbc18 100644
--- a/tests/e2e/location.helpers.js
+++ b/tests/e2e/location.helpers.js
@@ -183,15 +183,6 @@ export async function getFirstFileName() {
return fileName;
}
-export async function getPropertiesFileName() {
- const propsFileNameInput = await global.client.$(
- '[data-tid=fileNameProperties] input'
- );
- await propsFileNameInput.waitForDisplayed({ timeout: 10000 });
- const fileName = await propsFileNameInput.getValue();
- return fileName.replace(/ *\[[^\]]*]/, '');
-}
-
export async function getPropertiesTags() {
const arrTags = [];
const tags = await global.client.$$(
diff --git a/tests/e2e/perspective-grid.e2e.js b/tests/e2e/perspective-grid.e2e.js
index d439ec755..aca53529e 100644
--- a/tests/e2e/perspective-grid.e2e.js
+++ b/tests/e2e/perspective-grid.e2e.js
@@ -9,33 +9,38 @@ import {
getFirstFileName,
renameFirstFile,
deleteFirstFile,
- createMinioLocation,
- getPropertiesFileName,
- getPropertiesTags
+ createMinioLocation
} from './location.helpers';
import { searchEngine } from './search.spec';
import {
openContextEntryMenu,
perspectiveGridTable,
firstFile,
- toContainTID
+ toContainTID,
+ firstFolder
} from './test-utils.spec';
import {
addInputKeys,
clickOn,
+ createNewDirectory,
createTxtFile,
- disableTrashBin,
doubleClickOn,
expectElementExist,
+ expectTagsExist,
extractTags,
getGridCellClass,
getGridFileName,
+ removeTagFromTagMenu,
selectAllFiles,
selectorFile,
selectorFolder,
- waitForNotification,
- waitUntilClassChanged
+ setInputKeys,
+ setSettings,
+ showFilesWithTag,
+ waitForNotification
} from './general.helpers';
+import { AddRemoveTagsToSelectedFiles } from './perspective-grid.helpers';
+import { getPropertiesFileName } from './file.properties.helpers';
const subFolderName = '/test-perspective-grid';
const subFolderContentExtractionPath =
@@ -61,26 +66,6 @@ describe('TST50 - Perspective Grid', () => {
await closeFileProperties();
});
- /*test('TST5113 - Show sub folders content', async () => {});*/
-
- test('TST5001 - Arrow keys select next/prev file [TST5001,web,minio,electron]', async () => {
- const firstFileName = await getGridFileName(0);
-
- // open fileProperties
- await clickOn(perspectiveGridTable + firstFile);
- //Toggle Properties
- await clickOn('[data-tid=fileContainerToggleProperties]');
-
- const propsFileName = await getPropertiesFileName();
- expect(firstFileName).toBe(propsFileName);
-
- await clickOn('[data-tid=fileContainerNextFile]');
- const propsNextFileName = await getPropertiesFileName();
-
- const secondFileName = await getGridFileName(1);
- expect(secondFileName).toBe(propsNextFileName);
- });
-
test('TST5002 - Open file with click [TST5002,web,minio,electron]', async () => {
await searchEngine('txt'); //testTestFilename);
const firstFileName = await getGridFileName(0);
@@ -124,7 +109,7 @@ describe('TST50 - Perspective Grid', () => {
expect(firstFileName).toBe('note.txt');
//cleanup
- await disableTrashBin();
+ await setSettings('[data-tid=settingsSetUseTrashCan]');
await global.client.pause(500);
await deleteFirstFile();
// firstFileName = await getGridFileName(0);
@@ -181,7 +166,15 @@ describe('TST50 - Perspective Grid', () => {
perspectiveGridTable + firstFile,
'fileMenuAddRemoveTags'
);*/
- await clickOn('[data-tid=gridPerspectiveAddRemoveTags]');
+
+ const tags = ['test-tag1', 'test-tag2'];
+ await AddRemoveTagsToSelectedFiles(tags);
+ // Select all file and check if tag exist
+ const filesList = await global.client.$$(perspectiveGridTable + firstFile);
+ for (let i = 0; i < filesList.length; i++) {
+ await expectTagsExist(filesList[i], tags, true);
+ }
+ /*await clickOn('[data-tid=gridPerspectiveAddRemoveTags]');
await addInputKeys('AddRemoveTagsSelectTID', testTagName);
await global.client.keys('Enter');
@@ -193,7 +186,7 @@ describe('TST50 - Perspective Grid', () => {
for (let i = 0; i < filesList.length; i++) {
const tags = await extractTags(filesList[i]);
expect(tags.includes(testTagName)).toBe(true);
- }
+ }*/
});
test('TST5006 - Remove tags from selected files [TST5006,web,minio,electron]', async () => {
@@ -201,7 +194,15 @@ describe('TST50 - Perspective Grid', () => {
const classSelected = await selectAllFiles(classNotSelected);
expect(classNotSelected).not.toBe(classSelected);
- await clickOn('[data-tid=gridPerspectiveAddRemoveTags]');
+ const tags = ['test-tag1', 'test-tag2'];
+ await AddRemoveTagsToSelectedFiles(tags, false);
+
+ // Select all file and check if tag exist
+ const filesList = await global.client.$$(perspectiveGridTable + firstFile);
+ for (let i = 0; i < filesList.length; i++) {
+ await expectTagsExist(filesList[i], tags, false);
+ }
+ /*await clickOn('[data-tid=gridPerspectiveAddRemoveTags]');
await addInputKeys('AddRemoveTagsSelectTID', testTagName);
await global.client.keys('Enter');
@@ -213,9 +214,79 @@ describe('TST50 - Perspective Grid', () => {
for (let i = 0; i < filesList.length; i++) {
const tags = await extractTags(filesList[i]);
expect(tags.includes(testTagName)).toBe(false);
+ }*/
+ });
+
+ test('TST5007 - Remove all tags from selected files [TST5007,web,minio,electron]', async () => {
+ const classNotSelected = await getGridCellClass(0);
+ const classSelected = await selectAllFiles(classNotSelected);
+ expect(classNotSelected).not.toBe(classSelected);
+
+ await clickOn('[data-tid=gridPerspectiveAddRemoveTags]');
+
+ await clickOn('[data-tid=cleanTagsMultipleEntries]');
+ // await global.client.pause(500);
+ await waitForNotification();
+ const filesList = await global.client.$$(perspectiveGridTable + firstFile);
+ for (let i = 0; i < filesList.length; i++) {
+ const tags = await extractTags(filesList[i]);
+ expect(tags.length).toBe(0);
}
});
+ test('TST5008 - Copy file [TST5008,web,minio,electron]', async () => {
+ await searchEngine('bmp');
+
+ // select file
+ await clickOn(perspectiveGridTable + firstFile);
+ // open Copy File Dialog
+ await clickOn('[data-tid=gridPerspectiveCopySelectedFiles]');
+ await addInputKeys(
+ 'targetPathInput',
+ defaultLocationPath + '/empty_folder'
+ );
+ await clickOn('[data-tid=confirmCopyFiles]');
+ await waitForNotification();
+ await clickOn('#clearSearchID');
+ await global.client.pause(500);
+ await doubleClickOn(perspectiveGridTable + firstFolder);
+ const firstFileName = await getGridFileName(0);
+ expect(firstFileName).toBe('sample.bmp');
+ });
+
+ test('TST5010 - Move file [TST5010,web,minio,electron]', async () => {
+ await searchEngine('epub');
+
+ // select file
+ await clickOn(perspectiveGridTable + firstFile);
+ // open Copy File Dialog
+ await clickOn('[data-tid=gridPerspectiveCopySelectedFiles]');
+ await addInputKeys(
+ 'targetPathInput',
+ defaultLocationPath + '/empty_folder'
+ );
+ await clickOn('[data-tid=confirmMoveFiles]');
+ await waitForNotification();
+ await clickOn('#clearSearchID');
+ await global.client.pause(500);
+ await doubleClickOn(perspectiveGridTable + firstFolder);
+ await searchEngine('epub', { reindexing: true }); // TODO temp fix: https://trello.com/c/ZfcGGvOM/527-moved-files-is-not-indexing-not-found-in-search
+ const firstFileName = await getGridFileName(0);
+ expect(firstFileName).toBe('sample.epub');
+ });
+
+ test('TST5013 - Delete files from selection (many files) [TST5013,web,minio,electron]', async () => {
+ await doubleClickOn(perspectiveGridTable + firstFolder);
+
+ const classNotSelected = await getGridCellClass(0);
+ const classSelected = await selectAllFiles(classNotSelected);
+ expect(classNotSelected).not.toBe(classSelected);
+
+ await clickOn('[data-tid=gridPerspectiveDeleteMultipleFiles]');
+ await clickOn('[data-tid=confirmDeleteFileDialog]');
+ await waitForNotification();
+ await expectElementExist(perspectiveGridTable + firstFile, false);
+ });
/*test('TST51** - Show/Hide directories in perspective view', async () => { //TODO
await global.client.waitForVisible(
'[data-tid=gridPerspectiveToggleShowDirectories]'
@@ -293,6 +364,83 @@ describe('TST50** - Right button on a file', () => {
expect(firstFileName).toBe(undefined);*/
});
+ test('TST5019 - Rename tag in file [TST5019,web,minio,electron]', async () => {
+ await searchEngine('desktop');
+ // Select file
+ await clickOn(perspectiveGridTable + firstFile);
+ await AddRemoveTagsToSelectedFiles([testTagName], true);
+ let file = await global.client.$(perspectiveGridTable + firstFile);
+ await expectTagsExist(file, [testTagName], true);
+
+ /*await AddRemoveTagsToFile(perspectiveGridTable + firstFile, [testTagName], {
+ add: true
+ });*/
+ await clickOn('[data-tid=tagMoreButton_' + testTagName + ']');
+ await global.client.pause(500);
+ await clickOn('[data-tid=editTagDialogMenu]');
+ await setInputKeys('editTagEntryDialog_input', testTagName + '-edited');
+ await clickOn('[data-tid=confirmEditTagEntryDialog]');
+ await waitForNotification();
+
+ file = await global.client.$(perspectiveGridTable + firstFile);
+ await expectTagsExist(file, [testTagName + '-edited'], true);
+
+ //cleanup
+ await clickOn(perspectiveGridTable + firstFile);
+ await AddRemoveTagsToSelectedFiles([testTagName + '-edited'], false);
+ file = await global.client.$(perspectiveGridTable + firstFile);
+ await expectTagsExist(file, [testTagName + '-edited'], false);
+ });
+
+ test('TST5023 - Remove tag from file (tag menu) [TST5023,web,minio,electron]', async () => {
+ await searchEngine('desktop');
+ // select file
+ await clickOn(perspectiveGridTable + firstFile);
+ await AddRemoveTagsToSelectedFiles([testTagName], true);
+ let file = await global.client.$(perspectiveGridTable + firstFile);
+ await expectTagsExist(file, [testTagName], true);
+
+ await removeTagFromTagMenu(testTagName);
+ await global.client.pause(500);
+
+ file = await global.client.$(perspectiveGridTable + firstFile);
+ await expectTagsExist(file, [testTagName], false);
+ });
+
+ test('TST5024 - Show files with a given tag (tag menu) [TST5024,web,minio,electron]', async () => {
+ const classNotSelected = await getGridCellClass(0);
+ const classSelected = await selectAllFiles(classNotSelected);
+ expect(classNotSelected).not.toBe(classSelected);
+
+ await AddRemoveTagsToSelectedFiles([testTagName], true);
+ await showFilesWithTag(testTagName);
+
+ const filesList = await global.client.$$(perspectiveGridTable + firstFile);
+ for (let i = 0; i < filesList.length; i++) {
+ await expectTagsExist(filesList[i], [testTagName], true);
+ }
+
+ // cleanup
+ await selectAllFiles(classNotSelected);
+ expect(classNotSelected).not.toBe(classSelected);
+ await AddRemoveTagsToSelectedFiles([testTagName], false);
+ });
+
+ test('TST5025 - Add / Remove tags (file menu) [TST5025,web,minio,electron]', async () => {
+ await searchEngine('desktop');
+ const tags = [testTagName, testTagName + '2'];
+ // select file
+ await clickOn(perspectiveGridTable + firstFile);
+ await AddRemoveTagsToSelectedFiles(tags, true);
+
+ const file = await global.client.$(perspectiveGridTable + firstFile);
+ await expectTagsExist(file, tags, true);
+
+ //cleanup
+ await clickOn(perspectiveGridTable + firstFile);
+ await AddRemoveTagsToSelectedFiles(tags, false);
+ });
+
test('TST5026 - Open file natively [electron]', async () => {
if (!global.isMinio) {
// Open file natively option is missing for Minio Location
@@ -331,17 +479,102 @@ describe('TST50** - Right button on a file', () => {
await cancelButton.click();
});*/
- //TODO fix electron: element not interactable
- test('TST5028 - Move / Copy file [TST5028]', async () => {
- await searchEngine('txt');
+ test('TST5028 - Move / Copy file (file menu) [TST5028,web,minio,electron]', async () => {
+ // Move file in child folder
+ await searchEngine('eml');
await openContextEntryMenu(
perspectiveGridTable + firstFile,
'fileMenuMoveCopyFile'
);
- //TODO
- await clickOn('[data-tid=closeMoveCopyDialog]');
+ await addInputKeys(
+ 'targetPathInput',
+ defaultLocationPath + '/empty_folder'
+ );
- // Check if the directories are displayed
+ await clickOn('[data-tid=confirmMoveFiles]');
+ await waitForNotification();
+ await clickOn('#clearSearchID');
+ await global.client.pause(500);
+ await doubleClickOn(perspectiveGridTable + firstFolder);
+ await searchEngine('eml', { reindexing: true }); // TODO temp fix: https://trello.com/c/ZfcGGvOM/527-moved-files-is-not-indexing-not-found-in-search
+ let firstFileName = await getGridFileName(0);
+ expect(firstFileName).toBe('sample.eml');
+
+ //Copy file in parent directory
+ await openContextEntryMenu(
+ perspectiveGridTable + firstFile,
+ 'fileMenuMoveCopyFile'
+ );
+ await addInputKeys('targetPathInput', defaultLocationPath);
+ await clickOn('[data-tid=confirmCopyFiles]');
+ await waitForNotification();
+ await clickOn('#clearSearchID');
+ await clickOn('[data-tid=gridPerspectiveOnBackButton]');
+ await global.client.pause(500);
+ await searchEngine('eml');
+ firstFileName = await getGridFileName(0);
+ expect(firstFileName).toBe('sample.eml');
+ });
+
+ test('TST5033 - Open directory (directory menu) [TST5033,web,minio,electron]', async () => {
+ await openContextEntryMenu(
+ perspectiveGridTable + firstFolder,
+ 'openDirectory'
+ );
+ const firstFileName = await getGridFileName(0);
+ expect(firstFileName).toBe('sample.eml');
+ });
+
+ test('TST5034 - Rename directory (directory menu) [TST5034,web,minio,electron]', async () => {
+ const newDirName = 'new_dir_name';
+ await openContextEntryMenu(
+ perspectiveGridTable + firstFolder,
+ 'renameDirectory'
+ );
+ const oldDirName = await setInputKeys(
+ 'renameDirectoryDialogInput',
+ newDirName
+ );
+ await clickOn('[data-tid=confirmRenameDirectory]');
+ await waitForNotification();
+
+ //turn dir name back
+ await openContextEntryMenu(
+ perspectiveGridTable + firstFolder,
+ 'renameDirectory'
+ );
+ const renamedDir = await setInputKeys(
+ 'renameDirectoryDialogInput',
+ oldDirName
+ );
+ await clickOn('[data-tid=confirmRenameDirectory]');
+ await waitForNotification();
+ expect(renamedDir).toBe(newDirName);
+ });
+
+ test('TST5035 - Delete directory (directory menu) [TST5035,web,minio,electron]', async () => {
+ await setSettings('[data-tid=settingsSetUseTrashCan]');
+ await global.client.pause(500);
+ const testFolder = await createNewDirectory('aaa');
+
+ await openContextEntryMenu(
+ perspectiveGridTable + firstFolder,
+ 'deleteDirectory'
+ );
+ await clickOn('[data-tid=confirmDeleteDirectoryDialog]');
+
+ await expectElementExist(
+ '[data-tid=fsEntryName_' + testFolder + ']',
+ false
+ );
+ });
+
+ test('TST5036 - Open directory properties (directory menu) [TST5036,web,minio,electron]', async () => {
+ await openContextEntryMenu(
+ perspectiveGridTable + firstFolder,
+ 'showProperties'
+ );
+ await expectElementExist('[data-tid=fileNameProperties]', true);
});
test('TST5037 - Show sub folders [TST5037,web,minio,electron]', async () => {
diff --git a/tests/e2e/perspective-grid.helpers.js b/tests/e2e/perspective-grid.helpers.js
new file mode 100644
index 000000000..8cb50abfa
--- /dev/null
+++ b/tests/e2e/perspective-grid.helpers.js
@@ -0,0 +1,40 @@
+import {
+ addInputKeys,
+ clickOn,
+ expectTagsExist,
+ waitForNotification
+} from './general.helpers';
+import { firstFile, perspectiveGridTable } from './test-utils.spec';
+
+/**
+ *
+ * @param tagNames
+ * @param addTag = true - add tags; false - remove tags
+ * @returns {Promise<void>}
+ * @constructor
+ */
+export async function AddRemoveTagsToSelectedFiles(
+ tagNames = ['test-tag'], // TODO fix camelCase tag name
+ addTag = true
+) {
+ await clickOn('[data-tid=gridPerspectiveAddRemoveTags]');
+
+ for (let i = 0; i < tagNames.length; i++) {
+ const tagName = tagNames[i];
+ await addInputKeys('AddRemoveTagsSelectTID', tagName);
+ await global.client.keys('Enter');
+ await global.client.pause(500);
+ }
+
+ if (addTag) {
+ await clickOn('[data-tid=addTagsMultipleEntries]');
+ } else {
+ await clickOn('[data-tid=removeTagsMultipleEntries]');
+ }
+ await waitForNotification();
+
+ /*const filesList = await global.client.$$(perspectiveGridTable + firstFile); // Selected file can be only one this check all files
+ for (let i = 0; i < filesList.length; i++) {
+ await expectTagsExist(filesList[i], tagNames, addTag);
+ }*/
+}
diff --git a/tests/e2e/search.spec.js b/tests/e2e/search.spec.js
index 531806dd0..feebc691f 100644
--- a/tests/e2e/search.spec.js
+++ b/tests/e2e/search.spec.js
@@ -13,16 +13,33 @@ export const testFileInSubDirectory = 'sample_exif';
export const testFilename = 'sample.desktop';
export const firstTagButton = '/tbody/tr[1]/td[3]/button[1]';
-export async function searchEngine(filename, tagName, resetSearchButton) {
- await clickOn('[data-tid=search]');
+/**
+ *
+ * @param filename
+ * @param options = {
+ * tagName: true
+ * resetSearchButton: true
+ * reindexing: true
+ * }
+ * @returns {Promise<void>}
+ */
+export async function searchEngine(filename, options = {}) {
+ const textQuery = await global.client.$('#textQuery');
+ if (!(await textQuery.isDisplayed())) {
+ await clickOn('[data-tid=search]');
+ }
await expectElementExist('#textQuery', true);
await setInputValue('#textQuery', filename);
- if (tagName) {
+ if (options.tagName) {
await setInputValue('#searchTags', filename);
}
- if (resetSearchButton) {
+ if (options.reindexing) {
+ await clickOn('[data-tid=forceIndexingTID]');
+ }
+
+ if (options.resetSearchButton) {
await clickOn('#resetSearchButton');
} else {
await clickOn('#searchButton');
diff --git a/tests/e2e/test-utils.spec.js b/tests/e2e/test-utils.spec.js
index 3ed57ce7a..988eef0c7 100644
--- a/tests/e2e/test-utils.spec.js
+++ b/tests/e2e/test-utils.spec.js
@@ -8,6 +8,7 @@ const unixMinio = 'minio';
const newDirectoryName = 'newDirectory';
export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';
export const firstFile = '/span';
+export const firstFolder = '/div';
export const firstFileName = '/span/div/div/div/p';
// add perspective, remove perspective, change perspective