TagSpaces is an offline, open source, document manager with tagging support
fix e2e (#1661)
Stanimir18a4bcd64f63
diff --git a/app/components/dialogs/MoveOrCopyFilesDialog.tsx b/app/components/dialogs/MoveOrCopyFilesDialog.tsxindex e9f6b5545..03be37921 100644--- a/app/components/dialogs/MoveOrCopyFilesDialog.tsx+++ b/app/components/dialogs/MoveOrCopyFilesDialog.tsx@@ -71,19 +71,22 @@ function MoveCopyFilesDialog(props: Props) {</List></DialogContent><DialogActions>- <Button data-tid="closeMoveCopyDialog" onClick={() => props.onClose()}>+ <Button+ data-tid="closeMoveOrCopyDialog"+ onClick={() => props.onClose()}+ >{i18n.t('core:cancel')}</Button><ButtononClick={() => props.handleMoveFiles(props.selectedFiles)}- data-tid="confirmMoveFiles"+ data-tid="confirmMoveFilesTID"color="primary">{i18n.t('core:moveFilesButton')}</Button><ButtononClick={() => props.handleCopyFiles(props.selectedFiles)}- data-tid="confirmCopyFiles"+ data-tid="confirmCopyFilesTID"color="primary">{i18n.t('core:copyFilesButton')}diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsxindex ac3ab37eb..100ba7be4 100644--- a/app/perspectives/grid-perspective/components/GridPagination.tsx+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx@@ -16,7 +16,7 @@**/-import React, { useState, useEffect, useRef, useReducer } from 'react';+import React, { useEffect, useRef, useReducer } from 'react';import { connect } from 'react-redux';import Typography from '@material-ui/core/Typography';import Tooltip from '@material-ui/core/Tooltip';@@ -43,7 +43,7 @@ import PlatformIO from '-/services/platform-facade';interface Props {className: string;- style: Object;+ style;theme: any;// gridRef: Object;directories: Array<TS.FileSystemEntry>;@@ -64,9 +64,13 @@ interface Props {dirEntries: TS.FileSystemEntry[],pageEntries: any) => void;+ // eslint-disable-next-line react/no-unused-prop-types+ settings; // cache only+ // eslint-disable-next-line react/no-unused-prop-types+ selectedEntries; // cache only}-const GridPagination = (props: Props) => {+function GridPagination(props: Props) {const {className,style,@@ -341,7 +345,7 @@ const GridPagination = (props: Props) => {)}</div>);-};+}function mapStateToProps(state) {return {@@ -363,7 +367,11 @@ function mapActionCreatorsToProps(dispatch) {const areEqual = (prevProp: Props, nextProp: Props) =>JSON.stringify(nextProp.files) === JSON.stringify(prevProp.files) &&- JSON.stringify(nextProp.directories) === JSON.stringify(prevProp.directories);+ JSON.stringify(nextProp.directories) ===+ JSON.stringify(prevProp.directories) &&+ JSON.stringify(nextProp.settings) === JSON.stringify(prevProp.settings) &&+ JSON.stringify(nextProp.selectedEntries) ===+ JSON.stringify(prevProp.selectedEntries);export default connect(mapStateToProps,diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsxindex 58568a6d3..77733a9de 100644--- a/app/perspectives/grid-perspective/components/MainContainer.tsx+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx@@ -25,8 +25,8 @@ import { actions as TagLibraryActions } from '-/reducers/taglibrary';import {getSupportedFileTypes,getDesktopMode,- getKeyBindingObject,- isDesktopMode+ getKeyBindingObject+ // isDesktopMode} from '-/reducers/settings';import {isObj,@@ -89,7 +89,7 @@ interface Props {openFileNatively: (path?: string) => void;openURLExternally: (path: string) => void;loadParentDirectoryContent: () => void;- setSelectedEntries: (selectedEntries: Array<Object>) => void;+ setSelectedEntries: (selectedEntries: Array<TS.FileSystemEntry>) => void;addTags: () => void;addTag: (tag: TS.Tag, parentTagGroupUuid: TS.Uuid) => void;removeTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;@@ -104,14 +104,12 @@ interface Props {) => void;currentLocation: TS.Location;locations: Array<TS.Location>;- isDesktopMode: boolean;+ // isDesktopMode: boolean;toggleDeleteMultipleEntriesDialog: () => void;}-const GridPerspective = (props: Props) => {- const settings = JSON.parse(- localStorage.getItem(defaultSettings.settingsKey)- ); // loading settings+function GridPerspective(props: Props) {+ let settings = JSON.parse(localStorage.getItem(defaultSettings.settingsKey)); // loading settingsconst [mouseX, setMouseX] = useState<number>(undefined);const [mouseY, setMouseY] = useState<number>(undefined);@@ -199,22 +197,20 @@ const GridPerspective = (props: Props) => {makeFirstSelectedEntryVisible();}, [props.selectedEntries]);+ settings = {+ showDirectories,+ showTags,+ layoutType,+ orderBy,+ sortBy,+ singleClickAction,+ entrySize,+ thumbnailMode,+ gridPageLimit+ };+useEffect(() => {- const settingsObj = {- showDirectories,- showTags,- layoutType,- orderBy,- sortBy,- singleClickAction,- entrySize,- thumbnailMode,- gridPageLimit- };- localStorage.setItem(- defaultSettings.settingsKey,- JSON.stringify(settingsObj)- );+ localStorage.setItem(defaultSettings.settingsKey, JSON.stringify(settings));}, [showDirectories,showTags,@@ -785,6 +781,8 @@ const GridPerspective = (props: Props) => {currentDirectoryPath={props.currentDirectoryPath}onClick={onClick}onContextMenu={onContextMenu}+ settings={settings}+ selectedEntries={props.selectedEntries}/></GlobalHotKeys>{isAddRemoveTagsDialogOpened && (@@ -913,7 +911,7 @@ const GridPerspective = (props: Props) => {)}</div>);-};+}function mapActionCreatorsToProps(dispatch) {return bindActionCreators(@@ -944,7 +942,7 @@ function mapStateToProps(state) {keyBindings: getKeyBindingObject(state),currentLocation: getLocation(state, state.app.currentLocationId),locations: getLocations(state),- isDesktopMode: isDesktopMode(state),+ // isDesktopMode: isDesktopMode(state),isDeleteMultipleEntriesDialogOpened: isDeleteMultipleEntriesDialogOpened(state)diff --git a/app/perspectives/list/components/MainContainer.tsx b/app/perspectives/list/components/MainContainer.tsxindex 4dd05dbfb..2f6a28089 100644--- a/app/perspectives/list/components/MainContainer.tsx+++ b/app/perspectives/list/components/MainContainer.tsx@@ -25,8 +25,8 @@ import { actions as TagLibraryActions } from '-/reducers/taglibrary';import {getSupportedFileTypes,getDesktopMode,- getKeyBindingObject,- isDesktopMode+ getKeyBindingObject+ // isDesktopMode} from '-/reducers/settings';import {isObj,@@ -104,14 +104,12 @@ interface Props {) => void;currentLocation: TS.Location;locations: Array<TS.Location>;- isDesktopMode: boolean;+ // isDesktopMode: boolean;toggleDeleteMultipleEntriesDialog: () => void;}const GridPerspective = (props: Props) => {- const settings = JSON.parse(- localStorage.getItem(defaultSettings.settingsKey)- ); // loading settings+ let settings = JSON.parse(localStorage.getItem(defaultSettings.settingsKey)); // loading settingsconst [mouseX, setMouseX] = useState<number>(undefined);const [mouseY, setMouseY] = useState<number>(undefined);@@ -199,22 +197,20 @@ const GridPerspective = (props: Props) => {makeFirstSelectedEntryVisible();}, [props.selectedEntries]);+ settings = {+ showDirectories,+ showTags,+ layoutType,+ orderBy,+ sortBy,+ singleClickAction,+ entrySize,+ thumbnailMode,+ gridPageLimit+ };+useEffect(() => {- const settingsObj = {- showDirectories,- showTags,- layoutType,- orderBy,- sortBy,- singleClickAction,- entrySize,- thumbnailMode,- gridPageLimit- };- localStorage.setItem(- defaultSettings.settingsKey,- JSON.stringify(settingsObj)- );+ localStorage.setItem(defaultSettings.settingsKey, JSON.stringify(settings));}, [showDirectories,showTags,@@ -786,6 +782,8 @@ const GridPerspective = (props: Props) => {currentDirectoryPath={props.currentDirectoryPath}onClick={onClick}onContextMenu={onContextMenu}+ settings={settings}+ selectedEntries={props.selectedEntries}/></GlobalHotKeys>{isAddRemoveTagsDialogOpened && (@@ -945,7 +943,7 @@ function mapStateToProps(state) {keyBindings: getKeyBindingObject(state),currentLocation: getLocation(state, state.app.currentLocationId),locations: getLocations(state),- isDesktopMode: isDesktopMode(state),+ // isDesktopMode: isDesktopMode(state),isDeleteMultipleEntriesDialogOpened: isDeleteMultipleEntriesDialogOpened(state)diff --git a/app/reducers/app.ts b/app/reducers/app.tsindex 2bb0f465a..daf2bff82 100644--- a/app/reducers/app.ts+++ b/app/reducers/app.ts@@ -1202,9 +1202,8 @@ export const actions = {type: types.SET_CURRENDIRECTORYPERSPECTIVE,perspective}),- setSelectedEntries: (selectedEntries: Array<Object>) => (- dispatch: (actions: Object) => void,- getState: () => any+ setSelectedEntries: (selectedEntries: Array<TS.FileSystemEntry>) => (+ dispatch: (action) => void) => {// const { openedFiles } = getState().app;// skip select other file if its have openedFiles in editMode@@ -1212,7 +1211,7 @@ export const actions = {dispatch(actions.setSelectedEntriesInt(selectedEntries));// }},- setSelectedEntriesInt: (selectedEntries: Array<Object>) => ({+ setSelectedEntriesInt: (selectedEntries: Array<TS.FileSystemEntry>) => ({type: types.SET_SELECTED_ENTRIES,selectedEntries}),diff --git a/tests/e2e/perspective-grid.pw.e2e.js b/tests/e2e/perspective-grid.pw.e2e.jsindex 4586e7289..e8f63cece 100644--- a/tests/e2e/perspective-grid.pw.e2e.js+++ b/tests/e2e/perspective-grid.pw.e2e.js@@ -242,9 +242,10 @@ describe('TST50 - Perspective Grid', () => {await clickOn('[data-tid=gridPerspectiveCopySelectedFiles]');await setInputKeys('targetPathInput', copyLocationPath);await clickOn('[data-tid=confirmCopyFiles]');- await waitForNotification();+ //await waitForNotification();await global.client.dblclick(selectorFolder);+ await global.client.waitForSelector(selectorFile);await expectElementExist(selectorFile, true);// const firstFileName = await getGridFileName(0);// expect(firstFileName).toBe(sampleFileName);@@ -291,7 +292,7 @@ describe('TST50 - Perspective Grid', () => {await clickOn('[data-tid=gridPerspectiveDeleteMultipleFiles]');await clickOn('[data-tid=confirmDeleteFileDialog]');- await waitForNotification();+ // await waitForNotification();for (let i = 0; i < selectedIds.length; i++) {await expectElementExist(