LianaHus-patch-7
bunsenstraat 11 months ago
parent 756d0122c0
commit f0050e37e5
  1. 1
      apps/remix-ide-e2e/src/tests/file_explorer_context_menu.test.ts
  2. 125
      apps/remix-ide-e2e/src/tests/file_explorer_dragdrop.test.ts

@ -91,6 +91,7 @@ module.exports = {
.waitForElementPresent('[data-id="contextMenuItemcopy') .waitForElementPresent('[data-id="contextMenuItemcopy')
.click('[data-id="contextMenuItemcopy"]') .click('[data-id="contextMenuItemcopy"]')
.rightClick('*[data-id="treeViewUltreeViewMenu"]') .rightClick('*[data-id="treeViewUltreeViewMenu"]')
.saveScreenshot('./reports/screenshot/file_explorer_context_menu.png')
.click('*[data-id="contextMenuItempaste"]') .click('*[data-id="contextMenuItempaste"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemCopy_README.txt"]', 7000) .waitForElementVisible('*[data-id="treeViewLitreeViewItemCopy_README.txt"]', 7000)
}, },

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

Loading…
Cancel
Save