diff --git a/.env b/.env index 644e8c49bd..d26bff05b3 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ gist_token=ef5df4e3822bf121f1aee4616ea110309e2d49f5 -account_passphrase= -account_password= +account_passphrase=explain uniform adapt basic blue onion rebel pull rice erase volcano couple +account_password=remix_is_cool NODE_OPTIONS=--max-old-space-size=2048 \ No newline at end of file diff --git a/apps/remix-ide-e2e/src/commands/addFile.ts b/apps/remix-ide-e2e/src/commands/addFile.ts index 149d0fa43b..6a1bdfc6ef 100644 --- a/apps/remix-ide-e2e/src/commands/addFile.ts +++ b/apps/remix-ide-e2e/src/commands/addFile.ts @@ -15,20 +15,11 @@ class AddFile extends EventEmitter { function addFile (browser: NightwatchBrowser, name: string, content: NightwatchContractContent, done: VoidFunction) { browser.clickLaunchIcon('udapp').clickLaunchIcon('fileExplorers').click('.newFile') - .waitForElementVisible('#modal-dialog') - .perform((client, done) => { - browser.execute(function (fileName) { - if (fileName !== 'Untitled.sol') { - document.querySelector('#modal-dialog #prompt_text').setAttribute('value', fileName) - } - const elem = document.querySelector('#modal-footer-ok') as HTMLElement - - elem.click() - }, [name], function (result) { - console.log(result) - done() - }) - }) + .pause(2000) + .keys(name) + .keys(browser.Keys.ENTER) + .pause(1000) + .click('[data-id="treeViewLitreeViewItembrowser/Greet.sol"]') .setEditorValue(content.content) .pause(1000) .perform(function () { diff --git a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx index ebccbb8518..63e421d084 100644 --- a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx +++ b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx @@ -156,8 +156,8 @@ export const FileExplorer = (props: FileExplorerProps) => { filesProvider.event.register('fileRenamed', fileRenamed) }, [state.files]) - const resolveDirectory = async (folderPath, dir: File[]): Promise => { - if ((extractParentFromKey(state.focusEdit.element) === name) && (dir.findIndex(({ path }) => path === state.focusEdit.element) === -1)) { + const resolveDirectory = async (folderPath, dir: File[], isChild = false): Promise => { + if (!isChild && (state.focusEdit.element === 'browser/blank') && state.focusEdit.isNew && (dir.findIndex(({ path }) => path === 'browser/blank') === -1)) { dir = state.focusEdit.type === 'file' ? [...dir, { path: state.focusEdit.element, name: '', @@ -171,25 +171,21 @@ export const FileExplorer = (props: FileExplorerProps) => { dir = await Promise.all(dir.map(async (file) => { if (file.path === folderPath) { if ((extractParentFromKey(state.focusEdit.element) === folderPath) && state.focusEdit.isNew) { - if (file.child && (file.child.findIndex(({ path }) => path === state.focusEdit.element) === -1)) { - file.child = state.focusEdit.type === 'file' ? [...await fetchDirectoryContent(folderPath), { - path: state.focusEdit.element, - name: '', - isDirectory: false - }] : [{ - path: state.focusEdit.element, - name: '', - isDirectory: true - }, ...await fetchDirectoryContent(folderPath)] - } else { - file.child = await fetchDirectoryContent(folderPath) - } + file.child = state.focusEdit.type === 'file' ? [...await fetchDirectoryContent(folderPath), { + path: state.focusEdit.element, + name: '', + isDirectory: false + }] : [{ + path: state.focusEdit.element, + name: '', + isDirectory: true + }, ...await fetchDirectoryContent(folderPath)] } else { file.child = await fetchDirectoryContent(folderPath) } return file } else if (file.child) { - file.child = await resolveDirectory(folderPath, file.child) + file.child = await resolveDirectory(folderPath, file.child, true) return file } else { return file