Fixed solidity unit test

pull/5370/head
ioedeveloper 3 years ago
parent 521e04c442
commit c1809a4d04
  1. 11
      apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts
  2. 34
      libs/remix-ui/workspace/src/lib/actions/events.ts

@ -32,9 +32,10 @@ module.exports = {
.click('*[data-id="verticalIconsKindsolidityUnitTesting"]') .click('*[data-id="verticalIconsKindsolidityUnitTesting"]')
.waitForElementPresent('*[data-id="testTabGenerateTestFile"]') .waitForElementPresent('*[data-id="testTabGenerateTestFile"]')
.click('*[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') .clickLaunchIcon('filePanel')
.pause(10000) .waitForElementPresent('[data-id="treeViewDivtreeViewItemtests"]')
.click('[data-id="treeViewDivtreeViewItemtests"]')
.openFile('tests/simple_storage_test.sol') .openFile('tests/simple_storage_test.sol')
.removeFile('tests/simple_storage_test.sol', 'default_workspace') .removeFile('tests/simple_storage_test.sol', 'default_workspace')
}, },
@ -164,9 +165,9 @@ module.exports = {
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
// eslint-disable-next-line dot-notation // eslint-disable-next-line dot-notation
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_new' }) .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_new' })
.pause(5000) .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.waitForElementPresent('*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok') .click('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.click('*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok') .pause(2000)
.click('*[data-id="workspacesSelect"] option[value="workspace_new"]') .click('*[data-id="workspacesSelect"] option[value="workspace_new"]')
// end of creating // end of creating
.clickLaunchIcon('solidityUnitTesting') .clickLaunchIcon('solidityUnitTesting')

@ -11,31 +11,31 @@ export const listenOnPluginEvents = (filePanelPlugin) => {
plugin = filePanelPlugin plugin = filePanelPlugin
plugin.on('filePanel', 'createWorkspace', (name: string) => { plugin.on('filePanel', 'createWorkspace', (name: string) => {
createWorkspace(name) setTimeout(() => createWorkspace(name), 10)
}) })
plugin.on('filePanel', 'renameWorkspace', (oldName: string, workspaceName: string) => { plugin.on('filePanel', 'renameWorkspace', (oldName: string, workspaceName: string) => {
renameWorkspace(oldName, workspaceName) setTimeout(() => renameWorkspace(oldName, workspaceName), 10)
}) })
plugin.on('filePanel', 'registerContextMenuItem', (item: action) => { plugin.on('filePanel', 'registerContextMenuItem', (item: action) => {
registerContextMenuItem(item) setTimeout(() => registerContextMenuItem(item), 10)
}) })
plugin.on('filePanel', 'removePluginActions', (plugin) => { plugin.on('filePanel', 'removePluginActions', (plugin) => {
removePluginActions(plugin) setTimeout(() => removePluginActions(plugin), 10)
}) })
plugin.on('filePanel', 'displayNewFileInput', (path) => { plugin.on('filePanel', 'displayNewFileInput', (path) => {
addInputField('file', path) setTimeout(() => addInputField('file', path), 10)
}) })
plugin.on('filePanel', 'uploadFileEvent', (dir: string, target) => { plugin.on('filePanel', 'uploadFileEvent', (dir: string, target) => {
uploadFile(target, dir) setTimeout(() => uploadFile(target, dir), 10)
}) })
plugin.on('remixd', 'rootFolderChanged', async (path: string) => { 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 dispatch = reducerDispatch
provider.event.on('fileAdded', (filePath: string) => { provider.event.on('fileAdded', (filePath: string) => {
setTimeout(() => fileAdded(filePath), 0) setTimeout(() => fileAdded(filePath), 10)
}) })
provider.event.on('folderAdded', (folderPath: string) => { provider.event.on('folderAdded', (folderPath: string) => {
if (folderPath.indexOf('/.workspaces') === 0) return if (folderPath.indexOf('/.workspaces') === 0) return
setTimeout(() => folderAdded(folderPath), 0) setTimeout(() => folderAdded(folderPath), 10)
}) })
provider.event.on('fileRemoved', (removePath: string) => { provider.event.on('fileRemoved', (removePath: string) => {
setTimeout(() => fileRemoved(removePath), 0) setTimeout(() => fileRemoved(removePath), 10)
}) })
provider.event.on('fileRenamed', (oldPath: string) => { provider.event.on('fileRenamed', (oldPath: string) => {
setTimeout(() => fileRenamed(oldPath), 0) setTimeout(() => fileRenamed(oldPath), 10)
}) })
provider.event.on('disconnected', () => { provider.event.on('disconnected', () => {
@ -67,7 +67,7 @@ export const listenOnProviderEvents = (provider) => async (reducerDispatch: Reac
const workspaceProvider = plugin.fileProviders.workspace const workspaceProvider = plugin.fileProviders.workspace
await switchToWorkspace(workspaceProvider.workspace) await switchToWorkspace(workspaceProvider.workspace)
}, 0) }, 10)
}) })
provider.event.on('connected', async () => { provider.event.on('connected', async () => {
@ -76,14 +76,14 @@ export const listenOnProviderEvents = (provider) => async (reducerDispatch: Reac
dispatch(setMode('localhost')) dispatch(setMode('localhost'))
fetchWorkspaceDirectory('/') fetchWorkspaceDirectory('/')
dispatch(loadLocalhostSuccess()) dispatch(loadLocalhostSuccess())
}, 0) }, 10)
}) })
provider.event.on('loadingLocalhost', async () => { provider.event.on('loadingLocalhost', async () => {
setTimeout(async () => { setTimeout(async () => {
await switchToWorkspace(LOCALHOST) await switchToWorkspace(LOCALHOST)
dispatch(loadLocalhostRequest()) dispatch(loadLocalhostRequest())
}, 0) }, 10)
}) })
provider.event.on('fileExternallyChanged', async (path: string, file: { content: string }) => { 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 () => { 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) => { provider.event.on('readOnlyModeChanged', (mode: boolean) => {
setTimeout(() => dispatch(setReadOnlyMode(mode)), 0) setTimeout(() => dispatch(setReadOnlyMode(mode)), 10)
}) })
} }

Loading…
Cancel
Save