Commit b83bd26c authored by yann300's avatar yann300

fix e2e

parent fe0bb2e6
...@@ -3,9 +3,9 @@ import { NightwatchBrowser } from 'nightwatch' ...@@ -3,9 +3,9 @@ import { NightwatchBrowser } from 'nightwatch'
const EventEmitter = require('events') const EventEmitter = require('events')
class RemoveFile extends EventEmitter { class RemoveFile extends EventEmitter {
command (this: NightwatchBrowser, path: string): NightwatchBrowser { command (this: NightwatchBrowser, path: string, workspace: string): NightwatchBrowser {
this.api.perform((done) => { this.api.perform((done) => {
removeFile(this.api, path, () => { removeFile(this.api, path, workspace, () => {
done() done()
this.emit('complete') this.emit('complete')
}) })
...@@ -14,7 +14,7 @@ class RemoveFile extends EventEmitter { ...@@ -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) { browser.execute(function (path) {
function contextMenuClick (element) { function contextMenuClick (element) {
const evt = element.ownerDocument.createEvent('MouseEvents') const evt = element.ownerDocument.createEvent('MouseEvents')
...@@ -39,8 +39,8 @@ function removeFile (browser: NightwatchBrowser, path: string, done: VoidFunctio ...@@ -39,8 +39,8 @@ function removeFile (browser: NightwatchBrowser, path: string, done: VoidFunctio
.pause(2000) .pause(2000)
.perform(() => { .perform(() => {
console.log(path, 'to remove') console.log(path, 'to remove')
browser.waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"] .modal-ok') browser.waitForElementVisible('*[data-id="' + workspace + 'ModalDialogContainer-react"] .modal-ok')
.click('*[data-id="default_workspaceModalDialogContainer-react"] .modal-ok') .click('*[data-id="' + workspace + 'ModalDialogContainer-react"] .modal-ok')
.waitForElementNotPresent('[data-path="' + path + '"]') .waitForElementNotPresent('[data-path="' + path + '"]')
done() done()
}) })
......
...@@ -43,7 +43,8 @@ module.exports = { ...@@ -43,7 +43,8 @@ module.exports = {
.rightClick('[data-path="5_Renamed_Contract.sol"]') .rightClick('[data-path="5_Renamed_Contract.sol"]')
.click('*[id="menuitemdelete"]') .click('*[id="menuitemdelete"]')
.waitForElementVisible('*[data-id="default_workspaceModalDialogContainer-react"]') .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"') .waitForElementNotPresent('*[data-id="treeViewLitreeViewItem5_Renamed_Contract.sol"')
}, },
......
...@@ -125,7 +125,7 @@ function runTests (browser: NightwatchBrowser) { ...@@ -125,7 +125,7 @@ function runTests (browser: NightwatchBrowser) {
.pause(1000) .pause(1000)
.renamePath('folder1/contract_' + browserName + '.sol', 'renamed_contract_' + browserName + '.sol', 'folder1/renamed_contract_' + browserName + '.sol') .renamePath('folder1/contract_' + browserName + '.sol', 'renamed_contract_' + browserName + '.sol', 'folder1/renamed_contract_' + browserName + '.sol')
.pause(1000) .pause(1000)
.removeFile('folder1/contract_' + browserName + '_toremove.sol') .removeFile('folder1/contract_' + browserName + '_toremove.sol', 'localhost')
.perform(function (done) { .perform(function (done) {
testImportFromRemixd(browser, () => { done() }) testImportFromRemixd(browser, () => { done() })
}) })
......
...@@ -37,7 +37,7 @@ module.exports = { ...@@ -37,7 +37,7 @@ module.exports = {
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.pause(10000) .pause(10000)
.openFile('tests/simple_storage_test.sol') .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) { 'Should run simple unit test `simple_storage_test.sol` ': function (browser: NightwatchBrowser) {
......
...@@ -41,7 +41,7 @@ declare module "nightwatch" { ...@@ -41,7 +41,7 @@ declare module "nightwatch" {
getInstalledPlugins(cb: (plugins: string[]) => void): NightwatchBrowser, getInstalledPlugins(cb: (plugins: string[]) => void): NightwatchBrowser,
verifyCallReturnValue(address: string, checks: string[]): NightwatchBrowser, verifyCallReturnValue(address: string, checks: string[]): NightwatchBrowser,
testEditorValue(testvalue: 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<Window>) => void): NightwatchBrowser, switchBrowserWindow(url: string, windowName: string, cb: (browser: NightwatchBrowser, window?: NightwatchCallbackResult<Window>) => void): NightwatchBrowser,
setupMetamask(passphrase: string, password: string): NightwatchBrowser, setupMetamask(passphrase: string, password: string): NightwatchBrowser,
signMessage(msg: string, callback: (hash: { value: string }, signature: { value: string }) => void): NightwatchBrowser, signMessage(msg: string, callback: (hash: { value: string }, signature: { value: string }) => void): NightwatchBrowser,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment