TagSpaces is an offline, open source, document manager with tagging support
Tst3001 description for files (#1908)
Stanimir5d297e0476b6
diff --git a/.github/workflows/workflow_scheduled_win_electron_pro.yml b/.github/workflows/workflow_scheduled_win_electron_pro.ymlindex d8e6a7807..cd1485872 100644--- a/.github/workflows/workflow_scheduled_win_electron_pro.yml+++ b/.github/workflows/workflow_scheduled_win_electron_pro.yml@@ -40,7 +40,7 @@ jobs:run: |npm run build-mainnpm run build-e2e- npm run test-playwright+ npm run test-playwright-pro- uses: IgnusG/[email protected]if: always() # Run regardless of whether other steps failedwith:diff --git a/app/components/EditDescription.tsx b/app/components/EditDescription.tsxindex cd22510e9..87d87c613 100644--- a/app/components/EditDescription.tsx+++ b/app/components/EditDescription.tsx@@ -66,6 +66,7 @@ function EditDescription(props: Props) {)}<ProTooltip tooltip={i18n.t('editDescription')}><Button+ data-tid="editDescriptionTID"color="primary"className={classes.button}disabled={!Pro}diff --git a/app/perspectives/grid-perspective/components/CellContent.tsx b/app/perspectives/grid-perspective/components/CellContent.tsxindex 4c77f18bd..6003ae88e 100644--- a/app/perspectives/grid-perspective/components/CellContent.tsx+++ b/app/perspectives/grid-perspective/components/CellContent.tsx@@ -225,7 +225,10 @@ function CellContent(props: Props) {{description && (<Tooltip title={i18n.t('core:entryDescription')}><Typography- id="gridCellDescription"+ data-tid={+ 'gridCellDescription' ++ description.trim().replaceAll(/\s+/g, '-')+ }className={classes.gridCellDescription}variant="caption">diff --git a/package.json b/package.jsonindex e67f55592..df3631064 100644--- a/package.json+++ b/package.json@@ -132,8 +132,9 @@"test-one": "cross-env HEADLESS_MODE=true jest --detectOpenHandles --config=jest.config.web.js -t 'TST5016' --runInBand --verbose ./tests/e2e/","test-one-suite": "cross-env jest --config=jest.config.web.js --verbose ./tests/e2e/perspective-grid-right-button.e2e.js","test-one-suite-headless": "cross-env HEADLESS_MODE=true jest --config=jest.config.web.js --verbose ./tests/e2e/fileopener.e2e.js",- "test-playwright": "npm run test-refresh-data && cross-env JEST_JUNIT_OUTPUT_DIR=./tests NODE_ENV=test jest --config=jest.config.playwright.js -t 'electron' --verbose ./tests/e2e/",- "test-playwright-web": "npm run test-refresh-data && npm run prepare-web-pro && cross-env NODE_ENV=test SHOW_CONSOLE=true DEBUG=pw:api PLAYWRIGHT=test_playwright jest --config=jest.config.web.js -t 'web' --verbose ./tests/e2e/",+ "test-playwright": "npm run test-refresh-data && cross-env JEST_JUNIT_OUTPUT_DIR=./tests NODE_ENV=test jest --config=jest.config.playwright.js -t '^(?!.*\\b_pro\\b).*\\belectron\\b.*' --verbose ./tests/e2e/",+ "test-playwright-pro": "npm run test-refresh-data && cross-env JEST_JUNIT_OUTPUT_DIR=./tests NODE_ENV=test jest --config=jest.config.playwright.js -t 'electron' --verbose ./tests/e2e/",+ "test-playwright-web": "npm run test-refresh-data && cross-env NODE_ENV=test SHOW_CONSOLE=true DEBUG=pw:api PLAYWRIGHT=test_playwright jest --config=jest.config.web.js -t 'web' --verbose ./tests/e2e/","test-playwright-web-headless": "npm run test-refresh-data && npm run prepare-web-pro && cross-env NODE_ENV=test SHOW_CONSOLE=true JEST_JUNIT_OUTPUT_DIR=./tests PLAYWRIGHT=test_playwright HEADLESS_MODE=true jest --config=jest.config.web.js -t 'web' --verbose ./tests/e2e/","test-clone-data": "rimraf tests/testdata && git clone https://github.com/tagspaces/testdata tests/testdata","test-refresh-data": "rimraf tests/testdata-tmp && shx mkdir -p tests/testdata-tmp/file-structure && shx cp -rL tests/testdata/file-structure tests/testdata-tmp",diff --git a/tests/e2e/file.properties.helpers.js b/tests/e2e/file.properties.helpers.jsindex 2810147e2..bebb9d4ff 100644--- a/tests/e2e/file.properties.helpers.js+++ b/tests/e2e/file.properties.helpers.js@@ -3,6 +3,7 @@import {addInputKeys,clickOn,+ expectElementExist,isDisplayed,removeTagFromTagMenu,setInputKeys,@@ -30,14 +31,20 @@ export async function AddRemovePropertiesTags(//await setInputValue('[data-tid=PropertiesTagsSelectTID] input', tagName);// await clickOn('[data-tid=PropertiesTagsSelectTID]');await global.client.keyboard.press('Enter');- const tagDisplayed = await isDisplayed(+ await expectElementExist('[data-tid=tagContainer_' + tagName + ']',true,- 4000+ 8000,+ '[data-tid=perspectiveGridFileTable]');- expect(tagDisplayed).toBe(true);- const propsNewTags = await getPropertiesTags();- expect(propsNewTags.includes(tagName)).toBe(true);+ await expectElementExist(+ '[data-tid=tagContainer_' + tagName + ']',+ true,+ 8000,+ '[data-tid=PropertiesTagsSelectTID]'+ );+ //const propsNewTags = await getPropertiesTags();+ //expect(propsNewTags.includes(tagName)).toBe(true);}}@@ -45,12 +52,21 @@ export async function AddRemovePropertiesTags(for (let i = 0; i < tagNames.length; i++) {const tagName = tagNames[i];await removeTagFromTagMenu(tagName);- // await global.client.waitForLoadState('networkidle'); //'networkidle'); //'domcontentloaded'); // load- await isDisplayed('[data-tid=tagContainer_' + tagName + ']', false, 4000);+ await expectElementExist(+ '[data-tid=tagContainer_' + tagName + ']',+ false,+ 8000,+ '[data-tid=perspectiveGridFileTable]'+ );+ await expectElementExist(+ '[data-tid=tagContainer_' + tagName + ']',+ false,+ 8000,+ '[data-tid=PropertiesTagsSelectTID]'+ );// await global.client.waitForTimeout(1500);- const propsNewTags = await getPropertiesTags();- // console.log(JSON.stringify(propsNewTags));- expect(propsNewTags.includes(tagName)).toBe(false);+ //const propsNewTags = await getPropertiesTags();+ //expect(propsNewTags.includes(tagName)).toBe(false);}}}diff --git a/tests/e2e/fileopener.pw.e2e.js b/tests/e2e/fileopener.pw.e2e.jsindex a5ce10a4d..ce00baa86 100644--- a/tests/e2e/fileopener.pw.e2e.js+++ b/tests/e2e/fileopener.pw.e2e.js@@ -19,9 +19,10 @@ import {setInputValue,setSettings,takeScreenshot,+ typeInputValue,waitForNotification} from './general.helpers';-import { expect } from '@playwright/test';+import { expect, test } from '@playwright/test';import {AddRemovePropertiesTags,getPropertiesFileName@@ -220,18 +221,42 @@ describe('TST08 - File folder properties', () => {});/** todo web */- it('TST3002 - Add and remove tag to a folder [minio,electron]', async () => {+ it('TST0810a - Add and remove tag to a folder [web,minio,electron]', async () => {await openContextEntryMenu(selectorFolder, 'showProperties');await AddRemovePropertiesTags(['test-tag1', 'test-tag2']);});+ it('TST0811 - Duplicate file [web,minio,electron]', async () => {+ await openContextEntryMenu(selectorFile, 'fileMenuDuplicateFileTID');+ await expectElementExist('[data-tid=tagContainer_copy]', true, 5000);+ });+it.skip('TST3004 - Folder Tagging [Pro]', async () => {});- it.skip('TST3001 - Description for files -Pro [electron]', async () => {+ /**+ * Description is Pro feature (if no Pro editDescription button is disabled)+ */+ it('TST3001 - Description for files [web,minio,electron,_pro]', async () => {+ const desc = 'testDecr';// open filePropertiesawait clickOn(selectorFile);+ await clickOn('[data-tid=fileContainerToggleProperties]');await global.client.dblclick('[data-tid=descriptionTID]');await clickOn('[data-tid=descriptionTID]');++ const editor = await global.client.waitForSelector(+ '[data-tid=descriptionTID] .milkdown'+ );+ await editor.type(desc);++ await clickOn('[data-tid=editDescriptionTID]');+ await expectElementExist(+ '[data-tid=gridCellDescription' ++ desc.trim().replaceAll(/\s+/g, '-') ++ ']',+ true,+ 10000+ );});it.skip('TST3005 - Description for folders [Pro]', async () => {});diff --git a/tests/e2e/folder.pw.e2e.js b/tests/e2e/folder.pw.e2e.jsindex 68c2fcbe5..6e226144a 100644--- a/tests/e2e/folder.pw.e2e.js+++ b/tests/e2e/folder.pw.e2e.js@@ -73,6 +73,7 @@ describe('TST01 - Folder management', () => {await takeScreenshot('TST0103 - Rename folder - after OnBackButton');await expectElementExist('[data-tid=fsEntryName_' + newDirectoryName + ']',+ true,2000);// cleanupdiff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.jsindex 352cc5c4c..7f2f74c0a 100644--- a/tests/e2e/general.helpers.js+++ b/tests/e2e/general.helpers.js@@ -327,10 +327,16 @@ export async function frameLocator(selector = 'iframe') {return await global.client.frameLocator(selector);}-export async function isDisplayed(selector, displayed = true, timeout = 500) {+export async function isDisplayed(+ selector,+ displayed = true,+ timeout = 500,+ parentSelector = undefined+) {if (global.isPlaywright) {try {- const el = await global.client.waitForSelector(selector, {+ const parentEl = parentSelector ? parentSelector : global.client;+ const el = await parentEl.waitForSelector(selector, {timeout,// strict: true,state: displayed ? 'visible' : 'hidden' //'detached'@@ -387,11 +393,20 @@ export async function getGridCellClass(fileIndex = 0) {export async function expectElementExist(selector,exist = true,- timeout = 1000+ timeout = 2000,+ parentSelector = undefined) {- const displayed = await isDisplayed(selector, exist, timeout);+ let displayed;+ if (parentSelector) {+ const parentElement = await global.client.waitForSelector(parentSelector, {+ timeout,+ state: 'visible'+ });+ displayed = await isDisplayed(selector, exist, timeout, parentElement);+ } else {+ displayed = await isDisplayed(selector, exist, timeout);+ }expect(displayed).toBe(true);- // return element;}/* export async function expectExist(element, exist = true, timeout = 5000) {diff --git a/tests/e2e/location.pw.e2e.js b/tests/e2e/location.pw.e2e.jsindex 84728cf20..dcfcaadce 100644--- a/tests/e2e/location.pw.e2e.js+++ b/tests/e2e/location.pw.e2e.js@@ -92,7 +92,7 @@ describe('TST03 - Testing locations:', () => {await expectElementExist('[data-tid=location_' + newLocationName + ']',true,- 1000+ 5000);});@@ -103,7 +103,7 @@ describe('TST03 - Testing locations:', () => {// await global.client.pause(500);await openLocationMenu(testLocationName);await startupLocation();- await expectElementExist('[data-tid=startupIndication]');+ await expectElementExist('[data-tid=startupIndication]', true, 5000);// TODO check if the indicator is setted on the correct location// TODO evlt reastart the applcatio and see if the loading of default locations works});diff --git a/tests/e2e/perspective-grid.pw.e2e.js b/tests/e2e/perspective-grid.pw.e2e.jsindex dfb8b191f..08c4019a5 100644--- a/tests/e2e/perspective-grid.pw.e2e.js+++ b/tests/e2e/perspective-grid.pw.e2e.js@@ -366,7 +366,7 @@ describe('TST50 - Perspective Grid', () => {await expectElementExist('[data-entry-id="' + selectedIds[i] + '"]',false,- 1000+ 5000);}