TagSpaces is an offline, open source, document manager with tagging support
take screenshot of failed tests
sytolked0b1e2661c2
diff --git a/tests/e2e/fileopener.pw.e2e.js b/tests/e2e/fileopener.pw.e2e.jsindex 26e333459..15fff6831 100644--- a/tests/e2e/fileopener.pw.e2e.js+++ b/tests/e2e/fileopener.pw.e2e.js@@ -16,6 +16,7 @@ import {selectorFolder,setInputValue,setSettings,+ takeScreenshot,waitForNotification} from './general.helpers';import {@@ -36,7 +37,10 @@ test.afterAll(async () => {await testDataRefresh();});-test.afterEach(async () => {+test.afterEach(async ({ page }, testInfo) => {+ if (testInfo.status === 'failed') {+ await takeScreenshot(page, testInfo.title);+ }await init();});diff --git a/tests/e2e/folder.pw.e2e.js b/tests/e2e/folder.pw.e2e.jsindex 51c07efcf..8d03bfba6 100644--- a/tests/e2e/folder.pw.e2e.js+++ b/tests/e2e/folder.pw.e2e.js@@ -30,7 +30,10 @@ test.afterAll(async () => {await testDataRefresh();});-test.afterEach(async () => {+test.afterEach(async ({ page }, testInfo) => {+ if (testInfo.status === 'failed') {+ await takeScreenshot(page, testInfo.title);+ }await init();});@@ -78,7 +81,6 @@ test.describe('TST01 - Folder management', () => {await global.client.dblclick('[data-tid=fsEntryName_' + testFolder + ']');const newDirectoryName = await renameFolder();await clickOn('[data-tid=gridPerspectiveOnBackButton]');- await takeScreenshot('TST0103 - Rename folder - after OnBackButton');await expectElementExist('[data-tid=fsEntryName_' + newDirectoryName + ']',true,@@ -89,7 +91,6 @@ test.describe('TST01 - Folder management', () => {'[data-tid=fsEntryName_' + newDirectoryName + ']');await deleteDirectory();- await takeScreenshot('TST0103 - Rename folder - after deleteDirectory');await expectElementExist('[data-tid=fsEntryName_' + newDirectoryName + ']',false,diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.jsindex 9ffead0c8..a00d5abd1 100644--- a/tests/e2e/general.helpers.js+++ b/tests/e2e/general.helpers.js@@ -18,9 +18,9 @@ export const selectorFolder = '//*[@data-tid="perspectiveGridFileTable"]/div';const testFolder = 'testFolder';const testLocationName = '' + new Date().getTime();-export async function takeScreenshot(name) {+export async function takeScreenshot(page, name) {const sPath = path.join(__dirname, '..', 'test-reports', name + '.png');- await global.client.screenshot({ path: sPath });+ await page.screenshot({ path: sPath });}export async function clickOn(selector, options = { timeout: 15000 }) {diff --git a/tests/e2e/general.pw.e2e.js b/tests/e2e/general.pw.e2e.jsindex b5b5cba85..3a8d23a04 100644--- a/tests/e2e/general.pw.e2e.js+++ b/tests/e2e/general.pw.e2e.js@@ -45,7 +45,10 @@ test.afterAll(async () => {await testDataRefresh();});-test.afterEach(async () => {+test.afterEach(async ({ page }, testInfo) => {+ if (testInfo.status === 'failed') {+ await takeScreenshot(page, testInfo.title);+ }await init();});@@ -113,14 +116,12 @@ test.describe('TST51 - Perspective Grid', () => {});test('TST0503 - Create TEXT file [electron,web]', async () => {- await takeScreenshot('TST0503 start test');await createNewDirectory();await expectElementExist('[data-tid=fsEntryName_' + testFolder + ']',true,2000);- await takeScreenshot('TST0503 create folder');await global.client.dblclick('[data-tid=fsEntryName_' + testFolder + ']');// create new filediff --git a/tests/e2e/key-bindings.pw.e2e.js b/tests/e2e/key-bindings.pw.e2e.jsindex 772ff45d9..f33725f08 100644--- a/tests/e2e/key-bindings.pw.e2e.js+++ b/tests/e2e/key-bindings.pw.e2e.js@@ -7,7 +7,8 @@ import {clickOn,expectElementExist,selectorFile,- setInputValue+ setInputValue,+ takeScreenshot} from './general.helpers';import { startTestingApp, stopApp, testDataRefresh } from './hook';import { init } from './welcome.helpers';@@ -22,7 +23,10 @@ test.afterAll(async () => {await testDataRefresh();});-test.afterEach(async () => {+test.afterEach(async ({ page }, testInfo) => {+ if (testInfo.status === 'failed') {+ await takeScreenshot(page, testInfo.title);+ }await init();});diff --git a/tests/e2e/location.helpers.js b/tests/e2e/location.helpers.jsindex 229c9e70f..331a3e98c 100644--- a/tests/e2e/location.helpers.js+++ b/tests/e2e/location.helpers.js@@ -81,7 +81,6 @@ export async function createPwLocation(await global.client.check('[data-tid=locationIsDefault] input');}await global.client.click('[data-tid=confirmLocationCreation]');- await takeScreenshot('after createPwLocation');}}diff --git a/tests/e2e/location.pw.e2e.js b/tests/e2e/location.pw.e2e.jsindex 9988b1f08..d804f3200 100644--- a/tests/e2e/location.pw.e2e.js+++ b/tests/e2e/location.pw.e2e.js@@ -32,7 +32,10 @@ test.afterAll(async () => {await testDataRefresh();});-test.afterEach(async () => {+test.afterEach(async ({ page }, testInfo) => {+ if (testInfo.status === 'failed') {+ await takeScreenshot(page, testInfo.title);+ }await init();});@@ -56,7 +59,6 @@ test.describe('TST03 - Testing locations:', () => {// const lastLocation = allLocations[allLocations.length - 1];// const lastLocationNameInDom = (await global.client.elementIdText(lastLocation.ELEMENT)).value;// const addedLocation = await global.client.getText('//button[contains(., "' + testTagName + '")]');- await takeScreenshot('TST0301 Should create a location');await expectElementExist('[data-tid=location_' + testLocationName + ']',true,diff --git a/tests/e2e/markdown-editor.pw.e2e.js b/tests/e2e/markdown-editor.pw.e2e.jsindex 7e4ce8532..e003e1aac 100644--- a/tests/e2e/markdown-editor.pw.e2e.js+++ b/tests/e2e/markdown-editor.pw.e2e.js@@ -8,7 +8,12 @@ import {createPwMinioLocation,createPwLocation} from './location.helpers';-import { clickOn, frameLocator, isDisplayed } from './general.helpers';+import {+ clickOn,+ frameLocator,+ isDisplayed,+ takeScreenshot+} from './general.helpers';import { startTestingApp, stopApp, testDataRefresh } from './hook';import { openContextEntryMenu, toContainTID } from './test-utils';import { init } from './welcome.helpers';@@ -23,7 +28,10 @@ test.afterAll(async () => {await testDataRefresh();});-test.afterEach(async () => {+test.afterEach(async ({ page }, testInfo) => {+ if (testInfo.status === 'failed') {+ await takeScreenshot(page, testInfo.title);+ }await init();});diff --git a/tests/e2e/perspective-grid-right-button.pw.e2e.js b/tests/e2e/perspective-grid-right-button.pw.e2e.jsindex da07c250a..9032aedf5 100644--- a/tests/e2e/perspective-grid-right-button.pw.e2e.js+++ b/tests/e2e/perspective-grid-right-button.pw.e2e.js@@ -31,7 +31,8 @@ import {setGridOptions,showFilesWithTag,waitForNotification,- frameLocator+ frameLocator,+ takeScreenshot} from './general.helpers';import { AddRemoveTagsToSelectedFiles } from './perspective-grid.helpers';import { startTestingApp, stopApp, testDataRefresh } from './hook';@@ -49,7 +50,10 @@ test.afterAll(async () => {await testDataRefresh();});-test.afterEach(async () => {+test.afterEach(async ({ page }, testInfo) => {+ if (testInfo.status === 'failed') {+ await takeScreenshot(page, testInfo.title);+ }await init();});diff --git a/tests/e2e/perspective-grid-sort.pw.e2e.js b/tests/e2e/perspective-grid-sort.pw.e2e.jsindex f5706343b..413e5f6fe 100644--- a/tests/e2e/perspective-grid-sort.pw.e2e.js+++ b/tests/e2e/perspective-grid-sort.pw.e2e.js@@ -8,7 +8,7 @@ import {createPwMinioLocation,createPwLocation} from './location.helpers';-import { clickOn, getGridFileName } from './general.helpers';+import { clickOn, getGridFileName, takeScreenshot } from './general.helpers';import { startTestingApp, stopApp, testDataRefresh } from './hook';import { init } from './welcome.helpers';@@ -24,9 +24,11 @@ test.afterAll(async () => {await testDataRefresh();});-/*test.afterEach(async () => {- await init();-});*/+test.afterEach(async ({ page }, testInfo) => {+ if (testInfo.status === 'failed') {+ await takeScreenshot(page, testInfo.title);+ }+});test.beforeEach(async () => {if (global.isMinio) {diff --git a/tests/e2e/perspective-grid.pw.e2e.js b/tests/e2e/perspective-grid.pw.e2e.jsindex ebb510fdd..ae1b2c954 100644--- a/tests/e2e/perspective-grid.pw.e2e.js+++ b/tests/e2e/perspective-grid.pw.e2e.js@@ -23,6 +23,7 @@ import {selectorFolder,selectRowFiles,setInputKeys,+ takeScreenshot,waitForNotification} from './general.helpers';import {@@ -50,7 +51,10 @@ test.afterAll(async () => {await testDataRefresh();});-test.afterEach(async () => {+test.afterEach(async ({ page }, testInfo) => {+ if (testInfo.status === 'failed') {+ await takeScreenshot(page, testInfo.title);+ }await init();});diff --git a/tests/e2e/quick-access.pw.e2e.js b/tests/e2e/quick-access.pw.e2e.jsindex 10bfca3c4..314ac1c15 100644--- a/tests/e2e/quick-access.pw.e2e.js+++ b/tests/e2e/quick-access.pw.e2e.js@@ -12,7 +12,8 @@ import {clickOn,createNewDirectory,expectElementExist,- setInputKeys+ setInputKeys,+ takeScreenshot} from './general.helpers';import { startTestingApp, stopApp, testDataRefresh } from './hook';import { createSavedSearch, searchEngine } from './search.helpers';@@ -30,7 +31,10 @@ test.afterAll(async () => {await testDataRefresh();});-test.afterEach(async () => {+test.afterEach(async ({ page }, testInfo) => {+ if (testInfo.status === 'failed') {+ await takeScreenshot(page, testInfo.title);+ }await init();});diff --git a/tests/e2e/search.pw.e2e.js b/tests/e2e/search.pw.e2e.jsindex f996a4bb2..96c1beedd 100644--- a/tests/e2e/search.pw.e2e.js+++ b/tests/e2e/search.pw.e2e.js@@ -7,7 +7,8 @@ import {isDisabled,selectorFile,selectRowFiles,- setSettings+ setSettings,+ takeScreenshot} from './general.helpers';import { startTestingApp, stopApp, testDataRefresh } from './hook';import {@@ -30,7 +31,10 @@ test.afterAll(async () => {await testDataRefresh();});-test.afterEach(async () => {+test.afterEach(async ({ page }, testInfo) => {+ if (testInfo.status === 'failed') {+ await takeScreenshot(page, testInfo.title);+ }await init();});diff --git a/tests/e2e/tag.pw.e2e.js b/tests/e2e/tag.pw.e2e.jsindex 18944189a..0659b487c 100644--- a/tests/e2e/tag.pw.e2e.js+++ b/tests/e2e/tag.pw.e2e.js@@ -4,7 +4,8 @@ import {clickOn,expectElementExist,setInputKeys,- setInputValue+ setInputValue,+ takeScreenshot} from './general.helpers';import { startTestingApp, stopApp, testDataRefresh } from './hook';import { init } from './welcome.helpers';@@ -49,7 +50,10 @@ test.afterAll(async () => {await testDataRefresh();});-test.afterEach(async () => {+test.afterEach(async ({ page }, testInfo) => {+ if (testInfo.status === 'failed') {+ await takeScreenshot(page, testInfo.title);+ }await init();});diff --git a/tests/e2e/viewer-audiovideo.pw.e2e.js b/tests/e2e/viewer-audiovideo.pw.e2e.jsindex 4bd5f4dad..24c184943 100644--- a/tests/e2e/viewer-audiovideo.pw.e2e.js+++ b/tests/e2e/viewer-audiovideo.pw.e2e.js@@ -9,7 +9,12 @@ import {createPwMinioLocation,createPwLocation} from './location.helpers';-import { clickOn, expectAudioPlay, isDisplayed } from './general.helpers';+import {+ clickOn,+ expectAudioPlay,+ isDisplayed,+ takeScreenshot+} from './general.helpers';import { startTestingApp, stopApp, testDataRefresh } from './hook';import { openContextEntryMenu } from './test-utils';import { init } from './welcome.helpers';@@ -23,6 +28,11 @@ test.afterAll(async () => {await stopApp();await testDataRefresh();});+test.afterEach(async ({ page }, testInfo) => {+ if (testInfo.status === 'failed') {+ await takeScreenshot(page, testInfo.title);+ }+});test.beforeEach(async () => {if (global.isMinio) {await createPwMinioLocation('', defaultLocationName, true);