Skip to content

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

playwright screenshot fixes

sytolk9e0ca4c7f98e
diff --git a/.github/workflows/workflow_scheduled_mac_electron.yml b/.github/workflows/workflow_scheduled_mac_electron.yml
index 19f021c05..aabb29fae 100644
--- a/.github/workflows/workflow_scheduled_mac_electron.yml
+++ b/.github/workflows/workflow_scheduled_mac_electron.yml
@@ -40,4 +40,5 @@ jobs:
name: test-artifacts
path: |
tests/test-reports/
+ test-results/
playwright-report/
diff --git a/.gitignore b/.gitignore
index 20c4321a5..df81f55fe 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/*
+test-results/*
playwright-report/*
/app/**main.prod.js**
diff --git a/package.json b/package.json
index dcc921015..1947ae890 100644
--- a/package.json
+++ b/package.json
@@ -83,7 +83,7 @@
"package-win-pro": "npm run install-ext-node-win && electron-builder --win --x64 --config extensions/tagspacespro/resources/builder-pro.json",
"paste-android-linux": "adb shell input text '$(xclip -selection c -o)'",
"paste-android-macos": "adb shell input text \"'$(pbpaste)'\"",
- "playwright-show-trace": "npx playwright show-trace \"tests/test-reports/TST0813 - Delete file [web,minio,electron].zip\"",
+ "playwright-show-trace": "npx playwright show-trace \"test-results/folder.pw.e2e.js-TST01---Folder-management-TST0102---Reload-folder-web-minio-electron-/trace.zip\"",
"postinstall-cordova-check": "cross-env PD_PLATFORM=cordova node scripts/postinstall.js",
"postinstall-node-check": "cross-env PD_PLATFORM=node node scripts/postinstall.js",
"postinstall-electron-check": "cross-env PD_PLATFORM=electron node scripts/postinstall.js",
diff --git a/playwright.config.common.js b/playwright.config.common.js
index 9d52ee449..47812ad08 100644
--- a/playwright.config.common.js
+++ b/playwright.config.common.js
@@ -16,14 +16,26 @@ const pwConfig = {
maxFailures: process.env.CI ? 8 : 0,
globalSetup: './tests/global-setup.js',
globalTeardown: './tests/global-teardown.js',
+ use: {
+ screenshot: {
+ mode: 'only-on-failure',
+ fullPage: true,
+ },
+ trace: 'retain-on-failure',
+ // Record trace only when retrying a test for the first time.
+ // 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
- ? [['html', { open: 'never' }], ['github']]
+ ? [['html', { open: 'never' }], ['github'], ['list', { printSteps: true }]]
: [
['html', { open: 'never' }],
['list', { printSteps: true }]
- ]
+ ],
+ workers: 1
};
export default pwConfig;
diff --git a/tests/e2e/folder.pw.e2e.js b/tests/e2e/folder.pw.e2e.js
index 8d03bfba6..840a35ce0 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 === 'failed') {
+ /*if (testInfo.status !== testInfo.expectedStatus) {
await takeScreenshot(page, testInfo.title);
- }
+ }*/
await init();
});
@@ -66,7 +66,7 @@ test.describe('TST01 - Folder management', () => {
test('TST0102 - Reload folder [web,minio,electron]', async () => {
const testFolder = await createNewDirectory();
- await global.client.dblclick('[data-tid=fsEntryName_' + testFolder + ']');
+ await global.client.dblclick('[data-tid=fs1EntryName_' + testFolder + ']');
await reloadDirectory();
await deleteDirectory();
await expectElementExist(
diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.js
index a00d5abd1..aa8a30640 100644
--- a/tests/e2e/general.helpers.js
+++ b/tests/e2e/general.helpers.js
@@ -18,9 +18,16 @@ export const selectorFolder = '//*[@data-tid="perspectiveGridFileTable"]/div';
const testFolder = 'testFolder';
const testLocationName = '' + new Date().getTime();
-export async function takeScreenshot(page, name) {
- const sPath = path.join(__dirname, '..', 'test-reports', name + '.png');
- await page.screenshot({ path: sPath });
+export async function takeScreenshot(page, testInfo) {
+ // const sPath = path.join(__dirname, '..', 'test-reports', name + '.png');
+ /*const sPath = testInfo.outputPath(testInfo.name + 'failure.png');
+ // Add it to the report.
+ testInfo.attachments.push({
+ name: 'screenshot',
+ path: sPath,
+ contentType: 'image/png'
+ });
+ await page.screenshot({ path: sPath });*/
}
export async function clickOn(selector, options = { timeout: 15000 }) {
diff --git a/tests/e2e/hook.js b/tests/e2e/hook.js
index dce9c744e..49416122d 100644
--- a/tests/e2e/hook.js
+++ b/tests/e2e/hook.js
@@ -123,7 +123,7 @@ export async function startTestingApp(extconfig) {
env: {
ELECTRON_ENABLE_LOGGING: true,
ELECTRON_ENABLE_STACK_DUMPING: true,
- NODE_ENV: 'test'
+ // NODE_ENV: 'test'
}
});