|
|
|
@ -17,7 +17,10 @@ module.exports = { |
|
|
|
|
createContract, |
|
|
|
|
modalFooterOKClick, |
|
|
|
|
setEditorValue, |
|
|
|
|
getEditorValue |
|
|
|
|
getEditorValue, |
|
|
|
|
testEditorValue, |
|
|
|
|
renameFile, |
|
|
|
|
removeFile |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getCompiledContracts (browser, compiled, callback) { |
|
|
|
@ -146,12 +149,13 @@ function testFunction (fnFullName, txHash, log, expectedInput, expectedReturn, e |
|
|
|
|
return this |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function setEditorValue (value) { |
|
|
|
|
function setEditorValue (value, callback) { |
|
|
|
|
this.perform((client, done) => { |
|
|
|
|
this.execute(function (value) { |
|
|
|
|
document.getElementById('input').editor.session.setValue(value) |
|
|
|
|
}, [value], function (result) { |
|
|
|
|
done() |
|
|
|
|
if (callback) callback() |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
return this |
|
|
|
@ -184,6 +188,13 @@ function getEditorValue (callback) { |
|
|
|
|
return this |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function testEditorValue (testvalue, callback) { |
|
|
|
|
this.getEditorValue((value) => { |
|
|
|
|
this.assert.equal(testvalue, value) |
|
|
|
|
callback() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function modalFooterOKClick () { |
|
|
|
|
this.perform((client, done) => { |
|
|
|
|
this.execute(function () { |
|
|
|
@ -215,6 +226,73 @@ function addFile (browser, name, content, done) { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function renameFile (browser, path, newFileName, renamedPath, done) { |
|
|
|
|
browser.execute(function (path) { |
|
|
|
|
function contextMenuClick (element) { |
|
|
|
|
var evt = element.ownerDocument.createEvent('MouseEvents') |
|
|
|
|
var RIGHT_CLICK_BUTTON_CODE = 2 // the same for FF and IE
|
|
|
|
|
evt.initMouseEvent('contextmenu', true, true, |
|
|
|
|
element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, |
|
|
|
|
false, false, false, RIGHT_CLICK_BUTTON_CODE, null) |
|
|
|
|
if (document.createEventObject) { |
|
|
|
|
// dispatch for IE
|
|
|
|
|
return element.fireEvent('onclick', evt) |
|
|
|
|
} else { |
|
|
|
|
// dispatch for firefox + others
|
|
|
|
|
return !element.dispatchEvent(evt) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
contextMenuClick(document.querySelector('[data-path="' + path + '"]')) |
|
|
|
|
}, [path], function (result) { |
|
|
|
|
browser |
|
|
|
|
.click('#menuitemrename') |
|
|
|
|
.perform((client, doneSetValue) => { |
|
|
|
|
browser.execute(function (path, addvalue) { |
|
|
|
|
document.querySelector('[data-path="' + path + '"]').innerHTML = addvalue |
|
|
|
|
}, [path, newFileName], () => { |
|
|
|
|
doneSetValue() |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
.click('body') // blur
|
|
|
|
|
.pause(500) |
|
|
|
|
.click('#modal-footer-ok') |
|
|
|
|
.waitForElementNotPresent('[data-path="' + path + '"]') |
|
|
|
|
.waitForElementPresent('[data-path="' + renamedPath + '"]') |
|
|
|
|
.perform(() => { |
|
|
|
|
done() |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function removeFile (browser, path, done) { |
|
|
|
|
browser.execute(function (path, value) { |
|
|
|
|
function contextMenuClick (element) { |
|
|
|
|
var evt = element.ownerDocument.createEvent('MouseEvents') |
|
|
|
|
var RIGHT_CLICK_BUTTON_CODE = 2 // the same for FF and IE
|
|
|
|
|
evt.initMouseEvent('contextmenu', true, true, |
|
|
|
|
element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, |
|
|
|
|
false, false, false, RIGHT_CLICK_BUTTON_CODE, null) |
|
|
|
|
if (document.createEventObject) { |
|
|
|
|
// dispatch for IE
|
|
|
|
|
return element.fireEvent('onclick', evt) |
|
|
|
|
} else { |
|
|
|
|
// dispatch for firefox + others
|
|
|
|
|
return !element.dispatchEvent(evt) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
contextMenuClick(document.querySelector('[data-path="' + path + '"]')) |
|
|
|
|
}, [path], function (result) { |
|
|
|
|
browser |
|
|
|
|
.click('#menuitemdelete') |
|
|
|
|
.pause(500) |
|
|
|
|
.click('#modal-footer-ok') |
|
|
|
|
.waitForElementNotPresent('[data-path="' + path + '"]') |
|
|
|
|
.perform(() => { |
|
|
|
|
done() |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function useFilter (browser, filter, test, done) { |
|
|
|
|
if (browser.options.desiredCapabilities.browserName === 'chrome') { // nightwatch deos not handle well that part.... works locally
|
|
|
|
|
done() |
|
|
|
|