TagSpaces is an offline, open source, document manager with tagging support
TSN600 - Show directory menu on right click in the default perspective (#1353)
Stanimir92ec7d19a716
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.ymlindex 7d4b80503..0d51352cb 100644--- a/.github/workflows/pull_request.yml+++ b/.github/workflows/pull_request.yml@@ -55,7 +55,6 @@ jobs:- name: Run Electron testsrun: |yarn install-ext- yarn build-mainyarn build-e2eyarn test-e2e-electron- uses: IgnusG/[email protected]@@ -109,7 +108,6 @@ jobs:- name: Run Electron testsrun: |yarn install-ext- yarn build-mainyarn build-e2eyarn test-e2e-web- uses: IgnusG/[email protected]diff --git a/app/components/menus/DirectoryMenu.tsx b/app/components/menus/DirectoryMenu.tsxindex a990a4530..40442c38a 100644--- a/app/components/menus/DirectoryMenu.tsx+++ b/app/components/menus/DirectoryMenu.tsx@@ -34,7 +34,7 @@ import DefaultPerspectiveIcon from '@material-ui/icons/GridOn';import GalleryPerspectiveIcon from '@material-ui/icons/Camera';import MapiquePerspectiveIcon from '@material-ui/icons/Map';// import TreeVizPerspectiveIcon from '@material-ui/icons/AccountTree';-// import KanBanPerspectiveIcon from '@material-ui/icons/Dashboard';+import KanBanPerspectiveIcon from '@material-ui/icons/Dashboard';import NewFileIcon from '@material-ui/icons/InsertDriveFile';import NewFolderIcon from '@material-ui/icons/CreateNewFolder';import RenameFolderIcon from '@material-ui/icons/FormatTextdirectionLToR';@@ -82,6 +82,7 @@ interface Props {reflectCreateEntries: (fsEntries: Array<FileSystemEntry>) => void;onUploadProgress: (progress: Progress, response: any) => void;switchPerspective?: (perspectiveId: string) => void;+ setCurrentDirectoryPerspective: (perspective: string) => void;perspectiveMode?: boolean;showNotification?: (text: string,@@ -100,6 +101,8 @@ interface Props {toggleDeleteMultipleEntriesDialog: () => void;selectedEntries: Array<any>;setSelectedEntries: (selectedEntries: Array<Object>) => void;+ mouseX?: number;+ mouseY?: number;}const DirectoryMenu = (props: Props) => {@@ -150,7 +153,11 @@ const DirectoryMenu = (props: Props) => {function switchPerspective(perspectiveId) {props.onClose();if (Pro) {- props.switchPerspective(perspectiveId);+ if (props.switchPerspective) {+ props.switchPerspective(perspectiveId);+ } else {+ props.setCurrentDirectoryPerspective(perspectiveId);+ }} else {props.showNotification('Perspectives are part of TagSpaces PRO',@@ -335,7 +342,19 @@ Do you want to continue?`)selectedDirectoryPath={props.directoryPath}/>)}- <Menu anchorEl={props.anchorEl} open={props.open} onClose={props.onClose}>+ <Menu+ anchorEl={props.anchorEl}+ open={props.open}+ onClose={props.onClose}+ anchorReference={+ props.mouseY && props.mouseX ? 'anchorPosition' : undefined+ }+ anchorPosition={+ props.mouseY && props.mouseX+ ? { top: props.mouseY, left: props.mouseX }+ : undefined+ }+ >{props.selectedEntries.length < 2 && props.perspectiveMode && (<MenuItem data-tid="openDirectory" onClick={openDirectory}><ListItemIcon>@@ -465,16 +484,16 @@ Do you want to continue?`)</ListItemIcon><ListItemText primary="TreeViz Perspective" /></MenuItem> */}- {/* <MenuItem- data-tid="openTreeVizPerspective"+ <MenuItem+ data-tid="openKanBanPerspectiveTID"onClick={() => switchPerspective(perspectives.KANBAN)}title="Switch to kanban perspective"><ListItemIcon><KanBanPerspectiveIcon /></ListItemIcon>- <ListItemText primary="KanBan Perspective - Beta" />- </MenuItem> */}+ <ListItemText primary="KanBan Perspective" />+ </MenuItem></>)}{/* {!props.isReadOnlyMode && (@@ -529,6 +548,7 @@ function mapDispatchToProps(dispatch) {toggleCreateFileDialog: AppActions.toggleCreateFileDialog,resetProgress: AppActions.resetProgress,reflectCreateEntries: AppActions.reflectCreateEntries,+ setCurrentDirectoryPerspective: AppActions.setCurrentDirectoryPerspective,extractContent: IOActions.extractContent,uploadFilesAPI: IOActions.uploadFilesAPI,addTags: TaggingActions.addTags,diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsxindex 18709ec45..761fcee68 100644--- a/app/perspectives/grid-perspective/components/GridPagination.tsx+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx@@ -45,6 +45,7 @@ interface Props {currentLocationPath: string;currentDirectoryPath: string;searchResultCount: number;+ onContextMenu: (e: React.MouseEvent<HTMLDivElement>) => void;}const GridPagination = (props: Props) => {@@ -94,6 +95,9 @@ const GridPagination = (props: Props) => {}}><div+ onContextMenu={(e: React.MouseEvent<HTMLDivElement>) =>+ props.onContextMenu(e)+ }style={{height: '100%',// @ts-ignorediff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsxindex 57771ddbf..414c9598c 100644--- a/app/perspectives/grid-perspective/components/MainContainer.tsx+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx@@ -101,6 +101,8 @@ interface Props {const GridPerspective = (props: Props) => {const settings = JSON.parse(localStorage.getItem('tsPerspectiveGrid')); // loading settings+ const mouseX = useRef<number>(undefined);+ const mouseY = useRef<number>(undefined);const allFilesSelected = useRef<boolean>(false);const selectedEntryPath = useRef<string>('');const selectedTag = useRef<Tag | null>(null);@@ -417,6 +419,10 @@ const GridPerspective = (props: Props) => {};const handleGridContextMenu = (event, fsEntry: FileSystemEntry) => {+ event.preventDefault();+ event.stopPropagation();+ mouseX.current = undefined;+ mouseY.current = undefined;const { desktopMode, selectedEntries } = props;const isEntryExist = selectedEntries.some(entry => entry.uuid === fsEntry.uuid@@ -620,6 +626,17 @@ const GridPerspective = (props: Props) => {openFileExternally: props.keyBindings.openFileExternally};+ const onContextMenu = (e: React.MouseEvent<HTMLDivElement>) => {+ e.preventDefault();+ mouseX.current = e.pageX;+ mouseY.current = e.pageY;+ if (props.selectedEntries.length > 0) {+ props.setSelectedEntries([]);+ }+ selectedEntryPath.current = props.currentDirectoryPath;+ setDirContextMenuAnchorEl(e.currentTarget);+ };+const keyBindingHandlers = {nextDocument: () => props.openNextFile(),prevDocument: () => props.openPrevFile(),@@ -741,6 +758,7 @@ const GridPerspective = (props: Props) => {currentPage={1}currentLocationPath={locationPath}currentDirectoryPath={props.currentDirectoryPath}+ onContextMenu={onContextMenu}/></GlobalHotKeys>{isAddRemoveTagsDialogOpened && (@@ -804,7 +822,11 @@ const GridPerspective = (props: Props) => {openDirectory={props.openDirectory}openFsEntry={props.openFsEntry}isReadOnlyMode={props.isReadOnlyMode}- perspectiveMode={true}+ perspectiveMode={+ selectedEntryPath.current !== props.currentDirectoryPath+ }+ mouseX={mouseX.current}+ mouseY={mouseY.current}/>{/* {Boolean(tagContextMenuAnchorEl) && ( // TODO EntryTagMenu is used in TagSelect we cannot move confirm dialog from menu */}<EntryTagMenudiff --git a/tests/e2e/file.properties.helpers.js b/tests/e2e/file.properties.helpers.jsindex 373bc277f..0aa99a672 100644--- a/tests/e2e/file.properties.helpers.js+++ b/tests/e2e/file.properties.helpers.js@@ -39,10 +39,14 @@ export async function AddRemovePropertiesTags(}export async function getPropertiesFileName() {+ /* const fileNameProperties = await global.client.$('#descriptionArea');+ await fileNameProperties.waitForDisplayed({ timeout: 5000 });+ await fileNameProperties.click(); */+const propsFileNameInput = await global.client.$('[data-tid=fileNameProperties] input');- await propsFileNameInput.waitForDisplayed({ timeout: 10000 });+ await propsFileNameInput.waitForDisplayed({ timeout: 5000 });const fileName = await propsFileNameInput.getValue();return fileName.replace(/ *\[[^\]]*]/, '');}diff --git a/tests/e2e/fileopener.e2e.js b/tests/e2e/fileopener.e2e.jsindex 57734989b..defde1c44 100644--- a/tests/e2e/fileopener.e2e.js+++ b/tests/e2e/fileopener.e2e.js@@ -37,36 +37,33 @@ describe('TST08 - File folder properties', () => {});it('TST0801 - Arrow keys select next prev file (keybindings) [web,minio,electron]', async () => {- const firstFileName = await getGridFileName(0);-// open filePropertiesawait clickOn(selectorFile);//Toggle Propertiesawait clickOn('[data-tid=fileContainerToggleProperties]');const propsFileName = await getPropertiesFileName();+ const firstFileName = await getGridFileName(0);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);+ expect(propsPrevFileName).toBe(firstFileName);});it('TST0802 - Open next file buttons [web,minio,electron]', async () => {- const firstFileName = await getGridFileName(0);-// open filePropertiesawait clickOn(selectorFile);//Toggle Propertiesawait clickOn('[data-tid=fileContainerToggleProperties]');const propsFileName = await getPropertiesFileName();+ const firstFileName = await getGridFileName(0);expect(firstFileName).toBe(propsFileName);await clickOn('[data-tid=fileContainerNextFile]');@@ -77,14 +74,13 @@ describe('TST08 - File folder properties', () => {});it('TST0803 - Open previous files buttons [web,minio,electron]', async () => {- const firstFileName = await getGridFileName(0);-// open filePropertiesawait clickOn(selectorFile);//Toggle Propertiesawait clickOn('[data-tid=fileContainerToggleProperties]');const propsFileName = await getPropertiesFileName();+ const firstFileName = await getGridFileName(0);expect(firstFileName).toBe(propsFileName);await clickOn('[data-tid=fileContainerPrevFile]');diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.jsindex a06e09e78..17c2062aa 100644--- a/tests/e2e/general.helpers.js+++ b/tests/e2e/general.helpers.js@@ -187,7 +187,6 @@ export async function clearInputValue(inputElement) {}/**- ** @param fileIndex* @returns {Promise<string>} fileName; example usage: getFileName(-1) will return the last one*/@@ -199,6 +198,7 @@ export async function getGridFileName(fileIndex) {fileIndex < 0? filesList[filesList.length + fileIndex]: filesList[fileIndex];+ // await file.waitForDisplayed({ timeout: 5000 });file = await file.$('div');file = await file.$('div');file = await file.$('div');@@ -209,6 +209,10 @@ export async function getGridFileName(fileIndex) {const fileExtElem = await lastDiv.$('span');const fileExt = await fileExtElem.getText();return fileName + '.' + fileExt.toLowerCase();+ } else {+ console.log(+ "Can't find getGridFileName:" + fileIndex + ' filesList is empty'+ );}} catch (e) {console.log("Can't find getGridFileName:" + fileIndex, e);@@ -217,19 +221,28 @@ export async function getGridFileName(fileIndex) {}export async function getGridElement(fileIndex = 0) {- const filesList = await global.client.$$(perspectiveGridTable + firstFile);- let file =- fileIndex < 0- ? filesList[filesList.length + fileIndex]- : filesList[fileIndex];- file = await file.$('div');- file = await file.$('div');- return file;+ const filesList = await global.client.$$(selectorFile);+ if (filesList.length > 0) {+ let file =+ fileIndex < 0+ ? filesList[filesList.length + fileIndex]+ : filesList[fileIndex];+ // await file.waitForDisplayed({ timeout: 5000 });+ file = await file.$('div');+ file = await file.$('div');+ return file;+ } else {+ console.log("Can't getGridElement:" + fileIndex + ' filesList is empty');+ }+ return undefined;}export async function getGridCellClass(fileIndex = 0) {const file = await getGridElement(fileIndex);- return file.getAttribute('class');+ if (file !== undefined) {+ return file.getAttribute('class');+ }+ return undefined;}export async function expectElementExist(@@ -342,7 +355,7 @@ export async function selectAllFiles(classNotSelected) {await clickOn('[data-tid=gridPerspectiveSelectAllFiles]');return await waitUntilClassChanged(- perspectiveGridTable + firstFile + '/div/div',+ selectorFile + '/div/div',classNotSelected);}@@ -465,6 +478,56 @@ export async function showFilesWithTag(tagName) {await global.client.pause(1500); // web && minio search is slow}+export function getGridFileSelector(fileName) {+ return '[data-tid="fsEntryName_' + fileName + '"]';+}++export function generateFileName(fileName, fileExt, tags, tagDelimiter = ' ') {+ let tagsString = '';+ let beginTagContainer = '[';+ let endTagContainer = ']';+ const prefixTagContainer = '';+ // Creating the string will all the tags by more that 0 tags+ if (tags && tags.length > 0) {+ tagsString = beginTagContainer;+ for (let i = 0; i < tags.length; i += 1) {+ if (i === tags.length - 1) {+ tagsString += tags[i].trim();+ } else {+ tagsString += tags[i].trim() + tagDelimiter;+ }+ }+ tagsString = tagsString.trim() + endTagContainer;+ }+ // Assembling the new filename with the tags+ let newFileName = '';+ beginTagContainer = fileName.indexOf(beginTagContainer);+ endTagContainer = fileName.indexOf(endTagContainer);+ if (+ beginTagContainer < 0 ||+ endTagContainer < 0 ||+ beginTagContainer >= endTagContainer+ ) {+ // File does not have an extension+ newFileName = fileName.trim() + tagsString + '.' + fileExt;+ } else {+ // File does not have an extension+ newFileName =+ fileName.substring(0, beginTagContainer).trim() ++ prefixTagContainer ++ tagsString ++ fileName.substring(endTagContainer + 1, fileName.length).trim();+ }+ if (newFileName.length < 1) {+ throw new Error('Generated filename is invalid');+ }+ // Removing double prefix+ newFileName = newFileName+ .split(prefixTagContainer + '' + prefixTagContainer)+ .join(prefixTagContainer);+ return newFileName;+}+export async function expectTagsExistBySelector(selector,arrTagNames,diff --git a/tests/e2e/location.helpers.js b/tests/e2e/location.helpers.jsindex c0cc0c68d..21b0b5009 100644--- a/tests/e2e/location.helpers.js+++ b/tests/e2e/location.helpers.js@@ -145,35 +145,32 @@ export async function checkForIdExist(tid) {// expect(dataTid.selector).toBe('[data-tid=' + tid + ']');}-export async function renameFirstFile(newFileName) {- await openContextEntryMenu(- perspectiveGridTable + firstFile,- 'fileMenuRenameFile'- );- await global.client.pause(500);- await setInputKeys('renameFileDialogInput', newFileName);- /*const renameFileDialogInput = await global.client.$(+export async function renameFileFromMenu(newFileName, selector = selectorFile) {+ let fileName;+ await openContextEntryMenu(selector, 'fileMenuRenameFile');+ // await global.client.pause(500);+ const renameFileDialogInput = await global.client.$('[data-tid=renameFileDialogInput] input');await renameFileDialogInput.waitForDisplayed({ timeout: 5000 });- //await renameFileDialogInput.clearValue();- //await clearInputValue(renameFileDialogInput);- await global.client.pause(50);- await renameFileDialogInput.setValue(newFileName);*/- //await delay(1500);+ fileName = await renameFileDialogInput.getValue();++ await setInputKeys('renameFileDialogInput', newFileName);await clickOn('[data-tid=confirmRenameFileDialog]');await waitForNotification();+ return fileName;}-export async function deleteFirstFile() {- await openContextEntryMenu(- perspectiveGridTable + firstFile,- 'fileMenuDeleteFile'- );+export async function deleteFileFromMenu(fileSelector = selectorFile) {+ await openContextEntryMenu(fileSelector, 'fileMenuDeleteFile');await clickOn('[data-tid=confirmDeleteFileDialog]');await waitForNotification();}+/**+ * @deprecated too heavy+ * @returns {Promise<string>}+ */export async function getFirstFileName() {let fileName;await openContextEntryMenu(selectorFile, 'fileMenuRenameFile');diff --git a/tests/e2e/perspective-grid-right-button.e2e.js b/tests/e2e/perspective-grid-right-button.e2e.jsindex c557e096b..625410a6d 100644--- a/tests/e2e/perspective-grid-right-button.e2e.js+++ b/tests/e2e/perspective-grid-right-button.e2e.js@@ -6,9 +6,8 @@ import {defaultLocationPath,defaultLocationName,closeFileProperties,- getFirstFileName,- renameFirstFile,- deleteFirstFile,+ renameFileFromMenu,+ deleteFileFromMenu,createMinioLocation,closeLocation} from './location.helpers';@@ -29,7 +28,9 @@ import {expectElementExist,expectTagsExist,expectTagsExistBySelector,+ generateFileName,getGridFileName,+ getGridFileSelector,removeTagFromTagMenu,selectorFile,selectorFolder,@@ -66,10 +67,9 @@ describe('TST50** - Right button on a file', () => {});*/test('TST5016 - Open file [web,minio,electron]', async () => {- //await searchEngine('bmp');- await searchEngine('txt');+ //await searchEngine('txt');await openContextEntryMenu(- perspectiveGridTable + firstFile,+ '[data-tid="fsEntryName_sample.txt"]', // perspectiveGridTable + firstFile,'fileMenuOpenFile');// Check if the file is opened@@ -91,33 +91,44 @@ describe('TST50** - Right button on a file', () => {});test('TST5017 - Rename file [web,minio,electron]', async () => {- await searchEngine('txt');- const oldName = await getFirstFileName();- await renameFirstFile(newFileName);- const fileNameTxt = await getFirstFileName();- expect(fileNameTxt).toContain(newFileName);- //rename back to oldName- await renameFirstFile(oldName);- const fileName = await getFirstFileName();- expect(fileName).toContain(oldName);+ // await searchEngine('txt');+ const sampleFileName = 'sample.txt';+ const oldName = await renameFileFromMenu(+ newFileName,+ getGridFileSelector(sampleFileName)+ );+ expect(oldName).toBe(sampleFileName);++ await expectElementExist(getGridFileSelector(newFileName));+ await expectElementExist(getGridFileSelector(oldName), false);++ // const fileNameTxt = await getFirstFileName();+ // expect(fileNameTxt).toContain(newFileName);++ // rename back to oldName+ const fileName = await renameFileFromMenu(+ oldName,+ getGridFileSelector(newFileName)+ );+ expect(fileName).toBe(newFileName);});test('TST5018 - Delete file [web,minio,electron]', async () => {- await createTxtFile();- await searchEngine('note'); //select new created file - note[date_created].txt- /*let firstFileName = await getGridFileName(0);- expect(firstFileName).toBe('note.txt');*/+ // await createTxtFile();+ // await searchEngine('note'); //select new created file - note[date_created].txt+ let fileName = 'sample.html'; // await getGridFileName(-1);+ // expect(firstFileName).toBe('note.txt');- await expectElementExist(selectorFile, true);+ // await expectElementExist(selectorFile, true);- await deleteFirstFile();- await expectElementExist(selectorFile, false);- /*firstFileName = await getGridFileName(0);- expect(firstFileName).toBe(undefined);*/+ await deleteFileFromMenu(getGridFileSelector(fileName));+ await expectElementExist(getGridFileSelector(fileName), false);+ /* firstFileName = await getGridFileName(0);+ expect(firstFileName).toBe(undefined); */});test('TST5019 - Rename tag in file [web,minio,electron]', async () => {- await searchEngine('desktop');+ // await searchEngine('desktop');// Select fileawait clickOn(selectorFile);await AddRemoveTagsToSelectedFiles([testTagName], true);@@ -150,7 +161,7 @@ describe('TST50** - Right button on a file', () => {});test('TST5023 - Remove tag from file (tag menu) [web,minio,electron]', async () => {- await searchEngine('desktop');+ // await searchEngine('desktop');// select fileawait clickOn(selectorFile);await AddRemoveTagsToSelectedFiles([testTagName], true);@@ -200,19 +211,31 @@ describe('TST50** - Right button on a file', () => {* TODO minio sometimes: stale element reference: stale element reference: element is not attached to the page document*/test('TST5025 - Add - Remove tags (file menu) [web,electron]', async () => {- await searchEngine('desktop');+ // await searchEngine('desktop');+ const fileName = 'sample';+ const fileExt = 'desktop';const tags = [testTagName, testTagName + '2'];// select file- await clickOn(selectorFile);+ await clickOn(getGridFileSelector(fileName + '.' + fileExt));await AddRemoveTagsToSelectedFiles(tags, true);- await expectTagsExistBySelector(selectorFile, tags, true);+ let gridElement = await global.client.$(+ getGridFileSelector(generateFileName(fileName, fileExt, tags, ' '))+ );+ gridElement = await gridElement.$('..');+ await expectTagsExist(gridElement, tags, true);+ // await expectTagsExistBySelector(selectorFile, tags, true);// remove tags- await clickOn(selectorFile);+ await clickOn(gridElement);await AddRemoveTagsToSelectedFiles(tags, false);- await expectTagsExistBySelector(selectorFile, tags, false);+ gridElement = await global.client.$(+ getGridFileSelector(fileName + '.' + fileExt)+ );+ gridElement = await gridElement.$('..');+ await expectTagsExist(gridElement, tags, false);+ // await expectTagsExistBySelector(selectorFile, tags, false);});test('TST5026 - Open file natively [electron]', async () => {@@ -287,7 +310,7 @@ describe('TST50** - Right button on a file', () => {expect(firstFileName).toBe('sample.eml');// cleanup- await deleteFirstFile();+ await deleteFileFromMenu();await expectElementExist(selectorFile, false);});@@ -299,7 +322,7 @@ describe('TST50** - Right button on a file', () => {perspectiveGridTable + firstFolder,'openDirectory');- if (isWeb) {+ if (global.isWeb) {await global.client.pause(500);}const firstFileName = await getGridFileName(0);diff --git a/tests/e2e/perspective-grid.e2e.js b/tests/e2e/perspective-grid.e2e.jsindex 257476c70..8c6829b04 100644--- a/tests/e2e/perspective-grid.e2e.js+++ b/tests/e2e/perspective-grid.e2e.js@@ -6,7 +6,7 @@ import {defaultLocationPath,defaultLocationName,closeFileProperties,- deleteFirstFile,+ deleteFileFromMenu,createMinioLocation,getFirstFileName} from './location.helpers';@@ -23,6 +23,7 @@ import {extractTags,getGridCellClass,getGridFileName,+ getGridFileSelector,selectAllFiles,selectFilesByID,selectorFile,@@ -58,13 +59,15 @@ describe('TST50 - Perspective Grid', () => {});test('TST5002 - Open file with click [web,minio,electron]', async () => {- await searchEngine('txt'); //testTestFilename);- const firstFileName = await getGridFileName(0);- await clickOn(perspectiveGridTable + firstFile);+ // await searchEngine('txt'); //testTestFilename);+ const fileName = 'sample.txt';++ // const firstFileName = await getGridFileName(0);+ await clickOn(getGridFileSelector(fileName)); // perspectiveGridTable + firstFile);//Toggle Propertiesawait clickOn('[data-tid=fileContainerToggleProperties]');const propsFileName = await getPropertiesFileName();- expect(firstFileName).toBe(propsFileName);+ expect(fileName).toBe(propsFileName);// await checkFilenameForExist(testTestFilename);});@@ -109,7 +112,7 @@ describe('TST50 - Perspective Grid', () => {//cleanup// await setSettings('[data-tid=settingsSetUseTrashCan]');// await global.client.pause(500);- await deleteFirstFile();+ await deleteFileFromMenu();// firstFileName = await getGridFileName(0);// expect(firstFileName).not.toBe('note.txt'); TODO its have note.txt from another tests});@@ -135,7 +138,7 @@ describe('TST50 - Perspective Grid', () => {expect(classNotSelected).not.toBe(classSelected);- const filesList = await global.client.$$(perspectiveGridTable + firstFile);+ const filesList = await global.client.$$(selectorFile);for (let i = 0; i < filesList.length; i++) {let file = await filesList[i].$('div');file = await file.$('div');@@ -259,29 +262,27 @@ describe('TST50 - Perspective Grid', () => {}*/});- /**- * TODO copy file on minio failed with path: ./testdata-tmp/file-structure/supported-filestypes/empty_folder- * web cannot find bmp file- */test('TST5008 - Copy file [electron]', async () => {- const fileName = await getFirstFileName();+ const sampleFileName = 'sample.txt';+ // Electron path: ./testdata-tmp/file-structure/supported-filestypes/empty_folder+ let copyLocationPath = global.isElectron+ ? defaultLocationPath + '/empty_folder'+ : 'empty_folder';+ // const fileName = await getFirstFileName();// select file- await clickOn(selectorFile);+ await clickOn(getGridFileSelector(sampleFileName));// open Copy File Dialogawait clickOn('[data-tid=gridPerspectiveCopySelectedFiles]');- await addInputKeys(- 'targetPathInput',- defaultLocationPath + '/empty_folder'- );+ await addInputKeys('targetPathInput', copyLocationPath);await clickOn('[data-tid=confirmCopyFiles]');await waitForNotification();await doubleClickOn(selectorFolder);const firstFileName = await getGridFileName(0);- expect(firstFileName).toBe(fileName);+ expect(firstFileName).toBe(sampleFileName);// cleanup- await deleteFirstFile();+ await deleteFileFromMenu();await expectElementExist(selectorFile, false);});@@ -310,7 +311,7 @@ describe('TST50 - Perspective Grid', () => {const firstFileName = await getGridFileName(0);expect(firstFileName).toBe('sample.epub');// cleanup- await deleteFirstFile();+ await deleteFileFromMenu();await expectElementExist(selectorFile, false);});