From d3d3a6e5b48a28eb469868ac1a3f11e6a5625c6c Mon Sep 17 00:00:00 2001 From: filip mertens Date: Sun, 31 Dec 2023 06:48:22 +0100 Subject: [PATCH] rename path --- apps/remix-ide-e2e/src/commands/renamePath.ts | 12 ++---------- apps/remix-ide-e2e/src/tests/fileExplorer.test.ts | 2 +- apps/remix-ide-e2e/src/tests/remixd.test.ts | 2 +- apps/remix-ide-e2e/src/tests/workspace_git.test.ts | 2 +- .../src/lib/components/flat-tree-item-input.tsx | 1 + 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/renamePath.ts b/apps/remix-ide-e2e/src/commands/renamePath.ts index 220aeb9544..d87faf7261 100644 --- a/apps/remix-ide-e2e/src/commands/renamePath.ts +++ b/apps/remix-ide-e2e/src/commands/renamePath.ts @@ -34,16 +34,8 @@ function renamePath (browser: NightwatchBrowser, path: string, newFileName: stri }, [path], function () { browser .click('#menuitemrename') - .perform((client, doneSetValue) => { - browser.execute(function (path, addvalue) { - document.querySelector('[data-path="' + path + '"]').innerHTML = addvalue - }, [path, newFileName], () => { - doneSetValue() - }) - }) - .pause(1000) - .click('div[data-id="remixIdeMainPanel"]') // focus out to save - .pause(2000) + .sendKeys('[data-input-path="' + path + '"]', newFileName) + .sendKeys('[data-input-path="' + path + '"]', browser.Keys.ENTER) .waitForElementNotPresent('[data-path="' + path + '"]') .waitForElementPresent('[data-path="' + renamedPath + '"]') .perform(() => { diff --git a/apps/remix-ide-e2e/src/tests/fileExplorer.test.ts b/apps/remix-ide-e2e/src/tests/fileExplorer.test.ts index 0d1c02d36b..d8f527eb35 100644 --- a/apps/remix-ide-e2e/src/tests/fileExplorer.test.ts +++ b/apps/remix-ide-e2e/src/tests/fileExplorer.test.ts @@ -32,7 +32,7 @@ module.exports = { browser .waitForElementVisible('*[data-id="treeViewLitreeViewItem5_New_contract.sol"]') .click('*[data-id="treeViewLitreeViewItem5_New_contract.sol"]') - .renamePath('5_New_contract.sol', '5_Renamed_Contract.sol', '5_Renamed_Contract.sol') + .renamePath('5_New_contract.sol', '5_Renamed_Contract', '5_Renamed_Contract.sol') .waitForElementVisible('*[data-id="treeViewLitreeViewItem5_Renamed_Contract.sol"]') }, diff --git a/apps/remix-ide-e2e/src/tests/remixd.test.ts b/apps/remix-ide-e2e/src/tests/remixd.test.ts index 758e436001..ceebe0d553 100644 --- a/apps/remix-ide-e2e/src/tests/remixd.test.ts +++ b/apps/remix-ide-e2e/src/tests/remixd.test.ts @@ -277,7 +277,7 @@ function runTests(browser: NightwatchBrowser, done: any) { .setEditorValue('contract test1 { function get () returns (uint) { return 10; }}') .click('[data-path="folder1/contract_' + browserName + '.sol"]') // rename a file and check .pause(1000) - .renamePath('folder1/contract_' + browserName + '.sol', 'renamed_contract_' + browserName + '.sol', 'folder1/renamed_contract_' + browserName + '.sol') + .renamePath('folder1/contract_' + browserName + '.sol', 'renamed_contract_' + browserName, 'folder1/renamed_contract_' + browserName + '.sol') .pause(1000) .removeFile('folder1/contract_' + browserName + '_toremove.sol', 'localhost') .perform(function (done) { diff --git a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts index 138b040a3e..264e8dff67 100644 --- a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts @@ -226,7 +226,7 @@ module.exports = { 'Should prevent checkout to a branch if local changes exists #group3': function (browser: NightwatchBrowser) { browser - .renamePath('README.md', 'README.txt', 'README.txt') + .renamePath('README.md', 'README_2.md', 'README_2.md') .waitForElementVisible('[data-id="workspaceGitBranchesDropdown"]') .click('[data-id="workspaceGitBranchesDropdown"]') .waitForElementVisible('[data-id="workspaceGit-dev"]') diff --git a/libs/remix-ui/workspace/src/lib/components/flat-tree-item-input.tsx b/libs/remix-ui/workspace/src/lib/components/flat-tree-item-input.tsx index 82ee877c74..0ebed78d09 100644 --- a/libs/remix-ui/workspace/src/lib/components/flat-tree-item-input.tsx +++ b/libs/remix-ui/workspace/src/lib/components/flat-tree-item-input.tsx @@ -47,6 +47,7 @@ export const FlatTreeItemInput = (props: FlatTreeItemInputProps) => { return(