Skip to content

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

playwright screenshot fixes

sytolkd19a01d5ca01
diff --git a/.github/workflows/workflow_scheduled_mac_web.yml b/.github/workflows/workflow_scheduled_mac_web.yml
index 632be08a3..294dca7b7 100644
--- a/.github/workflows/workflow_scheduled_mac_web.yml
+++ b/.github/workflows/workflow_scheduled_mac_web.yml
@@ -56,4 +56,5 @@ jobs:
name: test-artifacts
path: |
tests/test-reports/
+ test-results/
playwright-report/
diff --git a/.github/workflows/workflow_scheduled_win_electron_pro.yml b/.github/workflows/workflow_scheduled_win_electron_pro.yml
index 6a6623440..c87b40dfc 100644
--- a/.github/workflows/workflow_scheduled_win_electron_pro.yml
+++ b/.github/workflows/workflow_scheduled_win_electron_pro.yml
@@ -47,6 +47,7 @@ jobs:
name: test-artifacts
path: |
tests/test-reports/
+ test-results/
playwright-report/
# e2eTestsElectronUbuntu:
diff --git a/.github/workflows/workflow_scheduled_win_web.yml b/.github/workflows/workflow_scheduled_win_web.yml
index aec7db727..ed12f5b1b 100644
--- a/.github/workflows/workflow_scheduled_win_web.yml
+++ b/.github/workflows/workflow_scheduled_win_web.yml
@@ -53,4 +53,5 @@ jobs:
name: test-artifacts
path: |
tests/test-reports/
+ test-results/
playwright-report/
diff --git a/playwright.config.common.js b/playwright.config.common.js
index 47812ad08..cf6aa542a 100644
--- a/playwright.config.common.js
+++ b/playwright.config.common.js
@@ -16,7 +16,7 @@ const pwConfig = {
maxFailures: process.env.CI ? 8 : 0,
globalSetup: './tests/global-setup.js',
globalTeardown: './tests/global-teardown.js',
- use: {
+ /*use: {
screenshot: {
mode: 'only-on-failure',
fullPage: true,
@@ -26,7 +26,7 @@ const pwConfig = {
// trace: 'on-first-retry',
// Record video only when retrying a test for the first time.
// video: 'on-first-retry'
- },
+ },*/
// 'github' for GitHub Actions CI to generate annotations, plus a concise 'dot'
// default 'list' when running locally
reporter: process.env.CI
diff --git a/tests/e2e/fileopener.pw.e2e.js b/tests/e2e/fileopener.pw.e2e.js
index 15fff6831..7d945ca5e 100644
--- a/tests/e2e/fileopener.pw.e2e.js
+++ b/tests/e2e/fileopener.pw.e2e.js
@@ -38,8 +38,8 @@ test.afterAll(async () => {
});
test.afterEach(async ({ page }, testInfo) => {
- if (testInfo.status === 'failed') {
- await takeScreenshot(page, testInfo.title);
+ if (testInfo.status !== testInfo.expectedStatus) {
+ await takeScreenshot(testInfo);
}
await init();
});
diff --git a/tests/e2e/folder.pw.e2e.js b/tests/e2e/folder.pw.e2e.js
index 840a35ce0..eea8ff081 100644
--- a/tests/e2e/folder.pw.e2e.js
+++ b/tests/e2e/folder.pw.e2e.js
@@ -31,9 +31,9 @@ test.afterAll(async () => {
});
test.afterEach(async ({ page }, testInfo) => {
- /*if (testInfo.status !== testInfo.expectedStatus) {
- await takeScreenshot(page, testInfo.title);
- }*/
+ if (testInfo.status !== testInfo.expectedStatus) {
+ await takeScreenshot(testInfo);
+ }
await init();
});
diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.js
index aa8a30640..a9b5ea88c 100644
--- a/tests/e2e/general.helpers.js
+++ b/tests/e2e/general.helpers.js
@@ -18,16 +18,16 @@ export const selectorFolder = '//*[@data-tid="perspectiveGridFileTable"]/div';
const testFolder = 'testFolder';
const testLocationName = '' + new Date().getTime();
-export async function takeScreenshot(page, testInfo) {
+export async function takeScreenshot(testInfo, title = 'failure') {
// const sPath = path.join(__dirname, '..', 'test-reports', name + '.png');
- /*const sPath = testInfo.outputPath(testInfo.name + 'failure.png');
+ const sPath = testInfo.outputPath(testInfo.title + title + '.png');
// Add it to the report.
testInfo.attachments.push({
name: 'screenshot',
path: sPath,
contentType: 'image/png'
});
- await page.screenshot({ path: sPath });*/
+ await global.client.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.js
index 3a8d23a04..357d0b13b 100644
--- a/tests/e2e/general.pw.e2e.js
+++ b/tests/e2e/general.pw.e2e.js
@@ -46,8 +46,8 @@ test.afterAll(async () => {
});
test.afterEach(async ({ page }, testInfo) => {
- if (testInfo.status === 'failed') {
- await takeScreenshot(page, testInfo.title);
+ if (testInfo.status !== testInfo.expectedStatus) {
+ await takeScreenshot(testInfo);
}
await init();
});
diff --git a/tests/e2e/hook.js b/tests/e2e/hook.js
index 49416122d..9b16ccb51 100644
--- a/tests/e2e/hook.js
+++ b/tests/e2e/hook.js
@@ -113,6 +113,7 @@ export async function startTestingApp(extconfig) {
args: [
pathLib.join(__dirname, '..', '..', 'app', 'main.prod.js'),
// `--user-data-dir=${tempDir.path}`,
+ '--integration-testing',
'--no-sandbox',
'--whitelisted-ips',
// '--enable-logging', // after enabling cmd windows appears in Windows
@@ -120,6 +121,7 @@ export async function startTestingApp(extconfig) {
'--ignore-ssl-errors',
'--disable-dev-shm-usage'
],
+ bypassCSP: true,
env: {
ELECTRON_ENABLE_LOGGING: true,
ELECTRON_ENABLE_STACK_DUMPING: true,
@@ -129,7 +131,7 @@ export async function startTestingApp(extconfig) {
// Get the first window that the app opens, wait if necessary.
global.client = await global.app.firstWindow();
- global.session = await global.client.context().newCDPSession(global.client);
+ // global.session = await global.client.context().newCDPSession(global.client);
// await global.client.setViewportSize({ width: 1920, height: 1080 });
await global.client.waitForLoadState('load'); //'domcontentloaded'); //'networkidle');
diff --git a/tests/e2e/key-bindings.pw.e2e.js b/tests/e2e/key-bindings.pw.e2e.js
index f33725f08..bff4e069a 100644
--- a/tests/e2e/key-bindings.pw.e2e.js
+++ b/tests/e2e/key-bindings.pw.e2e.js
@@ -24,8 +24,8 @@ test.afterAll(async () => {
});
test.afterEach(async ({ page }, testInfo) => {
- if (testInfo.status === 'failed') {
- await takeScreenshot(page, testInfo.title);
+ if (testInfo.status !== testInfo.expectedStatus) {
+ await takeScreenshot(testInfo);
}
await init();
});
diff --git a/tests/e2e/location.pw.e2e.js b/tests/e2e/location.pw.e2e.js
index d804f3200..1b6ab044e 100644
--- a/tests/e2e/location.pw.e2e.js
+++ b/tests/e2e/location.pw.e2e.js
@@ -33,8 +33,8 @@ test.afterAll(async () => {
});
test.afterEach(async ({ page }, testInfo) => {
- if (testInfo.status === 'failed') {
- await takeScreenshot(page, testInfo.title);
+ if (testInfo.status !== testInfo.expectedStatus) {
+ await takeScreenshot(testInfo);
}
await init();
});
diff --git a/tests/e2e/markdown-editor.pw.e2e.js b/tests/e2e/markdown-editor.pw.e2e.js
index e003e1aac..553dc5f72 100644
--- a/tests/e2e/markdown-editor.pw.e2e.js
+++ b/tests/e2e/markdown-editor.pw.e2e.js
@@ -29,8 +29,8 @@ test.afterAll(async () => {
});
test.afterEach(async ({ page }, testInfo) => {
- if (testInfo.status === 'failed') {
- await takeScreenshot(page, testInfo.title);
+ if (testInfo.status !== testInfo.expectedStatus) {
+ await takeScreenshot(testInfo);
}
await init();
});
diff --git a/tests/e2e/perspective-grid-right-button.pw.e2e.js b/tests/e2e/perspective-grid-right-button.pw.e2e.js
index 9032aedf5..8bdd2cc39 100644
--- a/tests/e2e/perspective-grid-right-button.pw.e2e.js
+++ b/tests/e2e/perspective-grid-right-button.pw.e2e.js
@@ -51,8 +51,8 @@ test.afterAll(async () => {
});
test.afterEach(async ({ page }, testInfo) => {
- if (testInfo.status === 'failed') {
- await takeScreenshot(page, testInfo.title);
+ if (testInfo.status !== testInfo.expectedStatus) {
+ await takeScreenshot(testInfo);
}
await init();
});
diff --git a/tests/e2e/perspective-grid-sort.pw.e2e.js b/tests/e2e/perspective-grid-sort.pw.e2e.js
index 413e5f6fe..05914f6cc 100644
--- a/tests/e2e/perspective-grid-sort.pw.e2e.js
+++ b/tests/e2e/perspective-grid-sort.pw.e2e.js
@@ -25,8 +25,8 @@ test.afterAll(async () => {
});
test.afterEach(async ({ page }, testInfo) => {
- if (testInfo.status === 'failed') {
- await takeScreenshot(page, testInfo.title);
+ if (testInfo.status !== testInfo.expectedStatus) {
+ await takeScreenshot(testInfo);
}
});
diff --git a/tests/e2e/perspective-grid.pw.e2e.js b/tests/e2e/perspective-grid.pw.e2e.js
index ae1b2c954..13dc1b5ec 100644
--- a/tests/e2e/perspective-grid.pw.e2e.js
+++ b/tests/e2e/perspective-grid.pw.e2e.js
@@ -52,8 +52,8 @@ test.afterAll(async () => {
});
test.afterEach(async ({ page }, testInfo) => {
- if (testInfo.status === 'failed') {
- await takeScreenshot(page, testInfo.title);
+ if (testInfo.status !== testInfo.expectedStatus) {
+ await takeScreenshot(testInfo);
}
await init();
});
diff --git a/tests/e2e/quick-access.pw.e2e.js b/tests/e2e/quick-access.pw.e2e.js
index 314ac1c15..5ed395053 100644
--- a/tests/e2e/quick-access.pw.e2e.js
+++ b/tests/e2e/quick-access.pw.e2e.js
@@ -32,8 +32,8 @@ test.afterAll(async () => {
});
test.afterEach(async ({ page }, testInfo) => {
- if (testInfo.status === 'failed') {
- await takeScreenshot(page, testInfo.title);
+ if (testInfo.status !== testInfo.expectedStatus) {
+ await takeScreenshot(testInfo);
}
await init();
});
diff --git a/tests/e2e/search.pw.e2e.js b/tests/e2e/search.pw.e2e.js
index 96c1beedd..1317b4221 100644
--- a/tests/e2e/search.pw.e2e.js
+++ b/tests/e2e/search.pw.e2e.js
@@ -32,8 +32,8 @@ test.afterAll(async () => {
});
test.afterEach(async ({ page }, testInfo) => {
- if (testInfo.status === 'failed') {
- await takeScreenshot(page, testInfo.title);
+ if (testInfo.status !== testInfo.expectedStatus) {
+ await takeScreenshot(testInfo);
}
await init();
});
diff --git a/tests/e2e/tag.pw.e2e.js b/tests/e2e/tag.pw.e2e.js
index 0659b487c..70c1f2a97 100644
--- a/tests/e2e/tag.pw.e2e.js
+++ b/tests/e2e/tag.pw.e2e.js
@@ -51,8 +51,8 @@ test.afterAll(async () => {
});
test.afterEach(async ({ page }, testInfo) => {
- if (testInfo.status === 'failed') {
- await takeScreenshot(page, testInfo.title);
+ if (testInfo.status !== testInfo.expectedStatus) {
+ await takeScreenshot(testInfo);
}
await init();
});
diff --git a/tests/e2e/viewer-audiovideo.pw.e2e.js b/tests/e2e/viewer-audiovideo.pw.e2e.js
index 24c184943..9a17a22df 100644
--- a/tests/e2e/viewer-audiovideo.pw.e2e.js
+++ b/tests/e2e/viewer-audiovideo.pw.e2e.js
@@ -29,8 +29,8 @@ test.afterAll(async () => {
await testDataRefresh();
});
test.afterEach(async ({ page }, testInfo) => {
- if (testInfo.status === 'failed') {
- await takeScreenshot(page, testInfo.title);
+ if (testInfo.status !== testInfo.expectedStatus) {
+ await takeScreenshot(testInfo);
}
});
test.beforeEach(async () => {