Skip to content

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

add e2e tests: TST0629-32

sytolk6dcbf6ee533b
diff --git a/tests/e2e/hook.js b/tests/e2e/hook.js
index 6fa71486b..08313a286 100644
--- a/tests/e2e/hook.js
+++ b/tests/e2e/hook.js
@@ -162,26 +162,6 @@ export async function startTestingApp(extconfig) {
}
}
-/*function setWdioImageComparisonService(browser) {
- global.browser = browser;
- const WdioImageComparisonService = require('wdio-image-comparison-service')
- .default;
- let wdioImageComparisonService = new WdioImageComparisonService({
- baselineFolder: pathLib.join(__dirname, '../test-pages/Baseline/'),
- formatImageName: '{tag}-{logName}-{width}x{height}',
- screenshotPath: pathLib.join(__dirname, '../test-pages/'),
- savePerInstance: true,
- autoSaveBaseline: true,
- blockOutStatusBar: true,
- blockOutToolBar: true
- });
- // wdioImageComparisonService.defaultOptions.autoSaveBaseline = true;
- browser.defaultOptions = wdioImageComparisonService.defaultOptions;
- browser.folders = wdioImageComparisonService.folders;
-
- wdioImageComparisonService.before(browser.capabilities);
-}*/
-
export async function stopApp() {
if (global.isWeb) {
await global.context.close();
@@ -193,10 +173,6 @@ export async function stopApp() {
}
export async function testDataRefresh() {
- const fse = require('fs-extra');
- //const gracefulFs = require('graceful-fs')
- //gracefulFs.gracefulify(fse);
-
const src = pathLib.join(
__dirname,
'..',
@@ -214,6 +190,25 @@ export async function testDataRefresh() {
}*/
}
+export async function createEmptyFile() {
+ const file = pathLib.join(
+ __dirname,
+ '..',
+ 'testdata-tmp',
+ 'file-structure',
+ 'supported-filestypes',
+ 'empty_folder',
+ 'empty_file.html'
+ );
+
+ try {
+ await fse.createFile(file);
+ console.log('Empty file created!');
+ } catch (err) {
+ console.error(err);
+ }
+}
+
/*export async function takeScreenshot(name = expect.getState().currentTestName) {
// if (jasmine.currentTest.failedExpectations.length > 0) {
if (global.isWeb) {
diff --git a/tests/e2e/search.pw.e2e.js b/tests/e2e/search.pw.e2e.js
index 791cd5350..0e0b34659 100644
--- a/tests/e2e/search.pw.e2e.js
+++ b/tests/e2e/search.pw.e2e.js
@@ -7,7 +7,12 @@ import {
setSettings,
takeScreenshot
} from './general.helpers';
-import { startTestingApp, stopApp, testDataRefresh } from './hook';
+import {
+ createEmptyFile,
+ startTestingApp,
+ stopApp,
+ testDataRefresh
+} from './hook';
import {
closeFileProperties,
closeLocation,
@@ -245,6 +250,44 @@ test.describe('TST06 - Test Search in file structure:', () => {
await expectElementExist(getFileName(file3, tags3), false, 5000);
});
+ test('TST0629 - Search q. comp - file size [web,electron]', async () => {
+ await createEmptyFile();
+ await addSearchCommand('si:', false, true);
+ await clickOn('#textQuery-option-0');
+ await global.client.keyboard.press('Enter');
+ await global.client.keyboard.press('Enter');
+ await expectElementExist(getGridFileSelector('empty_file.html'), true, 5000);
+ });
+
+ test('TST0630 - Search q. comp - type [web,electron]', async () => {
+ await addSearchCommand('t:', false, true);
+ // choose image file type
+ await clickOn('#textQuery-option-1');
+ await global.client.keyboard.press('Enter');
+ await global.client.keyboard.press('Enter');
+ await expectElementExist(getGridFileSelector('sample.jpg'), true, 5000);
+ await expectElementExist(getGridFileSelector('sample.txt'), false, 5000);
+ });
+
+ test('TST0631 - Search q. comp - last modified [web,electron]', async () => {
+ await addSearchCommand('lm:', false, true);
+ // choose option Today
+ await clickOn('#textQuery-option-0');
+ await global.client.keyboard.press('Enter');
+ await global.client.keyboard.press('Enter');
+ // TODO all files are modified today
+ await expectElementExist(getGridFileSelector('sample.txt'), true, 5000);
+ });
+
+ // TODO handle 3 cases with better key words
+ test('TST0632 - Search q. comp - accuracy (fuzzy, semi strict, strict) [web,electron]', async () => {
+ await addSearchCommand('a:', false, true);
+ // choose option Today
+ await clickOn('#textQuery-option-0');
+ await addSearchCommand('txt', true);
+ await expectElementExist(getGridFileSelector('sample.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']);