Skip to content

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

fix: folder rename tests

Ilian Sapundshiev8850475ee42f
diff --git a/tests/e2e/location.helpers.js b/tests/e2e/location.helpers.js
index f3816d2df..45d81fc24 100644
--- a/tests/e2e/location.helpers.js
+++ b/tests/e2e/location.helpers.js
@@ -217,9 +217,8 @@ export async function checkForIdExist(tid) {
export async function renameFileFromMenu(newFileName, selector = selectorFile) {
await openContextEntryMenu(selector, 'fileMenuRenameFile');
const input = await global.client.locator(`[data-tid='renameEntryDialogInput'] input`);
- const fileName = input.inputValue();
- await input.fill('');
- await input.type(newFileName)
+ const fileName = await input.inputValue();
+ await input.fill(newFileName)
await clickOn('[data-tid=confirmRenameEntry]');
await waitForNotification();
return fileName;
diff --git a/tests/e2e/perspective-grid-right-button.pw.e2e.js b/tests/e2e/perspective-grid-right-button.pw.e2e.js
index 63506b34d..7284d2d6e 100644
--- a/tests/e2e/perspective-grid-right-button.pw.e2e.js
+++ b/tests/e2e/perspective-grid-right-button.pw.e2e.js
@@ -396,7 +396,11 @@ test.describe('TST50** - Right button on a file', () => {
const newDirName = 'new_dir_name';
const folder = getGridFileSelector('empty_folder');
await openContextEntryMenu(folder, 'renameDirectory');
- const oldDirName = await setInputKeys('renameEntryDialogInput', newDirName);
+
+ const input = await global.client.locator(`[data-tid='renameEntryDialogInput'] input`);
+ const oldDirName = await input.inputValue();
+ await input.fill(newDirName)
+
await clickOn('[data-tid=confirmRenameEntry]');
// turn dir name back
@@ -404,7 +408,11 @@ test.describe('TST50** - Right button on a file', () => {
getGridFileSelector(newDirName),
'renameDirectory',
);
- const renamedDir = await setInputKeys('renameEntryDialogInput', oldDirName);
+
+ const input2 = await global.client.locator(`[data-tid='renameEntryDialogInput'] input`);
+ const renamedDir = await input2.inputValue();
+ await input2.fill(oldDirName)
+
await clickOn('[data-tid=confirmRenameEntry]');
expect(renamedDir).toBe(newDirName);
});
diff --git a/tests/e2e/test-utils.js b/tests/e2e/test-utils.js
index 6ee6136d1..d0694350f 100644
--- a/tests/e2e/test-utils.js
+++ b/tests/e2e/test-utils.js
@@ -1,6 +1,6 @@
/* Copyright (c) 2016-present - TagSpaces GmbH. All rights reserved. */
import { expect } from '@playwright/test';
-import { clickOn, expectElementExist, setInputKeys } from './general.helpers';
+import { clickOn, expectElementExist } from './general.helpers';
const newDirectoryName = 'newDirectory';
export const perspectiveGridTable = '//*[@data-tid="perspectiveGridFileTable"]';
@@ -39,7 +39,9 @@ export async function renameFolder() {
await clickOn('[data-tid=folderContainerOpenDirMenu]');
await clickOn('[data-tid=renameDirectory]');
// set new dir name
- await setInputKeys('renameEntryDialogInput', newDirectoryName);
+ const input = await global.client.locator(`[data-tid='renameEntryDialogInput'] input`);
+ await input.fill(newDirectoryName)
+
await clickOn('[data-tid=confirmRenameEntry]');
await expectElementExist(
'[data-tid=currentDir_' + newDirectoryName + ']',