Skip to content

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

fix e2e

sytolk9ebae5d82127
diff --git a/tests/e2e/fileopener.pw.e2e.js b/tests/e2e/fileopener.pw.e2e.js
index 721b878fd..971ace682 100644
--- a/tests/e2e/fileopener.pw.e2e.js
+++ b/tests/e2e/fileopener.pw.e2e.js
@@ -14,6 +14,7 @@ import {
dnd,
expectElementExist,
expectFileContain,
+ expectFileSizeGt,
expectMetaFilesExist,
frameLocator,
getGridFileName,
@@ -491,6 +492,7 @@ test.describe('TST08 - File folder properties', () => {
test('TST0829 - Create and restore revision [web,minio,electron,_pro]', async () => {
const fileName = 'sample.txt';
await openFile(fileName);
+ await expectFileSizeGt(2);
const fLocator = await frameLocator('iframe[allowfullscreen]');
const initContent = await fLocator.locator('body').innerText();
@@ -509,6 +511,7 @@ test.describe('TST08 - File folder properties', () => {
//create revision
const fileName = 'sample.md';
await openFile(fileName);
+ await expectFileSizeGt(2);
const fLocator = await frameLocator('iframe[allowfullscreen]');
const initContent = await fLocator.locator('body').innerText();
diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.js
index 33e236f7f..c623754a9 100644
--- a/tests/e2e/general.helpers.js
+++ b/tests/e2e/general.helpers.js
@@ -984,6 +984,28 @@ export async function expectFileContain(
.toBe(true);
}
+export async function expectFileSizeGt(
+ greater = 2,
+ timeout = 10000,
+ iframeLocator = 'iframe[allowfullscreen]',
+) {
+ await expect
+ .poll(
+ async () => {
+ const fLocator = await frameLocator(iframeLocator);
+ const bodyTxt = await fLocator.locator('body').innerText();
+ //console.log(bodyTxt);
+ return bodyTxt !== undefined && bodyTxt.length > greater;
+ },
+ {
+ message: 'make sure bodyTxt size > ' + greater, // custom error message
+ // Poll for 10 seconds; defaults to 5 seconds. Pass 0 to disable timeout.
+ timeout: timeout,
+ },
+ )
+ .toBe(true);
+}
+
/**
* @deprecated
* @param tid