Skip to content

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

fix e2e

sytolk7b210bfeeba5
diff --git a/app/components/TagLibrary.tsx b/app/components/TagLibrary.tsx
index 40fbe9c3a..954047ce5 100644
--- a/app/components/TagLibrary.tsx
+++ b/app/components/TagLibrary.tsx
@@ -39,7 +39,7 @@ import TagLibraryMenu from './menus/TagLibraryMenu';
import TagGroupMenu from './menus/TagGroupMenu';
import TaggingActions from '../reducers/tagging-actions';
import i18n from '../services/i18n';
-import settings, {
+import {
actions as SettingsActions,
getCurrentLanguage,
getTagColor,
@@ -54,7 +54,7 @@ import {
import SmartTags from '../reducers/smart-tags';
import EditTagDialog from '-/components/dialogs/EditTagDialog';
import { TS } from '-/tagspaces.namespace';
-import locations, { getLocations } from '-/reducers/locations';
+import { actions as LocationActions, getLocations } from '-/reducers/locations';
import { Pro } from '-/pro';
import TagGroupTitleDnD from '-/components/TagGroupTitleDnD';
import {
@@ -119,6 +119,8 @@ interface Props {
// moveTagGroup: (tagGroupUuid: TS.Uuid, position: number) => void;
reduceHeightBy: number;
isTagLibraryChanged: boolean;
+ switchLocationType: (locationId: string) => Promise<string | null>;
+ switchCurrentLocationType: (currentLocationId) => Promise<boolean>;
}
function TagLibrary(props: Props) {
@@ -466,9 +468,21 @@ function TagLibrary(props: Props) {
<CreateTagGroupDialog
open={isCreateTagGroupDialogOpened}
onClose={() => setIsCreateTagGroupDialogOpened(false)}
- createTagGroup={(entry: TS.TagGroup) =>
- setTagGroups(createTagGroup(entry, tagGroups, props.locations))
- }
+ createTagGroup={(entry: TS.TagGroup) => {
+ const location: TS.Location = props.locations.find(
+ l => l.uuid === entry.locationId
+ );
+ if (location) {
+ props
+ .switchLocationType(location.uuid)
+ .then(currentLocationId => {
+ setTagGroups(createTagGroup(entry, tagGroups, location));
+ props.switchCurrentLocationType(currentLocationId);
+ });
+ } else {
+ setTagGroups(createTagGroup(entry, tagGroups));
+ }
+ }}
color={props.tagBackgroundColor}
textcolor={props.tagTextColor}
/>
@@ -644,7 +658,9 @@ function mapDispatchToProps(dispatch) {
addTags: TaggingActions.addTags,
collectTagsFromLocation: TaggingActions.collectTagsFromLocation,
openURLExternally: AppActions.openURLExternally,
- showNotification: AppActions.showNotification
+ showNotification: AppActions.showNotification,
+ switchLocationType: LocationActions.switchLocationType,
+ switchCurrentLocationType: AppActions.switchCurrentLocationType
},
dispatch
);
diff --git a/app/services/taglibrary-utils.ts b/app/services/taglibrary-utils.ts
index e638a3d92..8375f5b4e 100644
--- a/app/services/taglibrary-utils.ts
+++ b/app/services/taglibrary-utils.ts
@@ -233,20 +233,15 @@ export function exportTagGroups(entry: Array<TS.TagGroup>, settingsVersion) {
export function createTagGroup(
entry: TS.TagGroup,
tagGroups: Array<TS.TagGroup>,
- locations: Array<TS.Location>
+ location?: TS.Location
): Array<TS.TagGroup> {
const newEntry = {
...entry,
created_date: new Date().getTime(),
modified_date: new Date().getTime()
};
- if (Pro && entry.locationId) {
- const location: TS.Location = locations.find(
- l => l.uuid === entry.locationId
- );
- if (location) {
- Pro.MetaOperations.createTagGroup(location.path, newEntry);
- }
+ if (Pro && location) {
+ Pro.MetaOperations.createTagGroup(location.path, newEntry);
}
return setTagLibrary([...tagGroups, newEntry]);
}
diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.js
index 35a94b73c..0c70f1c8f 100644
--- a/tests/e2e/general.helpers.js
+++ b/tests/e2e/general.helpers.js
@@ -685,10 +685,10 @@ export async function expectMetaFilesExist(
await clickOn('[data-tid=folderContainerOpenDirMenu]');
await clickOn('[data-tid=reloadDirectory]');
if (exist || (await isDisplayed(getGridFileSelector(AppConfig.metaFolder)))) {
- await global.client.dblclick(getGridFileSelector(AppConfig.metaFolder));
+ await global.client.dblclick(getGridFileSelector(AppConfig.metaFolder), { timeout: 3000 });
if (subFolder) {
if (await isDisplayed(getGridFileSelector(subFolder))) {
- await global.client.dblclick(getGridFileSelector(subFolder));
+ await global.client.dblclick(getGridFileSelector(subFolder), { timeout: 3000 });
} else if (!exist) {
await clickOn('[data-tid=gridPerspectiveOnBackButton]');
return true;
diff --git a/tests/e2e/search.helpers.js b/tests/e2e/search.helpers.js
index de24554a0..dec9bfcfd 100644
--- a/tests/e2e/search.helpers.js
+++ b/tests/e2e/search.helpers.js
@@ -99,7 +99,7 @@ export async function createSavedSearch(searchQuery) {
await typeInputValue('#textQuery', searchQuery.textQuery);
await clickOn('#searchButton');
await clickOn('[data-tid=advancedSearch]');
- await clickOn('[data-tid=saveSearchBtnTID]');
+ await clickOn('[data-tid=addSearchBtnTID]');
await global.client.dblclick('[data-tid=savedSearchTID]');
await setInputKeys('savedSearchTID', searchQuery.title);
await clickOn('[data-tid=confirmSavedSearchTID]');
diff --git a/tests/e2e/search.pw.e2e.js b/tests/e2e/search.pw.e2e.js
index 4e0d7b22d..6aec26c17 100644
--- a/tests/e2e/search.pw.e2e.js
+++ b/tests/e2e/search.pw.e2e.js
@@ -184,6 +184,7 @@ test.describe('TST06 - Test Search in file structure:', () => {
test('TST0625 - Search actions - execute query from stored searches [web,electron,_pro]', async () => {
const storedSearchTitle = 'jpgSearch';
await createSavedSearch({ title: storedSearchTitle, textQuery: 'jpg' });
+ await clickOn('#clearSearchID');
await searchEngine('q:', {}, false);
await clickOn('#textQuery-option-0');