Skip to content

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

add tests for quick access TST09 (#1909)

Stanimir6943d0503063
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index 5c6a338cc..02de09d31 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -99,8 +99,7 @@ jobs:
- name: Running npm install, prettier and type checks
run: |
npm install
- npm run install-ext-web
- npm run postinstall-aws-check
+ npm run prepare-web-pro
npm run prettier-check
npm run type-check
- name: Run Unit tests
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsx
index acb9e2875..f6ab54959 100644
--- a/app/components/EntryContainer.tsx
+++ b/app/components/EntryContainer.tsx
@@ -104,6 +104,7 @@ import Revisions from '-/components/Revisions';
import { Switch } from '@mui/material';
import useFirstRender from '-/utils/useFirstRender';
import ResolveConflictDialog from '-/components/dialogs/ResolveConflictDialog';
+import { dataTidFormat } from '-/services/test';
const defaultSplitSize = '7.86%'; // '7.2%'; // 103;
// const openedSplitSize = AppConfig.isElectron ? 560 : 360;
@@ -1272,6 +1273,7 @@ function EntryContainer(props: Props) {
>
<Tooltip title={fileName}>
<Box
+ data-tid={'OpenedTID' + dataTidFormat(fileName)}
style={{
color: theme.palette.text.primary,
display: 'inline',
@@ -1326,6 +1328,7 @@ function EntryContainer(props: Props) {
)}
<ProTooltip tooltip={i18n.t('core:toggleBookmark')}>
<IconButton
+ data-tid="toggleBookmarkTID"
aria-label="bookmark"
size="small"
onClick={bookmarkClick}
diff --git a/app/components/RenderHistory.tsx b/app/components/RenderHistory.tsx
index 70e6854b9..3611eb527 100644
--- a/app/components/RenderHistory.tsx
+++ b/app/components/RenderHistory.tsx
@@ -14,6 +14,7 @@ import {
} from '@tagspaces/tagspaces-common/paths';
import IconButton from '@mui/material/IconButton';
import { RemoveIcon, HistoryIcon } from '-/components/CommonIcons';
+import { dataTidFormat } from '-/services/test';
/**
* TagSpaces - universal file and folder organizer
@@ -46,80 +47,85 @@ export const renderHistory = (
) => (
<>
{items &&
- items.slice(0, maxItems || items.length).map(item => (
- <ListItem dense style={{ paddingLeft: 0 }} key={item.creationTimeStamp}>
- <Grid item xs={10} style={{ width: '100%' }}>
- <Button
- style={{
- textTransform: 'none',
- fontWeight: 'normal',
- justifyContent: 'start'
- }}
- onClick={() =>
- Pro.history.openItem(
- item,
- currentLocationId,
- openLink,
- openLocationById,
- openFsEntry
- )
- }
- >
- <Tooltip
- title={
- <span style={{ fontSize: 14 }}>
- <b>{i18n.t('core:filePath')}:</b> {item.path}
- <br />
- <br />
- {/* <b>Opened on: </b>{' '} */}
- {new Date(item.creationTimeStamp)
- .toISOString()
- .substring(0, 19)
- .split('T')
- .join(' ')}
- </span>
- }
- >
- {key === Pro.bookmarks.bookmarksKey ? (
- <BookmarkTwoToneIcon fontSize="small" />
- ) : (
- <HistoryIcon fontSize="small" />
- )}
- </Tooltip>
- &nbsp;
- <span
+ items.slice(0, maxItems || items.length).map(item => {
+ const itemName = item.path.endsWith(PlatformIO.getDirSeparator())
+ ? extractDirectoryName(item.path, PlatformIO.getDirSeparator())
+ : extractFileName(item.path, PlatformIO.getDirSeparator());
+ return (
+ <ListItem
+ dense
+ style={{ paddingLeft: 0 }}
+ key={item.creationTimeStamp}
+ >
+ <Grid item xs={10} style={{ width: '100%' }}>
+ <Button
+ data-tid={key + 'TID' + dataTidFormat(itemName)}
style={{
- whiteSpace: 'nowrap',
- textOverflow: 'ellipsis',
- overflow: 'hidden',
- maxWidth: 220
+ textTransform: 'none',
+ fontWeight: 'normal',
+ justifyContent: 'start'
}}
+ onClick={() =>
+ Pro.history.openItem(
+ item,
+ currentLocationId,
+ openLink,
+ openLocationById,
+ openFsEntry
+ )
+ }
>
- {item.path.endsWith(PlatformIO.getDirSeparator())
- ? extractDirectoryName(
- item.path,
- PlatformIO.getDirSeparator()
- )
- : extractFileName(item.path, PlatformIO.getDirSeparator())}
- </span>
- </Button>
- </Grid>
- {showDelete && (
- <Grid item xs={2}>
- <IconButton
- aria-label={i18n.t('core:clearHistory')}
- onClick={() => {
- Pro.history.delItem(item, key);
- update();
- }}
- data-tid="editSearchTID"
- size="small"
- >
- <RemoveIcon />
- </IconButton>
+ <Tooltip
+ title={
+ <span style={{ fontSize: 14 }}>
+ <b>{i18n.t('core:filePath')}:</b> {item.path}
+ <br />
+ <br />
+ {/* <b>Opened on: </b>{' '} */}
+ {new Date(item.creationTimeStamp)
+ .toISOString()
+ .substring(0, 19)
+ .split('T')
+ .join(' ')}
+ </span>
+ }
+ >
+ {key === Pro.bookmarks.bookmarksKey ? (
+ <BookmarkTwoToneIcon fontSize="small" />
+ ) : (
+ <HistoryIcon fontSize="small" />
+ )}
+ </Tooltip>
+ &nbsp;
+ <span
+ style={{
+ whiteSpace: 'nowrap',
+ textOverflow: 'ellipsis',
+ overflow: 'hidden',
+ maxWidth: 220
+ }}
+ >
+ {itemName}
+ </span>
+ </Button>
</Grid>
- )}
- </ListItem>
- ))}
+ {showDelete && (
+ <Grid item xs={2}>
+ <IconButton
+ aria-label={i18n.t('core:clearHistory')}
+ onClick={() => {
+ Pro.history.delItem(item, key);
+ update();
+ }}
+ data-tid="editSearchTID"
+ size="small"
+ >
+ <RemoveIcon />
+ </IconButton>
+ </Grid>
+ )}
+ </ListItem>
+ );
+ })}
</>
);
diff --git a/app/components/SearchPopover.tsx b/app/components/SearchPopover.tsx
index 89bc23c28..361783bee 100644
--- a/app/components/SearchPopover.tsx
+++ b/app/components/SearchPopover.tsx
@@ -594,6 +594,7 @@ function SearchPopover(props: Props) {
<FormControl className={classes.formControl}>
<ButtonGroup fullWidth style={{ justifyContent: 'center' }}>
<Button
+ data-tid="saveSearchBtnTID"
variant="outlined"
color="primary"
size="small"
@@ -604,6 +605,7 @@ function SearchPopover(props: Props) {
</Button>
{props.searchQuery.uuid && (
<Button
+ data-tid="editSearchBtnTID"
variant="outlined"
color="primary"
size="small"
@@ -1015,25 +1017,25 @@ function SearchPopover(props: Props) {
}}
/> */}
</FormControl>
- {SaveSearchDialog && saveSearchDialogOpened !== undefined && (
- <SaveSearchDialog
- open={true}
- onClose={(searchQuery: TS.SearchQuery) => {
- setSaveSearchDialogOpened(undefined);
- if (searchQuery) {
- props.setSearchQuery({
- ...searchQuery,
- showUnixHiddenEntries: props.showUnixHiddenEntries
- });
- }
- }}
- onClearSearch={() => clearSearch()}
- searchQuery={saveSearchDialogOpened}
- />
- )}
</>
)}
</div>
+ {SaveSearchDialog && saveSearchDialogOpened !== undefined && (
+ <SaveSearchDialog
+ open={true}
+ onClose={(searchQuery: TS.SearchQuery) => {
+ setSaveSearchDialogOpened(undefined);
+ if (searchQuery) {
+ props.setSearchQuery({
+ ...searchQuery,
+ showUnixHiddenEntries: props.showUnixHiddenEntries
+ });
+ }
+ }}
+ onClearSearch={() => clearSearch()}
+ searchQuery={saveSearchDialogOpened}
+ />
+ )}
</div>
);
}
diff --git a/app/components/StoredSearches.tsx b/app/components/StoredSearches.tsx
index 9394f216f..404c814c7 100644
--- a/app/components/StoredSearches.tsx
+++ b/app/components/StoredSearches.tsx
@@ -227,6 +227,11 @@ function StoredSearches(props: Props) {
<Grid container direction="row">
<Grid item xs={10} style={{ alignSelf: 'center' }}>
<IconButton
+ data-tid={
+ props.storedSearchesVisible
+ ? 'storedSearchesVisibleTID'
+ : 'storedSearchesHiddenTID'
+ }
style={{ minWidth: 'auto', padding: 7 }}
onClick={() =>
props.setStoredSearchesVisible(!props.storedSearchesVisible)
@@ -265,6 +270,7 @@ function StoredSearches(props: Props) {
}}
/>
<IconButton
+ data-tid="StoredSearchesMenuTID"
style={{ minWidth: 'auto', padding: 7 }}
onClick={handleSearchMenu}
size="large"
@@ -287,6 +293,10 @@ function StoredSearches(props: Props) {
<ListItem dense style={{ paddingLeft: 0 }} key={search.uuid}>
<Grid item xs={10} style={{ width: '100%' }}>
<Button
+ data-tid={
+ 'StoredSearchTID' +
+ search.title.trim().replaceAll(/\s+/g, '-')
+ }
style={{
textTransform: 'none',
fontWeight: 'normal',
@@ -323,6 +333,7 @@ function StoredSearches(props: Props) {
<Grid container direction="row">
<Grid item xs={10} style={{ alignSelf: 'center' }}>
<IconButton
+ data-tid="BookmarksTID"
style={{ minWidth: 'auto', padding: 7 }}
onClick={() => props.setShowBookmarks(!props.showBookmarks)}
size="large"
@@ -340,6 +351,7 @@ function StoredSearches(props: Props) {
</Grid>
<Grid item xs={2} style={{ alignSelf: 'center' }}>
<IconButton
+ data-tid="BookmarksMenuTID"
style={{ minWidth: 'auto', padding: 7 }}
onClick={(event: any) => {
menuHistoryKey.current = historyKeys.fileOpenKey;
@@ -372,6 +384,7 @@ function StoredSearches(props: Props) {
<Grid container direction="row">
<Grid item xs={10} style={{ alignSelf: 'center' }}>
<IconButton
+ data-tid="fileOpenHistoryTID"
style={{ minWidth: 'auto', padding: 7 }}
onClick={() => props.setFileOpenHistory(!props.fileOpenHistory)}
size="large"
@@ -389,6 +402,7 @@ function StoredSearches(props: Props) {
</Grid>
<Grid item xs={2} style={{ alignSelf: 'center' }}>
<IconButton
+ data-tid="fileOpenMenuTID"
style={{ minWidth: 'auto', padding: 7 }}
onClick={(event: any) => {
menuHistoryKey.current = historyKeys.fileOpenKey;
@@ -420,6 +434,7 @@ function StoredSearches(props: Props) {
<Grid container direction="row">
<Grid item xs={10} style={{ alignSelf: 'center' }}>
<IconButton
+ data-tid="fileEditHistoryTID"
style={{ minWidth: 'auto', padding: 7 }}
onClick={() => props.setFileEditHistory(!props.fileEditHistory)}
size="large"
@@ -438,6 +453,7 @@ function StoredSearches(props: Props) {
</Grid>
<Grid item xs={2} style={{ alignSelf: 'center' }}>
<IconButton
+ data-tid="FileEditedMenuTID"
style={{ minWidth: 'auto', padding: 7 }}
onClick={(event: any) => {
menuHistoryKey.current = historyKeys.fileEditKey;
@@ -469,6 +485,7 @@ function StoredSearches(props: Props) {
<Grid container direction="row">
<Grid item xs={10} style={{ alignSelf: 'center' }}>
<IconButton
+ data-tid="folderOpenHistoryTID"
style={{ minWidth: 'auto', padding: 7 }}
onClick={() =>
props.setFolderOpenHistory(!props.folderOpenHistory)
@@ -490,6 +507,7 @@ function StoredSearches(props: Props) {
</Grid>
<Grid item xs={2} style={{ alignSelf: 'center' }}>
<IconButton
+ data-tid="FolderOpenMenuTID"
style={{ minWidth: 'auto', padding: 7 }}
onClick={(event: any) => {
menuHistoryKey.current = historyKeys.folderOpenKey;
diff --git a/app/reducers/index.ts b/app/reducers/index.ts
index 7121bad6c..8fd4d4d19 100644
--- a/app/reducers/index.ts
+++ b/app/reducers/index.ts
@@ -31,24 +31,17 @@ const externalLocations = window.ExtLocations || false;
// const externalTagLibrary = window.ExtTagLibrary || false;
const externalSearches = window.ExtSearches || false;
-let locationsInBlackList = false; // electron case
-
-if (externalLocations || AppConfig.isWeb) {
- locationsInBlackList = true;
+const blacklist = ['app', 'locationIndex'];
+if (
+ !AppConfig.saveLocationsInBrowser &&
+ (externalLocations || AppConfig.isWeb)
+) {
+ blacklist.push('locations');
}
-
-if (AppConfig.saveLocationsInBrowser) {
- locationsInBlackList = false;
+if (externalSearches) {
+ blacklist.push('searches');
}
-const blacklist = [
- 'app',
- 'locationIndex',
- locationsInBlackList ? 'locations' : '',
- // externalTagLibrary ? 'taglibrary' : '',
- externalSearches ? 'searches' : ''
-];
-
// const migrations = {
// 2: (state) => { // migration to add geo and date tags in state
// const tagGroups = [...state.taglibrary];
diff --git a/app/services/test.ts b/app/services/test.ts
new file mode 100644
index 000000000..d922cb850
--- /dev/null
+++ b/app/services/test.ts
@@ -0,0 +1,7 @@
+export function dataTidFormat(tid: string) {
+ if (tid) {
+ // The ^ character inside the square brackets means "not"
+ return tid.trim().replace(/[^a-zA-Z0-9_-]+/g, '_');
+ }
+ return 'undefinedTID';
+}
diff --git a/package-lock.json b/package-lock.json
index ffbba2ac4..3accfe162 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -107,7 +107,7 @@
"@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@babel/register": "^7.17.7",
- "@playwright/test": "1.22.2",
+ "@playwright/test": "1.32.3",
"@tagspaces/dynamic-packages-loading": "^2.0.5",
"@types/jest": "^26.0.10",
"@types/react": "^17.0.48",
@@ -171,7 +171,7 @@
"mini-css-extract-plugin": "^2.6.1",
"node-polyfill-webpack-plugin": "^2.0.1",
"npm": "^8.5.5",
- "playwright": "1.22.2",
+ "playwright": "1.32.3",
"prettier": "1.19.1",
"properties-reader": "^2.2.0",
"raw-loader": "^4.0.2",
@@ -11949,19 +11949,22 @@
}
},
"node_modules/@playwright/test": {
- "version": "1.22.2",
- "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.22.2.tgz",
- "integrity": "sha512-cCl96BEBGPtptFz7C2FOSN3PrTnJ3rPpENe+gYCMx4GNNDlN4tmo2D89y13feGKTMMAIVrXfSQ/UmaQKLy1XLA==",
+ "version": "1.32.3",
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.32.3.tgz",
+ "integrity": "sha512-BvWNvK0RfBriindxhLVabi8BRe3X0J9EVjKlcmhxjg4giWBD/xleLcg2dz7Tx0agu28rczjNIPQWznwzDwVsZQ==",
"dev": true,
"dependencies": {
"@types/node": "*",
- "playwright-core": "1.22.2"
+ "playwright-core": "1.32.3"
},
"bin": {
"playwright": "cli.js"
},
"engines": {
"node": ">=14"
+ },
+ "optionalDependencies": {
+ "fsevents": "2.3.2"
}
},
"node_modules/@polka/url": {
@@ -39395,13 +39398,13 @@
}
},
"node_modules/playwright": {
- "version": "1.22.2",
- "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.22.2.tgz",
- "integrity": "sha512-hUTpg7LytIl3/O4t0AQJS1V6hWsaSY5uZ7w1oCC8r3a1AQN5d6otIdCkiB3cbzgQkcMaRxisinjMFMVqZkybdQ==",
+ "version": "1.32.3",
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.32.3.tgz",
+ "integrity": "sha512-h/ylpgoj6l/EjkfUDyx8cdOlfzC96itPpPe8BXacFkqpw/YsuxkpPyVbzEq4jw+bAJh5FLgh31Ljg2cR6HV3uw==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
- "playwright-core": "1.22.2"
+ "playwright-core": "1.32.3"
},
"bin": {
"playwright": "cli.js"
@@ -39411,9 +39414,9 @@
}
},
"node_modules/playwright-core": {
- "version": "1.22.2",
- "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.22.2.tgz",
- "integrity": "sha512-w/hc/Ld0RM4pmsNeE6aL/fPNWw8BWit2tg+TfqJ3+p59c6s3B6C8mXvXrIPmfQEobkcFDc+4KirNzOQ+uBSP1Q==",
+ "version": "1.32.3",
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.32.3.tgz",
+ "integrity": "sha512-SB+cdrnu74ZIn5Ogh/8278ngEh9NEEV0vR4sJFmK04h2iZpybfbqBY0bX6+BLYWVdV12JLLI+JEFtSnYgR+mWg==",
"dev": true,
"bin": {
"playwright": "cli.js"
@@ -58057,13 +58060,14 @@
}
},
"@playwright/test": {
- "version": "1.22.2",
- "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.22.2.tgz",
- "integrity": "sha512-cCl96BEBGPtptFz7C2FOSN3PrTnJ3rPpENe+gYCMx4GNNDlN4tmo2D89y13feGKTMMAIVrXfSQ/UmaQKLy1XLA==",
+ "version": "1.32.3",
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.32.3.tgz",
+ "integrity": "sha512-BvWNvK0RfBriindxhLVabi8BRe3X0J9EVjKlcmhxjg4giWBD/xleLcg2dz7Tx0agu28rczjNIPQWznwzDwVsZQ==",
"dev": true,
"requires": {
"@types/node": "*",
- "playwright-core": "1.22.2"
+ "fsevents": "2.3.2",
+ "playwright-core": "1.32.3"
}
},
"@polka/url": {
@@ -79215,18 +79219,18 @@
}
},
"playwright": {
- "version": "1.22.2",
- "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.22.2.tgz",
- "integrity": "sha512-hUTpg7LytIl3/O4t0AQJS1V6hWsaSY5uZ7w1oCC8r3a1AQN5d6otIdCkiB3cbzgQkcMaRxisinjMFMVqZkybdQ==",
+ "version": "1.32.3",
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.32.3.tgz",
+ "integrity": "sha512-h/ylpgoj6l/EjkfUDyx8cdOlfzC96itPpPe8BXacFkqpw/YsuxkpPyVbzEq4jw+bAJh5FLgh31Ljg2cR6HV3uw==",
"dev": true,
"requires": {
- "playwright-core": "1.22.2"
+ "playwright-core": "1.32.3"
}
},
"playwright-core": {
- "version": "1.22.2",
- "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.22.2.tgz",
- "integrity": "sha512-w/hc/Ld0RM4pmsNeE6aL/fPNWw8BWit2tg+TfqJ3+p59c6s3B6C8mXvXrIPmfQEobkcFDc+4KirNzOQ+uBSP1Q==",
+ "version": "1.32.3",
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.32.3.tgz",
+ "integrity": "sha512-SB+cdrnu74ZIn5Ogh/8278ngEh9NEEV0vR4sJFmK04h2iZpybfbqBY0bX6+BLYWVdV12JLLI+JEFtSnYgR+mWg==",
"dev": true
},
"please-upgrade-node": {
diff --git a/package.json b/package.json
index df3631064..a3a58f5bc 100644
--- a/package.json
+++ b/package.json
@@ -133,7 +133,7 @@
"test-one-suite": "cross-env jest --config=jest.config.web.js --verbose ./tests/e2e/perspective-grid-right-button.e2e.js",
"test-one-suite-headless": "cross-env HEADLESS_MODE=true jest --config=jest.config.web.js --verbose ./tests/e2e/fileopener.e2e.js",
"test-playwright": "npm run test-refresh-data && cross-env JEST_JUNIT_OUTPUT_DIR=./tests NODE_ENV=test jest --config=jest.config.playwright.js -t '^(?!.*\\b_pro\\b).*\\belectron\\b.*' --verbose ./tests/e2e/",
- "test-playwright-pro": "npm run test-refresh-data && cross-env JEST_JUNIT_OUTPUT_DIR=./tests NODE_ENV=test jest --config=jest.config.playwright.js -t 'electron' --verbose ./tests/e2e/",
+ "test-playwright-pro": "npm run test-refresh-data && cross-env JEST_JUNIT_OUTPUT_DIR=./tests NODE_ENV=test jest --config=jest.config.playwright.js -t 'TST0909' --verbose ./tests/e2e/",
"test-playwright-web": "npm run test-refresh-data && cross-env NODE_ENV=test SHOW_CONSOLE=true DEBUG=pw:api PLAYWRIGHT=test_playwright jest --config=jest.config.web.js -t 'web' --verbose ./tests/e2e/",
"test-playwright-web-headless": "npm run test-refresh-data && npm run prepare-web-pro && cross-env NODE_ENV=test SHOW_CONSOLE=true JEST_JUNIT_OUTPUT_DIR=./tests PLAYWRIGHT=test_playwright HEADLESS_MODE=true jest --config=jest.config.web.js -t 'web' --verbose ./tests/e2e/",
"test-clone-data": "rimraf tests/testdata && git clone https://github.com/tagspaces/testdata tests/testdata",
@@ -247,7 +247,7 @@
"@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@babel/register": "^7.17.7",
- "@playwright/test": "1.22.2",
+ "@playwright/test": "1.32.3",
"@tagspaces/dynamic-packages-loading": "^2.0.5",
"@types/jest": "^26.0.10",
"@types/react": "^17.0.48",
@@ -311,7 +311,7 @@
"mini-css-extract-plugin": "^2.6.1",
"node-polyfill-webpack-plugin": "^2.0.1",
"npm": "^8.5.5",
- "playwright": "1.22.2",
+ "playwright": "1.32.3",
"prettier": "1.19.1",
"properties-reader": "^2.2.0",
"raw-loader": "^4.0.2",
diff --git a/tests/e2e/hook.js b/tests/e2e/hook.js
index 0fbc2ef01..8814cb760 100644
--- a/tests/e2e/hook.js
+++ b/tests/e2e/hook.js
@@ -82,12 +82,14 @@ export async function copyExtConfig(extconfig = 'extconfig-with-welcome.js') {
}
export async function removeExtConfig() {
- await fse.remove(pathLib.join(__dirname, '..', 'app', 'extconfig.js'));
+ await fse.remove(pathLib.join(__dirname, '..', '..', 'app', 'extconfig.js'));
}
export async function startTestingApp(extconfig) {
if (extconfig) {
await copyExtConfig(extconfig);
+ } else {
+ await removeExtConfig();
}
const chromeDriverArgs = [
// '--disable-gpu',
diff --git a/tests/e2e/perspective-grid-right-button.pw.e2e.js b/tests/e2e/perspective-grid-right-button.pw.e2e.js
index f52a870ee..60879431a 100644
--- a/tests/e2e/perspective-grid-right-button.pw.e2e.js
+++ b/tests/e2e/perspective-grid-right-button.pw.e2e.js
@@ -1,6 +1,8 @@
/*
* Copyright (c) 2016-present - TagSpaces UG (Haftungsbeschraenkt). All rights reserved.
*/
+
+import { expect as pExpect } from '@playwright/test';
import {
defaultLocationPath,
defaultLocationName,
@@ -70,19 +72,32 @@ describe('TST50** - Right button on a file', () => {
/**
* todo web file content is slow loaded in web and innerText is empty string
*/
- test('TST5016 - Open file [minio,electron]', async () => {
+ test('TST5016 - Open file [web,minio,electron]', async () => {
// await searchEngine('txt');
await openContextEntryMenu(
'[data-tid="fsEntryName_sample.txt"]', // perspectiveGridTable + firstFile,
'fileMenuOpenFile'
);
- const fLocator = await frameLocator();
- const bodyTxt = await fLocator.locator('body').innerText();
- const containTID = toContainTID(bodyTxt);
+ await pExpect
+ .poll(
+ async () => {
+ const fLocator = await frameLocator();
+ const bodyTxt = await fLocator.locator('body').innerText();
+ return toContainTID(bodyTxt);
+ },
+ {
+ message: 'make sure bodyTxt contain etete&5435', // custom error message
+ // Poll for 10 seconds; defaults to 5 seconds. Pass 0 to disable timeout.
+ timeout: global.isWeb ? 40000 : 10000
+ }
+ )
+ .toBe(true);
+
+ /*const containTID = toContainTID(bodyTxt);
if (!containTID) {
console.debug('no containTID in:' + bodyTxt);
}
- expect(containTID).toBe(true);
+ expect(containTID).toBe(true);*/
// Check if the file is opened
// await delay(1500);
/*await expectElementExist('#FileViewer', true, 2000);
diff --git a/tests/e2e/quick-access.pw.e2e.js b/tests/e2e/quick-access.pw.e2e.js
new file mode 100644
index 000000000..7a1974d11
--- /dev/null
+++ b/tests/e2e/quick-access.pw.e2e.js
@@ -0,0 +1,290 @@
+/*
+ * Copyright (c) 2016-present - TagSpaces UG (Haftungsbeschraenkt). All rights reserved.
+ */
+import {
+ defaultLocationPath,
+ defaultLocationName,
+ createPwMinioLocation,
+ createPwLocation
+} from './location.helpers';
+import { clickOn, expectElementExist, setInputKeys } from './general.helpers';
+import { startTestingApp, stopSpectronApp, testDataRefresh } from './hook';
+import { createSavedSearch } from './search.helpers';
+import { openContextEntryMenu } from './test-utils';
+import { dataTidFormat } from '../../app/services/test';
+
+describe('TST09 - Quick access', () => {
+ beforeAll(async () => {
+ await startTestingApp();
+ });
+
+ afterAll(async () => {
+ await stopSpectronApp();
+ await testDataRefresh();
+ });
+ beforeEach(async () => {
+ if (global.isMinio) {
+ await createPwMinioLocation('', defaultLocationName, true);
+ } else {
+ await createPwLocation(defaultLocationPath, defaultLocationName, true);
+ }
+ await clickOn('[data-tid=location_' + defaultLocationName + ']');
+ // If its have opened file
+ // await closeFileProperties();
+ });
+
+ test('TST0901 - Create, rename and delete stored search [electron,_pro]', async () => {
+ const storedSearchTitle = 'jpgSearch';
+ await createSavedSearch({ title: storedSearchTitle, textQuery: 'jpg' });
+ //await expectElementExist('[data-tid=quickAccessButton]');
+ await clickOn('[data-tid=quickAccessButton]');
+ // await clickOn('[data-tid=storedSearchesVisibleTID]');
+ await expectElementExist(
+ '[data-tid=StoredSearchTID' + storedSearchTitle + ']'
+ );
+ // Rename
+ await clickOn('[data-tid=editSearchTID]');
+ await setInputKeys('savedSearchTID', 'Renamed');
+ await clickOn('[data-tid=confirmSavedSearchTID]');
+ await expectElementExist(
+ '[data-tid=StoredSearchTID' + storedSearchTitle + 'Renamed]'
+ );
+ //Delete
+ await clickOn('[data-tid=editSearchTID]');
+ await clickOn('[data-tid=deleteSavedSearchTID]');
+ await expectElementExist(
+ '[data-tid=StoredSearchTID' + storedSearchTitle + 'Renamed]',
+ false
+ );
+ });
+
+ test('TST0902 - Create, execute and delete stored search [electron,_pro]', async () => {
+ const storedSearchTitle = 'jpgExecutedSearch';
+ const textQuery = 'jpg';
+ await createSavedSearch({ title: storedSearchTitle, textQuery });
+ //await expectElementExist('[data-tid=quickAccessButton]');
+ await clickOn('[data-tid=quickAccessButton]');
+ // await clickOn('[data-tid=storedSearchesVisibleTID]');
+ await expectElementExist(
+ '[data-tid=StoredSearchTID' + storedSearchTitle + ']'
+ );
+ // Execute
+ await clickOn('[data-tid=StoredSearchTID' + storedSearchTitle + ']');
+ const inputValue = await global.client.inputValue('#textQuery');
+ expect(inputValue).toBe(textQuery);
+ //Delete
+ await clickOn('[data-tid=editSearchTID]');
+ await clickOn('[data-tid=deleteSavedSearchTID]');
+ await expectElementExist(
+ '[data-tid=StoredSearchTID' + storedSearchTitle + ']',
+ false
+ );
+ });
+
+ test('TST0905 - Create, open and remove bookmark to file in properties [electron,web,_pro]', async () => {
+ const bookmarkFileTitle = 'sample.txt';
+ const bookmarkFileTid = dataTidFormat(bookmarkFileTitle);
+ await openContextEntryMenu(
+ '[data-tid="fsEntryName_' + bookmarkFileTitle + '"]', // todo rethink selector here contain dot
+ 'fileMenuOpenFile'
+ );
+
+ // Create
+ await clickOn('[data-tid=toggleBookmarkTID]');
+ await clickOn('[data-tid=fileContainerCloseOpenedFile]');
+
+ // Open
+ await clickOn('[data-tid=quickAccessButton]');
+ await expectElementExist(
+ '[data-tid=tsBookmarksTID' + bookmarkFileTid + ']'
+ );
+ await clickOn('[data-tid=tsBookmarksTID' + bookmarkFileTid + ']');
+ await expectElementExist('[data-tid=OpenedTID' + bookmarkFileTid + ']');
+
+ //Delete
+ await clickOn('[data-tid=toggleBookmarkTID]');
+ await clickOn('[data-tid=BookmarksMenuTID]');
+ await clickOn('[data-tid=refreshBookmarksTID]');
+
+ await expectElementExist(
+ '[data-tid=tsBookmarksTID' + bookmarkFileTid + ']',
+ false
+ );
+ });
+
+ test('TST0906 - Create, open and remove bookmark to folder in quickaccess [electron,web,_pro]', async () => {
+ const testFolder = 'empty_folder';
+ await global.client.dblclick('[data-tid=fsEntryName_' + testFolder + ']');
+ await clickOn('[data-tid=folderContainerOpenDirMenu]');
+ await clickOn('[data-tid=showProperties]');
+
+ // Create
+ await clickOn('[data-tid=toggleBookmarkTID]');
+ await clickOn('[data-tid=fileContainerCloseOpenedFile]');
+
+ // Open
+ await clickOn('[data-tid=quickAccessButton]');
+ await expectElementExist('[data-tid=tsBookmarksTID' + testFolder + ']');
+ await clickOn('[data-tid=tsBookmarksTID' + testFolder + ']');
+ await clickOn('[data-tid=folderContainerOpenDirMenu]');
+ await clickOn('[data-tid=showProperties]');
+ await expectElementExist('[data-tid=OpenedTID' + testFolder + ']');
+
+ //Delete
+ await clickOn('[data-tid=toggleBookmarkTID]');
+ await clickOn('[data-tid=BookmarksMenuTID]');
+ await clickOn('[data-tid=refreshBookmarksTID]');
+
+ await expectElementExist(
+ '[data-tid=tsBookmarksTID' + testFolder + ']',
+ false
+ );
+ });
+
+ test('TST0907 - Create 2 local bookmarks and delete all bookmarks [electron,_pro]', async () => {
+ await clickOn('[data-tid=quickAccessButton]');
+ const bookmarks = ['sample.txt', 'sample.jpg'];
+ for (let i = 0; i < bookmarks.length; i++) {
+ await openContextEntryMenu(
+ '[data-tid="fsEntryName_' + bookmarks[i] + '"]',
+ 'fileMenuOpenFile'
+ );
+
+ // Create
+ await clickOn('[data-tid=toggleBookmarkTID]');
+ await clickOn('[data-tid=fileContainerCloseOpenedFile]');
+ // Refresh bookmarks
+ await clickOn('[data-tid=BookmarksMenuTID]');
+ await clickOn('[data-tid=refreshBookmarksTID]');
+
+ await expectElementExist(
+ '[data-tid=tsBookmarksTID' + dataTidFormat(bookmarks[i]) + ']'
+ );
+ }
+
+ // Delete All bookmarks
+ await clickOn('[data-tid=BookmarksMenuTID]');
+ await clickOn('[data-tid=clearBookmarksTID]');
+ for (let i = 0; i < bookmarks.length; i++) {
+ await expectElementExist(
+ '[data-tid=tsBookmarksTID' + dataTidFormat(bookmarks[i]) + ']',
+ false
+ );
+ }
+ });
+ test('TST0908 - Add, open and remove recently opened file [web,electron,_pro]', async () => {
+ // Add
+ const fileTitle = 'sample.jpg';
+ const fileTid = dataTidFormat(fileTitle);
+ await openContextEntryMenu(
+ '[data-tid="fsEntryName_' + fileTitle + '"]', // todo rethink selector here contain dot
+ 'fileMenuOpenFile'
+ );
+ await clickOn('[data-tid=fileContainerCloseOpenedFile]');
+
+ // Open
+ await clickOn('[data-tid=quickAccessButton]');
+ await clickOn('[data-tid=fileOpenHistoryTID]');
+ await expectElementExist(
+ '[data-tid=tsLastOpenedFilesHistoryTID' + fileTid + ']'
+ );
+ await clickOn('[data-tid=tsLastOpenedFilesHistoryTID' + fileTid + ']');
+ await expectElementExist('[data-tid=OpenedTID' + fileTid + ']');
+
+ //Delete
+ await clickOn('[data-tid=fileOpenMenuTID]');
+ await clickOn('[data-tid=clearHistoryTID]');
+ await expectElementExist(
+ '[data-tid=tsLastOpenedFilesHistoryTID' + fileTid + ']',
+ false
+ );
+ });
+
+ test('TST0909 - Add 2 recently opened files and clear history [electron,_pro]', async () => {
+ await clickOn('[data-tid=quickAccessButton]');
+ await clickOn('[data-tid=fileOpenHistoryTID]');
+
+ const files = ['sample.txt', 'sample.jpg'];
+ for (let i = 0; i < files.length; i++) {
+ // Add
+ const fileTid = dataTidFormat(files[i]);
+ await openContextEntryMenu(
+ '[data-tid="fsEntryName_' + files[i] + '"]',
+ 'fileMenuOpenFile'
+ );
+ await clickOn('[data-tid=fileContainerCloseOpenedFile]');
+ // Refresh opened files
+ await clickOn('[data-tid=fileOpenMenuTID]');
+ await clickOn('[data-tid=refreshHistoryTID]');
+ await expectElementExist(
+ '[data-tid=tsLastOpenedFilesHistoryTID' + fileTid + ']'
+ );
+ }
+
+ // Delete All bookmarks
+ await clickOn('[data-tid=fileOpenMenuTID]');
+ await clickOn('[data-tid=clearHistoryTID]');
+ for (let i = 0; i < files.length; i++) {
+ await expectElementExist(
+ '[data-tid=tsLastOpenedFilesHistoryTID' + dataTidFormat(files[i]) + ']',
+ false
+ );
+ }
+ });
+
+ test.skip('TST0910 - Add, open and remove recently edited file [web,electron,_pro]', async () => {
+ // Add
+ const fileTitle = 'sample.txt';
+ const fileTid = dataTidFormat(fileTitle);
+ await openContextEntryMenu(
+ '[data-tid="fsEntryName_' + fileTitle + '"]', // todo rethink selector here contain dot
+ 'fileMenuOpenFile'
+ );
+ await clickOn('[data-tid=fileContainerEditFile]');
+
+ await clickOn('[data-tid=fileContainerCloseOpenedFile]');
+
+ // Open
+ await clickOn('[data-tid=quickAccessButton]');
+ await clickOn('[data-tid=fileEditHistoryTID]');
+ await expectElementExist(
+ '[data-tid=tsLastOpenedFilesHistoryTID' + fileTid + ']'
+ );
+ await clickOn('[data-tid=tsLastOpenedFilesHistoryTID' + fileTid + ']');
+ await expectElementExist('[data-tid=OpenedTID' + fileTid + ']');
+
+ //Delete
+ await clickOn('[data-tid=fileOpenMenuTID]');
+ await clickOn('[data-tid=clearHistoryTID]');
+ await expectElementExist(
+ '[data-tid=tsLastOpenedFilesHistoryTID' + fileTid + ']',
+ false
+ );
+ });
+
+ test('TST0912 - Add, open and remove recently opened folder properties [web,electron,_pro]', async () => {
+ // Add
+ const testFolder = 'empty_folder';
+ await global.client.dblclick('[data-tid=fsEntryName_' + testFolder + ']');
+ await clickOn('[data-tid=folderContainerOpenDirMenu]');
+ await clickOn('[data-tid=showProperties]');
+ await clickOn('[data-tid=fileContainerCloseOpenedFile]');
+
+ // Open
+ await clickOn('[data-tid=quickAccessButton]');
+ await clickOn('[data-tid=folderOpenHistoryTID]');
+ await expectElementExist(
+ '[data-tid=tsLastOpenedFoldersHistoryTID' + testFolder + ']'
+ );
+ await clickOn('[data-tid=tsLastOpenedFoldersHistoryTID' + testFolder + ']');
+ await expectElementExist('[data-tid=OpenedTID' + testFolder + ']');
+
+ //Delete
+ await clickOn('[data-tid=FolderOpenMenuTID]');
+ await clickOn('[data-tid=clearHistoryTID]');
+ await expectElementExist(
+ '[data-tid=tsLastOpenedFoldersHistoryTID' + testFolder + ']',
+ false
+ );
+ });
+});
diff --git a/tests/e2e/search.helpers.js b/tests/e2e/search.helpers.js
index a56d70905..926921b8f 100644
--- a/tests/e2e/search.helpers.js
+++ b/tests/e2e/search.helpers.js
@@ -1,6 +1,7 @@
import {
clickOn,
isDisplayed,
+ setInputKeys,
setInputValue,
typeInputValue,
waitForNotification
@@ -54,6 +55,24 @@ export async function searchEngine(filename, options = {}) {
await waitForNotification('TIDSearching');
}
+/**
+ * @param searchQuery TS.SearchQuery
+ * @returns {Promise<void>}
+ */
+export async function createSavedSearch(searchQuery) {
+ if (!(await isDisplayed('#textQuery'))) {
+ await clickOn('[data-tid=toggleSearch]');
+ }
+ await typeInputValue('#textQuery', searchQuery.textQuery);
+ await clickOn('#searchButton');
+ await clickOn('[data-tid=advancedSearch]');
+ await clickOn('[data-tid=saveSearchBtnTID]');
+ await global.client.dblclick('[data-tid=savedSearchTID]');
+ await setInputKeys('savedSearchTID', searchQuery.title);
+ await clickOn('[data-tid=confirmSavedSearchTID]');
+ await clickOn('[data-tid=closeSearchTID]');
+}
+
/*describe('TST06 - Test Search in file structure:', () => {
beforeEach(async () => {
await clearLocalStorage();