TagSpaces is an offline, open source, document manager with tagging support
fix location tests (#1262)
Stanimir35dcfcb4b4f2
diff --git a/.github/workflows/workflow_scheduled.yml b/.github/workflows/workflow_scheduled.ymlnew file mode 100644index 000000000..657a81217--- /dev/null+++ b/.github/workflows/workflow_scheduled.yml@@ -0,0 +1,164 @@+name: scheduled workflow dispatch trigger+on:+ schedule:+ - cron: '0 0 * * *'++jobs:+ e2eTestsElectronWin:+ name: E2E Windows+ runs-on: windows-latest++ steps:+ - name: Checking out default branch+ uses: actions/checkout@v2+ with:+ submodules: true+ - uses: actions/setup-node@v2-beta+ with:+ node-version: '10.x'+ - name: Running yarn install, prettier and type checks+ run: |+ yarn install --check-files --cache-folder .ycache+ yarn prettier-check+ yarn type-check+ - name: Run Unit tests+ run: yarn test-unit+ - name: Run Electron tests+ run: |+ yarn setup-ext+ yarn build-main+ yarn build-e2e+ yarn test-e2e-electron++ e2eTestsMinioWin:+ name: E2E Windows Minio+ runs-on: windows-latest++ steps:+ - name: Checking out default branch+ uses: actions/checkout@v2+ with:+ submodules: true+ - uses: actions/setup-node@v2-beta+ with:+ node-version: '10.x'+ - name: Running yarn install, prettier and type checks+ run: |+ yarn install --check-files --cache-folder .ycache+ yarn prettier-check+ yarn type-check+ - name: Run Unit tests+ run: yarn test-unit+ - name: Run Electron tests+ run: |+ yarn setup-ext+ yarn build-main+ yarn build-e2e+ yarn test-e2e-electron-minio++ e2eTestsWebWin:+ name: E2E Windows Web+ runs-on: windows-latest++ steps:+ - name: Checking out default branch+ uses: actions/checkout@v2+ with:+ submodules: true+ - uses: actions/setup-node@v2-beta+ with:+ node-version: '10.x'+ - name: Running yarn install, prettier and type checks+ run: |+ yarn install --check-files --cache-folder .ycache+ yarn prettier-check+ yarn type-check+ - name: Run Unit tests+ run: yarn test-unit+ - name: Run Electron tests+ run: |+ yarn setup-ext+ yarn build-main+ yarn build-e2e+ yarn test-e2e-web++ e2eTestsElectronMac:+ name: E2E Mac+ runs-on: macos-latest+ steps:+ - name: Checking out default branch+ uses: actions/checkout@v2+ with:+ submodules: true+ - uses: actions/setup-node@v2-beta+ with:+ node-version: '10.x'+ - name: Running yarn install, prettier and type checks+ run: |+ yarn install --check-files --cache-folder .ycache+ yarn prettier-check+ yarn type-check+ - name: Run Unit tests+ run: yarn test-unit+ - name: Run Electron tests+ run: |+ yarn setup-ext+ yarn build-main+ yarn build-e2e+ yarn test-e2e-electron++ e2eTestsMinioMac:+ name: E2E Minio Mac+ runs-on: macos-latest+ steps:+ - name: Checking out default branch+ uses: actions/checkout@v2+ with:+ submodules: true+ - uses: actions/setup-node@v2-beta+ with:+ node-version: '10.x'+ - name: Running yarn install, prettier and type checks+ run: |+ yarn install --check-files --cache-folder .ycache+ yarn prettier-check+ yarn type-check+ - name: Run Unit tests+ run: yarn test-unit+ - name: Run Electron tests+ run: |+ yarn setup-ext+ yarn build-main+ yarn build-e2e+ yarn test-e2e-electron-minio++ e2eTestsWinMac:+ name: E2E Win Mac+ runs-on: macos-latest+ steps:+ - name: Checking out default branch+ uses: actions/checkout@v2+ with:+ submodules: true+ - uses: actions/setup-node@v2-beta+ with:+ node-version: '10.x'+ - name: Running yarn install, prettier and type checks+ run: |+ yarn install --check-files --cache-folder .ycache+ yarn prettier-check+ yarn type-check+ - name: Run Unit tests+ run: yarn test-unit+ - name: Run Electron tests+ run: |+ yarn setup-ext+ yarn build-main+ yarn build-e2e+ yarn test-e2e-web+ - name: 'Tar test reports'+ run: tar -cvf test_reports.tar /tests/test-reports+ - uses: actions/upload-artifact@v2+ with:+ name: test-reports+ path: test_reports.tardiff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsxindex 55de4cdd2..afc76c569 100644--- a/app/containers/MainPage.tsx+++ b/app/containers/MainPage.tsx@@ -664,19 +664,27 @@ class MainPage extends Component<Props, State> {selectedDirectoryPath={directoryPath}/>)}- <CreateFileDialog- open={isCreateFileDialogOpened}- selectedDirectoryPath={- this.state.selectedDirectoryPath || directoryPath- }- chooseDirectoryPath={this.chooseDirectoryPath}- onClose={toggleCreateFileDialog}- />+ {isCreateFileDialogOpened && (+ <CreateFileDialog+ open={isCreateFileDialogOpened}+ selectedDirectoryPath={+ this.state.selectedDirectoryPath || directoryPath+ }+ chooseDirectoryPath={this.chooseDirectoryPath}+ onClose={toggleCreateFileDialog}+ />+ )}<SettingsDialogopen={isSettingsDialogOpened}onClose={toggleSettingsDialog}/><Snackbar+ data-tid={+ 'TID' ++ (this.props.notificationStatus.text+ ? this.props.notificationStatus.text.replace(/\./g, '')+ : 'default')+ }anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}open={this.props.notificationStatus.visible}onClose={this.props.hideNotifications}diff --git a/package.json b/package.jsonindex c1e688791..33bde071b 100644--- a/package.json+++ b/package.json@@ -10,8 +10,7 @@"third-party": "yarn licenses generate-disclaimer --silent > app/third-party.txt","build": "rimraf app/dist && yarn version-meta && concurrently \"yarn build-main\" \"yarn build-renderer\" \"yarn build-worker\" \"yarn build-web\"","build-dll": "cross-env NODE_ENV=development webpack --config ./configs/webpack.config.renderer.dev.dll.babel.js --colors",- "build-e2e": "shx cp scripts/extconfig.js app && cross-env E2E_BUILD=true yarn build",- "build-e2e-without-config": "shx rm app/extconfig.js && cross-env E2E_BUILD=true yarn build",+ "build-e2e": "cross-env E2E_BUILD=true yarn build","build-main": "cross-env NODE_ENV=production webpack --config ./configs/webpack.config.main.prod.babel.js --colors","build-renderer": "cross-env NODE_ENV=production webpack --config ./configs/webpack.config.renderer.prod.babel.js --colors","build-worker": "cross-env NODE_ENV=production webpack --config ./configs/webpack.config.worker.prod.babel.js --colors",diff --git a/scripts/extconfig-without-locations.js b/scripts/extconfig-without-locations.jsnew file mode 100644index 000000000..1841547cf--- /dev/null+++ b/scripts/extconfig-without-locations.js@@ -0,0 +1,9 @@+window.ExtLogoURL = 'assets/images/text-logo-dev.svg';+window.ExtShowAdvancedSearch = false;+window.ExtSidebarColor = '#3bc8ff';+window.ExtSidebarSelectionColor = '#85d5f5';+window.ExtLightThemeLightColor = '#a6def4';+window.ExtLightThemeMainColor = '#3bc8ff';+window.ExtDarkThemeLightColor = '#a6def4';+window.ExtDarkThemeMainColor = '#3bc8ff';+window.ExtIsFirstRun = false;diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.jsindex 76e835e0e..6fae55296 100644--- a/tests/e2e/general.helpers.js+++ b/tests/e2e/general.helpers.js@@ -116,7 +116,7 @@ export async function expectElementExist(selector, exist = true) {const element = await global.client.$(selector);await element.waitUntil(async function() {- const displayed = await this.isDisplayed();+ const displayed = await this.isDisplayedInViewport();return displayed === exist;},{@@ -124,7 +124,7 @@ export async function expectElementExist(selector, exist = true) {timeoutMsg: 'expected selector to exist=' + exist + ' after 5s'});- expect(await element.isDisplayed()).toBe(exist);+ expect(await element.isDisplayedInViewport()).toBe(exist);}export async function createLocation(diff --git a/tests/e2e/hook.js b/tests/e2e/hook.jsindex 69936bbaf..80cba3011 100644--- a/tests/e2e/hook.js+++ b/tests/e2e/hook.js@@ -63,6 +63,14 @@ beforeAll(async () => {}if (global.isMinio) {global.minio = await startMinio();+ } else {+ // copy extconfig+ const fse = require('fs-extra');++ let srcDir = '../scripts/extconfig.js';+ let destDir = '../app/extconfig.js';++ fse.copySync(srcDir, destDir);}});@@ -73,6 +81,10 @@ afterAll(async () => {}if (global.isMinio) {await stopMinio(global.minio);+ } else {+ // cleanup extconfig+ const fse = require('fs-extra');+ fse.removeSync('../app/extconfig.js');}});diff --git a/tests/e2e/location.e2e.js b/tests/e2e/location.e2e.jsindex fc08406cb..22caecacf 100644--- a/tests/e2e/location.e2e.js+++ b/tests/e2e/location.e2e.js@@ -16,6 +16,24 @@ export const newLocationName = 'Location_Name_Changed';let testLocationName;describe('TST03 - Testing locations:', () => {+ beforeAll(async () => {+ const fse = require('fs-extra');++ let srcDir = '../scripts/extconfig-without-locations.js';+ let destDir = '../app/extconfig.js';++ fse.copySync(srcDir, destDir);+ });++ afterAll(async () => {+ const fse = require('fs-extra');++ let srcDir = '../scripts/extconfig.js';+ let destDir = '../app/extconfig.js';++ fse.copySync(srcDir, destDir);+ });+beforeEach(async () => {testLocationName = '' + new Date().getTime();diff --git a/tests/e2e/perspective-grid.e2e.js b/tests/e2e/perspective-grid.e2e.jsindex 0846b35d0..df8530036 100644--- a/tests/e2e/perspective-grid.e2e.js+++ b/tests/e2e/perspective-grid.e2e.js@@ -208,7 +208,7 @@ describe('TST50** - Right button on a file', () => {await closeFileProperties();});- test('TST5016 - Open file [web,electron]', async () => {+ test('TST5016 - Open file [TST5016,web,minio,electron]', async () => {//await searchEngine('bmp');await searchEngine('txt');// await delay(5000);@@ -245,7 +245,7 @@ describe('TST50** - Right button on a file', () => {test('TST5040 - Create file [web,electron]', async () => {await clickOn('[data-tid=folderContainerOpenDirMenu]');await clickOn('[data-tid=createNewFile]');- await global.client.pause(1000);+ //await global.client.pause(1500);await clickOn('[data-tid=createTextFileButton]');await searchEngine('note');await expectElementExist(selectorFile, true);diff --git a/tests/e2e/search.spec.js b/tests/e2e/search.spec.jsindex 05cd7b97a..b309bd6f3 100644--- a/tests/e2e/search.spec.js+++ b/tests/e2e/search.spec.js@@ -6,7 +6,7 @@ import {defaultLocationPath,defaultLocationName} from './location.helpers';-import { clickOn, setInputValue } from './general.helpers';+import { clickOn, expectElementExist, setInputValue } from './general.helpers';export const regexQuery = '!"#$%&\'()*+,-./@:;<=>[\\]^_`{|}~';export const searchTag = 'tag1';@@ -18,6 +18,7 @@ export const firstTagButton = '/tbody/tr[1]/td[3]/button[1]';export async function searchEngine(filename, tagName, resetSearchButton) {await clickOn('[data-tid=search]');+ await expectElementExist('#textQuery', true);await setInputValue('#textQuery', filename);if (tagName) {@@ -29,7 +30,9 @@ export async function searchEngine(filename, tagName, resetSearchButton) {} else {await clickOn('#searchButton');}- await global.client.pause(1000); // TODO wait for search results+ await expectElementExist('[data-tid=TIDSearching]', true);+ await expectElementExist('[data-tid=TIDSearching]', false);+ // await global.client.pause(1000); // TODO wait for search results}/*describe('TST06 - Test Search in file structure:', () => {