From f5668b52ebc99403b1ff051519a9808d1652c846 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Wed, 29 Sep 2021 12:50:45 +0100 Subject: [PATCH] Fixed solidity unit test --- .../src/tests/solidityUnittests.spec.ts | 11 +++--- .../workspace/src/lib/actions/events.ts | 34 +++++++++---------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts b/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts index b9dcccf13b..248620d3c8 100644 --- a/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts +++ b/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts @@ -32,9 +32,10 @@ module.exports = { .click('*[data-id="verticalIconsKindsolidityUnitTesting"]') .waitForElementPresent('*[data-id="testTabGenerateTestFile"]') .click('*[data-id="testTabGenerateTestFile"]') - .waitForElementPresent('*[title="tests/simple_storage_test.sol"]') + .waitForElementPresent('*[title="default_workspace/tests/simple_storage_test.sol"]') .clickLaunchIcon('filePanel') - .pause(10000) + .waitForElementPresent('[data-id="treeViewDivtreeViewItemtests"]') + .click('[data-id="treeViewDivtreeViewItemtests"]') .openFile('tests/simple_storage_test.sol') .removeFile('tests/simple_storage_test.sol', 'default_workspace') }, @@ -164,9 +165,9 @@ module.exports = { .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') // eslint-disable-next-line dot-notation .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_new' }) - .pause(5000) - .waitForElementPresent('*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok') - .click('*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok') + .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') + .click('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') + .pause(2000) .click('*[data-id="workspacesSelect"] option[value="workspace_new"]') // end of creating .clickLaunchIcon('solidityUnitTesting') diff --git a/libs/remix-ui/workspace/src/lib/actions/events.ts b/libs/remix-ui/workspace/src/lib/actions/events.ts index a490ac5261..40265c93e2 100644 --- a/libs/remix-ui/workspace/src/lib/actions/events.ts +++ b/libs/remix-ui/workspace/src/lib/actions/events.ts @@ -11,31 +11,31 @@ export const listenOnPluginEvents = (filePanelPlugin) => { plugin = filePanelPlugin plugin.on('filePanel', 'createWorkspace', (name: string) => { - createWorkspace(name) + setTimeout(() => createWorkspace(name), 10) }) plugin.on('filePanel', 'renameWorkspace', (oldName: string, workspaceName: string) => { - renameWorkspace(oldName, workspaceName) + setTimeout(() => renameWorkspace(oldName, workspaceName), 10) }) plugin.on('filePanel', 'registerContextMenuItem', (item: action) => { - registerContextMenuItem(item) + setTimeout(() => registerContextMenuItem(item), 10) }) plugin.on('filePanel', 'removePluginActions', (plugin) => { - removePluginActions(plugin) + setTimeout(() => removePluginActions(plugin), 10) }) plugin.on('filePanel', 'displayNewFileInput', (path) => { - addInputField('file', path) + setTimeout(() => addInputField('file', path), 10) }) plugin.on('filePanel', 'uploadFileEvent', (dir: string, target) => { - uploadFile(target, dir) + setTimeout(() => uploadFile(target, dir), 10) }) plugin.on('remixd', 'rootFolderChanged', async (path: string) => { - setTimeout(() => rootFolderChanged(path), 0) + setTimeout(() => rootFolderChanged(path), 10) }) } @@ -43,20 +43,20 @@ export const listenOnProviderEvents = (provider) => async (reducerDispatch: Reac dispatch = reducerDispatch provider.event.on('fileAdded', (filePath: string) => { - setTimeout(() => fileAdded(filePath), 0) + setTimeout(() => fileAdded(filePath), 10) }) provider.event.on('folderAdded', (folderPath: string) => { if (folderPath.indexOf('/.workspaces') === 0) return - setTimeout(() => folderAdded(folderPath), 0) + setTimeout(() => folderAdded(folderPath), 10) }) provider.event.on('fileRemoved', (removePath: string) => { - setTimeout(() => fileRemoved(removePath), 0) + setTimeout(() => fileRemoved(removePath), 10) }) provider.event.on('fileRenamed', (oldPath: string) => { - setTimeout(() => fileRenamed(oldPath), 0) + setTimeout(() => fileRenamed(oldPath), 10) }) provider.event.on('disconnected', () => { @@ -67,7 +67,7 @@ export const listenOnProviderEvents = (provider) => async (reducerDispatch: Reac const workspaceProvider = plugin.fileProviders.workspace await switchToWorkspace(workspaceProvider.workspace) - }, 0) + }, 10) }) provider.event.on('connected', async () => { @@ -76,14 +76,14 @@ export const listenOnProviderEvents = (provider) => async (reducerDispatch: Reac dispatch(setMode('localhost')) fetchWorkspaceDirectory('/') dispatch(loadLocalhostSuccess()) - }, 0) + }, 10) }) provider.event.on('loadingLocalhost', async () => { setTimeout(async () => { await switchToWorkspace(LOCALHOST) dispatch(loadLocalhostRequest()) - }, 0) + }, 10) }) provider.event.on('fileExternallyChanged', async (path: string, file: { content: string }) => { @@ -102,15 +102,15 @@ export const listenOnProviderEvents = (provider) => async (reducerDispatch: Reac } )) } - }, 0) + }, 10) }) provider.event.on('fileRenamedError', async () => { - setTimeout(() => dispatch(displayNotification('File Renamed Failed', '', 'Ok', 'Cancel')), 0) + setTimeout(() => dispatch(displayNotification('File Renamed Failed', '', 'Ok', 'Cancel')), 10) }) provider.event.on('readOnlyModeChanged', (mode: boolean) => { - setTimeout(() => dispatch(setReadOnlyMode(mode)), 0) + setTimeout(() => dispatch(setReadOnlyMode(mode)), 10) }) }