Skip to content

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

e2e fixes

Stanimirc8d47b992ab1
diff --git a/tests/e2e/fileopener.pw.e2e.js b/tests/e2e/fileopener.pw.e2e.js
index 489ff4eb2..be199effe 100644
--- a/tests/e2e/fileopener.pw.e2e.js
+++ b/tests/e2e/fileopener.pw.e2e.js
@@ -480,9 +480,9 @@ test.describe('TST08 - File folder properties', () => {
});
test('TST0828 - Toggle file revisions [web,minio,electron]', async () => {
- const fileName = 'sample.txt';
+ const fileName = 'sample.html';
await openFile(fileName);
- await createRevision();
+ await createRevision('revision content', 'div[class="note-editing-area"]');
const revision = await getRevision(0);
expect(revision).not.toBeUndefined();
});
@@ -506,27 +506,40 @@ test.describe('TST08 - File folder properties', () => {
test('TST0830 - Create, open and delete revision [web,minio,electron]', async () => {
//create revision
- const fileName = 'sample.txt';
+ const fileName = 'sample.md';
await openFile(fileName);
const fLocator = await frameLocator('iframe[allowfullscreen]');
const initContent = await fLocator.locator('body').innerText();
const revisionContent = 'file revision';
- await createRevision(revisionContent);
+ await createRevision(
+ revisionContent,
+ '.milkdown div[contenteditable=true]',
+ );
const revision = await getRevision(0);
expect(revision).not.toBeUndefined();
- // open revision
+ // open revision preview
await clickOn(
'[data-tid="' + revision.id + '"] [data-tid="viewRevisionTID"]',
);
- const pfLocator = await frameLocator(
+ await expectFileContain(
+ initContent,
+ 15000,
'[data-tid="filePreviewTID"] iframe[allowfullscreen]',
);
- const previewContent = await pfLocator.locator('body').innerText();
+ await clickOn('[data-tid="closeFilePreviewTID"]');
- expect(previewContent).toBe(initContent);
+ //delete revision
+ await clickOn(
+ '[data-tid="' + revision.id + '"] [data-tid="deleteRevisionTID"]',
+ );
+ await expectElementExist(
+ 'table[data-tid=tableRevisionsTID] tbody tr',
+ false,
+ 8000,
+ );
});
});
diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.js
index e4bf78a56..1f4965e04 100644
--- a/tests/e2e/general.helpers.js
+++ b/tests/e2e/general.helpers.js
@@ -887,9 +887,12 @@ export async function writeTextInIframeInput(
}
}
-export async function createRevision(newFileContent = 'txt') {
+export async function createRevision(
+ newFileContent = 'txt',
+ editorSelector = '#monaco_editor',
+) {
await clickOn('[data-tid=fileContainerEditFile]');
- await writeTextInIframeInput(newFileContent);
+ await writeTextInIframeInput(newFileContent, editorSelector);
await clickOn('[data-tid=fileContainerSaveFile]');
await clickOn('[data-tid=cancelEditingTID]');
@@ -960,11 +963,12 @@ export async function expectS3FileContain(
export async function expectFileContain(
txtToContain = 'etete&5435',
timeout = 10000,
+ iframeLocator = 'iframe[allowfullscreen]',
) {
await expect
.poll(
async () => {
- const fLocator = await frameLocator('iframe[allowfullscreen]');
+ const fLocator = await frameLocator(iframeLocator);
const bodyTxt = await fLocator.locator('body').innerText();
//console.log(bodyTxt);
return toContainTID(bodyTxt, [txtToContain]);