Skip to content

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

e2e refactoring (#2298)

Stanimir5115c2d454c7
diff --git a/package.json b/package.json
index 81b362424..1c68a78b4 100644
--- a/package.json
+++ b/package.json
@@ -138,14 +138,14 @@
"start:renderer": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts",
"test": "jest",
"test-clone-data": "rimraf tests/testdata && git clone https://github.com/tagspaces/testdata tests/testdata",
- "test-playwright": "npm run test-refresh-data && cross-env npx playwright test --project=electron -g '^(?!.*\\b_pro\\b).*\\belectron\\b.*'",
- "test-playwright-pro": "npm run test-refresh-data && cross-env npx playwright test --project=electron -g '/\\belectron\\b/'",
- "test-playwright-s3": "npx playwright install --with-deps && cross-env NODE_OPTIONS=--openssl-legacy-provider npx playwright test --project=electron-s3 -g '/\\bminio\\b/'",
- "test-playwright-minio": "npm run test-refresh-data && cross-env npx playwright test --project=electron-minio -g '/\\bminio\\b/'",
+ "test-playwright": "npx playwright install --with-deps && cross-env npx playwright test --project=electron-light",
+ "test-playwright-pro": "npx playwright install --with-deps && cross-env npx playwright test --project=electron",
+ "test-playwright-s3": "npx playwright install --with-deps && cross-env NODE_OPTIONS=--openssl-legacy-provider npx playwright test --project=electron-s3",
+ "test-playwright-minio": "npx playwright install --with-deps && cross-env npx playwright test --project=electron-minio",
"test-playwright-web": "npx playwright install --with-deps && cross-env NODE_OPTIONS=--openssl-legacy-provider npx playwright test --project=web-s3",
"test-playwright-web-headless": "npx playwright install --with-deps && cross-env NODE_OPTIONS=--openssl-legacy-provider HEADLESS_MODE=true npx playwright test --project=web-s3",
- "test-playwright-web-minio": "npm run test-refresh-data && cross-env npx playwright test --project=web-minio",
- "test-playwright-web-headless-minio": "npm run test-refresh-data && cross-env HEADLESS_MODE=true npx playwright test --project=web-minio",
+ "test-playwright-web-minio": "npx playwright install --with-deps && cross-env npx playwright test --project=web-minio",
+ "test-playwright-web-headless-minio": "npx playwright install --with-deps && cross-env HEADLESS_MODE=true npx playwright test --project=web-minio",
"test-pw-web-browsers": "npm run test-refresh-data && cross-env DEBUG=pw:api npx playwright test --config ./playwright.config.web.browsers.js -g '/\\bweb\\b/'",
"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 && npx playwright install --with-deps",
"test-unit": "npx playwright test --config ./playwright.unit.js",
diff --git a/playwright.config.common.js b/playwright.config.common.js
index 1bdd4d7d7..209be4a9b 100644
--- a/playwright.config.common.js
+++ b/playwright.config.common.js
@@ -11,15 +11,15 @@ const pwConfig = {
trace: 'on-first-retry',
},
// Set the timeout for each test
- timeout: process.env.CI ? 120000 : 300000,
+ timeout: process.env.CI ? 120000 : 30000,
// (2 hours) Maximum time in milliseconds the whole test suite can run. Useful on CI to prevent broken setup from running too long and wasting resources.
globalTimeout: process.env.CI ? 2 * 60 * 60 * 1000 : undefined,
ignoreSnapshots: !process.env.CI,
retries: process.env.CI ? 2 : 0,
// The maximum number of test failures for the whole test suite run. After reaching this number, testing will stop and exit with an error
- maxFailures: 0, // process.env.CI ? 20 : 0,
- globalSetup: './tests/global-setup.js',
- globalTeardown: './tests/global-teardown.js',
+ maxFailures: process.env.CI ? 20 : 0,
+ //globalSetup: './tests/global-setup.js',
+ //globalTeardown: './tests/global-teardown.js',
/*use: {
screenshot: {
mode: 'only-on-failure',
diff --git a/playwright.config.js b/playwright.config.js
index 3b8a94056..f17bd7331 100644
--- a/playwright.config.js
+++ b/playwright.config.js
@@ -7,42 +7,43 @@ const isWin = /win32|mswin(?!ce)|mingw|bccwin|cygwin/i.test(process.platform);
function projectTagGrep(name) {
// \b ensures we match whole words (so “web” doesn’t match “webhook”)
return new RegExp(`\\[.*\\b${name}\\b.*\\]`);
- //return new RegExp('TST5706');
+ //return new RegExp('(?:TST0108|TST0109|TST0114|TST5025|TST0419|TST0216|TST0218)'); // return new RegExp(`TST01.*`);
}
export default defineConfig({
...pwConfig,
projects: [
+ {
+ name: 'electron-light',
+ grep: new RegExp('^(?!.*\\b_pro\\b).*\\belectron\\b.*'),
+ use: {
+ isElectron: true,
+ isWin,
+ },
+ },
{
name: 'electron',
+ grep: projectTagGrep('electron'),
use: {
isElectron: true,
- isWeb: false,
- isUnitTest: false,
- isMinio: false,
- isS3: false,
isWin,
},
},
{
name: 'electron-s3',
+ grep: projectTagGrep('minio'),
use: {
isElectron: true,
- isWeb: false,
- isUnitTest: false,
- isMinio: false,
isS3: true,
isWin,
},
},
{
name: 'electron-minio',
+ grep: projectTagGrep('minio'),
use: {
isElectron: true,
- isWeb: false,
- isUnitTest: false,
isMinio: true,
- isS3: false,
isWin,
},
},
@@ -50,24 +51,18 @@ export default defineConfig({
name: 'web-s3',
grep: projectTagGrep('web'),
use: {
- isElectron: false,
isWeb: true,
- isUnitTest: false,
- isMinio: false,
isS3: true,
isWin,
- ...devices['Desktop Chrome'],
+ // ...devices['Desktop Chrome'],
},
},
{
name: 'web-minio',
grep: projectTagGrep('web'),
use: {
- isElectron: false,
isWeb: true,
- isUnitTest: false,
isMinio: true,
- isS3: false,
isWin,
},
},
diff --git a/release/app/package-lock.json b/release/app/package-lock.json
index dcaa283d1..1d001c549 100644
--- a/release/app/package-lock.json
+++ b/release/app/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "tagspaces",
- "version": "6.4.6",
+ "version": "6.4.7",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "tagspaces",
- "version": "6.4.6",
+ "version": "6.4.7",
"hasInstallScript": true,
"license": "AGPL-3.0",
"dependencies": {
diff --git a/src/renderer/components/dialogs/CreateTagGroupDialog.tsx b/src/renderer/components/dialogs/CreateTagGroupDialog.tsx
index 9e02ea022..780fb8f88 100644
--- a/src/renderer/components/dialogs/CreateTagGroupDialog.tsx
+++ b/src/renderer/components/dialogs/CreateTagGroupDialog.tsx
@@ -214,7 +214,7 @@ function CreateTagGroupDialog(props: Props) {
<MenuItem
key={defaultTagGroupLocation}
value={defaultTagGroupLocation}
- data-tid={'tagLibraryTID'}
+ data-tid="tagLibraryTID"
>
{t('tagLibrary')}
</MenuItem>
diff --git a/src/renderer/perspectives/grid/components/GridCell.tsx b/src/renderer/perspectives/grid/components/GridCell.tsx
index 74c155540..2cf5c3828 100644
--- a/src/renderer/perspectives/grid/components/GridCell.tsx
+++ b/src/renderer/perspectives/grid/components/GridCell.tsx
@@ -471,23 +471,25 @@ function GridCell(props: Props) {
>
{entryTitle}
</Typography>
- <Typography
- title={description}
- data-tid="gridCellDescription"
- variant="caption"
- display="block"
- gutterBottom
- style={{
- lineHeight: '12px',
- paddingRight: 4,
- overflowX: 'clip',
- textWrap: 'nowrap',
- whiteSpace: 'nowrap',
- color: 'gray',
- }}
- >
- {description}
- </Typography>
+ {description && (
+ <Typography
+ title={description}
+ data-tid="gridCellDescription"
+ variant="caption"
+ display="block"
+ gutterBottom
+ style={{
+ lineHeight: '12px',
+ paddingRight: 4,
+ overflowX: 'clip',
+ textWrap: 'nowrap',
+ whiteSpace: 'nowrap',
+ color: 'gray',
+ }}
+ >
+ {description}
+ </Typography>
+ )}
</CardContent>
<CardHeader
style={{ padding: 2 }}
diff --git a/tests/e2e/clearstorage.helpers.js b/tests/e2e/clearstorage.helpers.js
index 18e881367..24896cd95 100644
--- a/tests/e2e/clearstorage.helpers.js
+++ b/tests/e2e/clearstorage.helpers.js
@@ -5,21 +5,23 @@ export async function clearStorage() {
//await global.context.clearCookies();
//await global.client.clearStorageState();
- // Evaluate JavaScript to clear local storage.
- await global.client.evaluate(() => {
- window.localStorage.clear();
- });
- await global.client.evaluate(() => {
- window.sessionStorage.clear();
- });
- // Execute JavaScript to clear cookies.
- await global.client.evaluate(() => {
- document.cookie.split(';').forEach(function (c) {
- document.cookie = c
- .replace(/^ +/, '')
- .replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/');
+ if (global.client) {
+ // Evaluate JavaScript to clear local storage.
+ await global.client.evaluate(() => {
+ window.localStorage.clear();
+ });
+ await global.client.evaluate(() => {
+ window.sessionStorage.clear();
+ });
+ // Execute JavaScript to clear cookies.
+ await global.client.evaluate(() => {
+ document.cookie.split(';').forEach(function (c) {
+ document.cookie = c
+ .replace(/^ +/, '')
+ .replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/');
+ });
});
- });
+ }
/*if (global.session) {
//await global.client.evaluate(() => window.localStorage.clear());
//await global.client.evaluate(() => window.sessionStorage.clear());
diff --git a/tests/e2e/file.properties.helpers.js b/tests/e2e/file.properties.helpers.js
index 6b6f12225..61e152bbd 100644
--- a/tests/e2e/file.properties.helpers.js
+++ b/tests/e2e/file.properties.helpers.js
@@ -8,6 +8,7 @@ import {
removeTagFromTagMenu,
selectorFile,
setInputKeys,
+ setInputValue,
} from './general.helpers';
export async function getPropertiesTags() {
@@ -41,8 +42,8 @@ export async function AddRemovePropertiesTags(
const tagName = tagNames[i];
const propsTags = await getPropertiesTags();
expect(propsTags.includes(tagName)).toBe(false);
- await setInputKeys('PropertiesTagsSelectTID', tagName, 100);
- //await setInputValue('[data-tid=PropertiesTagsSelectTID] input', tagName);
+ // await setInputKeys('PropertiesTagsSelectTID', tagName, 100);
+ await setInputValue('[data-tid=PropertiesTagsSelectTID] input', tagName);
// await clickOn('[data-tid=PropertiesTagsSelectTID]');
await global.client.keyboard.press('Enter');
await expectElementExist(
diff --git a/tests/e2e/fileopener.pw.e2e.js b/tests/e2e/fileopener.pw.e2e.js
index 00db0ea7c..19ac5326e 100644
--- a/tests/e2e/fileopener.pw.e2e.js
+++ b/tests/e2e/fileopener.pw.e2e.js
@@ -4,7 +4,6 @@ import {
createPwMinioLocation,
createPwLocation,
defaultLocationName,
- defaultLocationPath,
createS3Location,
} from './location.helpers';
import {
@@ -18,6 +17,7 @@ import {
getGridFileSelector,
getRevision,
isDisplayed,
+ openFile,
openFolder,
selectorFile,
selectorFolder,
@@ -31,7 +31,6 @@ import {
import {
AddRemovePropertiesTags,
getPropertiesFileName,
- getPropertiesTags,
} from './file.properties.helpers';
import { openContextEntryMenu } from './test-utils';
import {
@@ -43,50 +42,38 @@ import {
} from './hook';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
import { dataTidFormat } from '../../src/renderer/services/test';
-import { stopServices } from '../setup-functions';
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
-});
-
-test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
-});
-
-test.afterEach(async ({ page }, testInfo) => {
+test.afterEach(async ({ isS3, testDataDir }, testInfo) => {
/*if (testInfo.status !== testInfo.expectedStatus) {
await takeScreenshot(testInfo);
}*/
- await testDataRefresh(s3ServerInstance);
+
+ await testDataRefresh(isS3, testDataDir);
await clearDataStorage();
await stopApp();
});
-test.beforeEach(async ({ isMinio, isS3, isWeb }) => {
- await startTestingApp(
- { isWeb, isS3 },
- isMinio || isS3 ? undefined : 'extconfig.js',
- );
- if (isMinio) {
- await closeWelcomePlaywright();
- await createPwMinioLocation('', defaultLocationName, true);
- } else if (isS3) {
- await closeWelcomePlaywright();
- await createS3Location('', defaultLocationName, true);
- } else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
- }
- await clickOn('[data-tid=location_' + defaultLocationName + ']');
- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
- // If its have opened file
- // await closeFileProperties();
-});
+test.beforeEach(
+ async ({ isMinio, isS3, isWeb, webServerPort, testDataDir }, testInfo) => {
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ isMinio || isS3 ? undefined : 'extconfig.js',
+ );
+ if (isMinio) {
+ await closeWelcomePlaywright();
+ await createPwMinioLocation('', defaultLocationName, true);
+ } else if (isS3) {
+ await closeWelcomePlaywright();
+ await createS3Location('', defaultLocationName, true);
+ } else {
+ await createPwLocation(testDataDir, defaultLocationName, true);
+ }
+ await clickOn('[data-tid=location_' + defaultLocationName + ']');
+ await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
+ // If its have opened file
+ // await closeFileProperties();
+ },
+);
test.describe('TST08 - File folder properties', () => {
test('TST0801 - Arrow keys select next prev file (keybindings) [web,s3,electron]', async () => {
@@ -197,21 +184,14 @@ test.describe('TST08 - File folder properties', () => {
// expect(global.client).toHaveSelector('[data-tid=folderContainerTID]');
});
- test('TST0805 - Rename opened file [web,electron]', async () => {
+ test('TST0805 - Rename opened file [web,electron]', async ({}) => {
const fileName = 'sample.svg';
const newTitle = 'renamed.svg';
// set setting PersistTagsInSidecarFile in order to add meta json file
await setSettings('[data-tid=settingsSetPersistTagsInSidecarFile]', true);
// open fileProperties
- await openContextEntryMenu(
- getGridFileSelector(fileName),
- 'showPropertiesTID',
- );
- //await clickOn(getGridFileSelector(fileName));
-
- //Toggle Properties
- //await clickOn('[data-tid=detailsTabTID]');
+ await openFile(fileName, 'showPropertiesTID');
await AddRemovePropertiesTags(['test-tag1', 'test-tag2'], {
add: true,
@@ -237,6 +217,7 @@ test.describe('TST08 - File folder properties', () => {
await expectMetaFilesExist(arrayMeta);
await setSettings('[data-tid=settingsSetPersistTagsInSidecarFile]', true);
+ //await testDataRefresh(isS3, testDataDir);
//turn fileName back
/*await clickOn('[data-tid=startRenameEntryTID]');
await setInputValue('[data-tid=fileNameProperties] input', propsFileName);
@@ -253,12 +234,7 @@ test.describe('TST08 - File folder properties', () => {
test('TST0808 - Add and remove tags to a file (file names) [web,electron]', async () => {
// open fileProperties
const fileName = 'sample.epub'; //'sample.svg';
- await openContextEntryMenu(
- getGridFileSelector(fileName),
- 'showPropertiesTID',
- );
- /*await clickOn(selectorFile);
- await clickOn('[data-tid=detailsTabTID]');*/
+ await openFile(fileName, 'showPropertiesTID');
await AddRemovePropertiesTags(['test-tag1', 'test-tag2']);
});
@@ -267,10 +243,7 @@ test.describe('TST08 - File folder properties', () => {
await setSettings('[data-tid=settingsSetPersistTagsInSidecarFile]', true);
// open fileProperties
const fileName = 'sample.bmp';
- await openContextEntryMenu(
- getGridFileSelector(fileName),
- 'showPropertiesTID',
- );
+ await openFile(fileName, 'showPropertiesTID');
await AddRemovePropertiesTags(['test-tag1', 'test-tag2']);
await setSettings('[data-tid=settingsSetPersistTagsInSidecarFile]', true);
});
@@ -280,7 +253,7 @@ test.describe('TST08 - File folder properties', () => {
await clickOn('[data-tid=tagLibrary]');
await dnd(
'[data-tid=tagContainer_' + tagName + ']',
- getGridFileSelector('sample.txt'),
+ getGridFileSelector('sample.ico'),
);
await expectElementExist(
'[data-tid=tagContainer_' + tagName + ']',
@@ -290,7 +263,7 @@ test.describe('TST08 - File folder properties', () => {
);
await openContextEntryMenu(
- getGridFileSelector('sample[' + tagName + '].txt'),
+ getGridFileSelector('sample[' + tagName + '].ico'),
'showPropertiesTID',
);
@@ -306,8 +279,11 @@ test.describe('TST08 - File folder properties', () => {
});
test('TST0811 - Duplicate file [web,electron]', async () => {
- await openContextEntryMenu(selectorFile, 'fileMenuDuplicateFileTID');
- await expectElementExist('[data-tid=tagContainer_copy]', true, 5000);
+ await openContextEntryMenu(
+ getGridFileSelector('sample.jpg'),
+ 'fileMenuDuplicateFileTID',
+ );
+ await expectElementExist('[data-tid=tagContainer_copy]', true, 10000);
});
test.skip('TST3004 - Folder Tagging [Pro]', async () => {});
@@ -333,6 +309,8 @@ test.describe('TST08 - File folder properties', () => {
delay: 0,
});
+ await clickOn('[data-tid=editDescriptionTID]');
+ await clickOn('[data-tid=editDescriptionTID]');
await clickOn('[data-tid=editDescriptionTID]');
await expectElementExist(
'[data-tid=gridCellDescription]',
@@ -350,7 +328,7 @@ test.describe('TST08 - File folder properties', () => {
/**
* reload file button failed on web windows only but the problem is in test only
*/
- test('TST0812 - Reload file [electron]', async ({ isS3 }) => {
+ test('TST0812 - Reload file [electron]', async ({ isS3, testDataDir }) => {
// open fileProperties
await clickOn(getGridFileSelector('sample.txt'));
//Toggle Properties
@@ -362,7 +340,7 @@ test.describe('TST08 - File folder properties', () => {
if (isS3) {
await createFileS3('sample.txt', newFileContent, '.');
} else {
- await createFile('sample.txt', newFileContent, '.');
+ await createFile(testDataDir, 'sample.txt', newFileContent, '.');
}
await clickOn('[data-tid=propsActionsMenuTID]');
await clickOn('[data-tid=reloadPropertiesTID]');
@@ -372,6 +350,7 @@ test.describe('TST08 - File folder properties', () => {
test('TST0813 - Delete file and check meta and thumbnails deleted [web,minio,electron]', async ({
isMinio,
isS3,
+ testDataDir,
}) => {
const fileName = 'new_file.svg';
const svg = `<svg
@@ -387,15 +366,11 @@ test.describe('TST08 - File folder properties', () => {
if (isS3) {
await createFileS3(fileName, svg);
} else {
- await createFile(fileName, svg);
+ await createFile(testDataDir, fileName, svg);
}
await openFolder('empty_folder');
await expectElementExist(getGridFileSelector(fileName));
- //await clickOn(getGridFileSelector(fileName));
- await openContextEntryMenu(
- getGridFileSelector(fileName),
- 'showPropertiesTID', //'fileMenuOpenFile'
- );
+ await openFile(fileName, 'showPropertiesTID');
const tags = isMinio ? ['test-tag1'] : ['test-tag1', 'test-tag2'];
// add meta json to file
@@ -421,7 +396,8 @@ test.describe('TST08 - File folder properties', () => {
test('TST0813a - Delete file and check revisions deleted [web,electron,_pro]', async () => {
const fileName = 'sample.txt';
- await clickOn(getGridFileSelector(fileName));
+ // await clickOn(getGridFileSelector(fileName));
+ await openFile(fileName);
await clickOn('[data-tid=fileContainerEditFile]');
await writeTextInIframeInput('txt');
await clickOn('[data-tid=fileContainerSaveFile]');
@@ -485,13 +461,7 @@ test.describe('TST08 - File folder properties', () => {
test('TST0827 - Link for internal sharing + copy [web,electron]', async () => {
const fileName = 'sample.jpg';
- //await clickOn(getGridFileSelector(fileName));
- await openContextEntryMenu(
- getGridFileSelector(fileName),
- 'showPropertiesTID',
- );
- //await expectElementExist('[data-tid=detailsTabTID]', true, 5000);
- //await clickOn('[data-tid=detailsTabTID]');
+ await openFile(fileName, 'showPropertiesTID');
const sharingLinkValue = await global.client.inputValue(
'[data-tid=sharingLinkTID] input',
diff --git a/tests/e2e/fixtures.js b/tests/e2e/fixtures.js
index 1f3374f63..2705da409 100644
--- a/tests/e2e/fixtures.js
+++ b/tests/e2e/fixtures.js
@@ -1,14 +1,16 @@
import { test as base, expect } from '@playwright/test';
import { runS3Server, startMinio, startWebServer } from '../setup-functions';
import { uploadTestDirectory } from '../s3rver/S3DataRefresh';
-import { removeExtConfig } from './hook';
+import { copyExtConfig, removeExtConfig } from './hook';
+import pathLib from 'path';
+import fse from 'fs-extra';
// Extend base test with a fixture for the S3 server
const test = base.extend({
- isWeb: [false, { option: true }],
- isS3: [false, { option: true }],
- isMinio: [false, { option: true }],
- isWin: [false, { option: true }],
+ isWeb: [false, { option: true, scope: 'worker' }],
+ isS3: [false, { option: true, scope: 'worker' }],
+ isMinio: [false, { option: true, scope: 'worker' }],
+ isWin: [false, { option: true, scope: 'worker' }],
/* TODO
// 1) Launch Electron once per test (or per worker if you prefer beforeAll)
electronApp: async ({}, use) => {
@@ -22,37 +24,112 @@ const test = base.extend({
const window = await electronApp.firstWindow();
await use(window);
},*/
- webServer: async ({ isWeb }, use) => {
- if (isWeb) {
- await removeExtConfig();
- const webserver = await startWebServer();
- await use(webserver);
- } else {
- // If the test does not require the S3 server, just use a dummy value
- await use(null);
- }
- },
- s3Server: async ({ isS3 }, use, testInfo) => {
- if (isS3) {
- //testInfo.title.includes('web')) {
- const s3Server = await runS3Server();
- await uploadTestDirectory();
- await use(s3Server);
- //await s3Server.close();
- } else {
- // If the test does not require the S3 server, just use a dummy value
- await use(null);
- }
- },
- minioServer: async ({ isMinio, isWin }, use, testInfo) => {
- if (isMinio) {
- const minioProcess = await startMinio(isWin);
- await use(minioProcess);
- } else {
- // If the test does not require the S3 server, just use a dummy value
- await use(null);
- }
- },
+ webServerPort: [
+ async ({ isWeb, isS3 }, use, testInfo) => {
+ if (isWeb) {
+ await copyExtConfig({ isWeb, isS3 }, 'extconfig-s3-location.js');
+ const { app, port, server } = await startWebServer();
+ // make port and server available to tests
+ await use(port);
+ // teardown
+ await new Promise((f) => server.close(f));
+ await removeExtConfig(isWeb);
+ } else {
+ // If the test does not require the S3 server, just use a dummy value
+ await use(null);
+ }
+ },
+ { scope: 'worker', auto: true },
+ ],
+ s3Server: [
+ async ({ isS3 }, use, testInfo) => {
+ if (isS3) {
+ //testInfo.title.includes('web')) {
+ const s3Server = await runS3Server(`testdata-${testInfo.workerIndex}`);
+ const src = pathLib.join(
+ __dirname,
+ '..',
+ 'testdata',
+ 'file-structure',
+ 'supported-filestypes',
+ );
+ await uploadTestDirectory(src);
+ await use(s3Server);
+ await s3Server.close();
+ await fse.rm(
+ pathLib.join(__dirname, '..', `testdata-${testInfo.workerIndex}`),
+ {
+ recursive: true,
+ force: true,
+ maxRetries: 5, // retry on EBUSY/EMFILE/ENFILE
+ retryDelay: 100, // optional back‑off in ms
+ },
+ );
+ } else {
+ // If the test does not require the S3 server, just use a dummy value
+ await use(null);
+ }
+ },
+ { scope: 'worker', auto: true },
+ ],
+ minioServer: [
+ async ({ isMinio, isWin, testDataDir }, use, testInfo) => {
+ if (isMinio) {
+ const minioProcess = await startMinio(
+ isWin,
+ `testdata-${testInfo.workerIndex}`,
+ );
+ await use(minioProcess);
+ minioProcess.stdin.pause();
+ minioProcess.kill();
+ } else {
+ // If the test does not require the S3 server, just use a dummy value
+ await use(null);
+ }
+ },
+ { scope: 'worker', auto: true },
+ ],
+ testDataDir: [
+ async ({ isS3 }, use, testInfo) => {
+ if (!isS3) {
+ const src = pathLib.join(
+ __dirname,
+ '..',
+ 'testdata',
+ 'file-structure',
+ 'supported-filestypes',
+ );
+
+ const testdata = pathLib.join(
+ __dirname,
+ '..',
+ `testdata-${testInfo.workerIndex}`,
+ );
+ const dst = pathLib.join(testdata, 'file-structure');
+ let newPath = pathLib.join(dst, pathLib.basename(src));
+ await fse.copy(src, newPath);
+
+ await use(newPath);
+ await fse.rm(testdata, {
+ recursive: true,
+ force: true,
+ maxRetries: 5, // retry on EBUSY/EMFILE/ENFILE
+ retryDelay: 100, // optional back‑off in ms
+ });
+ } else {
+ await use(
+ pathLib.join(
+ __dirname,
+ '..',
+ `testdata-${testInfo.workerIndex}`,
+ 'file-structure',
+ 'supported-filestypes',
+ ),
+ );
+ }
+ },
+ { scope: 'worker', auto: true },
+ ],
});
const extendedExpect = expect.extend({
diff --git a/tests/e2e/folder.pw.e2e.js b/tests/e2e/folder.pw.e2e.js
index a85bef3b3..53d350f39 100644
--- a/tests/e2e/folder.pw.e2e.js
+++ b/tests/e2e/folder.pw.e2e.js
@@ -3,7 +3,6 @@
*/
import { test, expect } from './fixtures';
import {
- defaultLocationPath,
defaultLocationName,
createPwMinioLocation,
createPwLocation,
@@ -21,47 +20,30 @@ import {
setInputKeys,
getGridFileSelector,
getElementScreenshot,
- waitForNotification,
- expectAllFileSelected,
- selectAllFiles,
openFolder,
waitUntilChanged,
getAttribute,
} from './general.helpers';
import { openContextEntryMenu, renameFolder } from './test-utils';
-import {
- createFile,
- createFileS3,
- startTestingApp,
- stopApp,
- testDataRefresh,
-} from './hook';
+import { createFile, createFileS3, startTestingApp, stopApp } from './hook';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
import { emptyFolderName } from './search.helpers';
import { AddRemovePropertiesTags } from './file.properties.helpers';
import { AddRemoveTagsToSelectedFiles } from './perspective-grid.helpers';
-import { stopServices } from '../setup-functions';
-
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
+test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
if (isS3) {
- await startTestingApp({ isWeb, isS3 });
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
await closeWelcomePlaywright();
} else {
- await startTestingApp({ isWeb, isS3 }, 'extconfig.js');
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ 'extconfig.js',
+ );
}
});
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
- await testDataRefresh(s3ServerInstance);
await stopApp();
});
@@ -72,14 +54,14 @@ test.afterEach(async ({ page }, testInfo) => {
await clearDataStorage();
});
-test.beforeEach(async ({ isMinio, isS3 }) => {
+test.beforeEach(async ({ isMinio, isS3, testDataDir }) => {
if (isMinio) {
await createPwMinioLocation('', defaultLocationName, true);
} else if (isS3) {
await createS3Location('', defaultLocationName, true);
await closeWelcomePlaywright();
} else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ await createPwLocation(testDataDir, defaultLocationName, true);
}
await clickOn('[data-tid=location_' + defaultLocationName + ']');
await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
@@ -90,7 +72,11 @@ test.beforeEach(async ({ isMinio, isS3 }) => {
test.describe('TST01 - Folder management', () => {
test('TST0101 - Create subfolder [web,electron]', async () => {
const testFolder = await createNewDirectory();
- await expectElementExist('[data-tid=fsEntryName_' + testFolder + ']');
+ await expectElementExist(
+ '[data-tid=fsEntryName_' + testFolder + ']',
+ true,
+ 8000,
+ );
await global.client.dblclick('[data-tid=fsEntryName_' + testFolder + ']');
await expectElementExist(
'[data-tid=currentDir_' + testFolder + ']',
@@ -105,7 +91,7 @@ test.describe('TST01 - Folder management', () => {
await expectElementExist(
'[data-tid=fsEntryName_' + testFolder + ']',
false,
- 5000,
+ 8000,
);
});
@@ -182,17 +168,23 @@ test.describe('TST01 - Folder management', () => {
test.skip('TST0107 - Show in file manager [manual]', async () => {});
- test('TST0108 - Move folder [web,electron]', async ({ isS3 }) => {
+ test('TST0108 - Move folder [web,electron]', async ({
+ isS3,
+ testDataDir,
+ }) => {
if (isS3) {
await createFileS3('file_to_move.txt', 'testing file content');
} else {
- await createFile('file_to_move.txt', 'testing file content');
+ await createFile(testDataDir, 'file_to_move.txt', 'testing file content');
}
+
+ const testFolder = await createNewDirectory('empty_folder2');
await openContextEntryMenu(
- '[data-tid=fsEntryName_empty_folder]',
+ '[data-tid=fsEntryName_' + testFolder + ']',
'fileMenuMoveCopyDirectoryTID',
);
await clickOn('[data-tid=newSubdirectoryTID]');
+
const folderToMove = 'folder_to_move';
await setInputKeys('directoryName', folderToMove);
await clickOn('[data-tid=confirmCreateNewDirectory]');
@@ -200,17 +192,20 @@ test.describe('TST01 - Folder management', () => {
await clickOn('[data-tid=confirmMoveFiles]');
await clickOn('[data-tid=uploadCloseAndClearTID]');
await clickOn('[data-tid=location_' + defaultLocationName + ']');
- await expectElementExist(getGridFileSelector('empty_folder'), false, 5000);
+ await expectElementExist(getGridFileSelector(testFolder), false, 5000);
await global.client.dblclick('[data-tid=fsEntryName_' + folderToMove + ']');
- await expectElementExist('[data-tid=fsEntryName_empty_folder]', true, 5000);
- await testDataRefresh(s3ServerInstance);
+ await expectElementExist(getGridFileSelector(testFolder), true, 7000);
+ // await testDataRefresh(isS3, testDataDir);
});
- test('TST0109 - Copy folder [web,electron]', async ({ isS3 }) => {
+ test('TST0109 - Copy folder [web,electron]', async ({
+ isS3,
+ testDataDir,
+ }) => {
if (isS3) {
await createFileS3('file_to_copy.txt', 'testing file content');
} else {
- await createFile('file_to_copy.txt', 'testing file content');
+ await createFile(testDataDir, 'file_to_copy.txt', 'testing file content');
}
await openContextEntryMenu(
'[data-tid=fsEntryName_empty_folder]',
@@ -227,7 +222,7 @@ test.describe('TST01 - Folder management', () => {
await expectElementExist(getGridFileSelector('empty_folder'), true, 5000);
await global.client.dblclick(getGridFileSelector(folderToCopy));
await expectElementExist(getGridFileSelector('empty_folder'), true, 5000);
- await testDataRefresh(s3ServerInstance);
+ // await testDataRefresh(isS3, testDataDir);
});
test('TST0110 - Tag folder [web,electron]', async () => {
@@ -267,78 +262,71 @@ test.describe('TST01 - Folder management', () => {
/**
* in old minio preSigned URL for thumbnails cannot be opened SignatureDoesNotMatch error
*/
- test('TST0114 - Use as thumbnail for parent folder [web,minio,electron,_pro]', async ({
- isMinio,
- isWeb,
- }) => {
- if (!isMinio || !isWeb) {
- // on Windows + Minio thumbnails is not displayed -> CORS
- //await global.client.waitForTimeout(10000000);
- const fileName = 'sample.png';
- await openContextEntryMenu(
- getGridFileSelector(fileName),
- 'fileMenuMoveCopyFile',
- );
- await clickOn('[data-tid=MoveTargetempty_folder]');
- await clickOn('[data-tid=confirmCopyFiles]');
- await clickOn('[data-tid=uploadCloseAndClearTID]');
-
- await openContextEntryMenu(
- getGridFileSelector('empty_folder'),
- 'showProperties',
- );
- await openContextEntryMenu(
- getGridFileSelector('empty_folder'),
- 'openDirectory',
- );
- await expectElementExist(getGridFileSelector(fileName), true, 5000);
- const folderThumbStyle = await getAttribute(
- '[data-tid=folderThumbTID]',
- 'style',
- );
- const initScreenshot = await getElementScreenshot(
- '[data-tid=folderThumbTID]',
- );
-
- await openContextEntryMenu(
- getGridFileSelector(fileName),
- 'setAsThumbTID',
- );
- const newStyle = await waitUntilChanged(
- '[data-tid=folderThumbTID]',
- folderThumbStyle,
- 'style',
- );
- //console.log('style changed:' + newStyle); style changed:border-radius: 10px; height: 100px; width: 140px; background-image: url("http://127.0.0.1:9000/supported-filestypes/empty_folder/.ts/tst.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=minioadmin%2F20250317%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20250317T112107Z&X-Amz-Expires=900&X-Amz-Signature=c0ccb39b79e20291b3c889c728e27b989119b5a542ba8b304e0e2486f20b4d47&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject"); background-size: cover; background-repeat: no-repeat; background-position: center center; position: absolute; top: 0px; right: 0px;
-
- /*if (global.isWin && global.isWeb) {
+ test('TST0114 - Use as thumbnail for parent folder [electron,_pro]', async () => {
+ //if (!isMinio || !isWeb) {
+ // on Windows + Minio thumbnails is not displayed -> CORS
+ //await global.client.waitForTimeout(10000000);
+ const fileName = 'sample.png';
+ await openContextEntryMenu(
+ getGridFileSelector(fileName),
+ 'fileMenuMoveCopyFile',
+ );
+ await clickOn('[data-tid=MoveTargetempty_folder]');
+ await clickOn('[data-tid=confirmCopyFiles]');
+ await clickOn('[data-tid=uploadCloseAndClearTID]');
+
+ await openContextEntryMenu(
+ getGridFileSelector('empty_folder'),
+ 'showProperties',
+ );
+ await openContextEntryMenu(
+ getGridFileSelector('empty_folder'),
+ 'openDirectory',
+ );
+ await expectElementExist(getGridFileSelector(fileName), true, 5000);
+ const folderThumbStyle = await getAttribute(
+ '[data-tid=folderThumbTID]',
+ 'style',
+ );
+ const initScreenshot = await getElementScreenshot(
+ '[data-tid=folderThumbTID]',
+ );
+
+ await openContextEntryMenu(getGridFileSelector(fileName), 'setAsThumbTID');
+ const newStyle = await waitUntilChanged(
+ '[data-tid=folderThumbTID]',
+ folderThumbStyle,
+ 'style',
+ );
+ //console.log('style changed:' + newStyle); style changed:border-radius: 10px; height: 100px; width: 140px; background-image: url("http://127.0.0.1:9000/supported-filestypes/empty_folder/.ts/tst.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=minioadmin%2F20250317%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20250317T112107Z&X-Amz-Expires=900&X-Amz-Signature=c0ccb39b79e20291b3c889c728e27b989119b5a542ba8b304e0e2486f20b4d47&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject"); background-size: cover; background-repeat: no-repeat; background-position: center center; position: absolute; top: 0px; right: 0px;
+
+ /*if (global.isWin && global.isWeb) {
await global.client.waitForTimeout(2000); // todo in Web Windows style is changed before thumbnail changes
}*/
- const withThumbScreenshot = await getElementScreenshot(
- '[data-tid=folderThumbTID]',
- );
- expect(initScreenshot).not.toBe(withThumbScreenshot);
-
- // remove thumb
- await clickOn('[data-tid=changeThumbnailTID]');
- await clickOn('[data-tid=clearThumbnail]');
-
- await global.client.waitForSelector('[data-tid=clearThumbnail]', {
- timeout: 5000,
- state: 'hidden',
- });
-
- await waitUntilChanged('[data-tid=folderThumbTID]', newStyle, 'style');
-
- const thumbRemovedScreenshot = await getElementScreenshot(
- '[data-tid=folderThumbTID]',
- );
- expect(initScreenshot).toBe(thumbRemovedScreenshot);
- //cleanup
- await deleteFileFromMenu(getGridFileSelector(fileName));
- await expectElementExist(getGridFileSelector(fileName), false, 2000);
- }
+ const withThumbScreenshot = await getElementScreenshot(
+ '[data-tid=folderThumbTID]',
+ );
+ expect(initScreenshot).not.toBe(withThumbScreenshot);
+
+ // remove thumb
+ await clickOn('[data-tid=changeThumbnailTID]');
+ await clickOn('[data-tid=clearThumbnail]');
+
+ await global.client.waitForSelector('[data-tid=clearThumbnail]', {
+ timeout: 5000,
+ state: 'hidden',
+ });
+
+ await waitUntilChanged('[data-tid=folderThumbTID]', newStyle, 'style');
+
+ const thumbRemovedScreenshot = await getElementScreenshot(
+ '[data-tid=folderThumbTID]',
+ );
+ expect(initScreenshot).toBe(thumbRemovedScreenshot);
+ //cleanup
+ await deleteFileFromMenu(getGridFileSelector(fileName));
+ await expectElementExist(getGridFileSelector(fileName), false, 2000);
});
test('TST0116 - Switch to Grid Perspective [web,electron]', async () => {
diff --git a/tests/e2e/folderprops.pw.e2e.js b/tests/e2e/folderprops.pw.e2e.js
index 65a851b95..1112d3649 100644
--- a/tests/e2e/folderprops.pw.e2e.js
+++ b/tests/e2e/folderprops.pw.e2e.js
@@ -3,7 +3,6 @@
*/
import { test, expect } from './fixtures';
import {
- defaultLocationPath,
defaultLocationName,
createPwMinioLocation,
createPwLocation,
@@ -22,6 +21,7 @@ import {
checkSettings,
openFolder,
waitUntilChanged,
+ openFolderProp,
} from './general.helpers';
import { openContextEntryMenu } from './test-utils';
import {
@@ -37,62 +37,67 @@ import {
getPropertiesFileName,
getPropertiesTags,
} from './file.properties.helpers';
-import { stopServices } from '../setup-functions';
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
+/*test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
if (isS3) {
- await startTestingApp({ isWeb, isS3 });
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
await closeWelcomePlaywright();
} else {
- await startTestingApp({ isWeb, isS3 }, 'extconfig.js');
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ 'extconfig.js',
+ );
}
// await clearDataStorage();
-});
+});*/
-test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
- await testDataRefresh(s3ServerInstance);
+/*test.afterAll(async () => {
await stopApp();
-});
+});*/
test.afterEach(async ({ page }, testInfo) => {
/*if (testInfo.status !== testInfo.expectedStatus) {
await takeScreenshot(testInfo);
}*/
await clearDataStorage();
+ await stopApp();
});
-test.beforeEach(async ({ isMinio, isS3 }) => {
- if (isMinio) {
- await createPwMinioLocation('', defaultLocationName, true);
- } else if (isS3) {
- await createS3Location('', defaultLocationName, true);
- } else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
- }
- await clickOn('[data-tid=location_' + defaultLocationName + ']');
- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
+test.beforeEach(
+ async ({ isMinio, isS3, testDataDir, isWeb, webServerPort }, testInfo) => {
+ if (isS3) {
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
+ await closeWelcomePlaywright();
+ } else {
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ 'extconfig.js',
+ );
+ }
+ if (isMinio) {
+ await createPwMinioLocation('', defaultLocationName, true);
+ } else if (isS3) {
+ await createS3Location('', defaultLocationName, true);
+ } else {
+ await createPwLocation(testDataDir, defaultLocationName, true);
+ }
+ await clickOn('[data-tid=location_' + defaultLocationName + ']');
+ await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
- await openContextEntryMenu(
- '[data-tid=fsEntryName_empty_folder]',
- 'showProperties',
- );
-});
+ await openFolderProp('empty_folder');
+ },
+);
test.describe('TST02 - Folder properties', () => {
- test('TST0201 - Open in main area [web,electron]', async ({ isS3 }) => {
+ test('TST0201 - Open in main area [web,electron]', async ({
+ isS3,
+ testDataDir,
+ }) => {
const testFile = 'file_in_empty_folder.txt';
if (isS3) {
await createFileS3(testFile);
} else {
- await createFile(testFile);
+ await createFile(testDataDir, testFile);
}
await clickOn('[data-tid=propsActionsMenuTID]');
await clickOn('[data-tid=openInMainAreaTID]');
@@ -101,6 +106,7 @@ test.describe('TST02 - Folder properties', () => {
test('TST0204 - Reload folder from toolbar [web,electron]', async ({
isS3,
+ testDataDir,
}) => {
let propsTags = await getPropertiesTags();
expect(propsTags).toHaveLength(0);
@@ -128,7 +134,12 @@ test.describe('TST02 - Folder properties', () => {
'empty_folder/.ts',
);
} else {
- await createFile('tsm.json', JSON.stringify(tsmJson), 'empty_folder/.ts');
+ await createFile(
+ testDataDir,
+ 'tsm.json',
+ JSON.stringify(tsmJson),
+ 'empty_folder/.ts',
+ );
}
await clickOn('[data-tid=propsActionsMenuTID]');
@@ -155,18 +166,22 @@ test.describe('TST02 - Folder properties', () => {
);
});
- test('TST0205 - Delete folder from toolbar [web,electron]', async () => {
+ test('TST0205 - Delete folder from toolbar [web,electron]', async ({
+ isS3,
+ testDataDir,
+ }) => {
await clickOn('[data-tid=propsActionsMenuTID]');
await clickOn('[data-tid=deleteFolderTID]');
await clickOn('[data-tid=confirmSaveBeforeCloseDialog]');
await expectElementExist('OpenedTIDempty_folder', false, 5000);
await expectElementExist(getGridFileSelector('empty_folder'), false, 5000);
- await testDataRefresh(s3ServerInstance);
+ await testDataRefresh(isS3, testDataDir);
});
test('TST0206 - Rename folder [web,electron]', async () => {
const newTile = 'folderRenamed';
+ await openFolder('empty_folder');
const propsFolderName = await getPropertiesFileName();
await clickOn('[data-tid=startRenameEntryTID]');
await setInputValue('[data-tid=fileNameProperties] input', newTile);
@@ -177,23 +192,26 @@ test.describe('TST02 - Folder properties', () => {
);
const propsNewFolderName = await getPropertiesFileName();
expect(propsFolderName).not.toBe(propsNewFolderName);
- await testDataRefresh(s3ServerInstance);
+ //await testDataRefresh(isS3, testDataDir);
//turn folderName back
- /*await clickOn('[data-tid=fileNameProperties] input');
+ //await clickOn('[data-tid=fileNameProperties] input');
await clickOn('[data-tid=startRenameEntryTID]');
await clickOn('[data-tid=fileNameProperties] input');
await setInputValue('[data-tid=fileNameProperties] input', propsFolderName);
await clickOn('[data-tid=confirmRenameEntryTID]');
// await waitForNotification();
await global.client.waitForSelector(
- '[data-tid=fileNameProperties] input[value="' + propsFolderName + '"]'
+ '[data-tid=fileNameProperties] input[value="' + propsFolderName + '"]',
);
const propsOldFileName = await getPropertiesFileName();
- expect(propsOldFileName).toEqual(propsFolderName);*/
+ expect(propsOldFileName).toBe(propsFolderName);
});
- test('TST0207 - Move folder [web,electron]', async () => {
+ test('TST0207 - Move folder [web,electron]', async ({
+ isS3,
+ testDataDir,
+ }) => {
const targetFolder = 'empty_folder';
const newFolder = await createNewDirectory('srcFolder');
// select folder to move
@@ -206,13 +224,16 @@ test.describe('TST02 - Folder properties', () => {
await expectElementExist(getGridFileSelector(newFolder), false, 5000);
await global.client.dblclick('[data-tid=fsEntryName_' + targetFolder + ']');
await expectElementExist(getGridFileSelector(newFolder), true, 5000);
- //await testDataRefresh(s3ServerInstance);
+ await testDataRefresh(isS3, testDataDir);
});
test('TST0210 - Add and remove tag to folder with dropdown menu [web,electron]', async () => {
await AddRemovePropertiesTags(['test-tag1', 'test-tag2']);
});
- test('TST0211 - Add tag folder with DnD from tag library [web,electron]', async () => {
+ test('TST0211 - Add tag folder with DnD from tag library [web,electron]', async ({
+ isS3,
+ testDataDir,
+ }) => {
const tagName = 'article';
await clickOn('[data-tid=tagLibrary]');
await dnd(
@@ -233,12 +254,14 @@ test.describe('TST02 - Folder properties', () => {
);
await expectElementExist('[data-tid=OpenedTIDempty_folder]', true, 5000);
+ await testDataRefresh(isS3, testDataDir);
+ //await clickOn('[data-tid=locationManager]');
//const propsTags = await getPropertiesTags();
//expect(propsTags).toContain(tagName);
});
test('TST0213 - Add description to folder [web,electron,_pro]', async () => {
- const desc = 'test description';
+ const desc = 'testDescription';
await clickOn('[data-tid=descriptionTabTID]');
//await clickOn('[data-tid=editDescriptionTID]');
@@ -254,6 +277,8 @@ test.describe('TST02 - Folder properties', () => {
await expect(editorContent).toBe(desc);
*/
await clickOn('[data-tid=editDescriptionTID]');
+ await clickOn('[data-tid=editDescriptionTID]');
+ await clickOn('[data-tid=editDescriptionTID]');
await expectElementExist(
'[data-tid=gridCellDescription]',
true,
@@ -307,10 +332,7 @@ test.describe('TST02 - Folder properties', () => {
await clickOn('[data-tid=confirmCopyFiles]');
await clickOn('[data-tid=uploadCloseAndClearTID]');
- await openContextEntryMenu(
- getGridFileSelector('empty_folder'),
- 'showProperties',
- );
+ //await openFolder('empty_folder','showProperties');
await clickOn('[data-tid=changePerspectiveTID]', {
// force: true,
@@ -340,10 +362,6 @@ test.describe('TST02 - Folder properties', () => {
test('TST0218 - Set and remove predefined background gradient for folder [web,electron,_pro]', async ({
isWeb,
}) => {
- await openContextEntryMenu(
- getGridFileSelector('empty_folder'),
- 'showProperties',
- );
await openFolder('empty_folder');
await checkSettings('[data-tid=settingsSetShowUnixHiddenEntries]', false);
const initScreenshot = await getElementScreenshot(
diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.js
index b8ce92833..17dd49cd1 100644
--- a/tests/e2e/general.helpers.js
+++ b/tests/e2e/general.helpers.js
@@ -5,8 +5,7 @@ import { dataTidFormat } from '../../src/renderer/services/test';
import { delay } from './hook';
import { firstFile, openContextEntryMenu, toContainTID } from './test-utils';
-export const defaultLocationPath =
- './testdata-tmp/file-structure/supported-filestypes';
+// export const defaultLocationPath = './testdata-tmp/file-structure/supported-filestypes';
export const defaultLocationName = 'supported-filestypes';
export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';
export const newLocationName = 'Location Name Changed';
@@ -367,7 +366,7 @@ export async function expectMediaPlay(visible = true) {
const fLocator = await frameLocator();
const videoLocator = fLocator.locator('video');
await expect(videoLocator).toBeVisible({
- timeout: 8000,
+ timeout: 15000,
visible: visible,
});
if (visible) {
@@ -485,7 +484,7 @@ export async function createLocation(
const locationPathInput = await global.client.$(
'[data-tid=locationPath] input',
);
- await locationPathInput.keys(locationPath || defaultLocationPath);
+ await locationPathInput.keys(locationPath); // || defaultLocationPath);
// keys is workarround for not working setValue await global.client.$('[data-tid=locationPath] input').setValue(locationPath || defaultLocationPath);
const lName = await global.client.$('[data-tid=locationName]');
await lName.click();
@@ -700,7 +699,7 @@ export async function removeTagFromTagMenu(tagName) {
await clickOn('[data-tid=tagMoreButton_' + tagName + ']');
await clickOn('[data-tid=deleteTagMenu]');
// await clickOn('[data-tid=confirmRemoveTagFromFile]');
- await isDisplayed('[data-tid=tagMoreButton_' + tagName + ']', false);
+ await isDisplayed('[data-tid=tagMoreButton_' + tagName + ']', false, 4000);
}
export async function showFilesWithTag(tagName) {
@@ -797,7 +796,11 @@ export async function writeTextInIframeInput(
await editor.click();
//await monacoEditor.fill(txt);
await global.client.keyboard.press('ControlOrMeta+KeyA'); //'Meta+KeyA');
- await editor.type(txt);
+ try {
+ await editor.fill(txt); // on mac it's have error for monaco editor is not input
+ } catch (e) {
+ await editor.type(txt);
+ }
}
export async function expectFileContain(
@@ -863,6 +866,18 @@ export async function openFolder(folderName) {
);
}
+export async function openFolderProp(
+ folderName,
+ menuOption = 'showProperties',
+) {
+ await openContextEntryMenu(getGridFileSelector(folderName), menuOption);
+ await expectElementExist(
+ '[data-tid=OpenedTID' + dataTidFormat(folderName) + ']',
+ true,
+ 8000,
+ );
+}
+
export async function openFile(fileName, menuOption = 'fileMenuOpenFile') {
await openContextEntryMenu(
getGridFileSelector(fileName), // perspectiveGridTable + firstFile,
diff --git a/tests/e2e/general.pw.e2e.js b/tests/e2e/general.pw.e2e.js
index f1307aa55..195181cbd 100644
--- a/tests/e2e/general.pw.e2e.js
+++ b/tests/e2e/general.pw.e2e.js
@@ -4,7 +4,6 @@
import { test, expect } from './fixtures';
import AppConfig from '../../src/renderer/AppConfig';
import {
- defaultLocationPath,
defaultLocationName,
createPwMinioLocation,
createPwLocation,
@@ -27,41 +26,35 @@ import {
frameLocator,
dnd,
setSettings,
+ openFile,
} from './general.helpers';
-import { startTestingApp, stopApp, testDataRefresh } from './hook';
+import { startTestingApp, stopApp } from './hook';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
import { openContextEntryMenu } from './test-utils';
-import { stopServices } from '../setup-functions';
import { dataTidFormat } from '../../src/renderer/services/test';
import { formatDateTime4Tag } from '@tagspaces/tagspaces-common/misc';
export const firstFile = '/span';
export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';
-const subFolderName = '/test-perspective-grid';
+/*const subFolderName = '/test-perspective-grid';
const subFolderContentExtractionPath =
defaultLocationPath + '/content-extraction';
-const subFolderThumbnailsPath = defaultLocationPath + '/thumbnails';
+const subFolderThumbnailsPath = defaultLocationPath + '/thumbnails';*/
const testFolder = 'testFolder';
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
+test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
if (isS3) {
- await startTestingApp({ isWeb, isS3 });
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
await closeWelcomePlaywright();
} else {
- await startTestingApp({ isWeb, isS3 }, 'extconfig.js');
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ 'extconfig.js',
+ );
}
});
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
- //await testDataRefresh(s3ServerInstance);
await stopApp();
});
@@ -72,7 +65,7 @@ test.afterEach(async ({ page }, testInfo) => {
await clearDataStorage();
});
-test.beforeEach(async ({ isMinio, isS3 }) => {
+test.beforeEach(async ({ isMinio, isS3, testDataDir }) => {
if (isMinio) {
await closeWelcomePlaywright();
await createPwMinioLocation('', defaultLocationName, true);
@@ -80,7 +73,7 @@ test.beforeEach(async ({ isMinio, isS3 }) => {
await closeWelcomePlaywright();
await createS3Location('', defaultLocationName, true);
} else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ await createPwLocation(testDataDir, defaultLocationName, true);
}
await clickOn('[data-tid=location_' + defaultLocationName + ']');
await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
@@ -279,10 +272,7 @@ test.describe('TST51 - Perspective Grid', () => {
});
test('TST0529 - Import EXIF information as Tags [web,minio,electron,_pro]', async () => {
- await openContextEntryMenu(
- getGridFileSelector('sample_exif[iptc].jpg'),
- 'showPropertiesTID',
- );
+ await openFile('sample_exif[iptc].jpg', 'showPropertiesTID');
await clickOn('[data-tid=openGalleryPerspective]');
await expectElementExist(
diff --git a/tests/e2e/hook.js b/tests/e2e/hook.js
index 757e953fc..20f97d0a8 100644
--- a/tests/e2e/hook.js
+++ b/tests/e2e/hook.js
@@ -1,7 +1,8 @@
/* Copyright (c) 2016-present - TagSpaces GmbH. All rights reserved. */
import pathLib from 'path';
import fse from 'fs-extra';
-import { uploadFile } from '../s3rver/S3DataRefresh';
+import os from 'os';
+import { refreshS3testData, uploadFile } from '../s3rver/S3DataRefresh';
// Spectron API https://github.com/electron/spectron
// Webdriver.io http://webdriver.io/api.html
@@ -70,7 +71,7 @@ export async function clearLocalStorage(isWeb) {
}
export async function copyExtConfig(
- { isWeb, isS3 },
+ { isWeb, isS3, testDataDir },
extconfig = 'extconfig-with-welcome.js',
) {
let srcDir;
@@ -115,22 +116,48 @@ export async function copyExtConfig(
'extconfig.js',
);
await fse.copy(srcDir, destDir);
+ if (testDataDir) {
+ await searchAndReplaceInFile(destDir, 'testdata-tmp', testDataDir);
+ }
}
-export async function removeExtConfig(isWeb) {
- if (!isWeb) {
- await fse.remove(
- pathLib.join(
- __dirname,
- '..',
- '..',
- isWeb ? 'web' : 'release/app/dist/renderer',
- 'extconfig.js',
- ),
+async function searchAndReplaceInFile(filePath, searchValue, replaceValue) {
+ try {
+ // 1. Read file as UTF‑8 text
+ let content = await fse.readFile(filePath, 'utf8');
+
+ // 2. Replace: if searchValue is a string, only first occurrence;
+ // use RegExp with global flag to replace all occurrences
+ const updated = content.replace(
+ typeof searchValue === 'string'
+ ? new RegExp(searchValue, 'g')
+ : searchValue, // assume user passed a RegExp
+ replaceValue,
);
+
+ // 3. Write it back
+ await fse.writeFile(filePath, updated, 'utf8');
+
+ // console.log(`✓ Updated ${filePath}`);
+ } catch (err) {
+ console.error(`✗ Error processing file:`, err);
}
}
+export async function removeExtConfig(isWeb) {
+ //if (!isWeb) {
+ await fse.remove(
+ pathLib.join(
+ __dirname,
+ '..',
+ '..',
+ isWeb ? 'web' : 'release/app/dist/renderer',
+ 'extconfig.js',
+ ),
+ );
+ // }
+}
+
const waitForMainMessage = (electronApp, messageId) => {
return electronApp.evaluate(({ ipcMain }, messageId) => {
return new Promise((resolve) => {
@@ -143,11 +170,17 @@ const waitForAppLoaded = async (electronApp) => {
await waitForMainMessage(electronApp, 'startup-finished');
};
-export async function startTestingApp({ isWeb, isS3 }, extconfig) {
+export async function startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ extconfig,
+) {
if (extconfig) {
- await copyExtConfig({ isWeb, isS3 }, extconfig);
+ await copyExtConfig(
+ { isWeb, isS3, testDataDir: `testdata-${testInfo.workerIndex}` },
+ extconfig,
+ );
} else {
- await removeExtConfig();
+ await removeExtConfig(isWeb);
}
const chromeDriverArgs = [
// '--disable-gpu',
@@ -173,12 +206,17 @@ export async function startTestingApp({ isWeb, isS3 }, extconfig) {
});
global.client = await global.context.newPage(); //page
- await global.client.goto('http://localhost:8000');
+ await global.client.goto('http://localhost:' + webServerPort);
// await global.client.screenshot({ path: `example.png` });
// await global.client.close();
} else {
//if (global.isPlaywright) {
const { _electron: electron } = require('playwright');
+ // 1. Create a unique temporary directory for user data
+ const userDataDir = fse.mkdtempSync(
+ pathLib.join(os.tmpdir(), `electron-user-data-${testInfo.workerIndex}`),
+ ); // :contentReference[oaicite:1]{index=1}
+
// Launch Electron app.
global.app = await electron.launch({
args: [
@@ -192,7 +230,7 @@ export async function startTestingApp({ isWeb, isS3 }, extconfig) {
'main',
'main.js',
),
- // `--user-data-dir=${tempDir.path}`,
+ `--user-data-dir=${userDataDir}`,
'--integration-testing',
'--no-sandbox',
'--whitelisted-ips',
@@ -248,14 +286,17 @@ export async function stopApp(isWeb) {
}
}
-export async function testDataRefresh(isS3, s3ServerInstance) {
+export async function testDataRefresh(isS3, testDataDir) {
if (isS3) {
- /*if(s3ServerInstance) {
- s3ServerInstance.reset();
- await uploadTestDirectory();
- }*/
+ //console.log('testDataDir:'+testDataDir);
+ await refreshS3testData(testDataDir);
} else {
- await deleteTestData();
+ await fse.rm(testDataDir, {
+ recursive: true,
+ force: true,
+ maxRetries: 5, // retry on EBUSY/EMFILE/ENFILE
+ retryDelay: 100, // optional back‑off in ms
+ });
const src = pathLib.join(
__dirname,
'..',
@@ -263,13 +304,13 @@ export async function testDataRefresh(isS3, s3ServerInstance) {
'file-structure',
'supported-filestypes',
);
- const dst = pathLib.join(__dirname, '..', 'testdata-tmp', 'file-structure');
- let newPath = pathLib.join(dst, pathLib.basename(src));
- await fse.copy(src, newPath); //, { overwrite: true });
+ //let newPath = pathLib.join(testDataDir, pathLib.basename(src));
+ //console.log('newPath:'+testDataDir);
+ await fse.copy(src, testDataDir); //, { overwrite: true });
}
}
-export async function deleteTestData() {
+/*export async function deleteTestData() {
const testDataDir = pathLib.join(
__dirname,
'..',
@@ -284,7 +325,7 @@ export async function deleteTestData() {
retryDelay: 100, // optional back‑off in ms
});
// await fse.emptyDir(testDataDir);
-}
+}*/
export async function createFileS3(
fileName = 'empty_file.html',
@@ -294,7 +335,7 @@ export async function createFileS3(
const filePath = pathLib.join(
__dirname,
'..',
- 'testdata-tmp',
+ 'testdata',
'file-structure',
'supported-filestypes',
rootFolder,
@@ -303,22 +344,16 @@ export async function createFileS3(
await uploadFile(filePath, fileContent || 'test content');
}
export async function createFile(
+ testDataDir,
fileName = 'empty_file.html',
fileContent = undefined,
rootFolder = 'empty_folder',
) {
- const filePath = pathLib.join(
- __dirname,
- '..',
- 'testdata-tmp',
- 'file-structure',
- 'supported-filestypes',
- rootFolder,
- fileName,
- );
+ const filePath = pathLib.join(testDataDir, rootFolder, fileName);
try {
if (fileContent) {
await fse.outputFile(filePath, fileContent);
+ console.log('file override:' + filePath);
} else {
await fse.createFile(filePath);
console.log('Empty file created!');
diff --git a/tests/e2e/html.editor.pw.e2e.js b/tests/e2e/html.editor.pw.e2e.js
index bc3fe0e0a..973af2656 100644
--- a/tests/e2e/html.editor.pw.e2e.js
+++ b/tests/e2e/html.editor.pw.e2e.js
@@ -3,7 +3,6 @@ import {
createPwMinioLocation,
createPwLocation,
defaultLocationName,
- defaultLocationPath,
createS3Location,
} from './location.helpers';
import {
@@ -13,53 +12,39 @@ import {
getGridFileSelector,
writeTextInIframeInput,
} from './general.helpers';
-import { startTestingApp, stopApp, testDataRefresh } from './hook';
+import { startTestingApp, stopApp } from './hook';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
import { dataTidFormat } from '../../src/renderer/services/test';
-import { stopServices } from '../setup-functions';
-
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
-});
-
-test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
-});
test.afterEach(async ({ page }, testInfo) => {
/*if (testInfo.status !== testInfo.expectedStatus) {
await takeScreenshot(testInfo);
}*/
- await testDataRefresh(s3ServerInstance);
await clearDataStorage();
await stopApp();
});
-test.beforeEach(async ({ isMinio, isS3, isWeb }) => {
- await startTestingApp(
- { isWeb, isS3 },
- isMinio || isS3 ? undefined : 'extconfig.js',
- );
- if (isMinio) {
- await closeWelcomePlaywright();
- await createPwMinioLocation('', defaultLocationName, true);
- } else if (isS3) {
- await closeWelcomePlaywright();
- await createS3Location('', defaultLocationName, true);
- } else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
- }
- await clickOn('[data-tid=location_' + defaultLocationName + ']');
- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
- // If its have opened file
- // await closeFileProperties();
-});
+test.beforeEach(
+ async ({ isMinio, isS3, isWeb, webServerPort, testDataDir }, testInfo) => {
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ isMinio || isS3 ? undefined : 'extconfig.js',
+ );
+ if (isMinio) {
+ await closeWelcomePlaywright();
+ await createPwMinioLocation('', defaultLocationName, true);
+ } else if (isS3) {
+ await closeWelcomePlaywright();
+ await createS3Location('', defaultLocationName, true);
+ } else {
+ await createPwLocation(testDataDir, defaultLocationName, true);
+ }
+ await clickOn('[data-tid=location_' + defaultLocationName + ']');
+ await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
+ // If its have opened file
+ // await closeFileProperties();
+ },
+);
test.describe('TST56 - HTML viewer/editot', () => {
test('TST5603 - Save html content [web,s3,electron]', async () => {
diff --git a/tests/e2e/json.editor.pw.e2e.js b/tests/e2e/json.editor.pw.e2e.js
index 2b4982a5d..89ef07ed6 100644
--- a/tests/e2e/json.editor.pw.e2e.js
+++ b/tests/e2e/json.editor.pw.e2e.js
@@ -3,7 +3,6 @@ import {
createPwMinioLocation,
createPwLocation,
defaultLocationName,
- defaultLocationPath,
createS3Location,
} from './location.helpers';
import {
@@ -13,53 +12,39 @@ import {
getGridFileSelector,
writeTextInIframeInput,
} from './general.helpers';
-import { startTestingApp, stopApp, testDataRefresh } from './hook';
+import { startTestingApp, stopApp } from './hook';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
import { dataTidFormat } from '../../src/renderer/services/test';
-import { stopServices } from '../setup-functions';
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
-});
-
-test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
-});
-
-test.afterEach(async ({ page }, testInfo) => {
+test.afterEach(async () => {
/*if (testInfo.status !== testInfo.expectedStatus) {
await takeScreenshot(testInfo);
}*/
- await testDataRefresh(s3ServerInstance);
await clearDataStorage();
await stopApp();
});
-test.beforeEach(async ({ isMinio, isS3, isWeb }) => {
- await startTestingApp(
- { isWeb, isS3 },
- isMinio || isS3 ? undefined : 'extconfig.js',
- );
- if (isMinio) {
- await closeWelcomePlaywright();
- await createPwMinioLocation('', defaultLocationName, true);
- } else if (isS3) {
- await closeWelcomePlaywright();
- await createS3Location('', defaultLocationName, true);
- } else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
- }
- await clickOn('[data-tid=location_' + defaultLocationName + ']');
- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
- // If its have opened file
- // await closeFileProperties();
-});
+test.beforeEach(
+ async ({ isMinio, isS3, isWeb, webServerPort, testDataDir }, testInfo) => {
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ isMinio || isS3 ? undefined : 'extconfig.js',
+ );
+ if (isMinio) {
+ await closeWelcomePlaywright();
+ await createPwMinioLocation('', defaultLocationName, true);
+ } else if (isS3) {
+ await closeWelcomePlaywright();
+ await createS3Location('', defaultLocationName, true);
+ } else {
+ await createPwLocation(testDataDir, defaultLocationName, true);
+ }
+ await clickOn('[data-tid=location_' + defaultLocationName + ']');
+ await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
+ // If its have opened file
+ // await closeFileProperties();
+ },
+);
test.describe('TST57 - JSON viewer/editor', () => {
test('TST5706 - Save file [web,s3,electron]', async () => {
diff --git a/tests/e2e/key-bindings.pw.e2e.js b/tests/e2e/key-bindings.pw.e2e.js
index bdf630a31..78fd77fea 100644
--- a/tests/e2e/key-bindings.pw.e2e.js
+++ b/tests/e2e/key-bindings.pw.e2e.js
@@ -7,7 +7,6 @@ import {
createPwMinioLocation,
createS3Location,
defaultLocationName,
- defaultLocationPath,
} from './location.helpers';
import {
clickOn,
@@ -16,31 +15,25 @@ import {
selectorFile,
setInputValue,
} from './general.helpers';
-import { startTestingApp, stopApp, testDataRefresh } from './hook';
+import { startTestingApp, stopApp } from './hook';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
-import { stopServices } from '../setup-functions';
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
const testFileName = 'sample.pdf';
const isMac = /^darwin/.test(process.platform);
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
+test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
if (isS3) {
- await startTestingApp({ isWeb, isS3 });
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
await closeWelcomePlaywright();
} else {
- await startTestingApp({ isWeb, isS3 }, 'extconfig.js');
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ 'extconfig.js',
+ );
}
});
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
- await testDataRefresh(s3ServerInstance);
await stopApp();
});
@@ -51,13 +44,13 @@ test.afterEach(async ({ page }, testInfo) => {
await clearDataStorage();
});
-test.beforeEach(async ({ isMinio, isS3 }) => {
+test.beforeEach(async ({ isMinio, isS3, testDataDir }) => {
if (isMinio) {
await createPwMinioLocation('', defaultLocationName, true);
} else if (isS3) {
await createS3Location('', defaultLocationName, true);
} else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ await createPwLocation(testDataDir, defaultLocationName, true);
}
await clickOn('[data-tid=location_' + defaultLocationName + ']');
await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
@@ -69,7 +62,8 @@ test.describe('TST13 - Settings Key Bindings [electron]', () => {
test('TST1311 - Test show search [electron]', async () => {
await clickOn(selectorFile);
await global.client.keyboard.press('ControlOrMeta+KeyF'); //('ControlOrMeta+KeyK');
- await expectElementExist('#textQuery', true, 2000);
+ await global.client.keyboard.press('ControlOrMeta+KeyK'); // on Mac
+ await expectElementExist('#textQuery', true, 5000);
});
test('TST1312 - Test rename file [electron]', async () => {
diff --git a/tests/e2e/location.helpers.js b/tests/e2e/location.helpers.js
index de10ba2d9..8c3824a42 100644
--- a/tests/e2e/location.helpers.js
+++ b/tests/e2e/location.helpers.js
@@ -12,8 +12,7 @@ import {
waitForNotification,
} from './general.helpers';
-export const defaultLocationPath =
- './tests/testdata-tmp/file-structure/supported-filestypes';
+// export const defaultLocationPath = './tests/testdata-tmp/file-structure/supported-filestypes';
export const defaultLocationName = 'supported-filestypes';
export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';
export const newLocationName = 'Location Name Changed';
@@ -108,13 +107,14 @@ export async function createPwLocation(
locationName,
isDefault = false,
) {
+ //await clickOn('[data-tid=locationManager]');
const lastLocationTID = await getPwLocationTid(-1);
// Check if location not exist (from extconfig.js)
if (locationName !== lastLocationTID) {
await clickOn('[data-tid=locationManagerMenu]');
await clickOn('[data-tid=locationManagerMenuCreateLocation]');
// await global.client.click('[data-tid=locationPath]');
- await setInputKeys('locationPath', locationPath || defaultLocationPath, 20);
+ await setInputKeys('locationPath', locationPath, 20); // || defaultLocationPath
await setInputKeys(
'locationName',
locationName || 'Test Location' + new Date().getTime(),
diff --git a/tests/e2e/location.pw.e2e.js b/tests/e2e/location.pw.e2e.js
index c950b2bb9..d0068812d 100644
--- a/tests/e2e/location.pw.e2e.js
+++ b/tests/e2e/location.pw.e2e.js
@@ -1,14 +1,12 @@
/* Copyright (c) 2016-present - TagSpaces GmbH. All rights reserved. */
import { test, expect } from './fixtures';
import {
- defaultLocationPath,
openLocationMenu,
startupLocation,
getPwLocationTid,
createPwMinioLocation,
createPwLocation,
createS3Location,
- defaultLocationName,
} from './location.helpers';
import {
clickOn,
@@ -16,30 +14,23 @@ import {
setInputKeys,
takeScreenshot,
} from './general.helpers';
-import { startTestingApp, stopApp, testDataRefresh } from './hook';
+import { startTestingApp, stopApp } from './hook';
import { clearDataStorage } from './welcome.helpers';
-import { stopServices } from '../setup-functions';
export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';
export const newLocationName = 'Location_Name_Changed';
let testLocationName;
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
- await startTestingApp({ isWeb, isS3 }, 'extconfig-without-locations.js');
+test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ 'extconfig-without-locations.js',
+ );
//await clearDataStorage();
});
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
- await testDataRefresh(s3ServerInstance);
await stopApp();
});
@@ -50,13 +41,13 @@ test.afterEach(async ({ page }, testInfo) => {
await clearDataStorage();
});
-test.beforeEach(async ({ isMinio, isS3 }) => {
+test.beforeEach(async ({ isMinio, isS3, testDataDir }) => {
testLocationName = '' + new Date().getTime();
if (isMinio || isS3) {
await createPwMinioLocation('', testLocationName, true);
} else {
- await createPwLocation(defaultLocationPath, testLocationName, true);
+ await createPwLocation(testDataDir, testLocationName, true);
}
await clickOn('[data-tid=location_' + testLocationName + ']');
// await delay(500);
diff --git a/tests/e2e/markdown-editor.pw.e2e.js b/tests/e2e/markdown-editor.pw.e2e.js
index 99bc19e20..dcb3ac99e 100644
--- a/tests/e2e/markdown-editor.pw.e2e.js
+++ b/tests/e2e/markdown-editor.pw.e2e.js
@@ -3,7 +3,6 @@
*/
import { test, expect } from './fixtures';
import {
- defaultLocationPath,
defaultLocationName,
createPwMinioLocation,
createPwLocation,
@@ -19,27 +18,17 @@ import {
takeScreenshot,
writeTextInIframeInput,
} from './general.helpers';
-import { startTestingApp, stopApp, testDataRefresh } from './hook';
+import { startTestingApp, stopApp } from './hook';
import { openContextEntryMenu, toContainTID } from './test-utils';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
-import { stopServices } from '../setup-functions';
import { dataTidFormat } from '../../src/renderer/services/test';
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
- await startTestingApp({ isWeb, isS3 });
+test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
// await clearDataStorage();
});
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
- await testDataRefresh(s3ServerInstance);
await stopApp();
});
@@ -50,14 +39,14 @@ test.afterEach(async ({ page }, testInfo) => {
await clearDataStorage();
});
-test.beforeEach(async ({ isMinio, isS3 }) => {
+test.beforeEach(async ({ isMinio, isS3, testDataDir }) => {
await closeWelcomePlaywright();
if (isMinio) {
await createPwMinioLocation('', defaultLocationName, true);
} else if (isS3) {
await createS3Location('', defaultLocationName, true);
} else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ await createPwLocation(testDataDir, defaultLocationName, true);
}
await clickOn('[data-tid=location_' + defaultLocationName + ']');
await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
diff --git a/tests/e2e/objectstore.pw.e2e.js b/tests/e2e/objectstore.pw.e2e.js
index 250a7aaeb..08cb5db29 100644
--- a/tests/e2e/objectstore.pw.e2e.js
+++ b/tests/e2e/objectstore.pw.e2e.js
@@ -2,48 +2,31 @@
* Copyright (c) 2016-present - TagSpaces GmbH. All rights reserved.
*/
import { test, expect } from './fixtures';
-import {
- defaultLocationPath,
- defaultLocationName,
- createPwMinioLocation,
- createPwLocation,
- createS3Location,
-} from './location.helpers';
+import { defaultLocationName, createS3Location } from './location.helpers';
import {
clickOn,
- createNewDirectory,
expectElementExist,
getGridFileSelector,
- rightClickOn,
- setInputKeys,
- takeScreenshot,
} from './general.helpers';
-import { startTestingApp, stopApp, testDataRefresh } from './hook';
+import { startTestingApp, stopApp } from './hook';
import { openContextEntryMenu } from './test-utils';
import { dataTidFormat } from '../../src/renderer/services/test';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
-import { stopServices } from '../setup-functions';
-
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
+test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
if (isS3) {
- await startTestingApp({ isWeb, isS3 });
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
await closeWelcomePlaywright();
} else {
- await startTestingApp({ isWeb, isS3 }, 'extconfig-objectstore-location.js');
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ 'extconfig-objectstore-location.js',
+ );
}
//await clearDataStorage();
});
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
- await testDataRefresh(s3ServerInstance);
await stopApp();
});
diff --git a/tests/e2e/perspective-gallery.pw.e2e.js b/tests/e2e/perspective-gallery.pw.e2e.js
index f7474a122..fc9e653ed 100644
--- a/tests/e2e/perspective-gallery.pw.e2e.js
+++ b/tests/e2e/perspective-gallery.pw.e2e.js
@@ -3,7 +3,6 @@
*/
import { test, expect } from './fixtures';
import {
- defaultLocationPath,
defaultLocationName,
createPwMinioLocation,
createPwLocation,
@@ -12,34 +11,25 @@ import {
import {
clickOn,
expectElementExist,
- expectElementSelected,
getGridFileSelector,
- takeScreenshot,
} from './general.helpers';
-import { startTestingApp, stopApp, testDataRefresh } from './hook';
+import { startTestingApp, stopApp } from './hook';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
-import { openContextEntryMenu } from './test-utils';
import { dataTidFormat } from '../../src/renderer/services/test';
-import { stopServices } from '../setup-functions';
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
+test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
if (isS3) {
- await startTestingApp({ isWeb, isS3 });
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
await closeWelcomePlaywright();
} else {
- await startTestingApp({ isWeb, isS3 }, 'extconfig.js');
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ 'extconfig.js',
+ );
}
});
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
await stopApp();
});
@@ -47,17 +37,16 @@ test.afterEach(async ({ page }, testInfo) => {
/*if (testInfo.status !== testInfo.expectedStatus) {
await takeScreenshot(testInfo);
}*/
- await testDataRefresh(s3ServerInstance);
await clearDataStorage();
});
-test.beforeEach(async ({ isMinio, isS3 }) => {
+test.beforeEach(async ({ isMinio, isS3, testDataDir }) => {
if (isMinio) {
await createPwMinioLocation('', defaultLocationName, true);
} else if (isS3) {
await createS3Location('', defaultLocationName, true);
} else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ await createPwLocation(testDataDir, defaultLocationName, true);
}
await clickOn('[data-tid=location_' + defaultLocationName + ']');
await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
diff --git a/tests/e2e/perspective-grid-right-button.pw.e2e.js b/tests/e2e/perspective-grid-right-button.pw.e2e.js
index 1ae5e65bf..ac1cf9264 100644
--- a/tests/e2e/perspective-grid-right-button.pw.e2e.js
+++ b/tests/e2e/perspective-grid-right-button.pw.e2e.js
@@ -5,7 +5,6 @@
import { test, expect } from './fixtures';
import { generateFileName } from '@tagspaces/tagspaces-common/paths';
import {
- defaultLocationPath,
defaultLocationName,
renameFileFromMenu,
deleteFileFromMenu,
@@ -40,29 +39,22 @@ import {
import { AddRemoveTagsToSelectedFiles } from './perspective-grid.helpers';
import { startTestingApp, stopApp, testDataRefresh } from './hook';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
-import { stopServices } from '../setup-functions';
const testTagName = 'testTag'; // TODO fix camelCase tag name
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
+test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
if (isS3) {
- await startTestingApp({ isWeb, isS3 });
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
await closeWelcomePlaywright();
} else {
- await startTestingApp({ isWeb, isS3 }, 'extconfig.js');
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ 'extconfig.js',
+ );
}
});
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
- await testDataRefresh(s3ServerInstance);
await stopApp();
});
@@ -73,13 +65,13 @@ test.afterEach(async ({ page }, testInfo) => {
await clearDataStorage();
});
-test.beforeEach(async ({ isMinio, isS3 }) => {
+test.beforeEach(async ({ isMinio, isS3, testDataDir }) => {
if (isMinio) {
await createPwMinioLocation('', defaultLocationName, true);
} else if (isS3) {
await createS3Location('', defaultLocationName, true);
} else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ await createPwLocation(testDataDir, defaultLocationName, true);
}
await clickOn('[data-tid=location_' + defaultLocationName + ']');
await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
@@ -153,7 +145,10 @@ test.describe('TST50** - Right button on a file', () => {
expect(firstFileName).toBe(undefined); */
});
- test('TST5019 - Rename tag in file [web,electron]', async () => {
+ test('TST5019 - Rename tag in file [web,electron]', async ({
+ isS3,
+ testDataDir,
+ }) => {
// await searchEngine('desktop');
// Select file
await clickOn(selectorFile);
@@ -185,7 +180,7 @@ test.describe('TST50** - Right button on a file', () => {
8000,
'[data-tid=perspectiveGridFileTable]',
);
- await testDataRefresh(s3ServerInstance);
+ await testDataRefresh(isS3, testDataDir);
// cleanup
/*await clickOn(selectorFile);
await AddRemoveTagsToSelectedFiles('grid', [testTagName + 'Edited'], false);
@@ -278,8 +273,7 @@ test.describe('TST50** - Right button on a file', () => {
// await searchEngine('desktop');
const fileName = 'sample.desktop';
const tags = [testTagName, testTagName + '2'];
- // select file
- await clickOn(getGridFileSelector(fileName));
+ await openFile(fileName);
await AddRemoveTagsToSelectedFiles('grid', tags, true);
let gridElement = await global.client.waitForSelector(
diff --git a/tests/e2e/perspective-grid-sort.pw.e2e.js b/tests/e2e/perspective-grid-sort.pw.e2e.js
index 7c70cbf18..b081f46ea 100644
--- a/tests/e2e/perspective-grid-sort.pw.e2e.js
+++ b/tests/e2e/perspective-grid-sort.pw.e2e.js
@@ -3,7 +3,6 @@
*/
import { test, expect } from './fixtures';
import {
- defaultLocationPath,
defaultLocationName,
createPwMinioLocation,
createPwLocation,
@@ -17,30 +16,23 @@ import {
takeScreenshot,
} from './general.helpers';
-import { startTestingApp, stopApp, testDataRefresh } from './hook';
+import { startTestingApp, stopApp } from './hook';
import { closeWelcomePlaywright } from './welcome.helpers';
import { getDirEntries } from './perspective-grid.helpers';
-import { stopServices } from '../setup-functions';
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
+test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
if (isS3) {
- await startTestingApp({ isWeb, isS3 });
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
await closeWelcomePlaywright();
} else {
- await startTestingApp({ isWeb, isS3 }, 'extconfig.js');
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ 'extconfig.js',
+ );
}
});
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
- await testDataRefresh(s3ServerInstance);
await stopApp();
});
@@ -50,13 +42,13 @@ test.afterAll(async () => {
}
});*/
-test.beforeEach(async ({ isMinio, isS3 }) => {
+test.beforeEach(async ({ isMinio, isS3, testDataDir }) => {
if (isMinio) {
await createPwMinioLocation('', defaultLocationName, true);
} else if (isS3) {
await createS3Location('', defaultLocationName, true);
} else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ await createPwLocation(testDataDir, defaultLocationName, true);
}
await clickOn('[data-tid=location_' + defaultLocationName + ']');
await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
@@ -67,10 +59,10 @@ test.beforeEach(async ({ isMinio, isS3 }) => {
// Scenarios for sorting files in grid perspective
test.describe('TST5003 - Testing sort files in the grid perspective [web,electron]', () => {
- test('TST10xx - Sort by name [web,electron]', async () => {
+ test('TST10xx - Sort by name [web,electron]', async ({ testDataDir }) => {
// DESC
await clickOn('[data-tid=gridPerspectiveSortByName]');
- let sorted = getDirEntries('byName', false);
+ let sorted = getDirEntries(testDataDir, 'byName', false);
for (let i = 0; i < sorted.length; i += 1) {
const fileName = await getGridFileName(i);
expect(fileName).toBe(sorted[i].name); //'sample_exif.jpg');
@@ -80,17 +72,17 @@ test.describe('TST5003 - Testing sort files in the grid perspective [web,electro
await clickOn('[data-tid=gridPerspectiveSortMenu]');
await clickOn('[data-tid=gridPerspectiveSortByName]');
- sorted = getDirEntries('byName', true);
+ sorted = getDirEntries(testDataDir, 'byName', true);
for (let i = 0; i < sorted.length; i += 1) {
const fileName = await getGridFileName(i);
expect(fileName).toBe(sorted[i].name); //'sample.avif');
}
});
- test('TST10xx - Sort by size [web,electron]', async () => {
+ test('TST10xx - Sort by size [web,electron]', async ({ testDataDir }) => {
await clickOn('[data-tid=gridPerspectiveSortBySize]');
// DESC
- let sorted = getDirEntries('byFileSize', true);
+ let sorted = getDirEntries(testDataDir, 'byFileSize', true);
for (let i = 0; i < sorted.length; i += 1) {
const fileName = await getGridFileName(i);
expect(fileName).toBe(sorted[i].name); //'sample.csv');
@@ -99,17 +91,17 @@ test.describe('TST5003 - Testing sort files in the grid perspective [web,electro
// ASC
await clickOn('[data-tid=gridPerspectiveSortMenu]');
await clickOn('[data-tid=gridPerspectiveSortBySize]');
- sorted = getDirEntries('byFileSize', false);
+ sorted = getDirEntries(testDataDir, 'byFileSize', false);
for (let i = 0; i < sorted.length; i += 1) {
const fileName = await getGridFileName(i);
expect(fileName).toBe(sorted[i].name); //'sample.nef');
}
});
- test('TST10xx - Sort by date [web,electron]', async () => {
+ test('TST10xx - Sort by date [web,electron]', async ({ testDataDir }) => {
await clickOn('[data-tid=gridPerspectiveSortByDate]');
- let sorted = getDirEntries('byDateModified', true);
+ let sorted = getDirEntries(testDataDir, 'byDateModified', true);
for (let i = 0; i < sorted.length; i += 1) {
const fileName = await getGridFileName(i);
expect(fileName).toBe(sorted[i].name);
@@ -119,16 +111,18 @@ test.describe('TST5003 - Testing sort files in the grid perspective [web,electro
await clickOn('[data-tid=gridPerspectiveSortMenu]');
await clickOn('[data-tid=gridPerspectiveSortByDate]');
- sorted = getDirEntries('byDateModified', false);
+ sorted = getDirEntries(testDataDir, 'byDateModified', false);
for (let i = 0; i < sorted.length; i += 1) {
const fileName = await getGridFileName(i);
expect(fileName).toBe(sorted[i].name);
}
});
- test('TST10xx - Sort by extension [web,electron]', async () => {
+ test('TST10xx - Sort by extension [web,electron]', async ({
+ testDataDir,
+ }) => {
await clickOn('[data-tid=gridPerspectiveSortByExt]');
- let sorted = getDirEntries('byExtension', true);
+ let sorted = getDirEntries(testDataDir, 'byExtension', true);
for (let i = 0; i < sorted.length; i += 1) {
const fileName = await getGridFileName(i);
expect(fileName).toBe(sorted[i].name);
@@ -136,16 +130,16 @@ test.describe('TST5003 - Testing sort files in the grid perspective [web,electro
await clickOn('[data-tid=gridPerspectiveSortMenu]');
await clickOn('[data-tid=gridPerspectiveSortByExt]');
- sorted = getDirEntries('byExtension', false);
+ sorted = getDirEntries(testDataDir, 'byExtension', false);
for (let i = 0; i < sorted.length; i += 1) {
const fileName = await getGridFileName(i);
expect(fileName).toBe(sorted[i].name);
}
});
- test('TST10xx - Sort by tags [web,electron]', async () => {
+ test('TST10xx - Sort by tags [web,electron]', async ({ testDataDir }) => {
await clickOn('[data-tid=gridPerspectiveSortByFirstTag]');
- let sorted = getDirEntries('byFirstTag', true);
+ let sorted = getDirEntries(testDataDir, 'byFirstTag', true);
for (let i = 0; i < sorted.length; i += 1) {
const fileName = await getGridFileName(i);
expect(fileName).toBe(sorted[i].name);
@@ -153,7 +147,7 @@ test.describe('TST5003 - Testing sort files in the grid perspective [web,electro
// ASC
await clickOn('[data-tid=gridPerspectiveSortMenu]');
await clickOn('[data-tid=gridPerspectiveSortByFirstTag]');
- sorted = getDirEntries('byFirstTag', false);
+ sorted = getDirEntries(testDataDir, 'byFirstTag', false);
for (let i = 0; i < sorted.length; i += 1) {
const fileName = await getGridFileName(i);
expect(fileName).toBe(sorted[i].name);
diff --git a/tests/e2e/perspective-grid.helpers.js b/tests/e2e/perspective-grid.helpers.js
index f75b8351d..bcd872bca 100644
--- a/tests/e2e/perspective-grid.helpers.js
+++ b/tests/e2e/perspective-grid.helpers.js
@@ -32,11 +32,20 @@ export async function AddRemoveTagsToSelectedFiles(
await expectElementExist('[data-tid=AddRemoveTagsSelectTID]', true, 5000);
for (let i = 0; i < tagNames.length; i++) {
const tagName = tagNames[i];
- // if (isWin) {
- await setInputValue('[data-tid=AddRemoveTagsSelectTID] input', tagName);
- //await typeInputValue('[data-tid=AddRemoveTagsSelectTID] input', tagName, 0);
- //await setInputKeys('AddRemoveTagsSelectTID', tagName);
- await global.client.keyboard.press('Enter');
+ const input = global.client.locator(
+ '[data-tid=AddRemoveTagsSelectTID] input',
+ );
+
+ // try to fill, fallback to typing
+ try {
+ await input.fill(tagName);
+ } catch {
+ await input.click(); // ensure focus
+ await global.client.keyboard.type(tagName);
+ }
+
+ // hit Enter to commit this tag
+ await input.press('Enter');
}
if (addTag) {
@@ -53,16 +62,16 @@ export async function AddRemoveTagsToSelectedFiles(
}*/
}
-export async function getDirEntries(sortCriteria, sortAsc) {
- const path = require('path');
+export async function getDirEntries(testDir, sortCriteria, sortAsc) {
+ // const path = require('path');
const fs = require('fs-extra');
- const testDir = path.join(
+ /*const testDir = path.join(
__dirname,
'..',
'testdata-tmp',
'file-structure',
'supported-filestypes',
- );
+ );*/
const dirEntries = (await fs.readdir(testDir, { withFileTypes: true }))
.filter((item) => !item.isDirectory() && !item.name.startsWith('.'))
.map((item) => {
diff --git a/tests/e2e/perspective-grid.pw.e2e.js b/tests/e2e/perspective-grid.pw.e2e.js
index 0467db385..11ffff4a2 100644
--- a/tests/e2e/perspective-grid.pw.e2e.js
+++ b/tests/e2e/perspective-grid.pw.e2e.js
@@ -3,7 +3,6 @@
*/
import { test, expect } from './fixtures';
import {
- defaultLocationPath,
defaultLocationName,
createPwMinioLocation,
createPwLocation,
@@ -15,16 +14,10 @@ import {
expectElementExist,
expectElementSelected,
expectMetaFilesExist,
- getGridCellClass,
- getGridFileName,
getGridFileSelector,
openFile,
selectAllFiles,
- selectFilesByID,
- selectorFile,
- selectorFolder,
selectRowFiles,
- setInputKeys,
setSettings,
takeScreenshot,
} from './general.helpers';
@@ -33,30 +26,23 @@ import {
AddRemovePropertiesTags,
getPropertiesFileName,
} from './file.properties.helpers';
-import { createFile, startTestingApp, stopApp, testDataRefresh } from './hook';
+import { createFile, startTestingApp, stopApp } from './hook';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
import { openContextEntryMenu } from './test-utils';
-import { stopServices } from '../setup-functions';
-import { dataTidFormat } from '../../src/renderer/services/test';
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
+test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
if (isS3) {
- await startTestingApp({ isWeb, isS3 });
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
await closeWelcomePlaywright();
} else {
- await startTestingApp({ isWeb, isS3 }, 'extconfig.js');
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ 'extconfig.js',
+ );
}
});
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
await stopApp();
});
@@ -64,17 +50,16 @@ test.afterEach(async ({ page }, testInfo) => {
/*if (testInfo.status !== testInfo.expectedStatus) {
await takeScreenshot(testInfo);
}*/
- await testDataRefresh(s3ServerInstance);
await clearDataStorage();
});
-test.beforeEach(async ({ isMinio, isS3 }) => {
+test.beforeEach(async ({ isMinio, isS3, testDataDir }) => {
if (isMinio) {
await createPwMinioLocation('', defaultLocationName, true);
} else if (isS3) {
await createS3Location('', defaultLocationName, true);
} else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ await createPwLocation(testDataDir, defaultLocationName, true);
}
await clickOn('[data-tid=location_' + defaultLocationName + ']');
@@ -208,10 +193,7 @@ test.describe('TST50 - Perspective Grid', () => {
test('TST5010 - Move file [web,electron]', async () => {
const fileName = 'sample.svg';
//Toggle Properties
- await openContextEntryMenu(
- getGridFileSelector(fileName),
- 'showPropertiesTID',
- );
+ await openFile(fileName, 'showPropertiesTID');
// add meta json to file
await setSettings('[data-tid=settingsSetPersistTagsInSidecarFile]', true);
await AddRemovePropertiesTags(['test-tag1', 'test-tag2'], {
diff --git a/tests/e2e/perspective-kanban.pw.e2e.js b/tests/e2e/perspective-kanban.pw.e2e.js
index afddaa3b8..9764cfad8 100644
--- a/tests/e2e/perspective-kanban.pw.e2e.js
+++ b/tests/e2e/perspective-kanban.pw.e2e.js
@@ -3,7 +3,6 @@
*/
import { test, expect } from './fixtures';
import {
- defaultLocationPath,
defaultLocationName,
createPwMinioLocation,
createPwLocation,
@@ -17,30 +16,24 @@ import {
setPerspectiveSetting,
takeScreenshot,
} from './general.helpers';
-import { startTestingApp, stopApp, testDataRefresh } from './hook';
+import { startTestingApp, stopApp } from './hook';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
import { openContextEntryMenu } from './test-utils';
import { dataTidFormat } from '../../src/renderer/services/test';
-import { stopServices } from '../setup-functions';
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
+test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
if (isS3) {
- await startTestingApp({ isWeb, isS3 });
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
await closeWelcomePlaywright();
} else {
- await startTestingApp({ isWeb, isS3 }, 'extconfig.js');
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ 'extconfig.js',
+ );
}
});
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
await stopApp();
});
@@ -48,17 +41,16 @@ test.afterEach(async ({ page }, testInfo) => {
/*if (testInfo.status !== testInfo.expectedStatus) {
await takeScreenshot(testInfo);
}*/
- await testDataRefresh(s3ServerInstance);
await clearDataStorage();
});
-test.beforeEach(async ({ isMinio, isS3 }) => {
+test.beforeEach(async ({ isMinio, isS3, testDataDir }) => {
if (isMinio) {
await createPwMinioLocation('', defaultLocationName, true);
} else if (isS3) {
await createS3Location('', defaultLocationName, true);
} else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ await createPwLocation(testDataDir, defaultLocationName, true);
}
await clickOn('[data-tid=location_' + defaultLocationName + ']');
await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
diff --git a/tests/e2e/quick-access.pw.e2e.js b/tests/e2e/quick-access.pw.e2e.js
index 5bace7ec7..26ac5823f 100644
--- a/tests/e2e/quick-access.pw.e2e.js
+++ b/tests/e2e/quick-access.pw.e2e.js
@@ -3,7 +3,6 @@
*/
import { test, expect } from './fixtures';
import {
- defaultLocationPath,
defaultLocationName,
createPwMinioLocation,
createPwLocation,
@@ -19,28 +18,18 @@ import {
setInputKeys,
takeScreenshot,
} from './general.helpers';
-import { startTestingApp, stopApp, testDataRefresh } from './hook';
+import { startTestingApp, stopApp } from './hook';
import { createSavedSearch, searchEngine } from './search.helpers';
import { openContextEntryMenu } from './test-utils';
import { dataTidFormat } from '../../src/renderer/services/test';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
-import { stopServices } from '../setup-functions';
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
- await startTestingApp({ isWeb, isS3 });
+test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
//await clearDataStorage();
});
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
- await testDataRefresh(s3ServerInstance);
await stopApp();
});
@@ -51,7 +40,7 @@ test.afterEach(async ({ page }, testInfo) => {
await clearDataStorage();
});
-test.beforeEach(async ({ isMinio, isS3 }) => {
+test.beforeEach(async ({ isMinio, isS3, testDataDir }) => {
await closeWelcomePlaywright();
await clickOn('[data-tid=locationManager]');
if (isMinio) {
@@ -59,7 +48,7 @@ test.beforeEach(async ({ isMinio, isS3 }) => {
} else if (isS3) {
await createS3Location('', defaultLocationName, true);
} else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ await createPwLocation(testDataDir, defaultLocationName, true);
}
await clickOn('[data-tid=location_' + defaultLocationName + ']');
await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
diff --git a/tests/e2e/search.pw.e2e.js b/tests/e2e/search.pw.e2e.js
index 1d03574f1..32eb16520 100644
--- a/tests/e2e/search.pw.e2e.js
+++ b/tests/e2e/search.pw.e2e.js
@@ -9,13 +9,7 @@ import {
selectorFile,
setSettings,
} from './general.helpers';
-import {
- createFile,
- createFileS3,
- startTestingApp,
- stopApp,
- testDataRefresh,
-} from './hook';
+import { createFile, createFileS3, startTestingApp, stopApp } from './hook';
import {
closeFileProperties,
closeLocation,
@@ -23,7 +17,6 @@ import {
createPwMinioLocation,
createS3Location,
defaultLocationName,
- defaultLocationPath,
} from './location.helpers';
import {
emptyFolderName,
@@ -37,30 +30,25 @@ import { clearDataStorage } from './welcome.helpers';
import { openContextEntryMenu } from './test-utils';
import { dataTidFormat } from '../../src/renderer/services/test';
import { AddRemoveTagsToSelectedFiles } from './perspective-grid.helpers';
-import { stopServices } from '../setup-functions';
import { AddRemovePropertiesTags } from './file.properties.helpers';
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
- await startTestingApp({ isWeb, isS3 }, 'extconfig-two-locations.js');
- // await startTestingApp('extconfig-without-locations.js');
- // await clearDataStorage();
- if (isS3) {
- await createFileS3();
- } else {
- await createFile();
- }
-});
+test.beforeAll(
+ async ({ isWeb, isS3, webServerPort, testDataDir }, testInfo) => {
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ 'extconfig-two-locations.js',
+ );
+ // await startTestingApp('extconfig-without-locations.js');
+ // await clearDataStorage();
+ if (isS3) {
+ await createFileS3();
+ } else {
+ await createFile(testDataDir);
+ }
+ },
+);
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
- await testDataRefresh(s3ServerInstance);
await stopApp();
});
@@ -78,14 +66,14 @@ test.afterEach(async ({ page }, testInfo) => {
await clearDataStorage();
});
-test.beforeEach(async ({ isMinio, isS3 }) => {
+test.beforeEach(async ({ isMinio, isS3, testDataDir }) => {
// await closeWelcomePlaywright();
if (isMinio) {
await createPwMinioLocation('', defaultLocationName, true);
} else if (isS3) {
await createS3Location('', defaultLocationName, true);
} else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ await createPwLocation(testDataDir, defaultLocationName, true);
}
await clickOn('[data-tid=location_' + defaultLocationName + ']');
await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
@@ -372,13 +360,14 @@ test.describe('TST06 - Test Search in file structure:', () => {
test('TST0632 - Search q. comp - accuracy (fuzzy, semi strict, strict) [web,electron]', async ({
isS3,
+ testDataDir,
}) => {
if (isS3) {
await createFileS3('n1ote.txt');
await createFileS3('note.txt');
} else {
- await createFile('n1ote.txt');
- await createFile('note.txt');
+ await createFile(testDataDir, 'n1ote.txt');
+ await createFile(testDataDir, 'note.txt');
}
// fuzzy
await addSearchCommand('a:', false);
@@ -449,11 +438,12 @@ test.describe('TST06 - Test Search in file structure:', () => {
*/
test('TST0636 - Search q. fulltext in content [electron,_pro]', async ({
isS3,
+ testDataDir,
}) => {
if (isS3) {
await createFileS3('fulltext.txt', 'testing fulltext');
} else {
- await createFile('fulltext.txt', 'testing fulltext');
+ await createFile(testDataDir, 'fulltext.txt', 'testing fulltext');
}
await addSearchCommand('sc:', false);
@@ -473,6 +463,7 @@ test.describe('TST06 - Test Search in file structure:', () => {
test('TST0646 - Open directory from search results [web,electron]', async ({
isS3,
+ testDataDir,
}) => {
if (isS3) {
await createFileS3(
@@ -481,6 +472,7 @@ test.describe('TST06 - Test Search in file structure:', () => {
);
} else {
await createFile(
+ testDataDir,
'text_file.txt',
'testing open subfolder from search results',
);
diff --git a/tests/e2e/tag.helpers.js b/tests/e2e/tag.helpers.js
index 87a655438..d9047652e 100644
--- a/tests/e2e/tag.helpers.js
+++ b/tests/e2e/tag.helpers.js
@@ -22,7 +22,7 @@ export async function createTagGroup(tagGroupName, locationName = undefined) {
await clickOn('[data-tid=createTagGroupConfirmButton]');
}
await expectElementExist(
- '[data-tid=tagLibraryTagGroupTitle_' + testGroup + ']',
+ '[data-tid=tagLibraryTagGroupTitle_' + tagGroupName + ']',
true,
);
}
diff --git a/tests/e2e/tag.pw.e2e.js b/tests/e2e/tag.pw.e2e.js
index 776da517b..9c1b9bfe5 100644
--- a/tests/e2e/tag.pw.e2e.js
+++ b/tests/e2e/tag.pw.e2e.js
@@ -11,20 +11,13 @@ import {
setInputValue,
takeScreenshot,
} from './general.helpers';
-import {
- createFile,
- createFileS3,
- startTestingApp,
- stopApp,
- testDataRefresh,
-} from './hook';
+import { createFile, createFileS3, startTestingApp, stopApp } from './hook';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
import {
createPwLocation,
createPwMinioLocation,
createS3Location,
defaultLocationName,
- defaultLocationPath,
} from './location.helpers';
import {
addTags,
@@ -38,27 +31,20 @@ import {
testTagName,
} from './tag.helpers';
import { dataTidFormat } from '../../src/renderer/services/test';
-import { stopServices } from '../setup-functions';
-
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
+test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
if (isS3) {
- await startTestingApp({ isWeb, isS3 });
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
await closeWelcomePlaywright();
} else {
- await startTestingApp({ isWeb, isS3 }, 'extconfig.js');
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ 'extconfig.js',
+ );
}
});
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
- await testDataRefresh(s3ServerInstance);
await stopApp();
});
@@ -277,7 +263,22 @@ 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 [web,electron, _pro]', async () => {
+ test('TST0419 - Create location based tag group [web,electron, _pro]', async ({
+ isS3,
+ isMinio,
+ testDataDir,
+ }) => {
+ await clickOn('[data-tid=locationManager]');
+ if (isMinio) {
+ await createPwMinioLocation('', defaultLocationName, true);
+ } else if (isS3) {
+ await createS3Location('', defaultLocationName, true);
+ } else {
+ await createPwLocation(testDataDir, defaultLocationName, true);
+ }
+ await clickOn('[data-tid=location_' + defaultLocationName + ']');
+ await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
+ await clickOn('[data-tid=tagLibrary]');
await checkSettings(
'[data-tid=saveTagInLocationTID]',
true,
@@ -286,6 +287,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 expectMetaFilesExist(['tsl.json'], true);
// cleanup
await deleteTagGroup(testGroup);
@@ -294,13 +296,14 @@ test.describe('TST04 - Testing the tag library:', () => {
test('TST0420 - Load tag groups from location [web,electron, _pro]', async ({
isS3,
isMinio,
+ testDataDir,
}) => {
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"}]}';
if (isS3) {
await createFileS3('tsl.json', tslContent, '.ts');
} else {
- await createFile('tsl.json', tslContent, '.ts');
+ await createFile(testDataDir, 'tsl.json', tslContent, '.ts');
}
await checkSettings(
'[data-tid=saveTagInLocationTID]',
@@ -313,7 +316,7 @@ test.describe('TST04 - Testing the tag library:', () => {
} else if (isS3) {
await createS3Location('', defaultLocationName, true);
} else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ await createPwLocation(testDataDir, defaultLocationName, true);
}
await clickOn('[data-tid=location_' + defaultLocationName + ']');
await clickOn('[data-tid=tagLibrary]');
diff --git a/tests/e2e/text.editor.pw.e2e.js b/tests/e2e/text.editor.pw.e2e.js
index b6d0441d8..1819ba6e6 100644
--- a/tests/e2e/text.editor.pw.e2e.js
+++ b/tests/e2e/text.editor.pw.e2e.js
@@ -3,7 +3,6 @@ import {
createPwMinioLocation,
createPwLocation,
defaultLocationName,
- defaultLocationPath,
createS3Location,
} from './location.helpers';
import {
@@ -13,53 +12,39 @@ import {
getGridFileSelector,
writeTextInIframeInput,
} from './general.helpers';
-import { startTestingApp, stopApp, testDataRefresh } from './hook';
+import { startTestingApp, stopApp } from './hook';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
import { dataTidFormat } from '../../src/renderer/services/test';
-import { stopServices } from '../setup-functions';
-
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
-});
-
-test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
-});
test.afterEach(async ({ page }, testInfo) => {
/*if (testInfo.status !== testInfo.expectedStatus) {
await takeScreenshot(testInfo);
}*/
- await testDataRefresh(s3ServerInstance);
await clearDataStorage();
await stopApp();
});
-test.beforeEach(async ({ isMinio, isS3, isWeb }) => {
- await startTestingApp(
- { isWeb, isS3 },
- isMinio || isS3 ? undefined : 'extconfig.js',
- );
- if (isMinio) {
- await closeWelcomePlaywright();
- await createPwMinioLocation('', defaultLocationName, true);
- } else if (isS3) {
- await closeWelcomePlaywright();
- await createS3Location('', defaultLocationName, true);
- } else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
- }
- await clickOn('[data-tid=location_' + defaultLocationName + ']');
- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
- // If its have opened file
- // await closeFileProperties();
-});
+test.beforeEach(
+ async ({ isMinio, isS3, isWeb, webServerPort, testDataDir }, testInfo) => {
+ await startTestingApp(
+ { isWeb, isS3, webServerPort, testInfo },
+ isMinio || isS3 ? undefined : 'extconfig.js',
+ );
+ if (isMinio) {
+ await closeWelcomePlaywright();
+ await createPwMinioLocation('', defaultLocationName, true);
+ } else if (isS3) {
+ await closeWelcomePlaywright();
+ await createS3Location('', defaultLocationName, true);
+ } else {
+ await createPwLocation(testDataDir, defaultLocationName, true);
+ }
+ await clickOn('[data-tid=location_' + defaultLocationName + ']');
+ await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
+ // If its have opened file
+ // await closeFileProperties();
+ },
+);
test.describe('TST55 - Text viewer/editor', () => {
test('TST5505 - Save text [web,s3,electron]', async () => {
diff --git a/tests/e2e/viewer-audiovideo.pw.e2e.js b/tests/e2e/viewer-audiovideo.pw.e2e.js
index 6db88d410..627ac06e7 100644
--- a/tests/e2e/viewer-audiovideo.pw.e2e.js
+++ b/tests/e2e/viewer-audiovideo.pw.e2e.js
@@ -4,7 +4,6 @@
import { test, expect } from './fixtures';
import {
- defaultLocationPath,
defaultLocationName,
createPwMinioLocation,
createPwLocation,
@@ -17,42 +16,27 @@ import {
getGridFileSelector,
isDisplayed,
} from './general.helpers';
-import { startTestingApp, stopApp, testDataRefresh } from './hook';
+import { startTestingApp, stopApp } from './hook';
import { openContextEntryMenu } from './test-utils';
import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
-import { stopServices } from '../setup-functions';
-let s3ServerInstance;
-let webServerInstance;
-let minioServerInstance;
-
-test.beforeAll(async ({ isWeb, isS3, s3Server, webServer, minioServer }) => {
- s3ServerInstance = s3Server;
- webServerInstance = webServer;
- minioServerInstance = minioServer;
-
- await startTestingApp({ isWeb, isS3 });
+test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {
+ await startTestingApp({ isWeb, isS3, webServerPort, testInfo });
await closeWelcomePlaywright();
});
test.afterAll(async () => {
- await stopServices(s3ServerInstance, webServerInstance, minioServerInstance);
- await testDataRefresh(s3ServerInstance);
await clearDataStorage();
await stopApp();
});
-/*test.afterEach(async ({ page }, testInfo) => {
- if (testInfo.status !== testInfo.expectedStatus) {
- await takeScreenshot(testInfo);
- }
-});*/
-test.beforeEach(async ({ isMinio, isS3 }) => {
+
+test.beforeEach(async ({ isMinio, isS3, testDataDir }) => {
if (isMinio) {
await createPwMinioLocation('', defaultLocationName, true);
} else if (isS3) {
await createS3Location('', defaultLocationName, true);
} else {
- await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ await createPwLocation(testDataDir, defaultLocationName, true);
}
await clickOn('[data-tid=location_' + defaultLocationName + ']');
await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);
@@ -125,13 +109,13 @@ test.describe('TST59 - Media player', () => {
/**
* for mp4 codecs missing web on Chromium browser
*/
- test('TST5905 - Play webm [web,minio,electron]', async () => {
+ test('TST5905 - Play webm [web,minio,electron]', async ({ isWeb }) => {
await openContextEntryMenu(
getGridFileSelector('sample.webm'),
'fileMenuOpenFile',
);
- await expectMediaPlay(false);
+ await expectMediaPlay(isWeb ? false : true);
// Access the iframe
/*const iframeElement = await global.client.waitForSelector('iframe');
diff --git a/tests/s3rver/S3DataRefresh.js b/tests/s3rver/S3DataRefresh.js
index b38aacae1..9afcf1d6a 100644
--- a/tests/s3rver/S3DataRefresh.js
+++ b/tests/s3rver/S3DataRefresh.js
@@ -110,23 +110,23 @@ function uploadFile(filePath, content = undefined) {
}
}
-function uploadTestDirectory() {
+function uploadTestDirectory(dirPath) {
try {
- const files = getFilesRecursive(directoryPath);
- console.log(`All files in ${directoryPath} uploaded to ${bucketName}`);
+ const files = getFilesRecursive(dirPath);
+ console.log(`All files in ${dirPath} uploaded to ${bucketName}`);
return Promise.all(files.map((file) => uploadFile(file)));
} catch (err) {
- console.error(`Error uploading directory ${directoryPath}:`, err);
+ console.error(`Error uploading directory ${dirPath}:`, err);
}
}
-async function refreshS3testData() {
+async function refreshS3testData(testDataDir) {
await deleteAllObjects('supported-filestypes');
- await uploadTestDirectory();
+ await uploadTestDirectory(testDataDir);
}
module.exports = {
uploadTestDirectory,
- //refreshS3testData,
+ refreshS3testData,
uploadFile,
};
diff --git a/tests/setup-functions.js b/tests/setup-functions.js
index 67ff75c24..f6b8fae3c 100644
--- a/tests/setup-functions.js
+++ b/tests/setup-functions.js
@@ -1,6 +1,8 @@
import pathLib from 'path';
import fs from 'fs';
import sh from 'shelljs';
+import express from 'express';
+import serveStatic from 'serve-static';
const S3rver = require('s3rver');
//const corsConfig = require.resolve('./s3rver/cors.xml');
@@ -16,14 +18,14 @@ export async function globalSetup() {
sh.cd(extensionDir);
}
-export async function startMinio(isWin) {
+export async function startMinio(isWin, testWorkerDir) {
const winMinio = pathLib.resolve(__dirname, './bin/minio.exe');
const unixMinio = pathLib.resolve(__dirname, './bin/minio');
const command = isWin ? winMinio : unixMinio;
const minioProcess = await require('child_process').spawn(command, [
'server',
- pathLib.resolve(__dirname, './testdata-tmp/file-structure'),
+ pathLib.resolve(__dirname, testWorkerDir, 'file-structure'),
]);
minioProcess.on('exit', function (code) {
@@ -42,14 +44,14 @@ export async function startMinio(isWin) {
});
return minioProcess;
}
-export function stopMinio(process) {
+/*export function stopMinio(process) {
if (process) {
// Send SIGHUP to process.
console.log('stopMinio');
process.stdin.pause();
process.kill(); //'SIGHUP');
}
-}
+}*/
export async function startChromeDriver() {
//const childProcess = await require('child_process');
@@ -76,54 +78,61 @@ export async function stopChromeDriver(chromeDriver) {
process.kill(); //'SIGHUP');*/
}
-export async function startWebServer() {
- const express = await require('express');
- const serveStatic = await require('serve-static');
-
- const port = 8000;
+/**
+ * Start a static file server on a free port.
+ *
+ * @param {number} [preferredPort=0] Pass 0 to let the OS pick an available port.
+ * @returns {Promise<{ app: import('express').Express, port: number, server: import('http').Server }>}
+ */
+export async function startWebServer(preferredPort = 0) {
const app = express();
- await app.use(
+ // Serve the contents of ../web with index.html as the default
+ app.use(
serveStatic(pathLib.resolve(__dirname, '../web'), {
index: ['index.html'],
}),
);
- //if (isMac) {
- //todo copyfiles do not work for MacOS
- // await app.use(serveStatic('../app'));
- //}
- app.server = app.listen(port);
- console.log('Webserver listining on http://127.0.0.1:' + port);
- return app;
+
+ return new Promise((resolve, reject) => {
+ // Listen on 0 to let the OS assign a free port
+ const server = app.listen(preferredPort, '127.0.0.1', () => {
+ const { port } = server.address();
+ console.log(`Webserver listening at http://127.0.0.1:${port}`);
+ resolve({ app, port, server });
+ });
+
+ server.on('error', reject);
+ });
}
-export async function stopServices(s3Server, webServer, minioServer) {
+/*export async function stopServices(s3Server, webServer, minioServer) {
await stopS3Server(s3Server);
await stopWebServer(webServer);
await stopMinio(minioServer);
-}
+}*/
-export async function stopWebServer(app) {
+/*export async function stopWebServer(app) {
if (app) {
await app.server.close();
app = null;
}
-}
+}*/
-export async function stopS3Server(server) {
+/*export async function stopS3Server(server) {
if (server) {
await server.close();
server = null;
}
-}
+}*/
-export async function runS3Server(silent = true) {
+export async function runS3Server(folder, silent = true) {
// Set NODE_OPTIONS environment variable to use openssl-legacy-provider
process.env.NODE_OPTIONS = '--openssl-legacy-provider';
const directoryTargetPath = pathLib.resolve(
__dirname,
- 'testdata-tmp',
+ folder, //'testdata-tmp',
'file-structure',
);
const corsConfig = pathLib.resolve(__dirname, 's3rver', 'cors.xml');
@@ -143,6 +152,7 @@ export async function runS3Server(silent = true) {
});
try {
await instance.run();
+ console.log('S3rver running for folder:' + directoryTargetPath);
} catch (e) {
console.log('S3rver run', e);
}
diff --git a/tests/test-data-refresh.js b/tests/test-data-refresh.js
index 006c57c2e..9912d71c2 100644
--- a/tests/test-data-refresh.js
+++ b/tests/test-data-refresh.js
@@ -1,4 +1,4 @@
-import pathLib from 'path';
+/*import pathLib from 'path';
const fse = require('fs-extra');
@@ -12,4 +12,4 @@ const dst = pathLib.join(__dirname, 'testdata-tmp', 'file-structure');
let newPath = pathLib.join(dst, pathLib.basename(src));
// fse.emptyDirSync(newPath);
-fse.copySync(src, newPath); //, { overwrite: true });
+fse.copySync(src, newPath); //, { overwrite: true });*/
diff --git a/web/extconfig.js b/web/extconfig.js
deleted file mode 100755
index 82947d529..000000000
--- a/web/extconfig.js
+++ /dev/null
@@ -1,4 +0,0 @@
-// Options available in extconfig.js are documented here: https://docs.tagspaces.org/dev/external-config
-
-// Uncomment the following line to enable saving the location data in the browser's local storage
-// window.ExtSaveLocationsInBrowser = true;