TagSpaces is an offline, open source, document manager with tagging support
fix web tests v2 (#1300)
Stanimir36221d8abdb3
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.ymlindex f63e92478..8291e48ad 100644--- a/.github/workflows/pull_request.yml+++ b/.github/workflows/pull_request.yml@@ -44,7 +44,7 @@ jobs:path: tests/testdata- uses: actions/setup-node@v2-betawith:- node-version: '10.x'+ node-version: '12.x'- name: Running yarn install, prettier and type checksrun: |yarn install --check-files --cache-folder .ycache@@ -70,59 +70,59 @@ jobs:path: |tests/test-pages/tests/test-reports/- # e2eTestsWebWin:- # name: E2E Windows Web- # runs-on: windows-latest- # steps:- # - name: Checking out default branch- # uses: actions/checkout@v2- # with:- # submodules: true- # - name: Checkout TagspacesPro- # uses: actions/checkout@v2- # with:- # repository: tagspaces/tagspacespro- # token: ${{ secrets.CHECKOUT_TSPRO }}- # path: extensions/tagspacespro- # - name: Checkout TestData- # uses: actions/checkout@v2- # with:- # repository: tagspaces/testdata- # path: tests/testdata- # - 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- # - uses: suisei-cn/actions-download-file@v1- # id: minio- # name: Download the Minio.exe- # with:- # url: 'https://dl.min.io/server/minio/release/windows-amd64/minio.exe'- # target: tests/bin/- # - name: Run Electron tests- # run: |- # yarn install-ext- # yarn build-main- # yarn build-e2e- # yarn test-e2e-web- # - uses: IgnusG/[email protected]- # if: always() # Run regardless of whether other steps failed- # with:- # access-token: ${{ secrets.GITHUB_TOKEN }}- # working-directory: tests- # - uses: actions/upload-artifact@v2- # if: always()- # with:- # name: test-artifacts-web- # path: |- # tests/test-pages/- # tests/test-reports/+ e2eTestsWebWin:+ name: E2E Windows Web+ runs-on: windows-latest+ steps:+ - name: Checking out default branch+ uses: actions/checkout@v2+ with:+ submodules: true+ - name: Checkout TagspacesPro+ uses: actions/checkout@v2+ with:+ repository: tagspaces/tagspacespro+ token: ${{ secrets.CHECKOUT_TSPRO }}+ path: extensions/tagspacespro+ - name: Checkout TestData+ uses: actions/checkout@v2+ with:+ repository: tagspaces/testdata+ path: tests/testdata+ - uses: actions/setup-node@v2-beta+ with:+ node-version: '12.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+ - uses: suisei-cn/actions-download-file@v1+ id: minio+ name: Download the Minio.exe+ with:+ url: 'https://dl.min.io/server/minio/release/windows-amd64/minio.exe'+ target: tests/bin/+ - name: Run Electron tests+ run: |+ yarn install-ext+ yarn build-main+ yarn build-e2e+ yarn test-e2e-web+ - uses: IgnusG/[email protected]+ if: always() # Run regardless of whether other steps failed+ with:+ access-token: ${{ secrets.GITHUB_TOKEN }}+ working-directory: tests+ - uses: actions/upload-artifact@v2+ if: failure()+ with:+ name: test-artifacts-web+ path: |+ tests/test-pages/+ tests/test-reports/# gitHubActionForNpmMac:# name: Validating MacOS# runs-on: macos-latestdiff --git a/.github/workflows/workflow_dispatch.yml b/.github/workflows/workflow_dispatch.ymlindex 05eda68a6..c15273a0c 100644--- a/.github/workflows/workflow_dispatch.yml+++ b/.github/workflows/workflow_dispatch.yml@@ -28,7 +28,7 @@ jobs:path: extensions/tagspacespro- uses: actions/setup-node@v2-betawith:- node-version: '10.x'+ node-version: '12.x'- name: Running yarn install, prettier and type checksrun: |yarn install --check-files --cache-folder .ycache@@ -58,3 +58,10 @@ jobs:with:access-token: ${{ secrets.GITHUB_TOKEN }}working-directory: tests+ - uses: actions/upload-artifact@v2+ if: failure()+ with:+ name: test-artifacts+ path: |+ tests/test-pages/+ tests/test-reports/diff --git a/.github/workflows/workflow_scheduled.yml b/.github/workflows/workflow_scheduled.ymlindex 161fccd6a..5f5c440eb 100644--- a/.github/workflows/workflow_scheduled.yml+++ b/.github/workflows/workflow_scheduled.yml@@ -21,7 +21,7 @@ jobs:path: tests/testdata- uses: actions/setup-node@v2-betawith:- node-version: '10.x'+ node-version: '12.x'- name: Running yarn install, prettier and type checksrun: |yarn install --check-files --cache-folder .ycache@@ -64,7 +64,7 @@ jobs:path: tests/testdata- uses: actions/setup-node@v2-betawith:- node-version: '10.x'+ node-version: '12.x'- name: Running yarn install, prettier and type checksrun: |yarn install --check-files --cache-folder .ycache@@ -113,7 +113,7 @@ jobs:path: tests/testdata- uses: actions/setup-node@v2-betawith:- node-version: '10.x'+ node-version: '12.x'- name: Running yarn install, prettier and type checksrun: |yarn install --check-files --cache-folder .ycache@@ -155,7 +155,7 @@ jobs:path: tests/testdata- uses: actions/setup-node@v2-betawith:- node-version: '10.x'+ node-version: '12.x'- name: Running yarn install, prettier and type checksrun: |yarn install --check-files --cache-folder .ycache@@ -197,7 +197,7 @@ jobs:path: tests/testdata- uses: actions/setup-node@v2-betawith:- node-version: '10.x'+ node-version: '12.x'- name: Running yarn install, prettier and type checksrun: |yarn install --check-files --cache-folder .ycache@@ -247,7 +247,7 @@ jobs:path: tests/testdata- uses: actions/setup-node@v2-betawith:- node-version: '10.x'+ node-version: '12.x'- name: Running yarn install, prettier and type checksrun: |yarn install --check-files --cache-folder .ycache@@ -274,139 +274,138 @@ jobs:with:name: test-pagespath: tests/test-pages/+# e2eTestsElectronUbuntu:+# name: E2E Ubuntu Electron+# runs-on: ubuntu-latest+# steps:+# - name: Checking out default branch+# uses: actions/checkout@v2+# with:+# ref: develop+# submodules: true+# - name: Checkout TestData+# uses: actions/checkout@v2+# with:+# repository: tagspaces/testdata+# path: tests/testdata+# - uses: actions/setup-node@v2-beta+# with:+# node-version: '12.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 install-ext+# yarn build-main+# yarn build-e2e+# yarn test-e2e-electron+# - uses: actions/upload-artifact@v2+# if: always()+# with:+# name: test-pages+# path: tests/test-pages/- e2eTestsElectronUbuntu:- name: E2E Ubuntu Electron- runs-on: ubuntu-latest- steps:- - name: Checking out default branch- uses: actions/checkout@v2- with:- ref: develop- submodules: true- - name: Checkout TestData- uses: actions/checkout@v2- with:- repository: tagspaces/testdata- path: tests/testdata- - 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 install-ext- yarn build-main- yarn build-e2e- yarn test-e2e-electron- - uses: actions/upload-artifact@v2- if: always()- with:- name: test-pages- path: tests/test-pages/-- e2eTestsMinioUbuntu:- name: E2E Ubuntu Minio- runs-on: ubuntu-latest- steps:- - name: Checking out default branch- uses: actions/checkout@v2- with:- ref: develop- submodules: true- - name: Checkout TagspacesPro- uses: actions/checkout@v2- with:- repository: tagspaces/tagspacespro- token: ${{ secrets.CHECKOUT_TSPRO }}- path: extensions/tagspacespro- - name: Checkout TestData- uses: actions/checkout@v2- with:- repository: tagspaces/testdata- path: tests/testdata- - 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- - uses: suisei-cn/actions-download-file@v1- id: minio- name: Download the Minio- with:- url: 'https://dl.min.io/server/minio/release/linux-amd64/minio'- target: tests/bin/- - name: Make the Minio executable- run: chmod +x ./tests/bin/minio- - name: Run Electron tests- run: |- yarn install-ext- yarn build-main- yarn build-e2e- yarn test-e2e-electron-minio- - uses: actions/upload-artifact@v2- if: always()- with:- name: test-pages- path: tests/test-pages/-- e2eTestsWebUbuntu:- name: E2E Ubuntu Web- runs-on: ubuntu-latest- steps:- - name: Checking out default branch- uses: actions/checkout@v2- with:- ref: develop- submodules: true- - name: Checkout TagspacesPro- uses: actions/checkout@v2- with:- repository: tagspaces/tagspacespro- token: ${{ secrets.CHECKOUT_TSPRO }}- path: extensions/tagspacespro- - name: Checkout TestData- uses: actions/checkout@v2- with:- repository: tagspaces/testdata- path: tests/testdata- - 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- - uses: suisei-cn/actions-download-file@v1- id: minio- name: Download the Minio.exe- with:- url: 'https://dl.min.io/server/minio/release/linux-amd64/minio'- target: tests/bin/- - name: Make the Minio executable- run: chmod +x ./tests/bin/minio- - name: Run Electron tests- run: |- yarn install-ext- yarn build-main- yarn build-e2e- yarn test-e2e-web- - uses: actions/upload-artifact@v2- if: always()- with:- name: test-reports- path: tests/test-reports/+# e2eTestsMinioUbuntu:+# name: E2E Ubuntu Minio+# runs-on: ubuntu-latest+# steps:+# - name: Checking out default branch+# uses: actions/checkout@v2+# with:+# ref: develop+# submodules: true+# - name: Checkout TagspacesPro+# uses: actions/checkout@v2+# with:+# repository: tagspaces/tagspacespro+# token: ${{ secrets.CHECKOUT_TSPRO }}+# path: extensions/tagspacespro+# - name: Checkout TestData+# uses: actions/checkout@v2+# with:+# repository: tagspaces/testdata+# path: tests/testdata+# - uses: actions/setup-node@v2-beta+# with:+# node-version: '12.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+# - uses: suisei-cn/actions-download-file@v1+# id: minio+# name: Download the Minio+# with:+# url: 'https://dl.min.io/server/minio/release/linux-amd64/minio'+# target: tests/bin/+# - name: Make the Minio executable+# run: chmod +x ./tests/bin/minio+# - name: Run Electron tests+# run: |+# yarn install-ext+# yarn build-main+# yarn build-e2e+# yarn test-e2e-electron-minio+# - uses: actions/upload-artifact@v2+# if: always()+# with:+# name: test-pages+# path: tests/test-pages/+#+# e2eTestsWebUbuntu:+# name: E2E Ubuntu Web+# runs-on: ubuntu-latest+# steps:+# - name: Checking out default branch+# uses: actions/checkout@v2+# with:+# ref: develop+# submodules: true+# - name: Checkout TagspacesPro+# uses: actions/checkout@v2+# with:+# repository: tagspaces/tagspacespro+# token: ${{ secrets.CHECKOUT_TSPRO }}+# path: extensions/tagspacespro+# - name: Checkout TestData+# uses: actions/checkout@v2+# with:+# repository: tagspaces/testdata+# path: tests/testdata+# - uses: actions/setup-node@v2-beta+# with:+# node-version: '12.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+# - uses: suisei-cn/actions-download-file@v1+# id: minio+# name: Download the Minio.exe+# with:+# url: 'https://dl.min.io/server/minio/release/linux-amd64/minio'+# target: tests/bin/+# - name: Make the Minio executable+# run: chmod +x ./tests/bin/minio+# - name: Run Electron tests+# run: |+# yarn install-ext+# yarn build-main+# yarn build-e2e+# yarn test-e2e-web+# - uses: actions/upload-artifact@v2+# if: always()+# with:+# name: test-reports+# path: tests/test-reports/diff --git a/app/perspectives/grid-perspective/components/CellContent.tsx b/app/perspectives/grid-perspective/components/CellContent.tsxindex cdf5f2f09..d8aa3b695 100644--- a/app/perspectives/grid-perspective/components/CellContent.tsx+++ b/app/perspectives/grid-perspective/components/CellContent.tsx@@ -253,6 +253,7 @@ const CellContent = (props: Props) => {}}><div+ data-tid="rowCellTID"className={classes.rowFileExtension}role="presentation"title={fsEntry.path}diff --git a/jest.config.web.headless.js b/jest.config.web.headless.jsdeleted file mode 100644index 00270f553..000000000--- a/jest.config.web.headless.js+++ /dev/null@@ -1,88 +0,0 @@-// const sh = require('shelljs');-const branchName = require('current-git-branch');--const isWin = /^win/.test(process.platform);-const isMac = /^darwin/.test(process.platform);-const isLinux = /^linux/.test(process.platform);-let os = '';-if (isWin) {- os = '_win';-} else if (isMac) {- os = '_macos';-} else if (isLinux) {- os = '_linux';-}-const web = process.env.NODE_JEST === 'test_web' ? '_web' : '';-const minio = process.env.NODE_JEST === 'test_minio' ? '_minio' : '';--module.exports = async () => {- /* const BRANCH_NAME = await new Promise((resolve, reject) => {- sh.exec(- 'git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3',- (code, stdout, stderr) => {- if (code !== 0) {- const e = new Error();- e.message = stderr;- e.name = String(code);- reject(e);- } else {- resolve(stdout);- }- }- );- }); */- const BRANCH_NAME = branchName();- return {- rootDir: './tests',- verbose: true,- /**- * setupFiles: ran once per test file before all tests- * https://jestjs.io/docs/en/configuration#setupfiles-array- */- setupFiles: ['../scripts/test-config-env-web-headless.js'],- /**- * setupFilesAfterEnv: ran before each test- *- * https://jestjs.io/docs/en/configuration#setupfilesafterenv-array- */- setupFilesAfterEnv: ['./setup-after-env.js'],- /**- * globalSetup: ran once before all tests- *- * https://jestjs.io/docs/en/configuration#globalsetup-string- */- globalSetup: './global-setup-web.js',- /**- * globalTeardown: ran once after all tests- *- * https://jestjs.io/docs/en/configuration#globalteardown-string- */- globalTeardown: './global-teardown-web.js',- moduleNameMapper: {- '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':- '<rootDir>/internals/mocks/fileMock.js',- '\\.(css|less|sass|scss)$': 'identity-obj-proxy'- },- moduleFileExtensions: ['js', 'ts', 'tsx'],- moduleDirectories: ['node_modules', 'app/node_modules'],- testMatch: [- '**/{unit,e2e,app,test,integration}/**/*.{test,e2e}.{js,tsx,ts,tsx}'- ],- testPathIgnorePatterns: ['<rootDir>/extensions'],- reporters: [- 'default',- [- '../node_modules/jest-html-reporter',- {- pageTitle: BRANCH_NAME + ' Test Report',- outputPath:- './test-reports/' + BRANCH_NAME + os + web + minio + '.html'- }- ],- 'jest-junit'- ],- collectCoverage: true,- maxWorkers: 1,- testTimeout: 30000- };-};diff --git a/package.json b/package.jsonindex 6abe83901..fb87df964 100644--- a/package.json+++ b/package.json@@ -82,10 +82,10 @@"test-unit": "cross-env NODE_JEST=unit_test BABEL_DISABLE_CACHE=1 jest --config=jest.config.unit.js --verbose ./tests/unit/","test-all": "yarn build && yarn test-unit && yarn build-e2e && yarn test-e2e","test-one": "jest --detectOpenHandles --config=jest.config.web.js -t 'TST5024' --runInBand --verbose ./tests/e2e/",- "test-e2e-electron": "node -r @babel/register ./internals/scripts/CheckBuiltsExist.js && cross-env NODE_ENV=test jest --config=jest.config.js -t 'electron' --runInBand --verbose ./tests/e2e/",- "test-e2e-electron-minio": "node -r @babel/register ./internals/scripts/CheckBuiltsExist.js && cross-env NODE_JEST=test_minio jest --config=jest.config.minio.js -t 'minio' --runInBand --verbose ./tests/e2e/",- "test-e2e-web": "yarn prepare-web && cross-env NODE_JEST=test_web jest --config=jest.config.web.headless.js -t 'web' --runInBand --verbose ./tests/e2e/",- "test-e2e-web-all": "yarn prepare-web && cross-env NODE_JEST=test_web jest --config=jest.config.web.js --verbose ./tests/e2e/",+ "test-e2e-electron": "node -r @babel/register ./internals/scripts/CheckBuiltsExist.js && cross-env NODE_ENV=test HEADLESS_MODE=true jest --config=jest.config.js -t 'electron' --verbose ./tests/e2e/",+ "test-e2e-electron-minio": "node -r @babel/register ./internals/scripts/CheckBuiltsExist.js && cross-env HEADLESS_MODE=true jest --config=jest.config.minio.js -t 'minio' --verbose ./tests/e2e/",+ "test-e2e-web": "yarn prepare-web && cross-env HEADLESS_MODE=true jest --config=jest.config.web.js -t 'web' --verbose ./tests/e2e/",+ "test-e2e-web-all": "yarn prepare-web && jest --config=jest.config.web.js --verbose ./tests/e2e/","minio-start": "./tests/bin/minio server ./tests/testdata/file-structure","minio-start-windows": "./tests/bin/minio.exe server ./tests/testdata/file-structure","start-chrome-driver": "./node_modules/.bin/chromedriver --url-base=/ --port=9515 --no-sandbox --disable-dev-shm-usage",diff --git a/scripts/test-config-env-web-headless.js b/scripts/test-config-env-web-headless.jsdeleted file mode 100644index 6d6188f68..000000000--- a/scripts/test-config-env-web-headless.js+++ /dev/null@@ -1,2 +0,0 @@-process.env.NODE_JEST = 'test_web';-process.env.HEADLESS_CHROME = 'headless_chrome';diff --git a/tests/e2e/fileopener.e2e.js b/tests/e2e/fileopener.e2e.jsindex 9518a06fd..cea5960a5 100644--- a/tests/e2e/fileopener.e2e.js+++ b/tests/e2e/fileopener.e2e.js@@ -112,7 +112,7 @@ describe('TST08 - File folder properties', () => {const newTile = 'fileRenamed.txt';await searchEngine('txt');// open fileProperties- await clickOn(perspectiveGridTable + firstFile);+ await clickOn(selectorFile);//Toggle Propertiesawait clickOn('[data-tid=fileContainerToggleProperties]');@@ -195,10 +195,7 @@ describe('TST08 - File folder properties', () => {// TODO externally change the file to check if its reloaded});- /** TODO- * web clickOn selector [data-tid=confirmSaveBeforeCloseDialog] to exist after 5s- */- it('TST0813 - Delete file [TST0813,minio,electron]', async () => {+ it('TST0813 - Delete file [TST0813,web,minio,electron]', async () => {await createTxtFile();await searchEngine('note');diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.jsindex 88888b71b..236139983 100644--- a/tests/e2e/general.helpers.js+++ b/tests/e2e/general.helpers.js@@ -19,8 +19,9 @@ export async function clickOn(selector, options = {}) {await element.waitUntil(async function() {const displayed = await this.isDisplayed();+ // const clickable = await this.isClickable();// const displayed = await this.isDisplayedInViewport();- return displayed === true;+ return displayed; // && clickable;},{timeout: 5000,@@ -32,6 +33,10 @@ export async function clickOn(selector, options = {}) {await element.click(options);}+/*export async function waitUntilOpen(element) {+ // const element = await global.client.$(selector);+ await element.waitUntil(async () => await this.isOpen());+}*//**** @param selector@@ -62,8 +67,9 @@ export async function doubleClickOn(selector) {const element = await global.client.$(selector);await element.waitUntil(async function() {- const displayed = await this.isDisplayedInViewport();- return displayed === true;+ const displayed = await this.isDisplayed();+ // const displayed = await this.isDisplayedInViewport();+ return displayed; //=== true;},{timeout: 5000,@@ -209,7 +215,7 @@ export async function getGridFileName(fileIndex) {return undefined;}-export async function getGridCellClass(fileIndex = 0) {+export async function getGridElement(fileIndex = 0) {const filesList = await global.client.$$(perspectiveGridTable + firstFile);let file =fileIndex < 0@@ -217,8 +223,12 @@ export async function getGridCellClass(fileIndex = 0) {: filesList[fileIndex];file = await file.$('div');file = await file.$('div');+ return file;+}- return await file.getAttribute('class');+export async function getGridCellClass(fileIndex = 0) {+ const file = await getGridElement(fileIndex);+ return file.getAttribute('class');}export async function expectElementExist(@@ -227,18 +237,42 @@ export async function expectElementExist(timeout = 5000) {const element = await global.client.$(selector);- await element.waitUntil(+ await expectExist(element, exist, timeout);+ return element;+}++export async function expectExist(element, exist = true, timeout = 5000) {+ await element.waitForDisplayed({+ timeout: timeout,+ reverse: !exist,+ timeoutMsg:+ 'expectElementExist selector:' ++ element.selector ++ ' to exist=' ++ exist ++ ' after ' ++ timeout / 1000 ++ 's'+ });+ /*await element.waitUntil(async function() {- const displayed = await this.isDisplayedInViewport();+ const displayed = await this.isDisplayed();+ // const displayed = await this.isDisplayedInViewport();return displayed === exist;},{timeout: timeout,timeoutMsg:- 'expected selector to exist=' + exist + ' after ' + timeout / 1000 + 's'+ 'expectElementExist selector:' ++ element.selector ++ ' to exist=' ++ exist ++ ' after ' ++ timeout / 1000 ++ 's'}- );- expect(await element.isDisplayedInViewport()).toBe(exist);+ );*/+ expect(await element.isDisplayed()).toBe(exist);return element;}@@ -312,6 +346,48 @@ export async function selectAllFiles(classNotSelected) {);}+export async function selectFilesByID(arrEntryIds = []) {+ await global.client.pause(500);+ await clickOn('[data-tid=gridPerspectiveSwitchLayoutToRow]');+ for (let i = 0; i < arrEntryIds.length; i++) {+ let entry = await global.client.$(+ '[data-entry-id="' + arrEntryIds[i] + '"]'+ );+ entry = await entry.$('[data-tid=rowCellTID]');+ await entry.click();+ }+ await clickOn('[data-tid=gridPerspectiveSwitchLayoutToGrid]');+}++export async function selectRowFiles(arrIndex = []) {+ await global.client.pause(500);+ await clickOn('[data-tid=gridPerspectiveSwitchLayoutToRow]');+ // const filesList = await global.client.$('[data-tid=perspectiveGridFileTable]');+ const filesList = await global.client.$$('[data-tid=rowCellTID]');+ const arrElements = [];+ for (let i = 0; i < arrIndex.length; i++) {+ const index =+ arrIndex[i] < 0 ? filesList.length + arrIndex[i] : arrIndex[i];+ if (filesList[index]) {+ let parent = await filesList[index].$('..');+ parent = await parent.$('..');+ parent = await parent.$('..');+ arrElements.push(await parent.getAttribute('data-entry-id'));+ filesList[index].click();+ } else {+ console.log(+ 'selectRowFiles filesList.length:' ++ filesList.length ++ ' with index:' ++ index ++ ' not exist'+ );+ }+ }+ await clickOn('[data-tid=gridPerspectiveSwitchLayoutToGrid]');+ return arrElements;+}+/*** TODO holdDownKey + click not work:* @param arrIndex@@ -384,10 +460,21 @@ export async function showFilesWithTag(tagName) {await clickOn('[data-tid=tagMoreButton_' + tagName + ']');await global.client.pause(500);await clickOn('[data-tid=showFilesWithThisTag]');- await global.client.pause(1500); // minio+ await waitForNotification();+ await global.client.pause(1500); // web && minio search is slow+}++export async function expectTagsExistBySelector(+ selector,+ arrTagNames,+ exist = true+) {+ const gridElement = await global.client.$(selector);+ await expectTagsExist(gridElement, arrTagNames, exist);}export async function expectTagsExist(gridElement, arrTagNames, exist = true) {+ await expectExist(gridElement);const tags = await extractTags(gridElement);for (let i = 0; i < arrTagNames.length; i++) {const tagName = arrTagNames[i];diff --git a/tests/e2e/hook.js b/tests/e2e/hook.jsindex 8fb22b3fb..d064ba824 100644--- a/tests/e2e/hook.js+++ b/tests/e2e/hook.js@@ -49,25 +49,31 @@ export async function clearLocalStorage() {}export async function startSpectronApp() {+ const chromeDriverArgs = [+ // '--disable-gpu',+ '--disable-infobars',+ '--no-sandbox',+ '--disable-dev-shm-usage',+ '--disable-extensions',+ '--window-size=1920,1080'+ ];+ if (global.isHeadlessMode) {+ chromeDriverArgs.push('--headless');+ }+if (global.isWeb) {//require('scripts/wdio.conf');const webdriverio = require('webdriverio');// https://webdriver.io/docs/configurationfile.html- let options = {++ const options = {host: 'localhost', // Use localhost as chrome driver serverport: 9515, // "9515" is the port opened by chrome driver.capabilities: {browserName: 'chrome','goog:chromeOptions': {w3c: true,- args: [- '--no-sandbox',- '--window-size=1920,1080',- '--disable-dev-shm-usage'- ]- },- timeouts: {- script: 60000+ args: chromeDriverArgs}},// Warns when a deprecated command is used@@ -90,30 +96,6 @@ export async function startSpectronApp() {logLevel: 'silent',coloredLogs: true};- if (global.isHeadlessChrome) {- options = {- ...options,- capabilities: {- browserName: 'chrome',- 'goog:chromeOptions': {- // binary: electronPath, // Path to your Electron binary.- // to run chrome headless the following flags are required- // (see https://developers.google.com/web/updates/2017/04/headless-chrome)- // args: ['--headless', '--disable-gpu']- args: [- '--headless',- // '--disable-gpu',- '--no-sandbox',- '--window-size=1920,1080',- '--disable-dev-shm-usage'- ]- },- timeouts: {- script: 60000- }- }- };- }// global.client = browserglobal.client = await webdriverio.remote(options);// global.client.setTimeout({ 'script': 60000 });@@ -136,7 +118,8 @@ export async function startSpectronApp() {args: [pathLib.join(__dirname, '..', '..', 'app')],// startTimeout: 500,waitTimeout: 1000,- waitforInterval: 50+ waitforInterval: 50,+ chromeDriverArgs: chromeDriverArgs});await global.app.start();global.client = global.app.client;diff --git a/tests/e2e/location.e2e.js b/tests/e2e/location.e2e.jsindex fc7765f9e..6dfcb815d 100644--- a/tests/e2e/location.e2e.js+++ b/tests/e2e/location.e2e.js@@ -126,7 +126,11 @@ describe('TST03 - Testing locations:', () => {// TODO test duplication warning on creating locations});- it('TST0307 - Move location Up and Down [web]', async () => {+ it('TST0307 - Move location Up and Down [web,electron]', async () => {+ if (global.isWeb) {+ // in web there is no other locations+ await createMinioLocation('', 'dummyLocation', false);+ }await openLocationMenu(testLocationName);await clickOn('[data-tid=moveLocationUp]');diff --git a/tests/e2e/location.helpers.js b/tests/e2e/location.helpers.jsindex 291fdfb9d..aa9bb6495 100644--- a/tests/e2e/location.helpers.js+++ b/tests/e2e/location.helpers.js@@ -259,5 +259,8 @@ export async function getLocationTid(locationIndex) {// location = await location.$('li');// location = await location.$('div');// return location.getAttribute('data-tid');- return location.getText();+ if (location !== undefined) {+ return await location.getText();+ }+ return undefined;}diff --git a/tests/e2e/perspective-grid-right-button.e2e.js b/tests/e2e/perspective-grid-right-button.e2e.jsindex 2225cb832..1c3c340c3 100644--- a/tests/e2e/perspective-grid-right-button.e2e.js+++ b/tests/e2e/perspective-grid-right-button.e2e.js@@ -28,12 +28,12 @@ import {doubleClickOn,expectElementExist,expectTagsExist,- getGridCellClass,+ expectTagsExistBySelector,getGridFileName,removeTagFromTagMenu,- selectAllFiles,selectorFile,selectorFolder,+ selectRowFiles,setInputKeys,setSettings,showFilesWithTag,@@ -118,10 +118,9 @@ describe('TST50** - Right button on a file', () => {test('TST5019 - Rename tag in file [TST5019,web,minio,electron]', async () => {await searchEngine('desktop');// Select file- await clickOn(perspectiveGridTable + firstFile);+ await clickOn(selectorFile);await AddRemoveTagsToSelectedFiles([testTagName], true);- let file = await global.client.$(perspectiveGridTable + firstFile);- await expectTagsExist(file, [testTagName], true);+ await expectTagsExistBySelector(selectorFile, [testTagName], true);/*await AddRemoveTagsToFile(perspectiveGridTable + firstFile, [testTagName], {add: true@@ -133,33 +132,51 @@ describe('TST50** - Right button on a file', () => {await clickOn('[data-tid=confirmEditTagEntryDialog]');await waitForNotification();- file = await global.client.$(perspectiveGridTable + firstFile);- await expectTagsExist(file, [testTagName + '-edited'], true);+ await expectTagsExistBySelector(+ selectorFile,+ [testTagName + '-edited'],+ true+ );//cleanup- await clickOn(perspectiveGridTable + firstFile);+ await clickOn(selectorFile);await AddRemoveTagsToSelectedFiles([testTagName + '-edited'], false);- file = await global.client.$(perspectiveGridTable + firstFile);- await expectTagsExist(file, [testTagName + '-edited'], false);+ await expectTagsExistBySelector(+ selectorFile,+ [testTagName + '-edited'],+ false+ );});test('TST5023 - Remove tag from file (tag menu) [TST5023,web,minio,electron]', async () => {await searchEngine('desktop');// select file- await clickOn(perspectiveGridTable + firstFile);+ await clickOn(selectorFile);await AddRemoveTagsToSelectedFiles([testTagName], true);- let file = await global.client.$(perspectiveGridTable + firstFile);- await expectTagsExist(file, [testTagName], true);+ await expectTagsExistBySelector(selectorFile, [testTagName], true);await removeTagFromTagMenu(testTagName);await global.client.pause(500);- file = await global.client.$(perspectiveGridTable + firstFile);- await expectTagsExist(file, [testTagName], false);+ await expectTagsExistBySelector(selectorFile, [testTagName], false);});test('TST5024 - Show files with a given tag (tag menu) [TST5024,web,minio,electron]', async () => {- const classNotSelected = await getGridCellClass(0);+ //open Option menu+ await clickOn('[data-tid=gridPerspectiveOptionsMenu]');+ //click on hide directories+ await clickOn('[data-tid=gridPerspectiveToggleShowDirectories]');++ await selectRowFiles([0, 1, 2]);+ await AddRemoveTagsToSelectedFiles([testTagName], true);+ await showFilesWithTag(testTagName);++ const filesList = await global.client.$$(selectorFile);+ for (let i = 0; i < filesList.length; i++) {+ await expectTagsExist(filesList[i], [testTagName], true);+ }++ /*const classNotSelected = await getGridCellClass(0);const classSelected = await selectAllFiles(classNotSelected);expect(classNotSelected).not.toBe(classSelected);@@ -174,7 +191,7 @@ describe('TST50** - Right button on a file', () => {// cleanupawait selectAllFiles(classNotSelected);expect(classNotSelected).not.toBe(classSelected);- await AddRemoveTagsToSelectedFiles([testTagName], false);+ await AddRemoveTagsToSelectedFiles([testTagName], false);*/});/**@@ -185,25 +202,23 @@ describe('TST50** - Right button on a file', () => {await searchEngine('desktop');const tags = [testTagName, testTagName + '2'];// select file- await clickOn(perspectiveGridTable + firstFile);+ await clickOn(selectorFile);await AddRemoveTagsToSelectedFiles(tags, true);- const file = await global.client.$(perspectiveGridTable + firstFile);- await expectTagsExist(file, tags, true);+ await expectTagsExistBySelector(selectorFile, tags, true);- //cleanup- await clickOn(perspectiveGridTable + firstFile);+ // remove tags+ await clickOn(selectorFile);await AddRemoveTagsToSelectedFiles(tags, false);++ await expectTagsExistBySelector(selectorFile, tags, false);});test('TST5026 - Open file natively [electron]', async () => {if (!global.isMinio) {// Open file natively option is missing for Minio Locationawait searchEngine('txt');- await openContextEntryMenu(- perspectiveGridTable + firstFile,- 'fileMenuOpenFileNatively'- );+ await openContextEntryMenu(selectorFile, 'fileMenuOpenFileNatively');}// check parent directory});@@ -212,10 +227,7 @@ describe('TST50** - Right button on a file', () => {if (!global.isMinio) {// Show in File Manager option is missing for Minio Locationawait searchEngine('txt');- await openContextEntryMenu(- perspectiveGridTable + firstFile,- 'fileMenuOpenContainingFolder'- );+ await openContextEntryMenu(selectorFile, 'fileMenuOpenContainingFolder');}// check parent directory});@@ -284,6 +296,9 @@ describe('TST50** - Right button on a file', () => {perspectiveGridTable + firstFolder,'openDirectory');+ if (isWeb) {+ await global.client.pause(500);+ }const firstFileName = await getGridFileName(0);expect(firstFileName).toBe(undefined); //'sample.eml');});diff --git a/tests/e2e/perspective-grid.e2e.js b/tests/e2e/perspective-grid.e2e.jsindex c6a604e21..0366f9c75 100644--- a/tests/e2e/perspective-grid.e2e.js+++ b/tests/e2e/perspective-grid.e2e.js@@ -22,14 +22,19 @@ import {createTxtFile,doubleClickOn,expectElementExist,- expectTagsExist,+ expectExist,+ expectTagsExistBySelector,extractTags,getGridCellClass,getGridFileName,selectAllFiles,+ selectFilesByID,selectorFile,+ selectorFolder,+ selectRowFiles,setSettings,- waitForNotification+ waitForNotification,+ waitUntilClassChanged} from './general.helpers';import { AddRemoveTagsToSelectedFiles } from './perspective-grid.helpers';import { getPropertiesFileName } from './file.properties.helpers';@@ -170,67 +175,94 @@ describe('TST50 - Perspective Grid', () => {// This scenario includes "Add tags" && "Remove tags" to be fulfilledtest('TST5005 - Add tags to the selected files [TST5005,web,minio,electron]', async () => {- const classNotSelected = await getGridCellClass(0);+ /*const classNotSelected = await getGridCellClass(0);const classSelected = await selectAllFiles(classNotSelected);- expect(classNotSelected).not.toBe(classSelected);+ expect(classNotSelected).not.toBe(classSelected);*/- /*await openContextEntryMenu( TODO Right button deselect files- perspectiveGridTable + firstFile,- 'fileMenuAddRemoveTags'- );*/+ //open Option menu+ await clickOn('[data-tid=gridPerspectiveOptionsMenu]');+ //click on hide directories+ await clickOn('[data-tid=gridPerspectiveToggleShowDirectories]');++ const selectedIds = await selectRowFiles([0, 1, 2]);const tags = ['test-tag1', 'test-tag2'];await AddRemoveTagsToSelectedFiles(tags);- // Select all file and check if tag exist- const filesList = await global.client.$$(perspectiveGridTable + firstFile);- for (let i = 0; i < filesList.length; i++) {- await expectTagsExist(filesList[i], tags, true);++ for (let i = 0; i < selectedIds.length; i++) {+ // const selectBox = await global.client.$('[data-tid=perspectiveGridFileTable]');+ await expectTagsExistBySelector(+ '[data-entry-id="' + selectedIds[i] + '"]',+ tags,+ true+ );}- /*await clickOn('[data-tid=gridPerspectiveAddRemoveTags]');- await addInputKeys('AddRemoveTagsSelectTID', testTagName);- await global.client.keys('Enter');- await global.client.pause(500);- await clickOn('[data-tid=addTagsMultipleEntries]');- // await global.client.pause(500);- await waitForNotification();- const filesList = await global.client.$$(perspectiveGridTable + firstFile);+ // Select all file and check if tag exist+ /*const filesList = await global.client.$$(perspectiveGridTable + firstFile);for (let i = 0; i < filesList.length; i++) {- const tags = await extractTags(filesList[i]);- expect(tags.includes(testTagName)).toBe(true);+ await expectTagsExist(filesList[i], tags, true);}*/});+ /**+ * TODO merge with TST5005+ */test('TST5006 - Remove tags from selected files [TST5006,web,minio,electron]', async () => {- const classNotSelected = await getGridCellClass(0);+ /*const classNotSelected = await getGridCellClass(0);const classSelected = await selectAllFiles(classNotSelected);- expect(classNotSelected).not.toBe(classSelected);+ expect(classNotSelected).not.toBe(classSelected);*/++ //open Option menu+ await clickOn('[data-tid=gridPerspectiveOptionsMenu]');+ //click on hide directories+ await clickOn('[data-tid=gridPerspectiveToggleShowDirectories]');++ const selectedIds = await selectRowFiles([0, 1, 2]);const tags = ['test-tag1', 'test-tag2'];await AddRemoveTagsToSelectedFiles(tags, false);+ for (let i = 0; i < selectedIds.length; i++) {+ await expectTagsExistBySelector(+ '[data-entry-id="' + selectedIds[i] + '"]',+ tags,+ false+ );+ }// Select all file and check if tag exist- const filesList = await global.client.$$(perspectiveGridTable + firstFile);+ /*const filesList = await global.client.$$(perspectiveGridTable + firstFile);for (let i = 0; i < filesList.length; i++) {await expectTagsExist(filesList[i], tags, false);- }- /*await clickOn('[data-tid=gridPerspectiveAddRemoveTags]');-- await addInputKeys('AddRemoveTagsSelectTID', testTagName);- await global.client.keys('Enter');- await global.client.pause(500);- await clickOn('[data-tid=removeTagsMultipleEntries]');- // await global.client.pause(500);- await waitForNotification();- const filesList = await global.client.$$(perspectiveGridTable + firstFile);- for (let i = 0; i < filesList.length; i++) {- const tags = await extractTags(filesList[i]);- expect(tags.includes(testTagName)).toBe(false);}*/});test('TST5007 - Remove all tags from selected files [TST5007,web,minio,electron]', async () => {- const classNotSelected = await getGridCellClass(0);+ //open Option menu+ await clickOn('[data-tid=gridPerspectiveOptionsMenu]');+ //click on hide directories+ await clickOn('[data-tid=gridPerspectiveToggleShowDirectories]');++ const selectedIds = await selectRowFiles([0, 1, 2]);+ const tags = ['test-tag1', 'test-tag2', 'test-tag3'];+ await AddRemoveTagsToSelectedFiles(tags, true);++ await selectFilesByID(selectedIds);++ await clickOn('[data-tid=gridPerspectiveAddRemoveTags]');+ await clickOn('[data-tid=cleanTagsMultipleEntries]');+ await global.client.pause(500);++ for (let i = 0; i < selectedIds.length; i++) {+ const gridElement = await global.client.$(+ '[data-entry-id="' + selectedIds[i] + '"]'+ );+ await expectExist(gridElement);+ const tags = await extractTags(gridElement);+ expect(tags.length).toBe(0);+ }++ /*const classNotSelected = await getGridCellClass(0);const classSelected = await selectAllFiles(classNotSelected);expect(classNotSelected).not.toBe(classSelected);@@ -243,7 +275,7 @@ describe('TST50 - Perspective Grid', () => {for (let i = 0; i < filesList.length; i++) {const tags = await extractTags(filesList[i]);expect(tags.length).toBe(0);- }+ }*/});/**@@ -300,19 +332,42 @@ describe('TST50 - Perspective Grid', () => {});test('TST5013 - Delete files from selection (many files) [TST5013,web,minio,electron]', async () => {- await doubleClickOn(perspectiveGridTable + firstFolder);+ //open Option menu+ await clickOn('[data-tid=gridPerspectiveOptionsMenu]');+ //click on hide directories+ await clickOn('[data-tid=gridPerspectiveToggleShowDirectories]');++ const selectedIds = await selectRowFiles([0, 1, 2]);++ await clickOn('[data-tid=gridPerspectiveDeleteMultipleFiles]');+ await clickOn('[data-tid=confirmDeleteFileDialog]');+ await waitForNotification();++ for (let i = 0; i < selectedIds.length; i++) {+ await expectElementExist(+ '[data-entry-id="' + selectedIds[i] + '"]',+ false,+ 1000+ );+ }++ /*await doubleClickOn(selectorFolder);await createTxtFile();await searchEngine('note');await expectElementExist(selectorFile, true);const classNotSelected = await getGridCellClass(0);- const classSelected = await selectAllFiles(classNotSelected);+ await clickOn(selectorFile);+ const classSelected = await waitUntilClassChanged(+ selectorFile + '/div/div',+ classNotSelected+ );expect(classNotSelected).not.toBe(classSelected);await clickOn('[data-tid=gridPerspectiveDeleteMultipleFiles]');await clickOn('[data-tid=confirmDeleteFileDialog]');await waitForNotification();- await expectElementExist(selectorFile, false);+ await expectElementExist(selectorFile, false);*/});/*test('TST51** - Show/Hide directories in perspective view', async () => { //TODOawait global.client.waitForVisible(diff --git a/tests/e2e/perspective-grid.helpers.js b/tests/e2e/perspective-grid.helpers.jsindex 8cb50abfa..420a70c69 100644--- a/tests/e2e/perspective-grid.helpers.js+++ b/tests/e2e/perspective-grid.helpers.js@@ -1,10 +1,4 @@-import {- addInputKeys,- clickOn,- expectTagsExist,- waitForNotification-} from './general.helpers';-import { firstFile, perspectiveGridTable } from './test-utils.spec';+import { addInputKeys, clickOn, waitForNotification } from './general.helpers';/***@@ -31,6 +25,7 @@ export async function AddRemoveTagsToSelectedFiles(} else {await clickOn('[data-tid=removeTagsMultipleEntries]');}+ await global.client.pause(1000);await waitForNotification();/*const filesList = await global.client.$$(perspectiveGridTable + firstFile); // Selected file can be only one this check all filesdiff --git a/tests/e2e/viewer-image.e2e.js b/tests/e2e/viewer-image.e2e.jsindex c2f2d07f7..702ced853 100644--- a/tests/e2e/viewer-image.e2e.js+++ b/tests/e2e/viewer-image.e2e.js@@ -42,7 +42,7 @@ export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';/*** TODO search don't work for web*/-describe('TST53 - Image viewer [minio,electron]', () => {+describe('TST53 - Image viewer [electron]', () => {beforeEach(async () => {if (global.isMinio) {await createMinioLocation('', defaultLocationName, true);@@ -87,18 +87,15 @@ describe('TST53 - Image viewer [minio,electron]', () => {await closeOpenedFile();});- /**- * skip for web -> webp- */- it('TST5305 - Open WEBP [TST5305]', async () => {- /*await delay(500);+ it('TST5305 - Open W-E-B-P [TST5305]', async () => {+ await delay(500);await searchEngine('webp');await delay(500);const file = await global.client.$(perspectiveGridTable + firstFile);await file.waitForDisplayed();await file.doubleClick();await delay(500);- await closeOpenedFile();*/+ await closeOpenedFile();});it('TST5306 - Open SVG [TST5306]', async () => {diff --git a/tests/setup-after-env.js b/tests/setup-after-env.jsindex ce0a61ed8..7a5a3088e 100644--- a/tests/setup-after-env.js+++ b/tests/setup-after-env.js@@ -1,4 +1,3 @@-import pathLib from 'path';import {clearLocalStorage,startSpectronApp,@@ -7,7 +6,6 @@ import {testDataRefresh} from './e2e/hook';import { closeWelcome } from './e2e/welcome.helpers';-import { clearStorage } from './e2e/clearstorage.helpers';// the default timeout before starting every testjasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;@@ -15,7 +13,7 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;// global.isWin = /^win/.test(process.platform);// global.isMac = /^darwin/.test(process.platform);global.isWeb = process.env.NODE_JEST === 'test_web';-global.isHeadlessChrome = process.env.HEADLESS_CHROME === 'headless_chrome';+global.isHeadlessMode = process.env.HEADLESS_MODE === 'true';global.isMinio = global.isWeb || process.env.NODE_JEST === 'test_minio';global.isElectron = process.env.NODE_JEST === 'test_electron';global.isUnitTest =