attempt to fix e2e

pull/4446/head
Joseph Izang 9 months ago
parent 38703f261b
commit 1a03f899e9
  1. 181
      apps/remix-ide-e2e/src/tests/file_explorer_dragdrop.test.ts
  2. 2
      libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx
  3. 3
      libs/remix-ui/workspace/src/lib/components/flat-tree.tsx

@ -3,101 +3,104 @@ import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
const checkBrowserIsChrome = function (browser: NightwatchBrowser) {
return browser.browserName.indexOf('chrome') > -1
return browser.browserName.indexOf('chrome') > -1
}
module.exports = {
'@disabled': true,
before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done)
},
'drag and drop file from root to contracts #group1 ': function (browser: NightwatchBrowser) {
if (checkBrowserIsChrome(browser)) {
browser
.clickLaunchIcon('filePanel')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]')
.findElement('*[data-id="treeViewLitreeViewItemcontracts"]', (el) => {
console.log((el as any).value.getId())
const id = (el as any).value.getId()
browser
.waitForElementVisible('li[data-id="treeViewLitreeViewItemREADME.txt"]')
.dragAndDrop('li[data-id="treeViewLitreeViewItemREADME.txt"]', id)
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
.waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/README.txt"]')
})
}
},
'@disabled': true,
before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done)
},
'drag and drop file from root to contracts #group1 ': function (browser: NightwatchBrowser) {
if (checkBrowserIsChrome(browser)) {
browser
.clickLaunchIcon('filePanel')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]')
.findElement('*[data-id="treeViewLitreeViewItemcontracts"]', (el) => {
console.log((el as any).value.getId())
const id = (el as any).value.getId()
browser
.waitForElementVisible('li[data-id="treeViewLitreeViewItemREADME.txt"]')
.dragAndDrop('li[data-id="treeViewLitreeViewItemREADME.txt"]', id)
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
.waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/README.txt"]')
})
}
},
'drag and drop file from contracts to root #group1': function (browser: NightwatchBrowser) {
if (checkBrowserIsChrome(browser)) {
browser.findElement('*[data-id="treeViewUltreeViewMenu"]', (el) => {
console.log((el as any).value.getId())
const id = (el as any).value.getId()
browser
.waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]')
.dragAndDrop('li[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]', id)
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
})
browser.pause(1000)
.waitForElementVisible('li[data-id="treeViewLitreeViewItem1_Storage.sol"]')
}
},
'drag and drop scripts from root to contracts #group1': function (browser: NightwatchBrowser) {
if (checkBrowserIsChrome(browser)) {
browser
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]')
.findElement('*[data-id="treeViewLitreeViewItemcontracts"]', (el) => {
console.log((el as any).value.getId())
const id = (el as any).value.getId()
browser
.waitForElementVisible('li[data-id="treeViewLitreeViewItemscripts"]')
.dragAndDrop('li[data-id="treeViewLitreeViewItemscripts"]', id)
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
.waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/scripts"]')
})
}
},
'drag scripts from contracts to root #group1': function (browser: NightwatchBrowser) {
if (checkBrowserIsChrome(browser)) {
browser.findElement('*[data-id="treeViewUltreeViewMenu"]', (el) => {
console.log((el as any).value.getId())
const id = (el as any).value.getId()
browser
.waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/scripts"]')
.dragAndDrop('li[data-id="treeViewLitreeViewItemcontracts/scripts"]', id)
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
})
browser.pause(1000)
.waitForElementVisible('li[data-id="treeViewLitreeViewItemscripts"]')
}
},
'drag into nested folder': function (browser: NightwatchBrowser) {
if (checkBrowserIsChrome(browser)) {
browser.waitForElementVisible('li[data-id="treeViewLitreeViewItemscripts"]')
.rightClick('li[data-id="treeViewLitreeViewItemscripts"]')
.waitForElementPresent('[data-id="contextMenuItemnewFolder')
.click('[data-id="contextMenuItemnewFolder')
.waitForElementVisible('*[data-id$="fileExplorerTreeItemInput"]')
.sendKeys('*[data-id$="fileExplorerTreeItemInput"]', 'nested')
.sendKeys('*[data-id$="fileExplorerTreeItemInput"]', browser.Keys.ENTER)
.findElement('*[data-id="treeViewLitreeViewItemscripts/nested"]', (el) => {
console.log((el as any).value.getId())
const id = (el as any).value.getId()
browser
.waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/README.txt"]')
.dragAndDrop('li[data-id="treeViewLitreeViewItemcontracts/README.txt"]', id)
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
.waitForElementVisible('li[data-id="treeViewLitreeViewItemscripts/nested/README.txt"]')
})
}
'drag and drop file from contracts to root #group1': function (browser: NightwatchBrowser) {
if (checkBrowserIsChrome(browser)) {
browser.findElement('*[data-id="treeViewUltreeViewMenu"]', (el) => {
console.log((el as any).value.getId())
const id = (el as any).value.getId()
browser
.waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]')
.dragAndDrop('li[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]', id)
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
})
browser.pause(1000)
.waitForElementVisible('li[data-id="treeViewLitreeViewItem1_Storage.sol"]')
}
},
'drag and drop scripts from root to contracts #group1': function (browser: NightwatchBrowser) {
if (checkBrowserIsChrome(browser)) {
browser
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]')
.findElement('*[data-id="treeViewLitreeViewItemcontracts"]', (el) => {
console.log((el as any).value.getId())
const id = (el as any).value.getId()
browser
.waitForElementVisible('li[data-id="treeViewLitreeViewItemscripts"]')
.dragAndDrop('div[data-id="treeViewDivDraggableItemscripts"]', id)
.pause()
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.pause()
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
.pause()
.waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/scripts"]')
})
}
},
'drag scripts from contracts to root #group1': function (browser: NightwatchBrowser) {
if (checkBrowserIsChrome(browser)) {
browser.findElement('*[data-id="treeViewUltreeViewMenu"]', (el) => {
console.log((el as any).value.getId())
const id = (el as any).value.getId()
browser
.waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/scripts"]')
.dragAndDrop('li[data-id="treeViewLitreeViewItemcontracts/scripts"]', id)
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
})
browser.pause(1000)
.waitForElementVisible('li[data-id="treeViewLitreeViewItemscripts"]')
}
},
'drag into nested folder': function (browser: NightwatchBrowser) {
if (checkBrowserIsChrome(browser)) {
browser.waitForElementVisible('li[data-id="treeViewLitreeViewItemscripts"]')
.rightClick('li[data-id="treeViewLitreeViewItemscripts"]')
.waitForElementPresent('[data-id="contextMenuItemnewFolder')
.click('[data-id="contextMenuItemnewFolder')
.waitForElementVisible('*[data-id$="fileExplorerTreeItemInput"]')
.sendKeys('*[data-id$="fileExplorerTreeItemInput"]', 'nested')
.sendKeys('*[data-id$="fileExplorerTreeItemInput"]', browser.Keys.ENTER)
.findElement('*[data-id="treeViewLitreeViewItemscripts/nested"]', (el) => {
console.log((el as any).value.getId())
const id = (el as any).value.getId()
browser
.waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/README.txt"]')
.dragAndDrop('li[data-id="treeViewLitreeViewItemcontracts/README.txt"]', id)
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
.waitForElementVisible('li[data-id="treeViewLitreeViewItemscripts/nested/README.txt"]')
})
}
}
}
}

@ -61,7 +61,7 @@ export const FlatTreeDrop = (props: FlatTreeDropProps) => {
} else {
dragDestination = getFlatTreeItem(target.path)
}
console.log(dragDestination)
if (dragDestination.isDirectory) {
if (dragSource.isDirectory) {
moveFolder(dragDestination.path, dragSource.path)

@ -186,7 +186,7 @@ export const FlatTree = (props: FlatTreeProps) => {
}, [focusEdit])
const showIcons = (file: FileType) =>
file.path === hover ? (
file.path === hover && !isDragging ? (
<div>
<FileHoverIcons
file={file}
@ -224,6 +224,7 @@ export const FlatTree = (props: FlatTreeProps) => {
editModeOff={editModeOff}
file={file} /> :
<><div
data-id={`treeViewDivDraggableItem${file.path}`}
draggable={true}
onDragStart={onDragStart}
onDragEnd={onDragEnd}

Loading…
Cancel
Save