From ba744311ba7cf5c76fdf24aca8fb5f3f6f151418 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 1 Mar 2021 15:36:53 +0100 Subject: [PATCH] fix e2e --- apps/remix-ide-e2e/src/commands/removeFile.ts | 10 +++++----- apps/remix-ide-e2e/src/tests/fileExplorer.test.ts | 3 ++- apps/remix-ide-e2e/src/tests/remixd.test.ts | 2 +- apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts | 2 +- apps/remix-ide-e2e/src/types/index.d.ts | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/removeFile.ts b/apps/remix-ide-e2e/src/commands/removeFile.ts index 6afe3a8a1a..8f0e2c9ee2 100644 --- a/apps/remix-ide-e2e/src/commands/removeFile.ts +++ b/apps/remix-ide-e2e/src/commands/removeFile.ts @@ -3,9 +3,9 @@ import { NightwatchBrowser } from 'nightwatch' const EventEmitter = require('events') class RemoveFile extends EventEmitter { - command (this: NightwatchBrowser, path: string): NightwatchBrowser { + command (this: NightwatchBrowser, path: string, workspace: string): NightwatchBrowser { this.api.perform((done) => { - removeFile(this.api, path, () => { + removeFile(this.api, path, workspace, () => { done() this.emit('complete') }) @@ -14,7 +14,7 @@ class RemoveFile extends EventEmitter { } } -function removeFile (browser: NightwatchBrowser, path: string, done: VoidFunction) { +function removeFile (browser: NightwatchBrowser, path: string, workspace: string, done: VoidFunction) { browser.execute(function (path) { function contextMenuClick (element) { const evt = element.ownerDocument.createEvent('MouseEvents') @@ -39,8 +39,8 @@ function removeFile (browser: NightwatchBrowser, path: string, done: VoidFunctio .pause(2000) .perform(() => { console.log(path, 'to remove') - browser.waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"] .modal-ok') - .click('*[data-id="default_workspaceModalDialogContainer-react"] .modal-ok') + browser.waitForElementVisible('*[data-id="' + workspace + 'ModalDialogContainer-react"] .modal-ok') + .click('*[data-id="' + workspace + 'ModalDialogContainer-react"] .modal-ok') .waitForElementNotPresent('[data-path="' + path + '"]') done() }) diff --git a/apps/remix-ide-e2e/src/tests/fileExplorer.test.ts b/apps/remix-ide-e2e/src/tests/fileExplorer.test.ts index 91bda71ee9..562a7cba6e 100644 --- a/apps/remix-ide-e2e/src/tests/fileExplorer.test.ts +++ b/apps/remix-ide-e2e/src/tests/fileExplorer.test.ts @@ -43,7 +43,8 @@ module.exports = { .rightClick('[data-path="5_Renamed_Contract.sol"]') .click('*[id="menuitemdelete"]') .waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]') - .click('*[data-id="default_workspace-modal-footer-ok-react"]') + .waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]') + .click('*[data-id="default_workspaceModalDialogContainer-react"] .modal-ok') .waitForElementNotPresent('*[data-id="treeViewLitreeViewItem5_Renamed_Contract.sol"') }, diff --git a/apps/remix-ide-e2e/src/tests/remixd.test.ts b/apps/remix-ide-e2e/src/tests/remixd.test.ts index bf72bcb4af..818834b837 100644 --- a/apps/remix-ide-e2e/src/tests/remixd.test.ts +++ b/apps/remix-ide-e2e/src/tests/remixd.test.ts @@ -125,7 +125,7 @@ function runTests (browser: NightwatchBrowser) { .pause(1000) .renamePath('folder1/contract_' + browserName + '.sol', 'renamed_contract_' + browserName + '.sol', 'folder1/renamed_contract_' + browserName + '.sol') .pause(1000) - .removeFile('folder1/contract_' + browserName + '_toremove.sol') + .removeFile('folder1/contract_' + browserName + '_toremove.sol', 'localhost') .perform(function (done) { testImportFromRemixd(browser, () => { done() }) }) diff --git a/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts b/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts index 9ec8c7585d..8ed2635e1d 100644 --- a/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts +++ b/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts @@ -37,7 +37,7 @@ module.exports = { .clickLaunchIcon('fileExplorers') .pause(10000) .openFile('tests/simple_storage_test.sol') - .removeFile('tests/simple_storage_test.sol') + .removeFile('tests/simple_storage_test.sol', 'default_workspace') }, 'Should run simple unit test `simple_storage_test.sol` ': function (browser: NightwatchBrowser) { diff --git a/apps/remix-ide-e2e/src/types/index.d.ts b/apps/remix-ide-e2e/src/types/index.d.ts index aac4cccdfb..a2423ab159 100644 --- a/apps/remix-ide-e2e/src/types/index.d.ts +++ b/apps/remix-ide-e2e/src/types/index.d.ts @@ -41,7 +41,7 @@ declare module "nightwatch" { getInstalledPlugins(cb: (plugins: string[]) => void): NightwatchBrowser, verifyCallReturnValue(address: string, checks: string[]): NightwatchBrowser, testEditorValue(testvalue: string): NightwatchBrowser, - removeFile(path: string): NightwatchBrowser, + removeFile(path: string, workspace: string): NightwatchBrowser, switchBrowserWindow(url: string, windowName: string, cb: (browser: NightwatchBrowser, window?: NightwatchCallbackResult) => void): NightwatchBrowser, setupMetamask(passphrase: string, password: string): NightwatchBrowser, signMessage(msg: string, callback: (hash: { value: string }, signature: { value: string }) => void): NightwatchBrowser,