Skip to content

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

e2e fixes in search.pw.e2e.js

sytolk695a2e95786b
diff --git a/tests/e2e/search.helpers.js b/tests/e2e/search.helpers.js
index 1565e1817..3d86b6872 100644
--- a/tests/e2e/search.helpers.js
+++ b/tests/e2e/search.helpers.js
@@ -13,6 +13,7 @@ import {
waitForNotification
} from './general.helpers';
import { AddRemoveTagsToSelectedFiles } from './perspective-grid.helpers';
+import { findAction } from '../../app/components/SearchOptions';
export const regexQuery = '!"#$%&\'()*+,-./@:;<=>[\\]^_`{|}~';
export const searchTag = 'tag1';
@@ -26,13 +27,15 @@ export const firstTagButton = '/tbody/tr[1]/td[3]/button[1]';
export async function addSearchCommand(
command,
executeSearch = true,
- forceOpenMenu = true
+ forceOpenMenu = false
) {
if (!(await isDisplayed('#textQuery'))) {
await clickOn('[data-tid=toggleSearch]');
}
await typeInputValue('#textQuery', command);
- await global.client.keyboard.press('Enter');
+ if (!findAction(command, true)) {
+ await global.client.keyboard.press('Enter');
+ }
if (executeSearch) {
await global.client.keyboard.press('Enter');
await global.client.keyboard.press('Enter');
diff --git a/tests/e2e/search.pw.e2e.js b/tests/e2e/search.pw.e2e.js
index 0e0b34659..c590bd140 100644
--- a/tests/e2e/search.pw.e2e.js
+++ b/tests/e2e/search.pw.e2e.js
@@ -185,7 +185,7 @@ test.describe('TST06 - Test Search in file structure:', () => {
await searchEngine('q:', {}, false);
await clickOn('#textQuery-option-0');
// expect to not exist other than jpg files extensions like txt
- await expectElementExist(getGridFileSelector('sample.txt'), false, 5000);
+ await expectElementExist(getGridFileSelector('sample.pdf'), false, 5000);
});
test('TST0626 - Search actions - execute query from search history [web,electron]', async () => {
@@ -238,7 +238,7 @@ test.describe('TST06 - Test Search in file structure:', () => {
await clickOn('#clearSearchID');
// Search for | tag - tag
- await addSearchCommand('|' + tags1[0], false, false);
+ await addSearchCommand('|' + tags1[0], false);
await addSearchCommand('|' + tags2[1], true);
await expectElementExist(getFileName(file1, tags1), true, 5000);
await expectElementExist(getFileName(file2, tags2), true, 5000);
@@ -252,7 +252,7 @@ test.describe('TST06 - Test Search in file structure:', () => {
test('TST0629 - Search q. comp - file size [web,electron]', async () => {
await createEmptyFile();
- await addSearchCommand('si:', false, true);
+ await addSearchCommand('si:', false);
await clickOn('#textQuery-option-0');
await global.client.keyboard.press('Enter');
await global.client.keyboard.press('Enter');
@@ -260,32 +260,32 @@ test.describe('TST06 - Test Search in file structure:', () => {
});
test('TST0630 - Search q. comp - type [web,electron]', async () => {
- await addSearchCommand('t:', false, true);
+ await addSearchCommand('t:', false);
// 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);
+ await expectElementExist(getGridFileSelector('sample.tif'), true, 5000);
+ await expectElementExist(getGridFileSelector('sample.csv'), false, 5000);
});
test('TST0631 - Search q. comp - last modified [web,electron]', async () => {
- await addSearchCommand('lm:', false, true);
+ await addSearchCommand('lm:', false);
// 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);
+ await expectElementExist(getGridFileSelector('sample.pdf'), 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);
+ await addSearchCommand('a:', false);
// choose option Today
await clickOn('#textQuery-option-0');
await addSearchCommand('txt', true);
- await expectElementExist(getGridFileSelector('sample.txt'), true, 5000);
+ await expectElementExist(getGridFileSelector('sample.pdf'), true, 5000);
});
test('TST0642 - Add/Remove sidecar tags in search results [web,electron]', async () => {