fixing workspace test

pull/5370/head
davidzagi93@gmail.com 3 years ago
parent ac3a87739f
commit c4a199d6f8
  1. 30
      apps/remix-ide-e2e/src/tests/workspace.test.ts
  2. 3
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx

@ -19,7 +19,7 @@ module.exports = {
browser browser
.pause(5000) .pause(5000)
.refresh() .refresh()
.pause(2000) .pause(5000)
.getEditorValue((content) => { .getEditorValue((content) => {
browser.assert.ok(content.indexOf('contract Ballot {') !== -1, 'content doesn\'t include Ballot contract') browser.assert.ok(content.indexOf('contract Ballot {') !== -1, 'content doesn\'t include Ballot contract')
}) })
@ -37,24 +37,20 @@ 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_name' }) .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_name' })
.pause(5000) .waitForElementVisible('[data-id="workspacesModalDialogModalDialogModalFooter-react"] > span')
.waitForElementPresent('*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok') .click('[data-id="workspacesModalDialogModalDialogModalFooter-react"]')
.waitForElementVisible('*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok') .click('[data-id="workspacesModalDialogModalDialogModalFooter-react"] > span')
.click('*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok')
.pause(1000)
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]')
.addFile('test.sol', { content: 'test' }) .addFile('test.sol', { content: 'test' })
.pause(1000) .waitForElementVisible('*[data-id="treeViewLitreeViewItemtest.sol"]')
// .waitForElementVisible('*[data-id="treeViewLitreeViewItemtest.sol"]')
.click('*[data-id="workspaceCreate"]') // create workspace_name_1 .click('*[data-id="workspaceCreate"]') // create workspace_name_1
.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_name_1' }) .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_name_1' })
.waitForElementPresent('*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok') .click('[data-id="workspacesModalDialogModalDialogModalFooter-react"]')
.click('span[data-id="workspacesModalDialog-modal-footer-ok-react"]') .click('[data-id="workspacesModalDialogModalDialogModalFooter-react"] > span')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]')
.pause(2000) .waitForElementNotPresent('*[data-id="treeViewLitreeViewItemtest.sol"]')
// .waitForElementNotVisible('*[data-id="treeViewLitreeViewItemtest.sol"]')
.click('*[data-id="workspacesSelect"] option[value="workspace_name"]') .click('*[data-id="workspacesSelect"] option[value="workspace_name"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]')
}, },
@ -70,8 +66,8 @@ module.exports = {
.waitForElementPresent('span[data-id="workspacesModalDialog-modal-footer-ok-react"]') .waitForElementPresent('span[data-id="workspacesModalDialog-modal-footer-ok-react"]')
.click('span[data-id="workspacesModalDialog-modal-footer-ok-react"]') .click('span[data-id="workspacesModalDialog-modal-footer-ok-react"]')
.click('*[data-id="workspacesSelect"] option[value="workspace_name_1"]') .click('*[data-id="workspacesSelect"] option[value="workspace_name_1"]')
.pause(6000) .pause(1000)
// .waitForElementNotVisible('*[data-id="treeViewLitreeViewItemtest.sol"]') .waitForElementNotPresent('*[data-id="treeViewLitreeViewItemtest.sol"]')
.click('*[data-id="workspacesSelect"] option[value="workspace_name_renamed"]') .click('*[data-id="workspacesSelect"] option[value="workspace_name_renamed"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtest.sol"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtest.sol"]')
}, },
@ -80,8 +76,10 @@ module.exports = {
browser browser
.click('*[data-id="workspacesSelect"] option[value="workspace_name_1"]') .click('*[data-id="workspacesSelect"] option[value="workspace_name_1"]')
.click('*[data-id="workspaceDelete"]') // delete workspace_name_1 .click('*[data-id="workspaceDelete"]') // delete workspace_name_1
.waitForElementVisible('*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok') .pause(5000)
.click('*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok') .waitForElementVisible('[data-id="workspacesModalDialogModalDialogModalFooter-react"] > span')
.click('[data-id="workspacesModalDialogModalDialogModalFooter-react"]')
.click('[data-id="workspacesModalDialogModalDialogModalFooter-react"] > span')
.waitForElementNotPresent('*[data-id="workspacesSelect"] option[value="workspace_name_1"]') .waitForElementNotPresent('*[data-id="workspacesSelect"] option[value="workspace_name_1"]')
.end() .end()
}, },

@ -332,7 +332,7 @@ export const Workspace = (props: WorkspaceProps) => {
return ( return (
<div className='remixui_container'> <div className='remixui_container'>
<ModalDialog { state.modal.message && <ModalDialog
id='workspacesModalDialog' id='workspacesModalDialog'
title={ state.modal.title } title={ state.modal.title }
message={ state.modal.message } message={ state.modal.message }
@ -344,6 +344,7 @@ export const Workspace = (props: WorkspaceProps) => {
handleHide={ handleHideModal }> handleHide={ handleHideModal }>
{ (typeof state.modal.message !== 'string') && state.modal.message } { (typeof state.modal.message !== 'string') && state.modal.message }
</ModalDialog> </ModalDialog>
}
<Toaster message={state.toasterMsg} /> <Toaster message={state.toasterMsg} />
<div className='remixui_fileexplorer' onClick={() => resetFocus(true)}> <div className='remixui_fileexplorer' onClick={() => resetFocus(true)}>
<div> <div>

Loading…
Cancel
Save