TagSpaces is an offline, open source, document manager with tagging support
fix: stabilizing the tests
Ilian Sapundshieva8356374164d
diff --git a/CLAUDE.md b/CLAUDE.mdindex 98cdee2e2..3936913f0 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -66,8 +66,13 @@ npx playwright test --project=electron-s3 folder.pw.e2e.js### Key patterns and pitfalls- **Workers = 1**: Tests run sequentially. Running multiple Playwright instances in parallel causes port conflicts on S3Proxy (port 4569).- **Test isolation**: Tests share a single Electron/browser instance per worker. Earlier tests can leave dirty state (renamed files, moved folders, tags) that breaks later tests. When a test fails, check if it passes in isolation first (`-g 'TSTXXXX'`).-- **S3 test data refresh**: `testDataRefresh()` in `hook.js` deletes all S3 objects and re-uploads. Uses individual `DeleteObjectCommand` (not batch `DeleteObjectsCommand`) because S3Proxy's filesystem backend throws `DirectoryNotEmptyException` on batch deletes when parent directories still contain children. Objects are sorted deepest-first before deletion.+- **S3 test data refresh**: `testDataRefresh()` in `hook.js` deletes all S3 objects and re-uploads from the **original** test data source (`tests/testdata/`), not from the worker copy. This is critical because `deleteAllObjects` wipes the S3Proxy filesystem backend which IS the worker copy (`testdata-{N}/`). Uses `Promise.allSettled` because S3Proxy can return malformed XML responses that cause AWS SDK deserialization errors. Empty directories (like `empty_folder`) need explicit directory markers since `getFilesRecursive` only finds files.- **S3Proxy config essentials**: `s3proxy.ignore-unknown-headers=true` (AWS SDK v3 sends `x-amz-checksum-crc32` headers), `s3proxy.cors-allow-all=true` (required for web tests), `jclouds.provider=filesystem-nio2`.- **Confirm dialogs**: The app uses `window.confirm()` for some operations (e.g., thumbnail overwrite). Handle with `global.client.once('dialog', (dialog) => dialog.accept())` **before** the triggering action.-- **S3 limitations**: Some features don't work on S3 locations — thumbnail generation for ODT/ODS/EPUB/TIFF, folder thumbnail set/clear (`setAsThumbTID`), sublocation listing. Keep these tests tagged `[electron,_pro]` without `s3`.-- **Timeouts**: S3 operations are slower than local filesystem. Use 10-15s for element existence checks on S3 (vs 5s local). The `createLocation` helper uses 30s for folder existence after opening a new location.+- **S3 limitations**: Some features don't work on S3 locations — thumbnail generation for ODT/ODS/EPUB/TIFF, folder thumbnail set/clear (`setAsThumbTID`), sublocation listing, open file natively (`fileMenuOpenFileNatively`), open containing folder (`fileMenuOpenContainingFolder`). Keep these tests tagged `[electron,_pro]` or `[electron]` without `s3`.+- **Timeouts**: S3 operations are slower than local filesystem. Use 15s for `empty_folder` existence checks in `beforeEach` on S3. The `createLocation` helper uses 30s for folder existence after opening a new location.+- **TagSpaces Pro source**: The `tagspacespro/` directory is a separate module loaded from `node_modules/@tagspacespro/`. When fixing Pro code (e.g., Kanban perspective), edit **both** `tagspacespro/` and `node_modules/@tagspacespro/tagspacespro/` — webpack compiles from `node_modules`. Rebuild with `npm run build-e2e` after Pro source changes.+- **`clickOn()` throws on failure**: The `clickOn()` helper in `general.helpers.js` re-throws errors after logging. This means failed clicks will fail the test immediately rather than silently continuing.+- **`openContextEntryMenu()` waits for menu**: The helper waits for the menu item to be visible (5s) before clicking, reducing flakiness from context menu render timing.+- **MUI `sx` prop and attribute monitoring**: MUI's `sx` prop generates dynamic CSS class names, not inline `style` attributes. When testing visual changes (e.g., background color), poll the `class` attribute with `waitUntilChanged()`, not `style`.+- **Kanban `getDirectoryMenuItems` parameter order**: If the `DirectoryMenuItems.tsx` function signature changes (new parameters added), all callers must be updated — especially `ColumnMenu.tsx` in tagspacespro which uses positional arguments. A misaligned parameter shifts all subsequent callbacks into wrong slots.diff --git a/tests/e2e/fileopener.pw.e2e.js b/tests/e2e/fileopener.pw.e2e.jsindex b1b7de50a..29f87d867 100644--- a/tests/e2e/fileopener.pw.e2e.js+++ b/tests/e2e/fileopener.pw.e2e.js@@ -59,7 +59,7 @@ test.beforeEach(await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);global.client.on('dialog', (dialog) => dialog.accept());// If its have opened file// await closeFileProperties();@@ -239,8 +239,11 @@ test.describe('TST08 - File folder properties', () => {'[data-tid=perspectiveGridFileTable]',);+ // After tagging, the file is renamed to include the tag in its filename+ const taggedFile = 'sample [' + tagName + '].ico';+ await expectElementExist(getGridFileSelector(taggedFile), true, 10000);await openContextEntryMenu(- getGridFileSelector('sample[' + tagName + '].ico'),+ getGridFileSelector(taggedFile),'showPropertiesTID',);@@ -444,9 +447,14 @@ test.describe('TST08 - File folder properties', () => {// const revision1 = await getRevision(0);// console.log('>>rev1>>> ' + JSON.stringify(revision1))- const revision2 = await getRevision(1);- // console.log('>>rev2>>> ' + JSON.stringify(revision2))- expect(revision2).not.toBeUndefined();+ // Poll for revision to appear (S3 may be slow to persist)+ let revision2;+ await expect+ .poll(async () => {+ revision2 = await getRevision(1);+ return revision2;+ }, { timeout: 15000 })+ .not.toBeUndefined();await clickOn('[data-tid="' + revision2.id + '"] [data-tid="restoreRevisionTID"]',);diff --git a/tests/e2e/folder.pw.e2e.js b/tests/e2e/folder.pw.e2e.jsindex d46402fa6..36ba2f489 100644--- a/tests/e2e/folder.pw.e2e.js+++ b/tests/e2e/folder.pw.e2e.js@@ -63,7 +63,7 @@ test.beforeEach(async ({ isS3, testDataDir }) => {await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);// If its have opened file// await closeFileProperties();});diff --git a/tests/e2e/folderprops.pw.e2e.js b/tests/e2e/folderprops.pw.e2e.jsindex 17461ea0e..56011ae5c 100644--- a/tests/e2e/folderprops.pw.e2e.js+++ b/tests/e2e/folderprops.pw.e2e.js@@ -333,10 +333,13 @@ test.describe('TST02 - Folder properties', () => {const imgElement = await global.client.waitForSelector('[data-tid=fsEntryName_empty_folder] img', //[contenteditable=true]'+ { timeout: 10000 },);const srcValue = await imgElement.getAttribute('src');expect(srcValue.indexOf('.ts/tst.jpg')).toBeGreaterThan(-1);+ // Wait for thumbnail to fully render before screenshot+ await global.client.waitForTimeout(500);const withThumbScreenshot = await getElementScreenshot(screenshotSelector);expect(initScreenshot).not.toBe(withThumbScreenshot);diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.jsindex 5b3ec7e9c..5f42b45bb 100644--- a/tests/e2e/general.helpers.js+++ b/tests/e2e/general.helpers.js@@ -58,7 +58,7 @@ export async function clickOn(selector, options = { timeout: 15000 }) {await global.client.click(selector, options);} catch (e) {console.log('clickOn ' + selector + ' error: ', e);- // await global.client.click(selector, { ...options, force: true });+ throw e;}}@@ -198,6 +198,10 @@ export async function typeInputValue(inputSelector, value, delay = 0) {*/export async function getGridFileName(fileIndex, cleanTags = true) {try {+ await global.client.waitForSelector(selectorFile, {+ state: 'visible',+ timeout: 8000,+ });const filesList = await global.client.$$(selectorFile);if (filesList.length > 0) {let file =diff --git a/tests/e2e/general.pw.e2e.js b/tests/e2e/general.pw.e2e.jsindex c05498e09..26d966caa 100644--- a/tests/e2e/general.pw.e2e.js+++ b/tests/e2e/general.pw.e2e.js@@ -78,7 +78,7 @@ test.beforeEach(async ({ isS3, testDataDir }) => {await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);// If its have opened file// await closeFileProperties();});diff --git a/tests/e2e/html.editor.pw.e2e.js b/tests/e2e/html.editor.pw.e2e.jsindex 37d7ddce6..018fe5fae 100644--- a/tests/e2e/html.editor.pw.e2e.js+++ b/tests/e2e/html.editor.pw.e2e.js@@ -36,7 +36,7 @@ test.beforeEach(await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);// If its have opened file// await closeFileProperties();},diff --git a/tests/e2e/json.editor.pw.e2e.js b/tests/e2e/json.editor.pw.e2e.jsindex 02a06d1af..e90dad13e 100644--- a/tests/e2e/json.editor.pw.e2e.js+++ b/tests/e2e/json.editor.pw.e2e.js@@ -36,7 +36,7 @@ test.beforeEach(await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);// If its have opened file// await closeFileProperties();},diff --git a/tests/e2e/key-bindings.pw.e2e.js b/tests/e2e/key-bindings.pw.e2e.jsindex abeb90a03..616fa0cca 100644--- a/tests/e2e/key-bindings.pw.e2e.js+++ b/tests/e2e/key-bindings.pw.e2e.js@@ -50,7 +50,7 @@ test.beforeEach(async ({ isS3, testDataDir }) => {await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);// If its have opened file// await closeFileProperties();});diff --git a/tests/e2e/location.pw.e2e.js b/tests/e2e/location.pw.e2e.jsindex b354382b8..881171437 100644--- a/tests/e2e/location.pw.e2e.js+++ b/tests/e2e/location.pw.e2e.js@@ -59,7 +59,7 @@ test.beforeEach(async ({ isS3, testDataDir }) => {}await clickOn('[data-tid=location_' + testLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);// await delay(500);// await closeFileProperties();});diff --git a/tests/e2e/markdown-editor.pw.e2e.js b/tests/e2e/markdown-editor.pw.e2e.jsindex 854b03256..415666c74 100644--- a/tests/e2e/markdown-editor.pw.e2e.js+++ b/tests/e2e/markdown-editor.pw.e2e.js@@ -46,7 +46,7 @@ test.beforeEach(async ({ isS3, testDataDir }) => {await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);// If its have opened file// await closeFileProperties();});@@ -121,9 +121,11 @@ test.describe('TST69 - Markdown editor', () => {'.milkdown div[contenteditable=true]',);await clickOn('[data-tid=fileContainerSaveFile]');+ // Wait for S3 write to complete before reloading+ await global.client.waitForTimeout(1500);await clickOn('[data-tid=cancelEditingTID]');await clickOn('[data-tid=propsActionsMenuTID]');await clickOn('[data-tid=reloadPropertiesTID]');- await expectFileContain(newFileContent, 10000);+ await expectFileContain(newFileContent, 15000);});});diff --git a/tests/e2e/objectstore.pw.e2e.js b/tests/e2e/objectstore.pw.e2e.jsindex 0e094db2e..c6fc1ea32 100644--- a/tests/e2e/objectstore.pw.e2e.js+++ b/tests/e2e/objectstore.pw.e2e.js@@ -39,7 +39,7 @@ test.beforeEach(async ({ isS3 }) => {//await createS3Location('', defaultLocationName, true);await clickOn('[data-tid=location_' + defaultLocationName + '-s3]');}- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);});test.describe('TST09 - ObjectStore location', () => {diff --git a/tests/e2e/perspective-gallery.pw.e2e.js b/tests/e2e/perspective-gallery.pw.e2e.jsindex d8569b10d..f1a472c59 100644--- a/tests/e2e/perspective-gallery.pw.e2e.js+++ b/tests/e2e/perspective-gallery.pw.e2e.js@@ -46,7 +46,7 @@ test.beforeEach(async ({ isS3, testDataDir }) => {await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);await clickOn('[data-tid=openGalleryPerspective]');});diff --git a/tests/e2e/perspective-grid-right-button.pw.e2e.js b/tests/e2e/perspective-grid-right-button.pw.e2e.jsindex 215c3d9fe..0eaad4dc1 100644--- a/tests/e2e/perspective-grid-right-button.pw.e2e.js+++ b/tests/e2e/perspective-grid-right-button.pw.e2e.js@@ -70,7 +70,7 @@ test.beforeEach(async ({ isS3, testDataDir }) => {await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);// If its have opened file// await closeFileProperties();});@@ -297,13 +297,13 @@ test.describe('TST50** - Right button on a file', () => {// await expectTagsExistBySelector(selectorFile, tags, false);});- test('TST5026 - Open file natively [s3,electron]', async () => {+ test('TST5026 - Open file natively [electron]', async () => {await searchEngine('txt');await openContextEntryMenu(selectorFile, 'fileMenuOpenFileNatively');// check parent directory});- test('TST5027 - Open containing folder [web,s3,electron]', async () => {+ test('TST5027 - Open containing folder [electron]', async () => {await searchEngine('txt');await openContextEntryMenu(selectorFile, 'fileMenuOpenContainingFolder');// check parent directory@@ -432,17 +432,17 @@ test.describe('TST50** - Right button on a file', () => {await setGridOptions('grid', false);// file- await expectElementExist(selectorFile, true);+ await expectElementExist(selectorFile, true, 5000);// folder- await expectElementExist(selectorFolder, false);+ await expectElementExist(selectorFolder, false, 5000);// show sub folder in the grid perspectiveawait setGridOptions('grid', true);// file- await expectElementExist(selectorFile, true);+ await expectElementExist(selectorFile, true, 5000);// folder- await expectElementExist(selectorFolder, true);+ await expectElementExist(selectorFolder, true, 5000);});test.skip('TST5038 - Return directory back [web,electron]', async () => {diff --git a/tests/e2e/perspective-grid-sort.pw.e2e.js b/tests/e2e/perspective-grid-sort.pw.e2e.jsindex a78fcc6e6..1265a706a 100644--- a/tests/e2e/perspective-grid-sort.pw.e2e.js+++ b/tests/e2e/perspective-grid-sort.pw.e2e.js@@ -48,7 +48,7 @@ test.beforeEach(async ({ isS3, testDataDir }) => {await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);// If its have opened file// await closeFileProperties();await clickOn('[data-tid=gridPerspectiveSortMenu]');diff --git a/tests/e2e/perspective-grid.pw.e2e.js b/tests/e2e/perspective-grid.pw.e2e.jsindex 7bdc24874..242306f24 100644--- a/tests/e2e/perspective-grid.pw.e2e.js+++ b/tests/e2e/perspective-grid.pw.e2e.js@@ -58,7 +58,7 @@ test.beforeEach(async ({ isS3, testDataDir }) => {}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);// If its have opened file// await closeFileProperties();});@@ -199,9 +199,11 @@ test.describe('TST50 - Perspective Grid', () => {await clickOn('[data-tid=gridPerspectiveCopySelectedFiles]');await clickOn('[data-tid=MoveTargetempty_folder]');await clickOn('[data-tid=confirmMoveFiles]');+ // Wait for S3 move operation to complete+ await global.client.waitForTimeout(1500);await global.client.dblclick(getGridFileSelector('empty_folder'));- await expectElementExist(getGridFileSelector(fileName));+ await expectElementExist(getGridFileSelector(fileName), true, 8000);const arrayMeta = [fileName + '.json'];/*global.isWeb || global.isMiniodiff --git a/tests/e2e/perspective-kanban.helpers.js b/tests/e2e/perspective-kanban.helpers.jsindex a0a7f7075..9a268be14 100644--- a/tests/e2e/perspective-kanban.helpers.js+++ b/tests/e2e/perspective-kanban.helpers.js@@ -31,7 +31,7 @@ export async function createMdCard(cardName, column = 'empty_folder') {}export async function getColumnEntries(column) {- await global.client.waitForTimeout(1000); // for web+ await global.client.waitForTimeout(2000); // wait for DOM to settle after reorder// grab a Locator for the containerconst container = global.client.locator('[data-tid="' + column + 'CTID"]');diff --git a/tests/e2e/perspective-kanban.pw.e2e.js b/tests/e2e/perspective-kanban.pw.e2e.jsindex 0e61c273e..8853f358d 100644--- a/tests/e2e/perspective-kanban.pw.e2e.js+++ b/tests/e2e/perspective-kanban.pw.e2e.js@@ -32,6 +32,7 @@ import {createColumn,createMdCard,dragKanBanColumn,+ expectFirstColumnElement,getColumnsIds,} from './perspective-kanban.helpers';import { openContextEntryMenu } from './test-utils';@@ -67,17 +68,18 @@ test.beforeEach(async ({ isS3, testDataDir }) => {await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- //await expectElementExist(getGridFileSelector('empty_folder'), true, 10000);await clickOn('[data-tid=openKanbanPerspective]');await expectElementExist('[data-tid=kanbanSettingsDialogOpenTID]',true,- 5000,+ 10000,);+ // Reload folder to ensure fresh S3 data is loaded+ await clickOn('[data-tid=kanbanPerspectiveOnReloadDirectory]');await expectElementExist('[data-tid=empty_folderKanBanColumnTID]',true,- 10000,+ 20000,);});@@ -97,6 +99,8 @@ test.describe('TST49 - Perspective KanBan', () => {await createFolderS3('test_kanban_column2');await createFolderS3('test_kanban_column3');await createFolderS3('test_kanban_column4');+ // Allow S3 to settle after folder creation+ await global.client.waitForTimeout(2000);} else {await createLocalFolder(testDataDir, 'test_kanban_column1');await createLocalFolder(testDataDir, 'test_kanban_column2');@@ -105,10 +109,18 @@ test.describe('TST49 - Perspective KanBan', () => {}await global.client.dblclick('[data-tid=empty_folderKanBanColumnTID]');+ // dblclick navigates into folder, which may switch to default Grid perspective+ // re-open Kanban perspective after navigation+ await clickOn('[data-tid=openKanbanPerspective]');+ await expectElementExist(+ '[data-tid=kanbanSettingsDialogOpenTID]',+ true,+ 10000,+ );await expectElementExist('[data-tid=test_kanban_column1KanBanColumnTID]',true,- 15000,+ 20000,);await expectElementExist('[data-tid=test_kanban_column2KanBanColumnTID]',@@ -216,11 +228,12 @@ test.describe('TST49 - Perspective KanBan', () => {await expectElementExist('[data-tid=OpenedTID' + dataTidFormat(columnName) + ']',true,- 8000,+ 10000,);await AddRemovePropertiesTags(['test-tag1', 'test-tag2'], {add: true,remove: false,+ expectProp: true,});});@@ -316,12 +329,9 @@ test.describe('TST49 - Perspective KanBan', () => {await clickOn('[data-tid=showProperties]');const targetSelector =- 'xpath=(//div[@data-tid="' +- columnName +- 'KanBanColumnTID"]//parent::div)[1]';+ '[data-tid="' + columnName + 'CTID"]';const initScreenshot = await getElementScreenshot(targetSelector);const initClass = await getAttribute(targetSelector, 'class');- //console.log(initClass);await clickOn('[data-tid=changeBackgroundColorTID]');await clickOn('[data-tid=backgroundTID1]');@@ -329,19 +339,18 @@ test.describe('TST49 - Perspective KanBan', () => {targetSelector,initClass,'class',- 10000,+ 15000,);const withBgnColorScreenshot = await getElementScreenshot(targetSelector);const bgClass = await getAttribute(targetSelector, 'class');- //console.log(bgClass);expect(initScreenshot).not.toBe(withBgnColorScreenshot);// remove backgroundawait clickOn('[data-tid=backgroundClearTID]');await clickOn('[data-tid=confirmConfirmResetColorDialog]');- await waitUntilChanged(targetSelector, bgClass, 'class', 10000);+ await waitUntilChanged(targetSelector, bgClass, 'class', 15000);//const bgRemovedStyle = await getAttribute(targetSelector, 'style');//expect(initStyle).toBe(bgRemovedStyle);@@ -352,43 +361,42 @@ test.describe('TST49 - Perspective KanBan', () => {test('TST4912 - Move card to top / bottom [web,s3,electron,_pro]', async () => {const cardName1 = 'testCard1';const cardName2 = 'testCard2';- await createMdCard(cardName1);- await createMdCard(cardName2);+ const card1 = await createMdCard(cardName1);+ const card2 = await createMdCard(cardName2);++ // Close any opened file panel so it doesn't block right-click on cards+ await clickOn('[data-tid=fileContainerCloseOpenedFile]');const sel1 = '[data-tid=fsEntryName_' + dataTidFormat(cardName1) + '_md]';const sel2 = '[data-tid=fsEntryName_' + dataTidFormat(cardName2) + '_md]';- async function getY(sel) {- return (await global.client.locator(sel).boundingBox()).y;- }-- // card2 (newest) should appear before card1 (lower Y = higher in list)- expect(await getY(sel2)).toBeLessThan(await getY(sel1));+ // card2 (newest) should appear first in the column+ await expectFirstColumnElement(card2.id);await rightClickOn(sel2);await clickOn('[data-tid=reorderBottomTID]');await expectElementExist(sel2, true, 5000);- // card2 at bottom: card1 should now be above card2- expect(await getY(sel1)).toBeLessThan(await getY(sel2));+ // card2 at bottom: card1 should now be first+ await expectFirstColumnElement(card1.id);await rightClickOn(sel1);await clickOn('[data-tid=reorderBottomTID]');await expectElementExist(sel1, true, 5000);- // card1 also at bottom: card2 should now be above card1- expect(await getY(sel2)).toBeLessThan(await getY(sel1));+ // card1 also at bottom: card2 should now be first+ await expectFirstColumnElement(card2.id);await rightClickOn(sel1);await clickOn('[data-tid=reorderTopTID]');await expectElementExist(sel1, true, 5000);- // card1 moved to top: card1 should now be above card2- expect(await getY(sel1)).toBeLessThan(await getY(sel2));+ // card1 moved to top: card1 should now be first+ await expectFirstColumnElement(card1.id);});test('TST4913 - Show column details [web,s3,electron,_pro]', async () => {const columnName = 'empty_folder';await clickOn('[data-tid=' + columnName + 'KanBanColumnActionTID]');await clickOn('[data-tid=showProperties]');- await expectElementExist('[data-tid=OpenedTIDempty_folder]', true, 5000);+ await expectElementExist('[data-tid=OpenedTIDempty_folder]', true, 10000);});test('TST4914 - Show current folder details [web,s3,electron,_pro]', async () => {@@ -456,8 +464,10 @@ test.describe('TST49 - Perspective KanBan', () => {await clickOn('[data-tid=changeThumbnailTID]');await clickOn('[data-tid=predefinedThumbnailsTID] > li');await clickOn('[data-tid=confirmCustomThumb]');- const targetSelector = '[data-tid=' + columnName + 'KanBanColumnThumbTID]';+ const targetSelector = '[data-tid=' + columnName + 'KanBanColumnThumbTID]';+ // Wait for thumbnail to be applied and rendered+ await global.client.waitForTimeout(2000);const loaded = await isBackgroundImageLoaded(targetSelector);expect(loaded).toBe(true);@@ -465,6 +475,8 @@ test.describe('TST49 - Perspective KanBan', () => {await clickOn('[data-tid=predefinedThumbnailsTID] > li:nth-child(2)');await clickOn('[data-tid=confirmCustomThumb]');+ // Wait for thumbnail to be applied and rendered+ await global.client.waitForTimeout(2000);const loaded2 = await isBackgroundImageLoaded(targetSelector);expect(loaded2).toBe(true);}@@ -489,13 +501,22 @@ test.describe('TST49 - Perspective KanBan', () => {const cardSelector = '[data-tid="' + columnName + 'CTID"] [data-tid=fsEntryName_' + dataTidFormat(name) + '_md]';const initScreenshot = await getElementScreenshot(cardSelector);+ expect(initScreenshot).toBeDefined();await clickOn('[data-tid=changeThumbnailTID]');await clickOn('[data-tid=predefinedThumbnailsTID] > li');await clickOn('[data-tid=confirmCustomThumb]');- const changeThumbScreenshot = await getElementScreenshot(cardSelector);- expect(initScreenshot).not.toBe(changeThumbScreenshot);+ // Wait for thumbnail to be applied and rendered, poll until screenshot changes+ await expect+ .poll(+ async () => {+ const screenshot = await getElementScreenshot(cardSelector);+ return screenshot !== initScreenshot;+ },+ { timeout: 15000 },+ )+ .toBe(true);}});diff --git a/tests/e2e/quick-access.pw.e2e.js b/tests/e2e/quick-access.pw.e2e.jsindex 08db7b8c9..dc6649025 100644--- a/tests/e2e/quick-access.pw.e2e.js+++ b/tests/e2e/quick-access.pw.e2e.js@@ -48,7 +48,7 @@ test.beforeEach(async ({ isS3, testDataDir }) => {await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);// If its have opened file// await closeFileProperties();});diff --git a/tests/e2e/search.helpers.js b/tests/e2e/search.helpers.jsindex 791f0b02f..fcaa4c1d4 100644--- a/tests/e2e/search.helpers.js+++ b/tests/e2e/search.helpers.js@@ -55,12 +55,13 @@ export async function searchEngine(options = {},executeSearch = true,) {- if (!(await isDisplayed('#textQuery'))) {+ if (!(await isDisplayed('#textQuery', true, 3000))) {await clickOn('[data-tid=toggleSearch]');+ await expectElementExist('#textQuery', true, 5000);}await global.client.type('#textQuery', filename);if (executeSearch) {- if (!(await isDisplayed('[data-tid=searchAdvancedTID]'))) {+ if (!(await isDisplayed('[data-tid=searchAdvancedTID]', true, 3000))) {await clickOn('[data-tid=advancedSearch]');}if (options.tagName) {diff --git a/tests/e2e/search.pw.e2e.js b/tests/e2e/search.pw.e2e.jsindex 3c881eb98..6c36552c7 100644--- a/tests/e2e/search.pw.e2e.js+++ b/tests/e2e/search.pw.e2e.js@@ -7,6 +7,7 @@ import {expectElementSelected,getGridFileName,getGridFileSelector,+ isDisplayed,openFile,selectorFile,setSettings,@@ -78,7 +79,7 @@ test.beforeEach(async ({ isS3, testDataDir }) => {await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);// If its have opened file// await closeFileProperties();});@@ -220,8 +221,11 @@ test.describe('TST06 - Test Search in file structure:', () => {test('TST0625 - Search actions - execute query from stored searches [web,s3,electron,_pro]', async () => {const storedSearchTitle = 'jpgSearch';await createSavedSearch({ title: storedSearchTitle, textQuery: 'jpg' });- await clickOn('#clearSearchID');- await expectElementExist('#textQuery', false, 5000);+ // Close search UI completely, then reopen for stored search query+ await clickOn('[data-tid=toggleSearch]');+ await global.client.waitForTimeout(500);+ await clickOn('[data-tid=toggleSearch]');+ await global.client.waitForTimeout(500);await searchEngine('q:', {}, false);await clickOn('#textQuery-option-0');diff --git a/tests/e2e/tag.pw.e2e.js b/tests/e2e/tag.pw.e2e.jsindex 59d1d1066..b633d2fa6 100644--- a/tests/e2e/tag.pw.e2e.js+++ b/tests/e2e/tag.pw.e2e.js@@ -292,7 +292,7 @@ test.describe('TST04 - Testing the tag library:', () => {await createTagGroup(testGroup, defaultLocationName);await clickOn('[data-tid=locationManager]');await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);await expectMetaFilesExist(['tsl.json'], true);// cleanupawait deleteTagGroup(testGroup);diff --git a/tests/e2e/test-utils.js b/tests/e2e/test-utils.jsindex d0694350f..c38883456 100644--- a/tests/e2e/test-utils.js+++ b/tests/e2e/test-utils.js@@ -12,7 +12,12 @@ export async function openContextEntryMenu(selector, menuOperation) {// selector is current selector location for element in perspectiveGridTable or perspectiveListTable (full xpath path to element)// menuOption is selector for current menu operationawait clickOn(selector, { button: 'right' });- await clickOn('[data-tid=' + menuOperation + ']');+ const menuSelector = '[data-tid=' + menuOperation + ']';+ await global.client.waitForSelector(menuSelector, {+ state: 'visible',+ timeout: 5000,+ });+ await clickOn(menuSelector);}/**diff --git a/tests/e2e/text.editor.pw.e2e.js b/tests/e2e/text.editor.pw.e2e.jsindex 89a17ba27..b3c136272 100644--- a/tests/e2e/text.editor.pw.e2e.js+++ b/tests/e2e/text.editor.pw.e2e.js@@ -36,7 +36,7 @@ test.beforeEach(await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);// If its have opened file// await closeFileProperties();},@@ -56,9 +56,11 @@ test.describe('TST55 - Text viewer/editor', () => {await clickOn('[data-tid=fileContainerEditFile]');await writeTextInIframeInput(newFileContent);await clickOn('[data-tid=fileContainerSaveFile]');+ // Wait for S3 write to complete before reloading+ await global.client.waitForTimeout(1500);await clickOn('[data-tid=cancelEditingTID]');await clickOn('[data-tid=propsActionsMenuTID]');await clickOn('[data-tid=reloadPropertiesTID]');- await expectFileContain(newFileContent, 10000);+ await expectFileContain(newFileContent, 15000);});});diff --git a/tests/e2e/viewer-audiovideo.pw.e2e.js b/tests/e2e/viewer-audiovideo.pw.e2e.jsindex bb2698c62..c076be985 100644--- a/tests/e2e/viewer-audiovideo.pw.e2e.js+++ b/tests/e2e/viewer-audiovideo.pw.e2e.js@@ -36,7 +36,7 @@ test.beforeEach(async ({ isS3, testDataDir }) => {await createPwLocation(testDataDir, defaultLocationName, true);}await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await expectElementExist(getGridFileSelector('empty_folder'), true, 15000);// If its have opened file// await closeFileProperties();});diff --git a/tests/s3rver/S3DataRefresh.js b/tests/s3rver/S3DataRefresh.jsindex 70489be80..ef7bd89fc 100644--- a/tests/s3rver/S3DataRefresh.js+++ b/tests/s3rver/S3DataRefresh.js@@ -18,10 +18,17 @@ const directoryPath = path.resolve(function getFilesRecursive(dirPath) {let files = [];+ let emptyDirs = [];const traverse = (currentPath) => {const items = fs.readdirSync(currentPath);+ if (items.length === 0) {+ // Track empty directories so we can create markers in S3+ emptyDirs.push(currentPath);+ return;+ }+items.forEach((item) => {const itemPath = path.join(currentPath, item);const stat = fs.statSync(itemPath);@@ -35,7 +42,7 @@ function getFilesRecursive(dirPath) {};traverse(dirPath);- return files;+ return { files, emptyDirs };}function getS3Client() {@@ -168,23 +175,46 @@ function createDir(dirPath) {});}-function uploadTestDirectory(dirPath) {+async function uploadTestDirectory(dirPath) {try {- const files = getFilesRecursive(dirPath);+ const { files, emptyDirs } = getFilesRecursive(dirPath);+ // Use allSettled so a single XML parsing error from S3Proxy+ // doesn't abort all remaining uploads+ const uploads = files.map((file) => uploadFile(file));+ // Create directory markers for empty directories+ const dirMarkers = emptyDirs.map((dir) => {+ const key = path.relative(directoryPath, dir).replace(/\\/g, '/');+ return createDir(key);+ });+ const results = await Promise.allSettled([...uploads, ...dirMarkers]);+ const failures = results.filter((r) => r.status === 'rejected');+ if (failures.length > 0) {+ console.warn(+ `${failures.length} of ${results.length} uploads had errors (likely S3Proxy XML response issues)`,+ );+ }console.log(`All files in ${dirPath} uploaded to ${bucketName}`);- return Promise.all(files.map((file) => uploadFile(file)));} catch (err) {console.error(`Error uploading directory ${dirPath}:`, err);}}-async function refreshS3testData(testDataDir) {+async function refreshS3testData() {try {await deleteAllObjects('supported-filestypes');} catch (error) {console.error('deleteAllObjects error:', error.message);}- await uploadTestDirectory(testDataDir);+ // Always upload from the original test data source (directoryPath),+ // not from the worker-specific copy, because deleteAllObjects wipes+ // the S3Proxy filesystem backend which IS the worker copy.+ try {+ await uploadTestDirectory(directoryPath);+ } catch (error) {+ // S3Proxy may return malformed XML responses that cause AWS SDK+ // deserialization errors, even though the upload succeeded+ console.error('uploadTestDirectory error:', error.message);+ }}module.exports = {