TagSpaces is an offline, open source, document manager with tagging support
fix e2e tests
sytolk4d198b326891
diff --git a/playwright.config.common.js b/playwright.config.common.jsindex 209be4a9b..c4e12ccaa 100644--- a/playwright.config.common.js+++ b/playwright.config.common.js@@ -11,7 +11,7 @@ const pwConfig = {trace: 'on-first-retry',},// Set the timeout for each test- timeout: process.env.CI ? 120000 : 30000,+ timeout: process.env.CI ? 120000 : 300000,// (2 hours) Maximum time in milliseconds the whole test suite can run. Useful on CI to prevent broken setup from running too long and wasting resources.globalTimeout: process.env.CI ? 2 * 60 * 60 * 1000 : undefined,ignoreSnapshots: !process.env.CI,diff --git a/tests/e2e/folderprops.pw.e2e.js b/tests/e2e/folderprops.pw.e2e.jsindex 1112d3649..c23ba11c5 100644--- a/tests/e2e/folderprops.pw.e2e.js+++ b/tests/e2e/folderprops.pw.e2e.js@@ -11,17 +11,17 @@ import {import {clickOn,expectElementExist,- takeScreenshot,getGridFileSelector,setInputValue,createNewDirectory,dnd,- setInputKeys,+ getAttribute,getElementScreenshot,checkSettings,openFolder,waitUntilChanged,openFolderProp,+ createLocation,} from './general.helpers';import { openContextEntryMenu } from './test-utils';import {@@ -74,15 +74,7 @@ test.beforeEach('extconfig.js',);}- if (isMinio) {- await createPwMinioLocation('', defaultLocationName, true);- } else if (isS3) {- await createS3Location('', defaultLocationName, true);- } else {- await createPwLocation(testDataDir, defaultLocationName, true);- }- await clickOn('[data-tid=location_' + defaultLocationName + ']');- await expectElementExist(getGridFileSelector('empty_folder'), true, 8000);+ await createLocation({ isMinio, isS3, testDataDir });await openFolderProp('empty_folder');},@@ -442,17 +434,14 @@ test.describe('TST02 - Folder properties', () => {* bgnRemovedScreenshot not always the same on web*/test('TST0220 - Set and remove predefined folder background [electron,_pro]', async () => {- await openContextEntryMenu(- getGridFileSelector('empty_folder'),- 'showProperties',- );- await openContextEntryMenu(- getGridFileSelector('empty_folder'),- 'openDirectory',- );- const initScreenshot = await getElementScreenshot(- '[data-tid=perspectiveGridFileTable]',- ); //propsBgnImageTID+ await openFolderProp('empty_folder');+ await openFolder('empty_folder');++ const targetSelector = '[data-tid=backgroundTID]>div'; //'[data-tid=perspectiveGridFileTable]';+ const screenshotSelector = '[data-tid=perspectiveGridFileTable]';+ const initScreenshot = await getElementScreenshot(screenshotSelector);+ const initStyle = await getAttribute(targetSelector, 'style');+await clickOn('[data-tid=changeBackgroundImageTID]');await clickOn('ul[data-tid=predefinedBackgroundsTID] > li');@@ -462,17 +451,19 @@ test.describe('TST02 - Folder properties', () => {5000,);await clickOn('[data-tid=colorPickerConfirm]');- const withBgnScreenshot = await getElementScreenshot(- '[data-tid=perspectiveGridFileTable]',- );+ // Wait for background-image style change+ await waitUntilChanged(targetSelector, initStyle, 'style', 8000);++ const withBgnScreenshot = await getElementScreenshot(screenshotSelector);expect(initScreenshot).not.toBe(withBgnScreenshot);+ const bgStyle = await getAttribute(targetSelector, 'style');- // remove background+ // Remove backgroundawait clickOn('[data-tid=changeBackgroundImageTID]');await clickOn('[data-tid=clearBackground]');- const bgnRemovedScreenshot = await getElementScreenshot(- '[data-tid=perspectiveGridFileTable]',- );+ await waitUntilChanged(targetSelector, bgStyle, 'style', 8000);++ const bgnRemovedScreenshot = await getElementScreenshot(screenshotSelector);expect(initScreenshot).toBe(bgnRemovedScreenshot);});});diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.jsindex 1b4e9717f..ac7b0f510 100644--- a/tests/e2e/general.helpers.js+++ b/tests/e2e/general.helpers.js@@ -108,10 +108,15 @@ export async function waitUntilChanged(return await element.getAttribute(attribute);}+// Utility to get style attributeexport async function getAttribute(selector, attribute = 'style') {- const element = global.client.locator(selector);- return await element.getAttribute(attribute);+ return await global.client+ .locator(selector)+ .evaluate((el, attr) => el.getAttribute(attr), attribute);+ //const element = global.client.locator(selector);+ //return await element.getAttribute(attribute);}+export async function setInputValue(selector, value) {await global.client.locator(selector).fill(value);}