Skip to content

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

add TST0633 TST0634 TST0635

sytolk48a8e0c62db0
diff --git a/scripts/extconfig-two-locations.js b/scripts/extconfig-two-locations.js
new file mode 100644
index 000000000..28fd0a0ba
--- /dev/null
+++ b/scripts/extconfig-two-locations.js
@@ -0,0 +1,56 @@
+window.ExtIsFirstRun = false;
+window.ExtCheckForUpdatesOnStartup = false;
+window.ExtUseGenerateThumbnails = true;
+window.ExtLocations = [
+ {
+ uuid: '30565f09-c7fd-2333-fc67-a75db27rt5ba', // an unique id of the location
+ type: '0', // 1 defines the locations a cloud based
+ name: 'empty_folder', // the name of the location
+ path:
+ './tests/testdata-tmp/file-structure/supported-filestypes/empty_folder', // the path to sub folder in the location
+ // accessKeyId: 'your_access_key', // the access key of the user
+ // secretAccessKey: 'your_secret_key', // the secret case of the user
+ // bucketName: 'demo-bucket', // the name of the S3 bucket
+ // region: 'eu-central-1', // the AWS region
+ isDefault: false, // if true this location will be loaded by the application start
+ isReadOnly: false, // if true the user interface of the application turns to read-only mode
+ disableIndexing: false, // if true the search index will be persisted and loaded by default on location opening
+ fullTextIndex: true, // activated the full-text search for TXT, MD and HTML files
+ watchForChanges: false // activates the watching for changed files in the current location
+ },
+ {
+ uuid: '30565f09-c7fd-2333-fc67-a75db27rt5ba', // an unique id of the location
+ type: '0', // 1 defines the locations a cloud based
+ name: 'supported-filestypes', // the name of the location
+ path: './tests/testdata-tmp/file-structure/supported-filestypes', // the path to sub folder in the location
+ // accessKeyId: 'your_access_key', // the access key of the user
+ // secretAccessKey: 'your_secret_key', // the secret case of the user
+ // bucketName: 'demo-bucket', // the name of the S3 bucket
+ // region: 'eu-central-1', // the AWS region
+ isDefault: false, // if true this location will be loaded by the application start
+ isReadOnly: false, // if true the user interface of the application turns to read-only mode
+ disableIndexing: false, // if true the search index will be persisted and loaded by default on location opening
+ fullTextIndex: true, // activated the full-text search for TXT, MD and HTML files
+ watchForChanges: false // activates the watching for changed files in the current location
+ }
+];
+/*window.ExtSearches = [
+ {
+ uuid: '16474266-0445-4f47-b092-25b884448d04', // an unique id of the search
+ title: 'search by tag 1star', // the name of the search
+ tagsAND: [
+ {
+ id: '6040a658-5e95-44da-acd0-b48d7aade9ce',
+ type: 'plain',
+ title: '1star',
+ color: '#ffcc24',
+ textcolor: '#ffffff'
+ }
+ ], // the tagsAND
+ searchBoxing: 'location',
+ searchType: 'semistrict',
+ fileTypes: ['files'],
+ maxSearchResults: 1000,
+ forceIndexing: false
+ }
+];*/
diff --git a/scripts/webextconfig-two-locations.js b/scripts/webextconfig-two-locations.js
new file mode 100644
index 000000000..28fd0a0ba
--- /dev/null
+++ b/scripts/webextconfig-two-locations.js
@@ -0,0 +1,56 @@
+window.ExtIsFirstRun = false;
+window.ExtCheckForUpdatesOnStartup = false;
+window.ExtUseGenerateThumbnails = true;
+window.ExtLocations = [
+ {
+ uuid: '30565f09-c7fd-2333-fc67-a75db27rt5ba', // an unique id of the location
+ type: '0', // 1 defines the locations a cloud based
+ name: 'empty_folder', // the name of the location
+ path:
+ './tests/testdata-tmp/file-structure/supported-filestypes/empty_folder', // the path to sub folder in the location
+ // accessKeyId: 'your_access_key', // the access key of the user
+ // secretAccessKey: 'your_secret_key', // the secret case of the user
+ // bucketName: 'demo-bucket', // the name of the S3 bucket
+ // region: 'eu-central-1', // the AWS region
+ isDefault: false, // if true this location will be loaded by the application start
+ isReadOnly: false, // if true the user interface of the application turns to read-only mode
+ disableIndexing: false, // if true the search index will be persisted and loaded by default on location opening
+ fullTextIndex: true, // activated the full-text search for TXT, MD and HTML files
+ watchForChanges: false // activates the watching for changed files in the current location
+ },
+ {
+ uuid: '30565f09-c7fd-2333-fc67-a75db27rt5ba', // an unique id of the location
+ type: '0', // 1 defines the locations a cloud based
+ name: 'supported-filestypes', // the name of the location
+ path: './tests/testdata-tmp/file-structure/supported-filestypes', // the path to sub folder in the location
+ // accessKeyId: 'your_access_key', // the access key of the user
+ // secretAccessKey: 'your_secret_key', // the secret case of the user
+ // bucketName: 'demo-bucket', // the name of the S3 bucket
+ // region: 'eu-central-1', // the AWS region
+ isDefault: false, // if true this location will be loaded by the application start
+ isReadOnly: false, // if true the user interface of the application turns to read-only mode
+ disableIndexing: false, // if true the search index will be persisted and loaded by default on location opening
+ fullTextIndex: true, // activated the full-text search for TXT, MD and HTML files
+ watchForChanges: false // activates the watching for changed files in the current location
+ }
+];
+/*window.ExtSearches = [
+ {
+ uuid: '16474266-0445-4f47-b092-25b884448d04', // an unique id of the search
+ title: 'search by tag 1star', // the name of the search
+ tagsAND: [
+ {
+ id: '6040a658-5e95-44da-acd0-b48d7aade9ce',
+ type: 'plain',
+ title: '1star',
+ color: '#ffcc24',
+ textcolor: '#ffffff'
+ }
+ ], // the tagsAND
+ searchBoxing: 'location',
+ searchType: 'semistrict',
+ fileTypes: ['files'],
+ maxSearchResults: 1000,
+ forceIndexing: false
+ }
+];*/
diff --git a/tests/e2e/hook.js b/tests/e2e/hook.js
index 25aec7843..2496596e0 100644
--- a/tests/e2e/hook.js
+++ b/tests/e2e/hook.js
@@ -193,8 +193,11 @@ export async function testDataRefresh() {
}*/
}
-export async function createEmptyFile(fileName = 'empty_file.html') {
- const file = pathLib.join(
+export async function createFile(
+ fileName = 'empty_file.html',
+ fileContent = undefined
+) {
+ const filePath = pathLib.join(
__dirname,
'..',
'testdata-tmp',
@@ -205,8 +208,12 @@ export async function createEmptyFile(fileName = 'empty_file.html') {
);
try {
- await fse.createFile(file);
- console.log('Empty file created!');
+ if (fileContent) {
+ await fse.outputFile(filePath, fileContent);
+ } else {
+ await fse.createFile(filePath);
+ console.log('Empty file created!');
+ }
} catch (err) {
console.error(err);
}
diff --git a/tests/e2e/search.pw.e2e.js b/tests/e2e/search.pw.e2e.js
index 891e19b6d..15e16ac26 100644
--- a/tests/e2e/search.pw.e2e.js
+++ b/tests/e2e/search.pw.e2e.js
@@ -4,11 +4,12 @@ import {
expectElementExist,
getGridFileName,
getGridFileSelector,
+ selectorFile,
setSettings,
takeScreenshot
} from './general.helpers';
import {
- createEmptyFile,
+ createFile,
startTestingApp,
stopApp,
testDataRefresh,
@@ -21,8 +22,7 @@ import {
createPwMinioLocation,
defaultLocationName,
defaultLocationPath,
- getPwLocationTid,
- openLocationMenu
+ getPwLocationTid
} from './location.helpers';
import {
emptyFolderName,
@@ -32,15 +32,16 @@ import {
createSavedSearch,
addSearchCommand
} from './search.helpers';
-import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';
+import { clearDataStorage } from './welcome.helpers';
import { openContextEntryMenu } from './test-utils';
import { dataTidFormat } from '../../app/services/test';
import { AddRemoveTagsToSelectedFiles } from './perspective-grid.helpers';
test.beforeAll(async () => {
- await startTestingApp('extconfig.js'); //'extconfig-with-welcome.js');
+ await startTestingApp('extconfig-two-locations.js'); //'extconfig-with-welcome.js');
+ // await startTestingApp('extconfig-without-locations.js');
// await clearDataStorage();
- await createEmptyFile();
+ await createFile();
});
test.afterAll(async () => {
@@ -302,8 +303,8 @@ test.describe('TST06 - Test Search in file structure:', () => {
});
test('TST0632 - Search q. comp - accuracy (fuzzy, semi strict, strict) [web,electron]', async () => {
- await createEmptyFile('n1ote.txt');
- await createEmptyFile('note.txt');
+ await createFile('n1ote.txt');
+ await createFile('note.txt');
// fuzzy
await addSearchCommand('a:', false);
await clickOn('#textQuery-option-0');
@@ -326,6 +327,48 @@ test.describe('TST06 - Test Search in file structure:', () => {
await expectElementExist(getGridFileSelector('note.txt'), true, 5000);
});
+ test('TST0633 - Search q. comp - scope (location) [web,electron]', async () => {
+ await addSearchCommand('sc:', false);
+ await clickOn('#textQuery-option-0');
+ await addSearchCommand('empty_file.html', true);
+ await expectElementExist(
+ getGridFileSelector('empty_file.html'),
+ true,
+ 5000
+ );
+ await clickOn('#clearSearchID');
+
+ await global.client.dblclick('[data-tid=fsEntryName_empty_folder]');
+ await addSearchCommand('sc:', false);
+ await clickOn('#textQuery-option-0');
+ await addSearchCommand('sample.html', true);
+ await expectElementExist(getGridFileSelector('sample.html'), true, 5000);
+ });
+
+ test('TST0634 - Search q. comp - scope (folder) [web,electron]', async () => {
+ await global.client.dblclick('[data-tid=fsEntryName_empty_folder]');
+ await addSearchCommand('sc:', false);
+ await clickOn('#textQuery-option-1');
+ await addSearchCommand('sample.html', true);
+ await expectElementExist(selectorFile, false, 5000);
+ });
+
+ test('TST0635 - Search q. comp - scope (global) [web,electron]', async () => {
+ await createFile('fulltext.txt', 'testing fulltext');
+
+ await clickOn('[data-tid=location_' + defaultLocationName + ']');
+ await addSearchCommand('sc:', false);
+ await clickOn('#textQuery-option-2');
+ await addSearchCommand('sample.html', true);
+ await expectElementExist(getGridFileSelector('sample.html'), true, 5000);
+ await clickOn('#clearSearchID');
+
+ await addSearchCommand('sc:', false);
+ await clickOn('#textQuery-option-2');
+ await addSearchCommand('testing fulltext', true);
+ await expectElementExist(getGridFileSelector('fulltext.txt'), true, 5000);
+ });
+
test('TST0642 - Add/Remove sidecar tags in search results [web,electron]', async () => {
await setSettings('[data-tid=settingsSetPersistTagsInSidecarFile]', true);
await addRemoveTagsInSearchResults(['sidecar-tag5', 'sidecar-tag6']);