Skip to content

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

e2e fixes and cleanup

sytolk9c44ed83f0e8
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index 7669b2a3a..63508d928 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -112,10 +112,10 @@ jobs:
- uses: actions/upload-artifact@v3
if: failure()
with:
- name: test-artifacts-web
+ name: test-artifacts-pr
path: |
- tests/test-pages/
tests/test-reports/
+ playwright-report/
# gitHubActionForNpmMac:
# name: Validating MacOS
# runs-on: macos-latest
diff --git a/.github/workflows/workflow_scheduled_mac_electron.yml b/.github/workflows/workflow_scheduled_mac_electron.yml
index bcd165bee..19f021c05 100644
--- a/.github/workflows/workflow_scheduled_mac_electron.yml
+++ b/.github/workflows/workflow_scheduled_mac_electron.yml
@@ -1,7 +1,7 @@
name: Nightly E2E Tests Electron MacOS
on:
schedule:
- - cron: '0 3 * * *'
+ - cron: '0 2 * * *'
jobs:
e2eTestsElectronMac:
@@ -34,10 +34,10 @@ jobs:
npm run build-main
npm run build-e2e
npm run test-playwright
- - uses: actions/upload-artifact@v2
+ - uses: actions/upload-artifact@v3
if: failure()
with:
name: test-artifacts
path: |
- tests/test-pages/
tests/test-reports/
+ playwright-report/
diff --git a/.github/workflows/workflow_scheduled_mac_web.yml b/.github/workflows/workflow_scheduled_mac_web.yml
index 11175c769..c3a6c0947 100644
--- a/.github/workflows/workflow_scheduled_mac_web.yml
+++ b/.github/workflows/workflow_scheduled_mac_web.yml
@@ -1,7 +1,7 @@
name: Nightly E2E Tests Web Minio macOS
on:
schedule:
- - cron: '0 5 * * *'
+ - cron: '0 3 * * *'
jobs:
e2eTestsWebMac:
@@ -35,22 +35,21 @@ jobs:
npm run type-check
- name: Run Unit tests
run: npm run test-unit
- - uses: suisei-cn/actions-download-file@v1
+ - uses: carlosperate/download-file-action@v2
id: minio
name: Download the Minio
with:
- url: 'https://dl.min.io/server/minio/release/darwin-amd64/minio'
- target: tests/bin/
- - name: Make the Minio executable
- run: chmod +x ./tests/bin/minio
+ file-url: 'https://dl.min.io/server/minio/release/windows-amd64/archive/minio.RELEASE.2020-11-19T23-48-16Z'
+ file-name: 'minio.exe'
+ location: './tests/bin/'
- name: Run Electron tests
run: |
npm run build-e2e-web
npm run test-playwright-web-headless
- - uses: actions/upload-artifact@v2
+ - uses: actions/upload-artifact@v3
if: failure()
with:
name: test-artifacts
path: |
- tests/test-pages/
tests/test-reports/
+ playwright-report/
diff --git a/.github/workflows/workflow_scheduled_win_electron_pro.yml b/.github/workflows/workflow_scheduled_win_electron_pro.yml
index ab989876c..6a6623440 100644
--- a/.github/workflows/workflow_scheduled_win_electron_pro.yml
+++ b/.github/workflows/workflow_scheduled_win_electron_pro.yml
@@ -41,13 +41,13 @@ jobs:
npm run build-main
npm run build-e2e
npm run test-playwright-pro
- - uses: actions/upload-artifact@v2
+ - uses: actions/upload-artifact@v3
if: failure()
with:
name: test-artifacts
path: |
- tests/test-pages/
tests/test-reports/
+ playwright-report/
# e2eTestsElectronUbuntu:
# name: E2E Ubuntu Electron
diff --git a/.github/workflows/workflow_scheduled_win_web.yml b/.github/workflows/workflow_scheduled_win_web.yml
index 6022d4bd3..aec7db727 100644
--- a/.github/workflows/workflow_scheduled_win_web.yml
+++ b/.github/workflows/workflow_scheduled_win_web.yml
@@ -1,7 +1,7 @@
name: Nightly E2E Tests Web Minio Windows
on:
schedule:
- - cron: '0 2 * * *'
+ - cron: '0 1 * * *'
jobs:
e2eTestsWebWin:
@@ -47,10 +47,10 @@ jobs:
run: |
npm run build-e2e-web
npm run test-playwright-web-headless
- - uses: actions/upload-artifact@v2
+ - uses: actions/upload-artifact@v3
if: failure()
with:
name: test-artifacts
path: |
- tests/test-pages/
tests/test-reports/
+ playwright-report/
diff --git a/.gitignore b/.gitignore
index c9bf0dc54..20c4321a5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -114,6 +114,7 @@ cordova/platforms/ios/www/yarn.lock
cordova/platforms/ios/www/package.json
junit.xml
test-reports/*
+playwright-report/*
/app/**main.prod.js**
diff --git a/playwright.config.common.js b/playwright.config.common.js
new file mode 100644
index 000000000..9d52ee449
--- /dev/null
+++ b/playwright.config.common.js
@@ -0,0 +1,29 @@
+//const path = require('path');
+
+// const testDir = path.join(__dirname, 'tests', 'e2e');
+const pwConfig = {
+ testDir: './tests/e2e', //testDir,
+ // Use the grep option to filter tests by title and file extension
+ // grep: /.*\.pw\.js$/,
+ testMatch: /.*\.pw\.e2e\.js/,
+ // Set the timeout for each test
+ timeout: process.env.CI ? 60000 : 30000,
+ // (3 hours) Maximum time in milliseconds the whole test suite can run. Useful on CI to prevent broken setup from running too long and wasting resources.
+ globalTimeout: process.env.CI ? 3 * 60 * 60 * 1000 : undefined,
+ ignoreSnapshots: !process.env.CI,
+ retries: process.env.CI ? 3 : 1,
+ // The maximum number of test failures for the whole test suite run. After reaching this number, testing will stop and exit with an error
+ maxFailures: process.env.CI ? 8 : 0,
+ globalSetup: './tests/global-setup.js',
+ globalTeardown: './tests/global-teardown.js',
+ // 'github' for GitHub Actions CI to generate annotations, plus a concise 'dot'
+ // default 'list' when running locally
+ reporter: process.env.CI
+ ? [['html', { open: 'never' }], ['github']]
+ : [
+ ['html', { open: 'never' }],
+ ['list', { printSteps: true }]
+ ]
+};
+
+export default pwConfig;
diff --git a/playwright.config.js b/playwright.config.js
index ab4e84169..bd2ddae8d 100644
--- a/playwright.config.js
+++ b/playwright.config.js
@@ -1,5 +1,5 @@
-const { defineConfig } = require('@playwright/test');
-const path = require('path');
+import { defineConfig } from '@playwright/test';
+import pwConfig from './playwright.config.common';
global.isWeb = false;
global.isWin = /win32|mswin(?!ce)|mingw|bccwin|cygwin/i.test(process.platform);
@@ -8,27 +8,6 @@ global.isMinio = false;
global.isElectron = true;
global.isUnitTest = false;
-const testDir = path.join(__dirname, 'tests', 'e2e');
-const config = defineConfig({
- testDir: testDir,
- // Use the grep option to filter tests by title and file extension
- // grep: /.*\.pw\.js$/,
- testMatch: /.*\.pw\.e2e\.js/,
- // Set the timeout for each test
- timeout: 30000,
- // (3 hours) Maximum time in milliseconds the whole test suite can run. Useful on CI to prevent broken setup from running too long and wasting resources.
- globalTimeout: process.env.CI ? 3 * 60 * 60 * 1000 : undefined,
- ignoreSnapshots: !process.env.CI,
- retries: 3,
- // The maximum number of test failures for the whole test suite run. After reaching this number, testing will stop and exit with an error
- // maxFailures: 8, //process.env.CI ? 3 : 0,
- globalSetup: './tests/global-setup.js',
- globalTeardown: './tests/global-teardown.js',
- // 'github' for GitHub Actions CI to generate annotations, plus a concise 'dot'
- // default 'list' when running locally
- reporter: process.env.CI ? 'github' : 'list',
-});
-
-console.log('in playwright.config.ts, testDir is', testDir);
+const config = defineConfig(pwConfig);
export default config;
diff --git a/playwright.config.minio.js b/playwright.config.minio.js
index 15e2ff74c..74aada3e6 100644
--- a/playwright.config.minio.js
+++ b/playwright.config.minio.js
@@ -1,4 +1,5 @@
-const { defineConfig } = require('@playwright/test');
+import { defineConfig } from '@playwright/test';
+import pwConfig from './playwright.config.common';
global.isWeb = false;
global.isWin = /win32|mswin(?!ce)|mingw|bccwin|cygwin/i.test(process.platform);
@@ -7,20 +8,8 @@ global.isMinio = true;
global.isElectron = true;
global.isUnitTest = false;
-module.exports = defineConfig({
- testDir: './tests/e2e',
- // Use the grep option to filter tests by title and file extension
- // grep: /.*\.pw\.js$/,
- testMatch: /.*\.pw\.e2e\.js/,
- // Set the timeout for each test
- timeout: 30000,
- // (3 hours) Maximum time in milliseconds the whole test suite can run. Useful on CI to prevent broken setup from running too long and wasting resources.
- globalTimeout: process.env.CI ? 3 * 60 * 60 * 1000 : undefined,
- ignoreSnapshots: !process.env.CI,
- retries: 3,
- // The maximum number of test failures for the whole test suite run. After reaching this number, testing will stop and exit with an error
- //maxFailures: process.env.CI ? 3 : 0,
+export default defineConfig({
+ ...pwConfig,
globalSetup: './tests/global-setup-minio.js',
- globalTeardown: './tests/global-teardown-minio.js',
- reporter: process.env.CI ? 'github' : 'list',
+ globalTeardown: './tests/global-teardown-minio.js'
});
diff --git a/playwright.config.web.browsers.js b/playwright.config.web.browsers.js
index af4dc1c90..be8e3dcb6 100644
--- a/playwright.config.web.browsers.js
+++ b/playwright.config.web.browsers.js
@@ -1,7 +1,5 @@
-const { defineConfig, devices } = require('@playwright/test');
-//const dotenv = require('dotenv');
-
-//dotenv.config({ path: path.resolve(__dirname, 'tests', 'env', 'web.env') });
+import { defineConfig, devices } from '@playwright/test';
+import pwConfig from './playwright.config.common';
global.isWeb = true;
global.isWin = /win32|mswin(?!ce)|mingw|bccwin|cygwin/i.test(process.platform);
@@ -10,22 +8,10 @@ global.isMinio = true;
global.isElectron = false;
global.isUnitTest = false;
-module.exports = defineConfig({
- testDir: './tests/e2e',
- // Use the grep option to filter tests by title and file extension
- // grep: /.*\.pw\.js$/,
- testMatch: /.*\.pw\.e2e\.js/,
- // Set the timeout for each test
- timeout: 30000,
- // (3 hours) Maximum time in milliseconds the whole test suite can run. Useful on CI to prevent broken setup from running too long and wasting resources.
- globalTimeout: process.env.CI ? 3 * 60 * 60 * 1000 : undefined,
- ignoreSnapshots: !process.env.CI,
- retries: 3,
- // The maximum number of test failures for the whole test suite run. After reaching this number, testing will stop and exit with an error
- //maxFailures: process.env.CI ? 3 : 0,
+export default defineConfig({
+ ...pwConfig,
globalSetup: './tests/global-setup-web.js',
globalTeardown: './tests/global-teardown-web.js',
- reporter: process.env.CI ? 'github' : 'list',
projects: [
{
name: 'chromium',
diff --git a/playwright.config.web.js b/playwright.config.web.js
index 11cbdfacd..439babcbf 100644
--- a/playwright.config.web.js
+++ b/playwright.config.web.js
@@ -1,6 +1,6 @@
-const { defineConfig } = require('@playwright/test');
+import { defineConfig } from '@playwright/test';
+import pwConfig from './playwright.config.common';
//const dotenv = require('dotenv');
-
//dotenv.config({ path: path.resolve(__dirname, 'tests', 'env', 'web.env') });
global.isWeb = true;
@@ -10,20 +10,9 @@ global.isMinio = true;
global.isElectron = false;
global.isUnitTest = false;
-module.exports = defineConfig({
- testDir: './tests/e2e',
- // Use the grep option to filter tests by title and file extension
- // grep: /.*\.pw\.js$/,
- testMatch: /.*\.pw\.e2e\.js/,
- // Set the timeout for each test
- timeout: 30000,
- // (3 hours) Maximum time in milliseconds the whole test suite can run. Useful on CI to prevent broken setup from running too long and wasting resources.
- globalTimeout: process.env.CI ? 3 * 60 * 60 * 1000 : undefined,
- ignoreSnapshots: !process.env.CI,
- retries: 3,
- // The maximum number of test failures for the whole test suite run. After reaching this number, testing will stop and exit with an error
- // maxFailures: process.env.CI ? 3 : 0,
+const config = defineConfig({
+ ...pwConfig,
globalSetup: './tests/global-setup-web.js',
- globalTeardown: './tests/global-teardown-web.js',
- reporter: process.env.CI ? 'github' : 'list',
+ globalTeardown: './tests/global-teardown-web.js'
});
+export default config;
diff --git a/tests/e2e/location.helpers.js b/tests/e2e/location.helpers.js
index 17a3fbbc2..229c9e70f 100644
--- a/tests/e2e/location.helpers.js
+++ b/tests/e2e/location.helpers.js
@@ -21,46 +21,12 @@ const minioAccessKey = 'minioadmin';
const minioSecretAccessKey = 'minioadmin';
const minioEndpointURL = 'http://127.0.0.1:9000';
-export async function createLocation(
- locationPath,
- locationName,
- isDefault = false
-) {
- const lastLocationTID = await getLocationTid(-1);
- // Check if location not exist (from extconfig.js)
- if (locationName !== lastLocationTID) {
- await clickOn('[data-tid=createNewLocation]');
- await clickOn('[data-tid=locationPath]');
- await setInputKeys('locationPath', locationPath || defaultLocationPath);
- /*const locationPathInput = await global.client.$(
- '[data-tid=locationPath] input'
- );
- await locationPathInput.keys(locationPath || defaultLocationPath);*/
- // keys is workarround for not working setValue await global.client.$('[data-tid=locationPath] input').setValue(locationPath || defaultLocationPath);
- await setInputKeys(
- 'locationName',
- locationName || 'Test Location' + new Date().getTime()
- );
- /* await clickOn('[data-tid=locationName]');
- const locationNameInput = await global.client.$(
- '[data-tid=locationName] input'
- );
- locationNameInput.keys(
- locationName || 'Test Location' + new Date().getTime()
- );*/
- if (isDefault) {
- await clickOn('[data-tid=locationIsDefault]');
- }
- await clickOn('[data-tid=confirmLocationCreation]');
- }
-}
-
export async function createPwMinioLocation(
locationPath,
locationName,
isDefault = false
) {
- const lastLocationTID = await getPwLocationTid(-1);
+ const lastLocationTID = global.isWeb ? undefined : await getPwLocationTid(-1);
// Check if location not exist (from extconfig.js)
if (locationName !== lastLocationTID) {
await clickOn('[data-tid=locationManagerMenu]');
@@ -119,38 +85,6 @@ export async function createPwLocation(
}
}
-export async function createMinioLocation(
- locationPath,
- locationName,
- isDefault = false
-) {
- const lastLocationTID = await getLocationTid(-1);
- // Check if location not exist (from extconfig.js)
- if (locationName !== lastLocationTID) {
- await clickOn('[data-tid=createNewLocation]');
- if (global.isMinio) {
- await clickOn('[data-tid=objectStorageLocation]');
- }
- await clickOn('[data-tid=switchAdvancedModeTID]');
-
- // SET LOCATION NAME
- await setInputKeys(
- 'locationName',
- locationName || 'Test Location' + new Date().getTime()
- );
- await setInputKeys('locationPath', locationPath);
- await setInputKeys('accessKeyId', minioAccessKey);
- await setInputKeys('secretAccessKey', minioSecretAccessKey);
- await setInputKeys('bucketName', locationName);
- await setInputKeys('endpointURL', minioEndpointURL);
-
- if (isDefault) {
- await clickOn('[data-tid=locationIsDefault]');
- }
- await clickOn('[data-tid=confirmLocationCreation]');
- }
-}
-
/*async function setInputValue(tid, value) {
// keys is workarround for not working setValue await global.client.$('[data-tid=locationPath] input').setValue(locationPath || defaultLocationPath);
const elem = await global.client.$('[data-tid=' + tid + ']');
diff --git a/tests/e2e/location.pw.e2e.js b/tests/e2e/location.pw.e2e.js
index cd4155864..9988b1f08 100644
--- a/tests/e2e/location.pw.e2e.js
+++ b/tests/e2e/location.pw.e2e.js
@@ -124,9 +124,9 @@ test.describe('TST03 - Testing locations:', () => {
test('TST0307 - Move location Up and Down [web,electron]', async () => {
if (global.isWeb) {
- await takeScreenshot(
+ /*await takeScreenshot(
'TST0307 Move location Up and Down before create dummyLocation'
- );
+ );*/
// in web there is no other locations
await createPwMinioLocation('', 'dummyLocation', false);
}