From e3df77a51ea3b3923fc80ab6e496412847c7a171 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Fri, 5 Jan 2024 12:02:29 +0100 Subject: [PATCH] drag drop tests --- .../src/tests/file_explorer_dragdrop.test.ts | 79 +++++++++++++++++-- 1 file changed, 73 insertions(+), 6 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/file_explorer_dragdrop.test.ts b/apps/remix-ide-e2e/src/tests/file_explorer_dragdrop.test.ts index 13025fb843..07a8142dc8 100644 --- a/apps/remix-ide-e2e/src/tests/file_explorer_dragdrop.test.ts +++ b/apps/remix-ide-e2e/src/tests/file_explorer_dragdrop.test.ts @@ -7,15 +7,82 @@ module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { init(browser, done) }, - 'drag and drop file from root to contracts #group1': async function (browser: NightwatchBrowser) { - browser.findElement('li[data-id="treeViewLitreeViewItemcontracts"]', (el) => { + 'drag and drop file from root to contracts #group1 #flaky': function (browser: NightwatchBrowser) { + 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) { + 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) { + 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) { + browser.findElement('*[data-id="treeViewUltreeViewMenu"]', (el) => { console.log((el as any).value.getId()) const id = (el as any).value.getId() browser - .clickLaunchIcon('filePanel') - .waitForElementVisible('li[data-id="treeViewLitreeViewItemREADME.txt"]') - .dragAndDrop('li[data-id="treeViewLitreeViewItemREADME.txt"]', id) - .waitForElementVisible('li[data-id="treeViewLitreeViewItemcontracts/README.txt"]') + .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) { + 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"]') + }) } + + + } \ No newline at end of file