Skip to content

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

add TST0420 TST0421

sytolk7970b9158cd8
diff --git a/app/components/TagGroupContainer.tsx b/app/components/TagGroupContainer.tsx
index 7d44cbd74..faa5afdb7 100644
--- a/app/components/TagGroupContainer.tsx
+++ b/app/components/TagGroupContainer.tsx
@@ -72,6 +72,7 @@ function TagGroupContainer(props: Props) {
border,
backgroundColor
}}
+ data-tid={'tagGroupContainer_' + props.taggroup.title}
>
{props.children}
</div>
diff --git a/app/components/TagLibrary.tsx b/app/components/TagLibrary.tsx
index 2bf287bf3..40fbe9c3a 100644
--- a/app/components/TagLibrary.tsx
+++ b/app/components/TagLibrary.tsx
@@ -311,10 +311,7 @@ function TagLibrary(props: Props) {
isReadOnly={isReadOnly}
/>
<Collapse in={tagGroup.expanded} unmountOnExit>
- <TagGroupContainer
- taggroup={tagGroup}
- data-tid={'tagGroupContainer_' + tagGroup.title}
- >
+ <TagGroupContainer taggroup={tagGroup}>
{tagGroup.children &&
tagGroup.children.map((tag: TS.Tag, idx) => {
if (props.isReadOnly) {
diff --git a/app/components/dialogs/CreateTagGroupDialog.tsx b/app/components/dialogs/CreateTagGroupDialog.tsx
index 4e7e85adc..217d64982 100644
--- a/app/components/dialogs/CreateTagGroupDialog.tsx
+++ b/app/components/dialogs/CreateTagGroupDialog.tsx
@@ -214,6 +214,7 @@ function CreateTagGroupDialog(props: Props) {
{i18n.t('core:tagGroupLocation')}
</FormHelperText>
<Select
+ data-tid="tagGroupLocationTID"
defaultValue={defaultTagGroupLocation}
onChange={(event: ChangeEvent<HTMLInputElement>) => {
locationId.current = event.target.value;
@@ -224,11 +225,16 @@ function CreateTagGroupDialog(props: Props) {
<MenuItem
key={defaultTagGroupLocation}
value={defaultTagGroupLocation}
+ data-tid={'tagLibraryTID'}
>
{i18n.t('tagLibrary')}
</MenuItem>
{props.locations.map(location => (
- <MenuItem key={location.uuid} value={location.uuid}>
+ <MenuItem
+ key={location.uuid}
+ value={location.uuid}
+ data-tid={'tglocation_' + location.name}
+ >
{i18n.t('core:location') + ': ' + location.name}
</MenuItem>
))}
diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.js
index c31a06ad5..35a94b73c 100644
--- a/tests/e2e/general.helpers.js
+++ b/tests/e2e/general.helpers.js
@@ -796,12 +796,10 @@ export async function setSettings(selector, click = false) {
export async function checkSettings(
selector,
isChecked = true,
- isAdvanced = false
+ tabSelector = '[data-tid=generalSettingsDialog]'
) {
await clickOn('[data-tid=settings]');
- if (isAdvanced) {
- await clickOn('[data-tid=advancedSettingsDialogTID]');
- }
+ await clickOn(tabSelector);
if (isChecked) {
await global.client.check(selector + ' input');
expect(await global.client.isChecked(selector + ' input')).toBeTruthy();
diff --git a/tests/e2e/tag.helpers.js b/tests/e2e/tag.helpers.js
new file mode 100644
index 000000000..d7d26a477
--- /dev/null
+++ b/tests/e2e/tag.helpers.js
@@ -0,0 +1,35 @@
+import { clickOn, setInputKeys } from "./general.helpers";
+
+export const testTagName = 'testTag';
+export const newTagName = 'newTagName';
+export const arrTags = ['tag1', 'tag2', 'tag3'];
+export const testGroup = 'testGroupName';
+export const editedGroupName = 'testGroup';
+
+export async function createTagGroup(tagGroupName, locationName = undefined) {
+ const tagGroup = await global.client.$(
+ '[data-tid=tagLibraryMoreButton_' + tagGroupName + ']'
+ );
+ if (!tagGroup) {
+ await clickOn('[data-tid=tagLibraryMenu]');
+ await clickOn('[data-tid=createNewTagGroup]');
+
+ await setInputKeys('createTagGroupInput', tagGroupName);
+ if (locationName) {
+ await clickOn('[data-tid=tagGroupLocationTID]');
+ await clickOn('[data-tid=tglocation_' + locationName + ']');
+ }
+ await clickOn('[data-tid=createTagGroupConfirmButton]');
+ }
+}
+
+export async function addTags(arrTags) {
+ await clickOn('[data-tid=createTags]');
+ await setInputKeys('addTagsInput', arrTags.join());
+ await clickOn('[data-tid=createTagsConfirmButton]');
+}
+
+export async function tagMenu(tagName, menuOperation) {
+ await clickOn('[data-tid=tagMoreButton_' + tagName + ']');
+ await clickOn('[data-tid=' + menuOperation + ']');
+}
diff --git a/tests/e2e/tag.pw.e2e.js b/tests/e2e/tag.pw.e2e.js
index dd4c9ba12..ad090742e 100644
--- a/tests/e2e/tag.pw.e2e.js
+++ b/tests/e2e/tag.pw.e2e.js
@@ -3,47 +3,34 @@ import { expect, test } from '@playwright/test';
import {
checkSettings,
clickOn,
+ dnd,
expectElementExist,
- setInputKeys,
+ expectMetaFilesExist,
+ getGridFileSelector,
setInputValue,
takeScreenshot
-} from "./general.helpers";
-import { createFile, startTestingApp, stopApp, testDataRefresh } from "./hook";
+} from './general.helpers';
+import { createFile, startTestingApp, stopApp, testDataRefresh } from './hook';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
-import { createPwLocation, createPwMinioLocation, defaultLocationName, defaultLocationPath } from "./location.helpers";
-
-const testTagName = 'testTag';
-const newTagName = 'newTagName';
-const arrTags = ['tag1', 'tag2', 'tag3'];
-const testGroup = 'testGroupName';
-const editedGroupName = 'testGroup';
-
-export async function createTagGroup(tagGroupName) {
- const tagGroup = await global.client.$(
- '[data-tid=tagLibraryMoreButton_' + testGroup + ']'
- );
- if (!tagGroup) {
- await clickOn('[data-tid=tagLibraryMenu]');
- await clickOn('[data-tid=createNewTagGroup]');
-
- await setInputKeys('createTagGroupInput', tagGroupName);
- await clickOn('[data-tid=createTagGroupConfirmButton]');
- }
-}
-
-export async function addTags(arrTags) {
- await clickOn('[data-tid=createTags]');
- await setInputKeys('addTagsInput', arrTags.join());
- await clickOn('[data-tid=createTagsConfirmButton]');
-}
-
-export async function tagMenu(tagName, menuOperation) {
- await clickOn('[data-tid=tagMoreButton_' + tagName + ']');
- await clickOn('[data-tid=' + menuOperation + ']');
-}
+import {
+ createPwLocation,
+ createPwMinioLocation,
+ defaultLocationName,
+ defaultLocationPath
+} from './location.helpers';
+import {
+ addTags,
+ arrTags,
+ createTagGroup,
+ editedGroupName,
+ newTagName,
+ tagMenu,
+ testGroup,
+ testTagName
+} from './tag.helpers';
test.beforeAll(async () => {
- await startTestingApp();
+ await startTestingApp('extconfig.js');
//await clearDataStorage();
});
@@ -275,10 +262,27 @@ test.describe('TST04 - Testing the tag library:', () => {
test.skip('TST0417 - Collect tags from current location [electron, Pro]', async () => {});
- test('TST0419 - Create location based tag group [electron, _pro]', async () => {
- const tslContent = '{"appName":"TagSpaces","appVersion":"5.3.6","description":"","lastUpdated":"2023-06-08T16:51:23.926Z","tagGroups":[{"uuid":"collected_tag_group_id","title":"Collected Tags","color":"#61DD61","textcolor":"white","children":[{"title":"Stanimir","color":"#61DD61","textcolor":"white","type":"sidecar"}],"created_date":1686119562860,"modified_date":1686243083871,"expanded":true,"locationId":"dc1ffaaeeb5747e39dd171c7e551afd6"}]}';
- await createFile('tsl.json', tslContent,'.ts');
- await checkSettings('[data-tid=saveTagInLocationTID]', true, true);
+ test('TST0419 - Create location based tag group [web,minio,electron, _pro]', async () => {
+ await checkSettings(
+ '[data-tid=saveTagInLocationTID]',
+ true,
+ '[data-tid=advancedSettingsDialogTID]'
+ );
+ await createTagGroup(testGroup, defaultLocationName);
+ await clickOn('[data-tid=locationManager]');
+ await clickOn('[data-tid=location_' + defaultLocationName + ']');
+ await expectMetaFilesExist(['tsl.json'], true);
+ });
+
+ test('TST0420 - Load tag groups from location [web,minio,electron, _pro]', async () => {
+ const tslContent =
+ '{"appName":"TagSpaces","appVersion":"5.3.6","description":"","lastUpdated":"2023-06-08T16:51:23.926Z","tagGroups":[{"uuid":"collected_tag_group_id","title":"Collected Tags","color":"#61DD61","textcolor":"white","children":[{"title":"Stanimir","color":"#61DD61","textcolor":"white","type":"sidecar"}],"created_date":1686119562860,"modified_date":1686243083871,"expanded":true,"locationId":"dc1ffaaeeb5747e39dd171c7e551afd6"}]}';
+ await createFile('tsl.json', tslContent, '.ts');
+ await checkSettings(
+ '[data-tid=saveTagInLocationTID]',
+ true,
+ '[data-tid=advancedSettingsDialogTID]'
+ );
await clickOn('[data-tid=locationManager]');
if (global.isMinio) {
await createPwMinioLocation('', defaultLocationName, true);
@@ -287,9 +291,29 @@ test.describe('TST04 - Testing the tag library:', () => {
}
await clickOn('[data-tid=location_' + defaultLocationName + ']');
await clickOn('[data-tid=tagLibrary]');
+ await expectElementExist('[data-tid=tagContainer_Stanimir]', true);
+ });
+
+ test('TST0421 - Move tag to another tag group with DnD [web,minio,electron]', async () => {
+ const tagName = '1star';
+ const sourceTagGroup = 'Ratings';
+ const destinationTagGroup = 'Priorities';
+
await expectElementExist(
- '[data-tid=tagContainer_Stanimir]',
- true
+ '[data-tid=tagContainer_' + tagName + ']',
+ true,
+ 3000,
+ '[data-tid=tagGroupContainer_' + sourceTagGroup + ']'
+ );
+ await dnd(
+ '[data-tid=tagContainer_' + tagName + ']',
+ '[data-tid=tagGroupContainer_' + destinationTagGroup + ']'
+ );
+ await expectElementExist(
+ '[data-tid=tagContainer_' + tagName + ']',
+ true,
+ 3000,
+ '[data-tid=tagGroupContainer_' + destinationTagGroup + ']'
);
});
});