Fix remixd tests

pull/668/head
ioedeveloper 4 years ago
parent 914ea80d40
commit 0537013e68
  1. 16
      apps/remix-ide-e2e/src/commands/removeFile.ts
  2. 8
      apps/remix-ide-e2e/src/tests/fileExplorer.test.ts
  3. 6
      apps/remix-ide-e2e/src/tests/gist.test.ts
  4. 19
      libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
  5. 11
      libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx
  6. 1
      libs/remix-ui/modal-dialog/src/lib/types/index.ts

@ -34,13 +34,19 @@ function removeFile (browser: NightwatchBrowser, path: string, done: VoidFunctio
contextMenuClick(document.querySelector('[data-path="' + path + '"]')) contextMenuClick(document.querySelector('[data-path="' + path + '"]'))
}, [path], function () { }, [path], function () {
browser browser
.waitForElementVisible('#menuitemdelete', 2000) .waitForElementVisible('#menuitemdelete')
.click('#menuitemdelete') .click('#menuitemdelete')
.pause(500) .pause(2000)
.waitForElementVisible('#modal-footer-ok', 2000)
.click('#modal-footer-ok')
.waitForElementNotPresent('[data-path="' + path + '"]')
.perform(() => { .perform(() => {
if (path.indexOf('browser') !== -1) {
browser.waitForElementVisible('[data-id="browser-modal-footer-ok-react"]')
.click('[data-id="browser-modal-footer-ok-react"]')
.waitForElementNotPresent('[data-path="' + path + '"]')
} else if (path.indexOf('localhost') !== -1) {
browser.waitForElementVisible('[data-id="localhost-modal-footer-ok-react"]')
.click('[data-id="localhost-modal-footer-ok-react"]')
.waitForElementNotPresent('[data-path="' + path + '"]')
}
done() done()
}) })
}) })

@ -39,7 +39,7 @@ module.exports = {
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"]')
.rightClick('[data-path="browser/5_Renamed_Contract.sol"]') .rightClick('[data-path="browser/5_Renamed_Contract.sol"]')
.click('*[id="menuitemdelete"]') .click('*[id="menuitemdelete"]')
.waitForElementVisible('*[data-id="modalDialogContainer-react"]') .waitForElementVisible('*[data-id="browserModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.waitForElementNotPresent('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"') .waitForElementNotPresent('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"')
@ -67,7 +67,7 @@ module.exports = {
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]')
.rightClick('[data-path="browser/Browser_E2E_Tests"]') .rightClick('[data-path="browser/Browser_E2E_Tests"]')
.click('*[id="menuitemdelete"]') .click('*[id="menuitemdelete"]')
.waitForElementVisible('*[data-id="modalDialogContainer-react"]') .waitForElementVisible('*[data-id="browserModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.waitForElementNotPresent('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]') .waitForElementNotPresent('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]')
@ -80,11 +80,11 @@ module.exports = {
.pause(10000) .pause(10000)
.waitForElementVisible('*[data-id="fileExplorerNewFilepublishToGist"]') .waitForElementVisible('*[data-id="fileExplorerNewFilepublishToGist"]')
.click('*[data-id="fileExplorerNewFilepublishToGist"]') .click('*[data-id="fileExplorerNewFilepublishToGist"]')
.waitForElementVisible('*[data-id="modalDialogContainer-react"]') .waitForElementVisible('*[data-id="browserModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.pause(2000) .pause(2000)
.waitForElementVisible('*[data-id="modalDialogContainer-react"]') .waitForElementVisible('*[data-id="browserModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.pause(2000) .pause(2000)

@ -34,11 +34,11 @@ module.exports = {
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]')
.addFile('File.sol', { content: '' }, false) .addFile('File.sol', { content: '' }, false)
.click('*[data-id="fileExplorerNewFilepublishToGist"]') .click('*[data-id="fileExplorerNewFilepublishToGist"]')
.waitForElementVisible('*[data-id="modalDialogContainer-react"]') .waitForElementVisible('*[data-id="browserModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.pause(10000) .pause(10000)
.getText('[data-id="modalDialogModalBody-react"]', (result) => { .getText('[data-id="browserModalDialogModalBody-react"]', (result) => {
console.log(result) console.log(result)
const value = typeof result.value === 'string' ? result.value : null const value = typeof result.value === 'string' ? result.value : null
const reg = /gist.github.com\/([^.]+)/ const reg = /gist.github.com\/([^.]+)/
@ -50,7 +50,7 @@ module.exports = {
} else { } else {
const gistid = id[1] const gistid = id[1]
browser browser
.click('[data-id="modal-footer-cancel-react"]') .click('[data-id="browser-modal-footer-ok-react"]')
.executeScript(`remix.loadgist('${gistid}')`) .executeScript(`remix.loadgist('${gistid}')`)
.perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('browser/gists') } done() }) .perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('browser/gists') } done() })
.waitForElementVisible(`[data-id="treeViewLitreeViewItembrowser/gists/${gistid}"]`) .waitForElementVisible(`[data-id="treeViewLitreeViewItembrowser/gists/${gistid}"]`)

@ -903,14 +903,17 @@ export const FileExplorer = (props: FileExplorerProps) => {
</div> </div>
</TreeViewItem> </TreeViewItem>
</TreeView> </TreeView>
<ModalDialog {
title={ state.modalOptions.title } props.name && <ModalDialog
message={ state.modalOptions.message } id={ props.name }
hide={ state.modalOptions.hide } title={ state.modalOptions.title }
ok={ state.modalOptions.ok } message={ state.modalOptions.message }
cancel={ state.modalOptions.cancel } hide={ state.modalOptions.hide }
handleHide={ handleHideModal } ok={ state.modalOptions.ok }
/> cancel={ state.modalOptions.cancel }
handleHide={ handleHideModal }
/>
}
<Toaster message={state.toasterMsg} /> <Toaster message={state.toasterMsg} />
</div> </div>
) )

@ -42,7 +42,7 @@ export const ModalDialog = (props: ModalDialogProps) => {
return ( return (
<div <div
data-id="modalDialogContainer-react" data-id={`${props.id}ModalDialogContainer-react`}
data-backdrop="static" data-backdrop="static"
data-keyboard="false" data-keyboard="false"
className='modal' className='modal'
@ -61,7 +61,7 @@ export const ModalDialog = (props: ModalDialogProps) => {
onKeyDown={({ keyCode }) => { modalKeyEvent(keyCode) }} onKeyDown={({ keyCode }) => { modalKeyEvent(keyCode) }}
> >
<div className="modal-header"> <div className="modal-header">
<h6 className="modal-title" data-id="modalDialogModalTitle-react"> <h6 className="modal-title" data-id={`${props.id}ModalDialogModalTitle-react`}>
{props.title && props.title} {props.title && props.title}
</h6> </h6>
{!props.showCancelIcon && {!props.showCancelIcon &&
@ -70,13 +70,14 @@ export const ModalDialog = (props: ModalDialogProps) => {
</span> </span>
} }
</div> </div>
<div className="modal-body text-break remixModalBody" data-id="modalDialogModalBody-react"> <div className="modal-body text-break remixModalBody" data-id={`${props.id}ModalDialogModalBody-react`}>
{ props.children ? props.children : props.message } { props.children ? props.children : props.message }
</div> </div>
<div className="modal-footer" data-id="modalDialogModalFooter-react"> <div className="modal-footer" data-id={`${props.id}ModalDialogModalFooter-react`}>
{/* todo add autofocus ^^ */} {/* todo add autofocus ^^ */}
{ props.ok && { props.ok &&
<span <span
data-id={`${props.id}-modal-footer-ok-react`}
className={'modal-ok btn btn-sm ' + (state.toggleBtn ? 'btn-dark' : 'btn-light')} className={'modal-ok btn btn-sm ' + (state.toggleBtn ? 'btn-dark' : 'btn-light')}
onClick={() => { onClick={() => {
if (props.ok.fn) props.ok.fn() if (props.ok.fn) props.ok.fn()
@ -88,7 +89,7 @@ export const ModalDialog = (props: ModalDialogProps) => {
} }
{ props.cancel && { props.cancel &&
<span <span
data-id='modal-footer-cancel-react' data-id={`${props.id}-modal-footer-cancel-react`}
className={'modal-cancel btn btn-sm ' + (state.toggleBtn ? 'btn-light' : 'btn-dark')} className={'modal-cancel btn btn-sm ' + (state.toggleBtn ? 'btn-light' : 'btn-dark')}
data-dismiss="modal" data-dismiss="modal"
onClick={() => { onClick={() => {

@ -1,4 +1,5 @@
export interface ModalDialogProps { export interface ModalDialogProps {
id?: string
title?: string, title?: string,
message?: string, message?: string,
ok?: { label: string, fn: () => void }, ok?: { label: string, fn: () => void },

Loading…
Cancel
Save