Skip to content

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

Add move button in the path text field of the folder properties and e2e test

sytolkbb5e47aca124
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsx
index 43e44a0a7..e49b9af25 100644
--- a/app/components/EntryContainer.tsx
+++ b/app/components/EntryContainer.tsx
@@ -185,7 +185,6 @@ interface Props {
// reflectUpdateSidecarMeta: (path: string, entryMeta: Object) => void;
updateThumbnailUrl: (path: string, thumbUrl: string) => void;
// setLastSelectedEntry: (path: string) => void;
- setSelectedEntries: (selectedEntries: Array<Object>) => void;
loadDirectoryContent: (
path: string,
generateThumbnails: boolean,
@@ -1732,7 +1731,6 @@ function mapActionCreatorsToProps(dispatch) {
removeAllTags: TaggingActions.removeAllTags,
updateOpenedFile: AppActions.updateOpenedFile,
updateThumbnailUrl: AppActions.updateThumbnailUrl,
- setSelectedEntries: AppActions.setSelectedEntries,
switchLocationType: LocationActions.switchLocationType,
switchCurrentLocationType: AppActions.switchCurrentLocationType
},
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index d209bb9f2..6bfc7f36c 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -187,6 +187,7 @@ interface Props {
folderPath: string,
lastBackgroundColorChange: number
) => void;
+ setSelectedEntries: (selectedEntries: Array<TS.FileSystemEntry>) => void;
}
const defaultBackgrounds = [
@@ -414,6 +415,9 @@ function EntryProperties(props: Props) {
};
const toggleMoveCopyFilesDialog = () => {
+ props.setSelectedEntries([
+ { name: '', isFile: true, tags: [], ...currentEntry.current }
+ ]);
setMoveCopyFilesDialogOpened(!isMoveCopyFilesDialogOpened);
};
@@ -1042,12 +1046,12 @@ function EntryProperties(props: Props) {
),
endAdornment: (
<InputAdornment position="end">
- {currentEntry.current.isFile &&
- !isReadOnlyMode &&
+ {!isReadOnlyMode &&
!currentEntry.current.editMode &&
editName === undefined &&
editDescription.current === undefined && (
<Button
+ data-tid="moveCopyEntryTID"
color="primary"
onClick={toggleMoveCopyFilesDialog}
>
@@ -1484,7 +1488,8 @@ function mapActionCreatorsToProps(dispatch) {
{
switchLocationType: LocationActions.switchLocationType,
switchCurrentLocationType: AppActions.switchCurrentLocationType,
- setLastBackgroundColorChange: AppActions.setLastBackgroundColorChange
+ setLastBackgroundColorChange: AppActions.setLastBackgroundColorChange,
+ setSelectedEntries: AppActions.setSelectedEntries
},
dispatch
);
diff --git a/tests/e2e/fileopener.pw.e2e.js b/tests/e2e/fileopener.pw.e2e.js
index 7f34debd0..8fd2f46af 100644
--- a/tests/e2e/fileopener.pw.e2e.js
+++ b/tests/e2e/fileopener.pw.e2e.js
@@ -164,34 +164,6 @@ test.describe('TST08 - File folder properties', () => {
test.skip('TST0806 - Download file [manual]', async () => {});
- test('TST0807 - Rename opened folder [web,minio,electron]', async () => {
- const newTile = 'folderRenamed';
- // open folderProperties
- await openContextEntryMenu(selectorFolder, 'showProperties');
-
- const propsFolderName = await getPropertiesFileName();
- await clickOn('[data-tid=startRenameEntryTID]');
- await setInputValue('[data-tid=fileNameProperties] input', newTile);
- await clickOn('[data-tid=confirmRenameEntryTID]');
- // await waitForNotification();
- await global.client.waitForSelector(
- '[data-tid=fileNameProperties] input[value="' + newTile + '"]'
- );
- const propsNewFolderName = await getPropertiesFileName();
- expect(propsFolderName).not.toBe(propsNewFolderName);
-
- //turn folderName back
- await clickOn('[data-tid=startRenameEntryTID]');
- await setInputValue('[data-tid=fileNameProperties] input', propsFolderName);
- await clickOn('[data-tid=confirmRenameEntryTID]');
- // await waitForNotification();
- await global.client.waitForSelector(
- '[data-tid=fileNameProperties] input[value="' + propsFolderName + '"]'
- );
- const propsOldFileName = await getPropertiesFileName();
- expect(propsOldFileName).toBe(propsFolderName);
- });
-
test('TST0808 - Add and remove tags to a file (file names) [web,minio,electron]', async () => {
// await searchEngine('bmp');
// open fileProperties
diff --git a/tests/e2e/folderprops.pw.e2e.js b/tests/e2e/folderprops.pw.e2e.js
index d16a6f1ed..044c47430 100644
--- a/tests/e2e/folderprops.pw.e2e.js
+++ b/tests/e2e/folderprops.pw.e2e.js
@@ -12,12 +12,18 @@ import {
clickOn,
expectElementExist,
takeScreenshot,
- getGridFileSelector
+ getGridFileSelector,
+ selectorFolder,
+ setInputValue,
+ createNewDirectory
} from './general.helpers';
import { openContextEntryMenu } from './test-utils';
import { createFile, startTestingApp, stopApp, testDataRefresh } from './hook';
import { clearDataStorage } from './welcome.helpers';
-import { getPropertiesTags } from './file.properties.helpers';
+import {
+ getPropertiesFileName,
+ getPropertiesTags
+} from './file.properties.helpers';
test.beforeAll(async () => {
await startTestingApp('extconfig.js');
@@ -90,6 +96,53 @@ test.describe('TST02 - Folder properties', () => {
'[data-tid=descriptionTID] .milkdown'
);
const description = await editor.innerText();
- expect(description.replace(/[\s*#]/g, '')).toMatch(tsmJson.description.replace(/[\s*#]/g, ''));
+ expect(description.replace(/[\s*#]/g, '')).toMatch(
+ tsmJson.description.replace(/[\s*#]/g, '')
+ );
+ });
+
+ test('TST0205 - Delete folder from toolbar [web,minio,electron]', async () => {
+ await clickOn('[data-tid=deleteFolderTID]');
+ await clickOn('[data-tid=confirmSaveBeforeCloseDialog]');
+ await expectElementExist('OpenedTIDempty_folder', false, 5000);
+ await expectElementExist(getGridFileSelector('empty_folder'), false, 5000);
+ await testDataRefresh();
+ });
+
+ test('TST0206 - Rename folder [web,minio,electron]', async () => {
+ const newTile = 'folderRenamed';
+
+ const propsFolderName = await getPropertiesFileName();
+ await clickOn('[data-tid=startRenameEntryTID]');
+ await setInputValue('[data-tid=fileNameProperties] input', newTile);
+ await clickOn('[data-tid=confirmRenameEntryTID]');
+ // await waitForNotification();
+ await global.client.waitForSelector(
+ '[data-tid=fileNameProperties] input[value="' + newTile + '"]'
+ );
+ const propsNewFolderName = await getPropertiesFileName();
+ expect(propsFolderName).not.toBe(propsNewFolderName);
+
+ //turn folderName back
+ await clickOn('[data-tid=startRenameEntryTID]');
+ await setInputValue('[data-tid=fileNameProperties] input', propsFolderName);
+ await clickOn('[data-tid=confirmRenameEntryTID]');
+ // await waitForNotification();
+ await global.client.waitForSelector(
+ '[data-tid=fileNameProperties] input[value="' + propsFolderName + '"]'
+ );
+ const propsOldFileName = await getPropertiesFileName();
+ expect(propsOldFileName).toEqual(propsFolderName);
+ });
+
+ test('TST0207 - Move folder [web,minio,electron]', async () => {
+ const newFolder = await createNewDirectory('targetFolder');
+ await clickOn('[data-tid=moveCopyEntryTID]');
+ await clickOn('[data-tid=MoveTarget' + newFolder + ']');
+ await clickOn('[data-tid=confirmMoveFiles]');
+ await clickOn('[data-tid=uploadCloseAndClearTID]');
+ await expectElementExist(getGridFileSelector('empty_folder'), false, 5000);
+ await global.client.dblclick('[data-tid=fsEntryName_' + newFolder + ']');
+ await expectElementExist(getGridFileSelector('empty_folder'), true, 5000);
});
});
diff --git a/tests/e2e/search.pw.e2e.js b/tests/e2e/search.pw.e2e.js
index c4f978eb4..7d58e60d6 100644
--- a/tests/e2e/search.pw.e2e.js
+++ b/tests/e2e/search.pw.e2e.js
@@ -134,17 +134,15 @@ test.describe('TST06 - Test Search in file structure:', () => {
});*/
test('TST0621 - Search actions - open location [web,electron]', async () => {
- const firstLocationTID = await getPwLocationTid(0);
+ //const firstLocationTID = await getPwLocationTid(0);
await closeLocation(); //lastLocationTID);
await expectElementExist('[data-tid=WelcomePanelTID]', true);
await searchEngine('l:', {}, false);
await clickOn('#textQuery-option-0');
await clickOn('[data-tid=folderContainerOpenDirMenu]');
await clickOn('[data-tid=showProperties]');
- await expectElementExist(
- '[data-tid=OpenedTID' + firstLocationTID + ']',
- true
- );
+ await expectElementExist(getGridFileSelector('empty_folder'), true, 5000);
+ // await expectElementExist('[data-tid=OpenedTID' + firstLocationTID + ']',true);
});
test('TST0622 - Search actions - filter [web,electron]', async () => {