TagSpaces is an offline, open source, document manager with tagging support
e2e fixes
Stanimire67f9171156f
diff --git a/tests/e2e/clearstorage.helpers.js b/tests/e2e/clearstorage.helpers.jsindex 360cf8b9e..c8963c7b7 100644--- a/tests/e2e/clearstorage.helpers.js+++ b/tests/e2e/clearstorage.helpers.js@@ -1,6 +1,25 @@-import { clickOn } from './general.helpers';+// import { clickOn } from './general.helpers';export async function clearStorage() {+ // Clear cookies and local storage data+ //await global.context.clearCookies();+ //await global.client.clearStorageState();++ // Evaluate JavaScript to clear local storage.+ await global.client.evaluate(() => {+ window.localStorage.clear();+ });+ await global.client.evaluate(() => {+ window.sessionStorage.clear();+ });+ // Execute JavaScript to clear cookies.+ await global.client.evaluate(() => {+ document.cookie.split(';').forEach(function(c) {+ document.cookie = c+ .replace(/^ +/, '')+ .replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/');+ });+ });/*if (global.session) {//await global.client.evaluate(() => window.localStorage.clear());//await global.client.evaluate(() => window.sessionStorage.clear());@@ -16,10 +35,11 @@ export async function clearStorage() {}); //, { origin: 'your-electron-app-url' });await global.client.reload();} else {*/- // await takeScreenshot('clearStorage');- await clickOn('[data-tid=settings]', { timeout: 20000 });+ /*await clickOn('[data-tid=settings]', { timeout: 20000 });await clickOn('[data-tid=advancedSettingsDialogTID]');+ await global.client.waitForTimeout(500);await clickOn('[data-tid=resetSettingsTID]');- await clickOn('[data-tid=confirmResetSettingsDialogTID]');+ await global.client.waitForTimeout(500);+ await clickOn('[data-tid=confirmResetSettingsDialogTID]');*///}}diff --git a/tests/e2e/folder.pw.e2e.js b/tests/e2e/folder.pw.e2e.jsindex 530ab7160..16505ecfc 100644--- a/tests/e2e/folder.pw.e2e.js+++ b/tests/e2e/folder.pw.e2e.js@@ -249,6 +249,7 @@ test.describe('TST01 - Folder management', () => {});test('TST0118 - Switch to Gallery Perspective [web,minio,electron,_pro]', async () => {+ await clickOn('[data-tid=openGalleryPerspective]');await clickOn('[data-tid=openGalleryPerspective]');await expectElementExist('[data-tid=perspectiveGalleryToolbar]',@@ -259,6 +260,7 @@ test.describe('TST01 - Folder management', () => {});test('TST0119 - Switch to Mapique Perspective [web,minio,electron,_pro]', async () => {+ await clickOn('[data-tid=openMapiquePerspective]');await clickOn('[data-tid=openMapiquePerspective]');await expectElementExist('[data-tid=perspectiveMapiqueToolbar]',@@ -269,6 +271,7 @@ test.describe('TST01 - Folder management', () => {});test('TST0120 - Switch to Kanban Perspective [web,minio,electron,_pro]', async () => {+ await clickOn('[data-tid=openKanbanPerspective]');await clickOn('[data-tid=openKanbanPerspective]');await expectElementExist('[data-tid=kanbanSettingsDialogOpenTID]',diff --git a/tests/e2e/hook.js b/tests/e2e/hook.jsindex f6e8b1df5..baf28b978 100644--- a/tests/e2e/hook.js+++ b/tests/e2e/hook.js@@ -155,6 +155,9 @@ export async function startTestingApp(extconfig) {}});+ // Get the Electron context.+ global.context = await global.app.context();+// 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);diff --git a/tests/e2e/welcome.helpers.js b/tests/e2e/welcome.helpers.jsindex 1425f565b..564583ce8 100644--- a/tests/e2e/welcome.helpers.js+++ b/tests/e2e/welcome.helpers.js@@ -2,6 +2,8 @@ import { clearStorage } from './clearstorage.helpers';export async function clearDataStorage() {if (global.isWeb) {+ //await global.context.clearCookies();+ //await global.context.clearStorageState();await global.client.evaluate(() => {window.history.pushState('', document.title, window.location.pathname);localStorage.clear();