diff --git a/apps/remix-ide-e2e/src/commands/checkElementStyle.ts b/apps/remix-ide-e2e/src/commands/checkElementStyle.ts index 139bc622f1..6d3a099833 100644 --- a/apps/remix-ide-e2e/src/commands/checkElementStyle.ts +++ b/apps/remix-ide-e2e/src/commands/checkElementStyle.ts @@ -20,7 +20,7 @@ function checkStyle (browser: NightwatchBrowser, cssSelector: string, stylePrope const value = result.value if (typeof value === 'string') { - browser.assert.equal(value.trim(), expectedResult) + browser.assert.equal(value.trim().toLowerCase(), expectedResult.toLowerCase()) } else { browser.assert.fail('Failed with error info :', result.value.toString()) } diff --git a/apps/remix-ide-e2e/src/helpers/init.ts b/apps/remix-ide-e2e/src/helpers/init.ts index e4c0bbf6b5..c2c291f19f 100644 --- a/apps/remix-ide-e2e/src/helpers/init.ts +++ b/apps/remix-ide-e2e/src/helpers/init.ts @@ -11,8 +11,9 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url if (preloadPlugins) { initModules(browser, () => { browser.clickLaunchIcon('solidity') - .waitForElementPresent('[for="autoCompile"]') + .waitForElementVisible('[for="autoCompile"]') .click('[for="autoCompile"]') + .verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked') }) } }) diff --git a/apps/remix-ide-e2e/src/tests/remixd.test.ts b/apps/remix-ide-e2e/src/tests/remixd.test.ts index d9d32cf147..333bb49ff7 100644 --- a/apps/remix-ide-e2e/src/tests/remixd.test.ts +++ b/apps/remix-ide-e2e/src/tests/remixd.test.ts @@ -99,7 +99,7 @@ function runTests (browser: NightwatchBrowser) { .assert.containsText('[data-path="localhost/contract1.sol"]', 'contract1.sol') .assert.containsText('[data-path="localhost/contract2.sol"]', 'contract2.sol') .waitForElementVisible('[data-path="localhost/folder1/contract1.sol"]') - .assert.containsText('[data-path="localhost/folder1/cont ract1.sol"]', 'contract1.sol') + .assert.containsText('[data-path="localhost/folder1/contract1.sol"]', 'contract1.sol') .assert.containsText('[data-path="localhost/folder1/contract2.sol"]', 'contract2.sol') // load and test sub folder .click('[data-path="localhost/folder1/contract2.sol"]') .click('[data-path="localhost/folder1/contract1.sol"]') // open localhost/folder1/contract1.sol diff --git a/apps/remix-ide/test-browser/commands/addAtAddressInstance.js b/apps/remix-ide/test-browser/commands/addAtAddressInstance.js deleted file mode 100644 index 8c2e7680f6..0000000000 --- a/apps/remix-ide/test-browser/commands/addAtAddressInstance.js +++ /dev/null @@ -1,33 +0,0 @@ -const EventEmitter = require('events') - -class addAtAddressInstance extends EventEmitter { - command (address, isValidFormat, isValidChecksum) { - this.api.perform((done) => { - addInstance(this.api, address, isValidFormat, isValidChecksum, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function addInstance (browser, address, isValidFormat, isValidChecksum, callback) { - browser.clickLaunchIcon('udapp').clearValue('.ataddressinput').setValue('.ataddressinput', address, function () { - browser.click('button[id^="runAndDeployAtAdressButton"]') - .execute(function () { - var ret = document.querySelector('div[class^="modal-body"] div').innerHTML - document.querySelector('#modal-footer-ok').click() - return ret - }, [], function (result) { - if (!isValidFormat) { - browser.assert.equal(result.value, 'Invalid address.') - } else if (!isValidChecksum) { - browser.assert.equal(result.value, 'Invalid checksum address.') - } - callback() - }) - }) -} - -module.exports = addAtAddressInstance diff --git a/apps/remix-ide/test-browser/commands/addFile.js b/apps/remix-ide/test-browser/commands/addFile.js deleted file mode 100644 index 5c5564d666..0000000000 --- a/apps/remix-ide/test-browser/commands/addFile.js +++ /dev/null @@ -1,36 +0,0 @@ -const EventEmitter = require('events') - -class AddFile extends EventEmitter { - command (name, content) { - this.api.perform((done) => { - addFile(this.api, name, content, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function addFile (browser, name, content, done) { - browser.clickLaunchIcon('udapp').clickLaunchIcon('fileExplorers').click('.newFile') - .waitForElementVisible('#modal-dialog') - .perform((client, done) => { - browser.execute(function (fileName) { - if (fileName !== 'Untitled.sol') { - document.querySelector('#modal-dialog #prompt_text').setAttribute('value', fileName) - } - document.querySelector('#modal-footer-ok').click() - }, [name], function (result) { - console.log(result) - done() - }) - }) - .setEditorValue(content.content) - .pause(1000) - .perform(function () { - done() - }) -} - -module.exports = AddFile diff --git a/apps/remix-ide/test-browser/commands/checkElementStyle.js b/apps/remix-ide/test-browser/commands/checkElementStyle.js deleted file mode 100644 index 4fb00f0495..0000000000 --- a/apps/remix-ide/test-browser/commands/checkElementStyle.js +++ /dev/null @@ -1,26 +0,0 @@ -const EventEmitter = require('events') - -class checkElementStyle extends EventEmitter { - command (cssSelector, styleProperty, expectedResult) { - this.api.perform((done) => { - checkStyle(this.api, cssSelector, styleProperty, expectedResult, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function checkStyle (browser, cssSelector, styleProperty, expectedResult, callback) { - browser.execute(function (cssSelector, styleProperty) { - return window.getComputedStyle(document.querySelector(cssSelector)).getPropertyValue(styleProperty) - }, [cssSelector, styleProperty], function (result) { - const value = result.value - - browser.assert.equal(value.trim().toLowerCase(), expectedResult.toLowerCase()) - callback() - }) -} - -module.exports = checkElementStyle diff --git a/apps/remix-ide/test-browser/commands/checkTerminalFilter.js b/apps/remix-ide/test-browser/commands/checkTerminalFilter.js deleted file mode 100644 index 8f78306fe2..0000000000 --- a/apps/remix-ide/test-browser/commands/checkTerminalFilter.js +++ /dev/null @@ -1,35 +0,0 @@ -const EventEmitter = require('events') - -class CheckTerminalFilter extends EventEmitter { - command (filter, test) { - this.api.perform((done) => { - checkFilter(this.api, filter, test, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function checkFilter (browser, filter, test, done) { - if (browser.options.desiredCapabilities.browserName === 'chrome') { // nightwatch deos not handle well that part.... works locally - done() - return - } - const filterClass = '[data-id="terminalInputSearch"]' - browser.setValue(filterClass, filter, function () { - browser.execute(function () { - return document.querySelector('[data-id="terminalJournal"]').innerHTML === test - }, [], function (result) { - browser.clearValue(filterClass).setValue(filterClass, '', function () { - if (!result.value) { - browser.assert.fail('useFilter on ' + filter + ' ' + test, 'info about error', '') - } - done() - }) - }) - }) -} - -module.exports = CheckTerminalFilter diff --git a/apps/remix-ide/test-browser/commands/checkVariableDebug.js b/apps/remix-ide/test-browser/commands/checkVariableDebug.js deleted file mode 100644 index d5ad7834e1..0000000000 --- a/apps/remix-ide/test-browser/commands/checkVariableDebug.js +++ /dev/null @@ -1,38 +0,0 @@ -const EventEmitter = require('events') -const deepequal = require('deep-equal') - -class CreateContract extends EventEmitter { - command (id, debugValue) { - this.api.perform((done) => { - checkDebug(this.api, id, debugValue, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function checkDebug (browser, id, debugValue, done) { - // id is soliditylocals or soliditystate - browser.execute(function (id) { - return document.querySelector('#' + id + ' .dropdownrawcontent').innerText - }, [id], function (result) { - console.log(id + ' ' + result.value) - var value - try { - value = JSON.parse(result.value) - } catch (e) { - browser.assert.fail('cant parse solidity state', e.message, '') - done() - return - } - var equal = deepequal(debugValue, value) - if (!equal) { - browser.assert.fail('checkDebug on ' + id, 'info about error\n ' + JSON.stringify(debugValue) + '\n ' + JSON.stringify(value), '') - } - done() - }) -} - -module.exports = CreateContract diff --git a/apps/remix-ide/test-browser/commands/clearEditableContent.js b/apps/remix-ide/test-browser/commands/clearEditableContent.js deleted file mode 100644 index f80aef543a..0000000000 --- a/apps/remix-ide/test-browser/commands/clearEditableContent.js +++ /dev/null @@ -1,30 +0,0 @@ -const EventEmitter = require('events') - -class clearEditablecontent extends EventEmitter { - command (cssSelector) { - this.api.perform((done) => { - clearContent(this.api, cssSelector, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function clearContent (browser, cssSelector, callback) { - browser.execute(function (cssSelector) { - const selection = window.getSelection() - const range = document.createRange() - - range.selectNodeContents(document.querySelector(cssSelector)) - selection.removeAllRanges() - selection.addRange(range) - }, [cssSelector], function () { - browser.sendKeys(cssSelector, browser.Keys.BACK_SPACE) - .pause(5000) - callback() - }) -} - -module.exports = clearEditablecontent diff --git a/apps/remix-ide/test-browser/commands/clickElementAtPosition.js b/apps/remix-ide/test-browser/commands/clickElementAtPosition.js deleted file mode 100644 index b0ec4816f6..0000000000 --- a/apps/remix-ide/test-browser/commands/clickElementAtPosition.js +++ /dev/null @@ -1,24 +0,0 @@ -const EventEmitter = require('events') - -class ClickElement extends EventEmitter { - command (cssSelector, index = 0) { - this.api.perform((done) => { - _clickElement(this.api, cssSelector, index, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function _clickElement (browser, cssSelector, index, cb) { - browser.waitForElementPresent(cssSelector) - .execute(function (cssSelector, index) { - document.querySelectorAll(cssSelector)[index].click() - }, [cssSelector, index], function () { - cb() - }) -} - -module.exports = ClickElement diff --git a/apps/remix-ide/test-browser/commands/clickFunction.js b/apps/remix-ide/test-browser/commands/clickFunction.js deleted file mode 100644 index fce9b7f811..0000000000 --- a/apps/remix-ide/test-browser/commands/clickFunction.js +++ /dev/null @@ -1,25 +0,0 @@ -const EventEmitter = require('events') - -class ClickFunction extends EventEmitter { - command (fnFullName, expectedInput) { - this.api.waitForElementPresent('.instance button[title="' + fnFullName + '"]') - .perform(function (client, done) { - client.execute(function () { - document.querySelector('#runTabView').scrollTop = document.querySelector('#runTabView').scrollHeight - }, [], function () { - if (expectedInput) { - client.setValue('#runTabView input[title="' + expectedInput.types + '"]', expectedInput.values, function () {}) - } - done() - }) - }) - .click('.instance button[title="' + fnFullName + '"]') - .pause(2000) - .perform(() => { - this.emit('complete') - }) - return this - } -} - -module.exports = ClickFunction diff --git a/apps/remix-ide/test-browser/commands/clickInstance.js b/apps/remix-ide/test-browser/commands/clickInstance.js deleted file mode 100644 index 2c01f08095..0000000000 --- a/apps/remix-ide/test-browser/commands/clickInstance.js +++ /dev/null @@ -1,12 +0,0 @@ -const EventEmitter = require('events') - -class ClickInstance extends EventEmitter { - command (index) { - index = index + 2 - let selector = '.instance:nth-of-type(' + index + ') > div > button' - this.api.waitForElementPresent(selector).scrollAndClick(selector).perform(() => { this.emit('complete') }) - return this - } -} - -module.exports = ClickInstance diff --git a/apps/remix-ide/test-browser/commands/clickLaunchIcon.js b/apps/remix-ide/test-browser/commands/clickLaunchIcon.js deleted file mode 100644 index 850c0d0197..0000000000 --- a/apps/remix-ide/test-browser/commands/clickLaunchIcon.js +++ /dev/null @@ -1,13 +0,0 @@ -const EventEmitter = require('events') - -class ClickLaunchIcon extends EventEmitter { - command (icon) { - this.api.waitForElementVisible('#icon-panel div[plugin="' + icon + '"]').click('#icon-panel div[plugin="' + icon + '"]').perform((done) => { - done() - this.emit('complete') - }) - return this - } -} - -module.exports = ClickLaunchIcon diff --git a/apps/remix-ide/test-browser/commands/createContract.js b/apps/remix-ide/test-browser/commands/createContract.js deleted file mode 100644 index ae108816bd..0000000000 --- a/apps/remix-ide/test-browser/commands/createContract.js +++ /dev/null @@ -1,31 +0,0 @@ -const EventEmitter = require('events') - -class CreateContract extends EventEmitter { - command (inputParams) { - this.api.perform((done) => { - createContract(this.api, inputParams, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function createContract (browser, inputParams, callback) { - if (inputParams) { - browser.clickLaunchIcon('settings').clickLaunchIcon('udapp') - .setValue('div[class^="contractActionsContainerSingle"] input', inputParams, function () { - browser.click('#runTabView button[class^="instanceButton"]').pause(500).perform(function () { callback() }) - }) - } else { - browser - .clickLaunchIcon('settings') - .clickLaunchIcon('udapp') - .click('#runTabView button[class^="instanceButton"]') - .pause(500) - .perform(function () { callback() }) - } -} - -module.exports = CreateContract diff --git a/apps/remix-ide/test-browser/commands/debugTransaction.js b/apps/remix-ide/test-browser/commands/debugTransaction.js deleted file mode 100644 index 7ef32af5a3..0000000000 --- a/apps/remix-ide/test-browser/commands/debugTransaction.js +++ /dev/null @@ -1,25 +0,0 @@ -const EventEmitter = require('events') - -class debugTransaction extends EventEmitter { - command (index = 0) { - this.api.perform((done) => { - checkStyle(this.api, index, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function checkStyle (browser, index, callback) { - browser.pause(2000).execute(function (index) { - const debugBtn = document.querySelectorAll('*[data-shared="txLoggerDebugButton"]')[index] - - debugBtn.click() - }, [index], function () { - callback() - }) -} - -module.exports = debugTransaction diff --git a/apps/remix-ide/test-browser/commands/editorScroll.js b/apps/remix-ide/test-browser/commands/editorScroll.js deleted file mode 100644 index d2b08c9ebe..0000000000 --- a/apps/remix-ide/test-browser/commands/editorScroll.js +++ /dev/null @@ -1,21 +0,0 @@ -const EventEmitter = require('events') - -// fix for editor scroll -class ScrollEditor extends EventEmitter { - command (direction, numberOfTimes) { - const browser = this.api - - browser.waitForElementPresent('.ace_text-input') - for (let i = 0; i < numberOfTimes; i++) { - if (direction.toLowerCase() === 'up') browser.sendKeys('.ace_text-input', browser.Keys.ARROW_UP) - if (direction.toLowerCase() === 'down') browser.sendKeys('.ace_text-input', browser.Keys.ARROW_DOWN) - } - browser.perform((done) => { - done() - this.emit('complete') - }) - return this - } -} - -module.exports = ScrollEditor diff --git a/apps/remix-ide/test-browser/commands/executeScript.js b/apps/remix-ide/test-browser/commands/executeScript.js deleted file mode 100644 index 38396ea423..0000000000 --- a/apps/remix-ide/test-browser/commands/executeScript.js +++ /dev/null @@ -1,18 +0,0 @@ -const EventEmitter = require('events') - -class ExecuteScript extends EventEmitter { - command (script) { - this.api - .clearEditableContent('*[data-id="terminalCliInput"]') - .click('*[data-id="terminalCli"]') - .sendKeys('*[data-id="terminalCliInput"]', script) - .sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER) - .sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER) - .perform(() => { - this.emit('complete') - }) - return this - } -} - -module.exports = ExecuteScript diff --git a/apps/remix-ide/test-browser/commands/getAddressAtPosition.js b/apps/remix-ide/test-browser/commands/getAddressAtPosition.js deleted file mode 100644 index b0af766747..0000000000 --- a/apps/remix-ide/test-browser/commands/getAddressAtPosition.js +++ /dev/null @@ -1,28 +0,0 @@ -const EventEmitter = require('events') - -class GetAddressAtPosition extends EventEmitter { - command (index, cb) { - this.api.perform((done) => { - getAddressAtPosition(this.api, index, (pos) => { - done() - cb(pos) - this.emit('complete') - }) - }) - return this - } -} - -function getAddressAtPosition (browser, index, callback) { - browser.waitForElementPresent('*[data-shared="universalDappUiInstance"]') - .execute(function (index) { - const deployedContracts = document.querySelectorAll('*[data-shared="universalDappUiInstance"]') - const id = deployedContracts[index].getAttribute('id') - - return id.replace('instance', '') - }, [index], function (result) { - callback(result.value) - }) -} - -module.exports = GetAddressAtPosition diff --git a/apps/remix-ide/test-browser/commands/getEditorValue.js b/apps/remix-ide/test-browser/commands/getEditorValue.js deleted file mode 100644 index f62d88ba2f..0000000000 --- a/apps/remix-ide/test-browser/commands/getEditorValue.js +++ /dev/null @@ -1,18 +0,0 @@ -const EventEmitter = require('events') - -class GetEditorValue extends EventEmitter { - command (callback) { - this.api.perform((client, done) => { - this.api.execute(function (value) { - return document.getElementById('input').editor.getValue() - }, [], (result) => { - done(result.value) - callback(result.value) - this.emit('complete') - }) - }) - return this - } -} - -module.exports = GetEditorValue diff --git a/apps/remix-ide/test-browser/commands/getInstalledPlugins.js b/apps/remix-ide/test-browser/commands/getInstalledPlugins.js deleted file mode 100644 index fadbcca320..0000000000 --- a/apps/remix-ide/test-browser/commands/getInstalledPlugins.js +++ /dev/null @@ -1,27 +0,0 @@ -const EventEmitter = require('events') - -class GetInstalledPlugins extends EventEmitter { - command (cb) { - const browser = this.api - - browser.waitForElementPresent('[plugin]:not([plugin=""]') - .perform((done) => { - browser.execute(function() { - const pluginNames = [] - const plugins = document.querySelectorAll('[plugin]:not([plugin=""]') - - plugins.forEach(plugin => { - pluginNames.push(plugin.getAttribute('plugin')) - }) - return pluginNames - }, [], (result) => { - done() - cb(result.value) - this.emit('complete') - }) - }) - return this - } -} - -module.exports = GetInstalledPlugins diff --git a/apps/remix-ide/test-browser/commands/getModalBody.js b/apps/remix-ide/test-browser/commands/getModalBody.js deleted file mode 100644 index 5467275c12..0000000000 --- a/apps/remix-ide/test-browser/commands/getModalBody.js +++ /dev/null @@ -1,16 +0,0 @@ -const EventEmitter = require('events') - -class GetModalBody extends EventEmitter { - command (callback) { - this.api.waitForElementVisible('.modal-body') - .getText('.modal-body', (result) => { - console.log(result) - callback(result.value, () => { - this.emit('complete') - }) - }) - return this - } -} - -module.exports = GetModalBody diff --git a/apps/remix-ide/test-browser/commands/goToVMTraceStep.js b/apps/remix-ide/test-browser/commands/goToVMTraceStep.js deleted file mode 100644 index d31e184dca..0000000000 --- a/apps/remix-ide/test-browser/commands/goToVMTraceStep.js +++ /dev/null @@ -1,37 +0,0 @@ -const EventEmitter = require('events') - -class GoToVmTraceStep extends EventEmitter { - command (step, incr) { - this.api.perform((done) => { - goToVMtraceStep(this.api, step, incr, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function goToVMtraceStep (browser, step, incr, done) { - if (!incr) incr = 0 - browser.execute(function (step) { - return document.querySelector('#stepdetail').innerHTML - }, [step], function (result) { - if (result.value.indexOf('vm trace step:') !== -1 && result.value.indexOf(step) !== -1) { - done() - } else if (incr > 1000) { - browser.assert.fail('goToVMtraceStep fails', 'info about error', '') - done() - } else { - incr++ - browser.click('#intoforward') - .perform(() => { - setTimeout(() => { - goToVMtraceStep(browser, step, incr, done) - }, 200) - }) - } - }) -} - -module.exports = GoToVmTraceStep diff --git a/apps/remix-ide/test-browser/commands/journalChildIncludes.js b/apps/remix-ide/test-browser/commands/journalChildIncludes.js deleted file mode 100644 index 6e4f0d7fee..0000000000 --- a/apps/remix-ide/test-browser/commands/journalChildIncludes.js +++ /dev/null @@ -1,30 +0,0 @@ -const EventEmitter = require('events') - -/* - Checks if any child elements of journal (console) contains a matching value. -*/ -class JournalChildIncludes extends EventEmitter { - command (val) { - let isTextFound = false - const browser = this.api - - this.api.elements('css selector', '*[data-id="terminalJournal"]', (res) => { - res.value.forEach(function (jsonWebElement) { - const jsonWebElementId = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]] - - browser.elementIdText(jsonWebElementId, (jsonElement) => { - const text = jsonElement.value - - if (text.indexOf(val) !== -1) isTextFound = true - }) - }) - }) - browser.perform(() => { - browser.assert.ok(isTextFound, isTextFound ? `<*[data-id="terminalJournal"]> contains ${val}.` : `${val} not found in <*[data-id="terminalJournal"]> div:last-child>`) - this.emit('complete') - }) - return this - } -} - -module.exports = JournalChildIncludes diff --git a/apps/remix-ide/test-browser/commands/journalLastChild.js b/apps/remix-ide/test-browser/commands/journalLastChild.js deleted file mode 100644 index 49d0fb3516..0000000000 --- a/apps/remix-ide/test-browser/commands/journalLastChild.js +++ /dev/null @@ -1,14 +0,0 @@ -const EventEmitter = require('events') - -class JournalLastChild extends EventEmitter { - command (val) { - this.api - .waitForElementVisible('*[data-id="terminalJournal"] > div:last-child', 10000) - .assert.containsText('*[data-id="terminalJournal"] > div:last-child', val).perform(() => { - this.emit('complete') - }) - return this - } -} - -module.exports = JournalLastChild diff --git a/apps/remix-ide/test-browser/commands/journalLastChildIncludes.js b/apps/remix-ide/test-browser/commands/journalLastChildIncludes.js deleted file mode 100644 index c480694fbe..0000000000 --- a/apps/remix-ide/test-browser/commands/journalLastChildIncludes.js +++ /dev/null @@ -1,20 +0,0 @@ -const EventEmitter = require('events') - -/* - Check if the last log in the console contains a specific text -*/ -class JournalLastChildIncludes extends EventEmitter { - command (val) { - this.api - .waitForElementVisible('*[data-id="terminalJournal"] > div:last-child', 10000) - .getText('*[data-id="terminalJournal"] > div:last-child', (result) => { - console.log('JournalLastChildIncludes', result.value) - if (result.value.indexOf(val) === -1) return this.api.assert.fail(`wait for ${val} in ${result.value}`) - else this.api.assert.ok(`<*[data-id="terminalJournal"] > div:last-child> contains ${val}.`) - this.emit('complete') - }) - return this - } -} - -module.exports = JournalLastChildIncludes diff --git a/apps/remix-ide/test-browser/commands/modalFooterCancelClick.js b/apps/remix-ide/test-browser/commands/modalFooterCancelClick.js deleted file mode 100644 index 86adbc63b3..0000000000 --- a/apps/remix-ide/test-browser/commands/modalFooterCancelClick.js +++ /dev/null @@ -1,17 +0,0 @@ -const EventEmitter = require('events') - -class ModalFooterOKClick extends EventEmitter { - command () { - this.api.waitForElementVisible('#modal-footer-cancel').perform((client, done) => { - this.api.execute(function () { - document.querySelector('#modal-footer-cancel').click() - }, [], (result) => { - done() - this.emit('complete') - }) - }) - return this - } -} - -module.exports = ModalFooterOKClick diff --git a/apps/remix-ide/test-browser/commands/modalFooterOKClick.js b/apps/remix-ide/test-browser/commands/modalFooterOKClick.js deleted file mode 100644 index b6c0db5b7c..0000000000 --- a/apps/remix-ide/test-browser/commands/modalFooterOKClick.js +++ /dev/null @@ -1,17 +0,0 @@ -const EventEmitter = require('events') - -class ModalFooterOKClick extends EventEmitter { - command () { - this.api.waitForElementVisible('#modal-footer-ok').perform((client, done) => { - this.api.execute(function () { - document.querySelector('#modal-footer-ok').click() - }, [], (result) => { - done() - this.emit('complete') - }) - }) - return this - } -} - -module.exports = ModalFooterOKClick diff --git a/apps/remix-ide/test-browser/commands/noWorkerErrorFor.js b/apps/remix-ide/test-browser/commands/noWorkerErrorFor.js deleted file mode 100644 index 614e710c14..0000000000 --- a/apps/remix-ide/test-browser/commands/noWorkerErrorFor.js +++ /dev/null @@ -1,28 +0,0 @@ -const EventEmitter = require('events') - -class NoWorkerErrorFor extends EventEmitter { - command (version) { - this.api.perform((done) => { - noWorkerErrorFor(this.api, version, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function noWorkerErrorFor (browser, version, callback) { - browser - .setSolidityCompilerVersion(version) - .click('*[data-id="compilerContainerCompileBtn"]') - .waitForElementPresent('*[data-id="compilationFinishedWith_' + version + '"]', 10000) - .notContainsText('*[data-id="compiledErrors"]', 'worker error:undefined') - .notContainsText('*[data-id="compiledErrors"]', 'Uncaught RangeError: Maximum call stack size exceeded') - .notContainsText('*[data-id="compiledErrors"]', 'RangeError: Maximum call stack size exceeded') - .perform(() => { - callback() - }) -} - -module.exports = NoWorkerErrorFor diff --git a/apps/remix-ide/test-browser/commands/notContainsText.js b/apps/remix-ide/test-browser/commands/notContainsText.js deleted file mode 100644 index d2faa1d8ad..0000000000 --- a/apps/remix-ide/test-browser/commands/notContainsText.js +++ /dev/null @@ -1,18 +0,0 @@ -const EventEmitter = require('events') - -class NotContainsText extends EventEmitter { - command (cssSelector, text) { - const browser = this.api - - browser.getText(cssSelector, (result) => { - if (result.value.includes(text)) return this.api.assert.fail(`${cssSelector} contains ${text}.`) - else this.api.assert.ok(`${cssSelector} does not contains ${text}.`) - }) - .perform(() => { - this.emit('complete') - }) - return this - } -} - -module.exports = NotContainsText diff --git a/apps/remix-ide/test-browser/commands/openFile.js b/apps/remix-ide/test-browser/commands/openFile.js deleted file mode 100644 index 3812afa0ed..0000000000 --- a/apps/remix-ide/test-browser/commands/openFile.js +++ /dev/null @@ -1,26 +0,0 @@ -const EventEmitter = require('events') - -class OpenFile extends EventEmitter { - command (name) { - this.api.perform((done) => { - openFile(this.api, name, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -// click on fileExplorer can toggle it. We go through settings to be sure FE is open -function openFile (browser, name, done) { - browser.clickLaunchIcon('settings').clickLaunchIcon('fileExplorers') - .waitForElementVisible('li[key="' + name + '"]') - .click('li[key="' + name + '"]') - .pause(2000) - .perform(() => { - done() - }) -} - -module.exports = OpenFile diff --git a/apps/remix-ide/test-browser/commands/removeFile.js b/apps/remix-ide/test-browser/commands/removeFile.js deleted file mode 100644 index c2ebb3b873..0000000000 --- a/apps/remix-ide/test-browser/commands/removeFile.js +++ /dev/null @@ -1,46 +0,0 @@ -const EventEmitter = require('events') - -class RemoveFile extends EventEmitter { - command (path) { - this.api.perform((done) => { - removeFile(this.api, path, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function removeFile (browser, path, 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 - .waitForElementVisible('#menuitemdelete', 2000) - .click('#menuitemdelete') - .pause(500) - .waitForElementVisible('#modal-footer-ok', 2000) - .click('#modal-footer-ok') - .waitForElementNotPresent('[data-path="' + path + '"]') - .perform(() => { - done() - }) - }) -} - -module.exports = RemoveFile diff --git a/apps/remix-ide/test-browser/commands/renameFile.js b/apps/remix-ide/test-browser/commands/renameFile.js deleted file mode 100644 index 840b0974d6..0000000000 --- a/apps/remix-ide/test-browser/commands/renameFile.js +++ /dev/null @@ -1,54 +0,0 @@ -const EventEmitter = require('events') - -class RenameFile extends EventEmitter { - command (path, newFileName, renamedPath) { - this.api.perform((done) => { - renameFile(this.api, path, newFileName, renamedPath, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -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 - .waitForElementVisible('#modal-footer-ok', 10000) - .pause(2000) - .click('#modal-footer-ok') - .waitForElementNotPresent('[data-path="' + path + '"]') - .waitForElementPresent('[data-path="' + renamedPath + '"]') - .perform(() => { - done() - }) - }) -} - -module.exports = RenameFile diff --git a/apps/remix-ide/test-browser/commands/rightClick.js b/apps/remix-ide/test-browser/commands/rightClick.js deleted file mode 100644 index 827b5f02df..0000000000 --- a/apps/remix-ide/test-browser/commands/rightClick.js +++ /dev/null @@ -1,36 +0,0 @@ -const EventEmitter = require('events') - -class RightClick extends EventEmitter { - command (cssSelector) { - this.api.perform((done) => { - rightClick(this.api, cssSelector, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function rightClick (browser, cssSelector, callback) { - browser.execute(function (cssSelector) { - const element = document.querySelector(cssSelector) - const evt = element.ownerDocument.createEvent('MouseEvents') - const RIGHT_CLICK_BUTTON_CODE = 2 - - 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) - } - }, [cssSelector], function () { - callback() - }) -} - -module.exports = RightClick diff --git a/apps/remix-ide/test-browser/commands/scrollAndClick.js b/apps/remix-ide/test-browser/commands/scrollAndClick.js deleted file mode 100644 index ab44f47d57..0000000000 --- a/apps/remix-ide/test-browser/commands/scrollAndClick.js +++ /dev/null @@ -1,15 +0,0 @@ -const EventEmitter = require('events') - -class scrollAndClick extends EventEmitter { - command (target) { - this.api - .scrollInto(target) - .click(target) - .perform(() => { - this.emit('complete') - }) - return this - } -} - -module.exports = scrollAndClick diff --git a/apps/remix-ide/test-browser/commands/scrollInto.js b/apps/remix-ide/test-browser/commands/scrollInto.js deleted file mode 100644 index e5727225c0..0000000000 --- a/apps/remix-ide/test-browser/commands/scrollInto.js +++ /dev/null @@ -1,23 +0,0 @@ -const EventEmitter = require('events') - -class ScrollInto extends EventEmitter { - command (target) { - this.api.perform((client, done) => { - _scrollInto(this.api, target, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function _scrollInto (browser, target, cb) { - browser.execute(function (target) { - document.querySelector(target).scrollIntoView(({block: 'center'})) - }, [target], function () { - cb() - }) -} - -module.exports = ScrollInto diff --git a/apps/remix-ide/test-browser/commands/selectAccount.js b/apps/remix-ide/test-browser/commands/selectAccount.js deleted file mode 100644 index 132a52679e..0000000000 --- a/apps/remix-ide/test-browser/commands/selectAccount.js +++ /dev/null @@ -1,16 +0,0 @@ -const EventEmitter = require('events') - -class SelectAccount extends EventEmitter { - command (account) { - if (account) { - this.api - .click(`select[data-id="runTabSelectAccount"] [value="${account}"]`) - .perform(() => { - this.emit('complete') - }) - } else this.emit('complete') - return this - } -} - -module.exports = SelectAccount diff --git a/apps/remix-ide/test-browser/commands/selectContract.js b/apps/remix-ide/test-browser/commands/selectContract.js deleted file mode 100644 index 98a6eb7600..0000000000 --- a/apps/remix-ide/test-browser/commands/selectContract.js +++ /dev/null @@ -1,22 +0,0 @@ -const EventEmitter = require('events') - -class SelectContract extends EventEmitter { - command (contractName) { - this.api.perform((done) => { - selectContract(this.api, contractName, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function selectContract (browser, contractName, callback) { - browser.clickLaunchIcon('settings').clickLaunchIcon('udapp') - .setValue('#runTabView select[class^="contractNames"]', contractName).perform(() => { - callback() - }) -} - -module.exports = SelectContract diff --git a/apps/remix-ide/test-browser/commands/sendLowLevelTx.js b/apps/remix-ide/test-browser/commands/sendLowLevelTx.js deleted file mode 100644 index 1198482f2f..0000000000 --- a/apps/remix-ide/test-browser/commands/sendLowLevelTx.js +++ /dev/null @@ -1,19 +0,0 @@ -const EventEmitter = require('events') -class sendLowLevelTx extends EventEmitter { - command (address, value, callData) { - console.log('low level transact to ', address, value, callData) - this.api.waitForElementVisible(`#instance${address} #deployAndRunLLTxSendTransaction`, 1000) - .clearValue(`#instance${address} #deployAndRunLLTxCalldata`) - .setValue(`#instance${address} #deployAndRunLLTxCalldata`, callData) - .waitForElementVisible('#value') - .clearValue('#value') - .setValue('#value', value) - .scrollAndClick(`#instance${address} #deployAndRunLLTxSendTransaction`) - .perform(() => { - this.emit('complete') - }) - return this - } -} - -module.exports = sendLowLevelTx diff --git a/apps/remix-ide/test-browser/commands/setEditorValue.js b/apps/remix-ide/test-browser/commands/setEditorValue.js deleted file mode 100644 index 1cf38a4027..0000000000 --- a/apps/remix-ide/test-browser/commands/setEditorValue.js +++ /dev/null @@ -1,20 +0,0 @@ -const EventEmitter = require('events') - -class SetEditorValue extends EventEmitter { - command (value, callback) { - this.api.perform((client, done) => { - this.api.execute(function (value) { - document.getElementById('input').editor.session.setValue(value) - }, [value], (result) => { - done() - if (callback) { - callback.call(this.api) - } - this.emit('complete') - }) - }) - return this - } -} - -module.exports = SetEditorValue diff --git a/apps/remix-ide/test-browser/commands/setSolidityCompilerVersion.js b/apps/remix-ide/test-browser/commands/setSolidityCompilerVersion.js deleted file mode 100644 index afca5d562f..0000000000 --- a/apps/remix-ide/test-browser/commands/setSolidityCompilerVersion.js +++ /dev/null @@ -1,15 +0,0 @@ -const EventEmitter = require('events') - -class SetSolidityCompilerVersion extends EventEmitter { - command (version) { - this.api - .click(`#compileTabView #versionSelector [value="${version}"]`) - .pause(5000) - .perform(() => { - this.emit('complete') - }) - return this - } -} - -module.exports = SetSolidityCompilerVersion diff --git a/apps/remix-ide/test-browser/commands/setupMetamask.js b/apps/remix-ide/test-browser/commands/setupMetamask.js deleted file mode 100644 index aec9717909..0000000000 --- a/apps/remix-ide/test-browser/commands/setupMetamask.js +++ /dev/null @@ -1,38 +0,0 @@ -const EventEmitter = require('events') - -class MetaMask extends EventEmitter { - command (passphrase, password) { - this.api.perform((done) => { - setupMetaMask(this.api, passphrase, password, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function setupMetaMask (browser, passphrase, password, done) { - browser - .switchBrowserWindow('chrome-extension://poemojpkcjbpmcccohjnomjffeinlafe/home.html#initialize/welcome', 'MetaMask', (browser) => { - browser.waitForElementPresent('.first-time-flow__button') - .click('.first-time-flow__button') - .waitForElementPresent('.select-action__select-button:nth-of-type(1) > .first-time-flow__button') - .click('.select-action__select-button:nth-of-type(1) > .first-time-flow__button') - .waitForElementPresent('.page-container__footer-button:nth-of-type(2)') - .click('.page-container__footer-button:nth-of-type(2)') - .waitForElementPresent('.first-time-flow__textarea') - .setValue('.first-time-flow__textarea', passphrase) - .setValue('*[autocomplete="new-password"]', password) - .setValue('*[autocomplete="confirm-password"]', password) - .click('.first-time-flow__checkbox') - .click('.first-time-flow__button') - .pause(5000) - .click('.first-time-flow__button') - .perform(() => { - done() - }) - }) -} - -module.exports = MetaMask diff --git a/apps/remix-ide/test-browser/commands/signMessage.js b/apps/remix-ide/test-browser/commands/signMessage.js deleted file mode 100644 index 66ff5dbf79..0000000000 --- a/apps/remix-ide/test-browser/commands/signMessage.js +++ /dev/null @@ -1,42 +0,0 @@ -const EventEmitter = require('events') - -class SelectContract extends EventEmitter { - command (msg, callback) { - this.api.perform((done) => { - signMsg(this.api, msg, (hash, signature) => { - callback(hash, signature) - done() - this.emit('complete') - }) - }) - return this - } -} - -function signMsg (browser, msg, cb) { - let hash, signature - browser - .waitForElementPresent('i[id="remixRunSignMsg"]') - .click('i[id="remixRunSignMsg"]') - .waitForElementVisible('textarea[id="prompt_text"]') - .setValue('textarea[id="prompt_text"]', msg, () => { - browser.modalFooterOKClick().perform( - (client, done) => { - browser.waitForElementVisible('span[id="remixRunSignMsgHash"]').getText('span[id="remixRunSignMsgHash"]', (v) => { hash = v; done() }) - } - ) - .perform( - (client, done) => { - browser.waitForElementVisible('span[id="remixRunSignMsgSignature"]').getText('span[id="remixRunSignMsgSignature"]', (v) => { signature = v; done() }) - } - ) - .modalFooterOKClick() - .perform( - () => { - cb(hash, signature) - } - ) - }) -} - -module.exports = SelectContract diff --git a/apps/remix-ide/test-browser/commands/switchBrowserTab.js b/apps/remix-ide/test-browser/commands/switchBrowserTab.js deleted file mode 100644 index 973fa182ae..0000000000 --- a/apps/remix-ide/test-browser/commands/switchBrowserTab.js +++ /dev/null @@ -1,20 +0,0 @@ -const EventEmitter = require('events') - -/* - Switches between browser tabs -*/ - -class SwitchBrowserTab extends EventEmitter { - command (index) { - this.api.perform((browser, done) => { - browser.windowHandles((result) => { - browser.switchWindow(result.value[index]) - done() - }) - this.emit('complete') - }) - return this - } -} - -module.exports = SwitchBrowserTab diff --git a/apps/remix-ide/test-browser/commands/switchBrowserWindow.js b/apps/remix-ide/test-browser/commands/switchBrowserWindow.js deleted file mode 100644 index a153de17a0..0000000000 --- a/apps/remix-ide/test-browser/commands/switchBrowserWindow.js +++ /dev/null @@ -1,26 +0,0 @@ -const EventEmitter = require('events') - -class SwitchBrowserWindow extends EventEmitter { - command (url, windowName, cb) { - this.api.perform((done) => { - switchWindow(this.api, url, windowName, cb) - done() - this.emit('complete') - }) - return this - } -} - -function switchWindow (browser, url, windowName, cb) { - browser.execute(function (windowName) { - return window.open('', windowName, 'width=2560, height=1440') - }, [windowName], (newWindow) => { - browser.switchWindow(windowName) - .url(url) - .pause(5000) - .assert.urlContains(url) - if (cb) cb(browser, newWindow) - }) -} - -module.exports = SwitchBrowserWindow diff --git a/apps/remix-ide/test-browser/commands/switchFile.js b/apps/remix-ide/test-browser/commands/switchFile.js deleted file mode 100644 index 004697b8fe..0000000000 --- a/apps/remix-ide/test-browser/commands/switchFile.js +++ /dev/null @@ -1,26 +0,0 @@ -const EventEmitter = require('events') - -class SwitchFile extends EventEmitter { - command (name) { - this.api.perform((done) => { - switchFile(this.api, name, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -// click on fileExplorer can toggle it. We go through settings to be sure FE is open -function switchFile (browser, name, done) { - browser.clickLaunchIcon('settings').clickLaunchIcon('fileExplorers') - .waitForElementVisible('li[key="' + name + '"]') - .click('li[key="' + name + '"]') - .pause(2000) - .perform(() => { - done() - }) -} - -module.exports = SwitchFile diff --git a/apps/remix-ide/test-browser/commands/testConstantFunction.js b/apps/remix-ide/test-browser/commands/testConstantFunction.js deleted file mode 100644 index 9282d9a10d..0000000000 --- a/apps/remix-ide/test-browser/commands/testConstantFunction.js +++ /dev/null @@ -1,36 +0,0 @@ -const EventEmitter = require('events') - -class TestConstantFunction extends EventEmitter { - command (address, fnFullName, expectedInput, expectedOutput) { - console.log('TestConstantFunction ' + address + ' fnFullName') - this.api.perform((done) => { - testConstantFunction(this.api, address, fnFullName, expectedInput, expectedOutput, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function testConstantFunction (browser, address, fnFullName, expectedInput, expectedOutput, cb) { - browser.waitForElementPresent('.instance button[title="' + fnFullName + '"]').perform(function (client, done) { - client.execute(function () { - document.querySelector('#runTabView').scrollTop = document.querySelector('#runTabView').scrollHeight - }, [], function () { - if (expectedInput) { - client.setValue('#runTabView input[title="' + expectedInput.types + '"]', expectedInput.values, function () {}) - } - done() - }) - }) - .click('.instance button[title="' + fnFullName + '"]') - .pause(1000) - .waitForElementPresent('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]') - .scrollInto('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]') - .assert.containsText('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]', expectedOutput).perform(() => { - cb() - }) -} - -module.exports = TestConstantFunction diff --git a/apps/remix-ide/test-browser/commands/testContracts.js b/apps/remix-ide/test-browser/commands/testContracts.js deleted file mode 100644 index a6a878ee0a..0000000000 --- a/apps/remix-ide/test-browser/commands/testContracts.js +++ /dev/null @@ -1,27 +0,0 @@ -const EventEmitter = require('events') - -class TestContracts extends EventEmitter { - command (fileName, contractCode, compiledContractNames) { - this.api.perform((done) => { - testContracts(this.api, fileName, contractCode, compiledContractNames, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function testContracts (browser, fileName, contractCode, compiledContractNames, callback) { - browser - .clickLaunchIcon('solidity') - .addFile(fileName, contractCode) - .pause(1000) - .verifyContracts(compiledContractNames) - - .perform(() => { - callback() - }) -} - -module.exports = TestContracts diff --git a/apps/remix-ide/test-browser/commands/testEditorValue.js b/apps/remix-ide/test-browser/commands/testEditorValue.js deleted file mode 100644 index 331d844037..0000000000 --- a/apps/remix-ide/test-browser/commands/testEditorValue.js +++ /dev/null @@ -1,13 +0,0 @@ -const EventEmitter = require('events') - -class TestEditorValue extends EventEmitter { - command (testvalue) { - this.api.getEditorValue((value) => { - this.api.assert.equal(testvalue, value) - this.emit('complete') - }) - return this - } -} - -module.exports = TestEditorValue diff --git a/apps/remix-ide/test-browser/commands/testFunction.js b/apps/remix-ide/test-browser/commands/testFunction.js deleted file mode 100644 index 58ec5f4bd6..0000000000 --- a/apps/remix-ide/test-browser/commands/testFunction.js +++ /dev/null @@ -1,60 +0,0 @@ -const EventEmitter = require('events') -const deepequal = require('deep-equal') - -class TestFunction extends EventEmitter { - command (txHash, expectedValue) { - const browser = this.api - const logs = {} - const setLog = (index, value) => { logs[Object.keys(logs)[index]] = typeof value === 'string' ? value.trim() : value } - - browser - .waitForElementVisible(`[data-id="block_tx${txHash}"]`) - .click(`[data-id="block_tx${txHash}"]`) - .waitForElementVisible(`*[data-id="txLoggerTable${txHash}"]`) - - // fetch and format transaction logs as key => pair object - .elements('css selector', `*[data-shared="key_${txHash}"]`, (res) => { - res.value.forEach(function (jsonWebElement) { - const jsonWebElementId = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]] - - browser.elementIdText(jsonWebElementId, (jsonElement) => { - const key = jsonElement.value.trim() - - logs[key] = null - }) - }) - }) - .elements('css selector', `*[data-shared="pair_${txHash}"]`, (res) => { - res.value.forEach(function (jsonWebElement, index) { - const jsonWebElementId = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]] - - browser.elementIdText(jsonWebElementId, (jsonElement) => { - let value = jsonElement.value - - try { - value = JSON.parse(jsonElement.value) - setLog(index, value) - } catch (e) { - setLog(index, value) - } - }) - }) - }) - - browser.perform(() => { - Object.keys(expectedValue).forEach(key => { - const equal = deepequal(logs[key], expectedValue[key]) - - if (!equal) { - browser.assert.fail(`Expected ${expectedValue[key]} but got ${logs[key]}`) - } else { - browser.assert.ok(true, `Expected value matched returned value ${expectedValue[key]}`) - } - }) - this.emit('complete') - }) - return this - } -} - -module.exports = TestFunction diff --git a/apps/remix-ide/test-browser/commands/verifyCallReturnValue.js b/apps/remix-ide/test-browser/commands/verifyCallReturnValue.js deleted file mode 100644 index b60fab80d2..0000000000 --- a/apps/remix-ide/test-browser/commands/verifyCallReturnValue.js +++ /dev/null @@ -1,33 +0,0 @@ -const EventEmitter = require('events') - -class VerifyCallReturnValue extends EventEmitter { - command (address, checks) { - this.api.perform((done) => { - verifyCallReturnValue(this.api, address, checks, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function verifyCallReturnValue (browser, address, checks, done) { - browser.execute(function (address) { - var nodes = document.querySelectorAll('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]') - var ret = [] - for (var k = 0; k < nodes.length; k++) { - var text = nodes[k].innerText ? nodes[k].innerText : nodes[k].textContent - ret.push(text.replace('\n', '')) - } - return ret - }, [address], function (result) { - console.log('verifyCallReturnValue', result) - for (var k in checks) { - browser.assert.equal(result.value[k].trim(), checks[k].trim()) - } - done() - }) -} - -module.exports = VerifyCallReturnValue diff --git a/apps/remix-ide/test-browser/commands/verifyContracts.js b/apps/remix-ide/test-browser/commands/verifyContracts.js deleted file mode 100644 index bb2bf5ce26..0000000000 --- a/apps/remix-ide/test-browser/commands/verifyContracts.js +++ /dev/null @@ -1,68 +0,0 @@ -const EventEmitter = require('events') - -class VerifyContracts extends EventEmitter { - command (compiledContractNames, opts = { wait: 1000, version: null }) { - this.api.perform((done) => { - verifyContracts(this.api, compiledContractNames, opts, () => { - done() - this.emit('complete') - }) - }) - return this - } -} - -function getCompiledContracts (browser, opts, callback) { - browser - .clickLaunchIcon('solidity') - .pause(opts.wait) - .waitForElementPresent('*[data-id="compiledContracts"] option') - .perform((done) => { - if (opts.version) { - browser - .click('*[data-id="compilation-details"]') - .waitForElementVisible('*[data-id="treeViewDivcompiler"]') - .pause(2000) - .click('*[data-id="treeViewDivcompiler"]') - .waitForElementVisible('*[data-id="treeViewLicompiler/version"]') - .assert.containsText('*[data-id="treeViewLicompiler/version"]', `version:\n ${opts.version}`) - .perform(done) - } else done() - }) - .execute(function () { - var contracts = document.querySelectorAll('*[data-id="compiledContracts"] option') - if (!contracts) { - return null - } else { - var ret = [] - for (var c = 0; c < contracts.length; c++) { - ret.push(contracts[c].value) - } - return ret - } - }, [], function (result) { - callback(result) - }) -} - -function verifyContracts (browser, compiledContractNames, opts, callback) { - getCompiledContracts(browser, opts, (result) => { - if (result.value) { - for (var contract in compiledContractNames) { - console.log(' - ' + compiledContractNames[contract], result.value) - if (result.value.indexOf(compiledContractNames[contract]) === -1) { - browser.assert.fail('compiled contract ' + compiledContractNames + ' not found', 'info about error', '') - browser.end() - return - } - } - } else { - browser.assert.fail('compiled contract ' + compiledContractNames + ' not found - none found', 'info about error', '') - browser.end() - } - console.log('contracts all found ' + compiledContractNames) - callback() - }) -} - -module.exports = VerifyContracts diff --git a/apps/remix-ide/test-browser/commands/waitForElementContainsText.js b/apps/remix-ide/test-browser/commands/waitForElementContainsText.js deleted file mode 100644 index b636b68a82..0000000000 --- a/apps/remix-ide/test-browser/commands/waitForElementContainsText.js +++ /dev/null @@ -1,24 +0,0 @@ -const EventEmitter = require('events') - -class WaitForElementContainsText extends EventEmitter { - command (id, value) { - let incr = 0 - let runid = setInterval(() => { - this.api.getText(id, (result) => { - if (value.indexOf(result.value || '') !== -1) { - clearInterval(runid) - this.api.assert.ok(true, `WaitForElementContainsText ${id} contains ${value}`) - this.emit('complete') - } else incr++ - if (incr > 50) { - clearInterval(runid) - this.api.assert.fail(`WaitForElementContainsText - expected ${value} but got ${result.value}`) - // throw new Error(`WaitForElementContainsText ${id} ${value}`) - } - }) - }, 200) - return this - } -} - -module.exports = WaitForElementContainsText diff --git a/apps/remix-ide/test-browser/extensions/chrome/metamask.crx b/apps/remix-ide/test-browser/extensions/chrome/metamask.crx deleted file mode 100644 index 6cde846884..0000000000 Binary files a/apps/remix-ide/test-browser/extensions/chrome/metamask.crx and /dev/null differ diff --git a/apps/remix-ide/test-browser/helpers/applytestmode.js b/apps/remix-ide/test-browser/helpers/applytestmode.js deleted file mode 100644 index c97c4b7ce1..0000000000 --- a/apps/remix-ide/test-browser/helpers/applytestmode.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This script is injected by NightWatch just before starting test - * - */ -console.log('applying test mode') -var editor = document.getElementById('input').editor -editor.setBehavioursEnabled(false) // disable bracket auto-match (i.e. automatic injection of closing brackets and other things), so we can enter raw source code. -editor.setOptions({ - enableBasicAutocompletion: false, - enableSnippets: false, - enableLiveAutocompletion: false -}) -console.log('test mode applied') diff --git a/apps/remix-ide/test-browser/helpers/init.js b/apps/remix-ide/test-browser/helpers/init.js deleted file mode 100644 index 805660cd46..0000000000 --- a/apps/remix-ide/test-browser/helpers/init.js +++ /dev/null @@ -1,37 +0,0 @@ -require('dotenv').config() - -module.exports = function (browser, callback, url, preloadPlugins = true) { - browser - .url(url || 'http://127.0.0.1:8080') - .pause(5000) - .switchBrowserTab(0) - .injectScript('test-browser/helpers/applytestmode.js', function () { - browser.fullscreenWindow(() => { - if (preloadPlugins) { - console.log('preloadPlugins: ', preloadPlugins) - initModules(browser, () => { - browser.clickLaunchIcon('solidity') - .waitForElementVisible('[for="autoCompile"]') - .click('[for="autoCompile"]') - .verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked') - }) - } - }) - }) - .perform(() => { - callback() - }) -} - -function initModules (browser, callback) { - browser.pause(5000) - .click('[data-id="verticalIconsKindpluginManager"]') - .scrollAndClick('[data-id="pluginManagerComponentActivateButtonsolidityStaticAnalysis"]') - .scrollAndClick('[data-id="pluginManagerComponentActivateButtondebugger"]') - .scrollAndClick('[data-id="verticalIconsKindfileExplorers"]') - .clickLaunchIcon('settings') - .setValue('[data-id="settingsTabGistAccessToken"]', process.env.gist_token) - .click('[data-id="settingsTabSaveGistToken"]') - .click('[data-id="settingsTabThemeFlatly"]') // e2e tests were initially developed with Flatly. Some tests are failing with the default one (Dark), because the dark theme put uppercase everywhere. - .perform(() => { callback() }) -} diff --git a/apps/remix-ide/test-browser/mockcompiler/compiler.js b/apps/remix-ide/test-browser/mockcompiler/compiler.js deleted file mode 100644 index f3d0488ee6..0000000000 --- a/apps/remix-ide/test-browser/mockcompiler/compiler.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict' - -var Module = { // eslint-disable-line - cwrap: function () { return arguments[0] === 'version' ? version : compileStandard }, - writeStringToMemory: function () {}, - setValue: function () {}, - Pointer_stringify: function (value) { return value }, - Runtime: { - addFunction: function () { return arguments[0] }, - removeFunction: function () {} - }, - _compileJSONMulti: {}, - _compileJSONCallback: {}, - _compileJSON: {}, - _malloc: function () {}, - _compileStandard: compileStandard -} - -function compileStandard (source, missingInputs) { - source = source.replace(/(\t)|(\n)|(\\n)|( )/g, '') - var data = mockData[source] // eslint-disable-line - if (data === undefined) { - return JSON.stringify({ - errors: [{ formattedMessage: 'mock compiler: source not found', severity: 'error' }] - }) - } else { - data.missingInputs.map(function (item, i) { - if (missingInputs) { - missingInputs(item, '', '') - } - }) - } - return data.result -} - -function version () { - return mockCompilerVersion // eslint-disable-line -} diff --git a/apps/remix-ide/test-browser/tests/ballot.test.js b/apps/remix-ide/test-browser/tests/ballot.test.js deleted file mode 100644 index 1b73083b90..0000000000 --- a/apps/remix-ide/test-browser/tests/ballot.test.js +++ /dev/null @@ -1,316 +0,0 @@ -'use strict' -var examples = require('../../src/app/editor/example-contracts') -var init = require('../helpers/init') -var sauce = require('./sauce') - -var sources = [ - {'browser/Untitled.sol': {content: examples.ballot.content}} -] - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - '@sources': function () { - return sources - }, - 'Deploy Ballot': function (browser) { - browser - .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) - .clickLaunchIcon('solidity') - .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) - .clickLaunchIcon('udapp') - .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') - .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') - .click('*[data-id="Deploy - transact (not payable)"]') - .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]') - .click('*[data-id="universalDappUiTitleExpander"]') - .clickFunction('delegate - transact (not payable)', {types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'}) - .testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', - { - status: '0x1 Transaction mined and execution succeed', - 'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', - 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } - }) - }, - - 'Debug Ballot / delegate': function (browser) { - browser.pause(500) - .click('*[data-id="txLoggerDebugButton0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3"]') - .pause(2000) - // .clickLaunchIcon('debugger') - .click('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]') - .pause(2000) - .goToVMTraceStep(79) - .pause(1000) - .checkVariableDebug('soliditystate', stateCheck) - .checkVariableDebug('soliditylocals', localsCheck) - }, - - 'Access Ballot via at address': function (browser) { - browser.clickLaunchIcon('udapp') - .click('*[data-id="universalDappUiUdappClose"]') - .addFile('ballot.abi', { content: ballotABI }) - .addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3B', true, false) - .clickLaunchIcon('fileExplorers') - .addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3A', true, true) - .pause(500) - .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]') - .click('*[data-id="universalDappUiTitleExpander"]') - .clickFunction('delegate - transact (not payable)', {types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'}) - .testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', - { - status: '0x0 Transaction mined but execution failed', - 'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', - 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } - }) - }, - - 'Deploy and use Ballot using external web3': function (browser) { - browser - .click('*[data-id="settingsWeb3Mode"]') - .modalFooterOKClick() - .clickLaunchIcon('solidity') - .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) - .clickLaunchIcon('udapp') - .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') - .click('*[data-id="Deploy - transact (not payable)"]') - .clickInstance(0) - .click('*[data-id="terminalClearConsole"]') - .clickFunction('delegate - transact (not payable)', {types: 'address to', values: '0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c'}) - .journalLastChildIncludes('Ballot.delegate(address)') - .journalLastChildIncludes('data: 0x5c1...a733c') - .end() - }, - - tearDown: sauce -} - -var localsCheck = { - 'to': { - 'value': '0x4B0897B0513FDC7C541B6D9D7E929C4E5364D2DB', - 'type': 'address' - } -} - -var stateCheck = { - 'chairperson': { - 'value': '0xCA35B7D915458EF540ADE6068DFE2F44E8FA733C', - 'type': 'address', - 'constant': false - }, - 'voters': { - 'value': { - '000000000000000000000000ca35b7d915458ef540ade6068dfe2f44e8fa733c': { - 'value': { - 'weight': { - 'value': '1', - 'type': 'uint256' - }, - 'voted': { - 'value': false, - 'type': 'bool' - }, - 'delegate': { - 'value': '0x0000000000000000000000000000000000000000', - 'type': 'address' - }, - 'vote': { - 'value': '0', - 'type': 'uint256' - } - }, - 'type': 'struct Ballot.Voter' - } - }, - 'type': 'mapping(address => struct Ballot.Voter)', - 'constant': false - }, - 'proposals': { - 'value': [ - { - 'value': { - 'name': { - 'value': '0x48656C6C6F20576F726C64210000000000000000000000000000000000000000', - 'type': 'bytes32' - }, - 'voteCount': { - 'value': '0', - 'type': 'uint256' - } - }, - 'type': 'struct Ballot.Proposal' - } - ], - 'length': '0x1', - 'type': 'struct Ballot.Proposal[]', - 'constant': false - } -} - -var ballotABI = `[ -{ - "inputs": [ - { - "internalType": "bytes32[]", - "name": "proposalNames", - "type": "bytes32[]" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" -}, -{ - "constant": true, - "inputs": [], - "name": "chairperson", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -}, -{ - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "delegate", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" -}, -{ - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "voter", - "type": "address" - } - ], - "name": "giveRightToVote", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" -}, -{ - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "proposals", - "outputs": [ - { - "internalType": "bytes32", - "name": "name", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "voteCount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -}, -{ - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "proposal", - "type": "uint256" - } - ], - "name": "vote", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" -}, -{ - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "voters", - "outputs": [ - { - "internalType": "uint256", - "name": "weight", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "voted", - "type": "bool" - }, - { - "internalType": "address", - "name": "delegate", - "type": "address" - }, - { - "internalType": "uint256", - "name": "vote", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -}, -{ - "constant": true, - "inputs": [], - "name": "winnerName", - "outputs": [ - { - "internalType": "bytes32", - "name": "winnerName_", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -}, -{ - "constant": true, - "inputs": [], - "name": "winningProposal", - "outputs": [ - { - "internalType": "uint256", - "name": "winningProposal_", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} -]` diff --git a/apps/remix-ide/test-browser/tests/compiler_api.test.js b/apps/remix-ide/test-browser/tests/compiler_api.test.js deleted file mode 100644 index 7e7e59c9cc..0000000000 --- a/apps/remix-ide/test-browser/tests/compiler_api.test.js +++ /dev/null @@ -1,100 +0,0 @@ -'use strict' -var examples = require('../../src/app/editor/example-contracts') -var init = require('../helpers/init') -var sauce = require('./sauce') - -var sources = [ - {'browser/Untitled.sol': {content: examples.ballot.content}} -] - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - '@sources': function () { - return sources - }, - - 'Should compile using "compileWithParamaters" API': function (browser) { - browser - .addFile('test_jsCompile.js', { content: jsCompile }) - .executeScript('remix.exeCurrent()') - .pause(5000) - .journalChildIncludes(`version: '0.6.8+commit.0bbfe453'`) - }, - - 'Should update the compiler configuration with "setCompilerConfig" API': function (browser) { - browser - .addFile('test_updateConfiguration.js', { content: updateConfiguration }) - .executeScript('remix.exeCurrent()') - .pause(5000) - .addFile('test_updateConfiguration.sol', { content: simpleContract }) - .verifyContracts(['StorageTestUpdateConfiguration'], {wait: 5000, version: '0.6.8+commit.0bbfe453'}) - .end() - }, - - tearDown: sauce -} - -const simpleContract = `pragma solidity >=0.4.22 <0.7.0; - -/** -* @title Storage -* @dev Store & retrieve value in a variable -*/ -contract StorageTestUpdateConfiguration { - - uint256 number; - - /** - * @dev Store value in variable - * @param num value to store - */ - function store(uint256 num) public { - number = num; - } - - /** - * @dev Return value - * @return value of 'number' - */ - function retrieve() public view returns (uint256){ - return number; - } -} - - ` - -const jsCompile = `(async () => { - - try { - const contract = { - "storage.sol": {content : \`${simpleContract}\` } - } - console.log('compile') - const params = { - optimize: false, - evmVersion: null, - language: 'Solidity', - version: '0.6.8+commit.0bbfe453' - } - const result = await remix.call('solidity', 'compileWithParameters', contract, params) - console.log('result ', result) - } catch (e) { - console.log(e.message) - } -})()` - -const updateConfiguration = `(async () => { - try { - const params = { - optimize: false, - evmVersion: null, - language: 'Solidity', - version: '0.6.8+commit.0bbfe453' - } - await remix.call('solidity', 'setCompilerConfig', params) - } catch (e) { - console.log(e.message) - } -})()` diff --git a/apps/remix-ide/test-browser/tests/debugger.test.js b/apps/remix-ide/test-browser/tests/debugger.test.js deleted file mode 100644 index 9e9ca728e5..0000000000 --- a/apps/remix-ide/test-browser/tests/debugger.test.js +++ /dev/null @@ -1,115 +0,0 @@ -'use strict' -var init = require('../helpers/init') -var sauce = require('./sauce') - -module.exports = { - - before: function (browser, done) { - init(browser, done) - }, - - '@sources': function () { - return sources - }, - - 'Should launch debugger': function (browser) { - browser.addFile('blah.sol', sources[0]['browser/blah.sol']) - .clickLaunchIcon('udapp') - .waitForElementPresent('*[title="Deploy - transact (not payable)"]') - .click('*[title="Deploy - transact (not payable)"]') - .debugTransaction(0) - .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER') - }, - - 'Should debug failing transaction': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]') - .clickLaunchIcon('udapp') - .waitForElementPresent('*[data-id="universalDappUiTitleExpander"]') - .click('*[data-id="universalDappUiTitleExpander"]') - .scrollAndClick('*[title="string name, uint256 goal"]') - .setValue('*[title="string name, uint256 goal"]', '"toast", 999') - .click('*[data-id="createProject - transact (not payable)"]') - .debugTransaction(1) - .pause(2000) - .scrollAndClick('*[data-id="solidityLocals"]') - .assert.containsText('*[data-id="solidityLocals"]', 'toast') - .assert.containsText('*[data-id="solidityLocals"]', '999') - }, - - 'Should debug transaction using slider': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]') - .waitForElementVisible('*[data-id="slider"]') - .click('*[data-id="slider"]') - .setValue('*[data-id="slider"]', 50) - .pause(2000) - .assert.containsText('*[data-id="solidityLocals"]', 'no locals') - .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n92') - }, - - 'Should step back and forward transaction': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]') - .waitForElementPresent('*[data-id="buttonNavigatorIntoBack"]') - .scrollAndClick('*[data-id="buttonNavigatorIntoBack"]') - .pause(2000) - .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n91') - .assert.containsText('*[data-id="stepdetail"]', 'execution step:\n91') - .click('*[data-id="buttonNavigatorIntoForward"]') - .pause(2000) - .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n92') - .assert.containsText('*[data-id="stepdetail"]', 'execution step:\n92') - }, - - 'Should jump through breakpoints': function (browser) { - browser.waitForElementVisible('*[data-id="editorInput"]') - .click('.ace_gutter-cell:nth-of-type(10)') - .click('.ace_gutter-cell:nth-of-type(20)') - .waitForElementVisible('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]') - .click('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]') - .pause(2000) - .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n0') - .assert.containsText('*[data-id="stepdetail"]', 'execution step:\n0') - .click('*[data-id="buttonNavigatorJumpNextBreakpoint"]') - .pause(2000) - .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n184') - .assert.containsText('*[data-id="stepdetail"]', 'execution step:\n184') - .end() - }, - - tearDown: sauce -} - -var sources = [ - { - 'browser/blah.sol': { - content: ` - pragma solidity >=0.4.22 <0.6.0; - - contract Kickstarter { - - enum State { Started, Completed } - - struct Project { - address owner; - string name; - uint goal; - State state; - } - - Project[] public projects; - - constructor() public { - - } - - function createProject(string memory name, uint goal) public { - Project storage project = projects[projects.length]; - project.name = name; - project.owner = msg.sender; - project.state = State.Started; - project.goal = goal; - } - } - ` - } - } -] diff --git a/apps/remix-ide/test-browser/tests/defaultLayout.test.js b/apps/remix-ide/test-browser/tests/defaultLayout.test.js deleted file mode 100644 index 3e1a397005..0000000000 --- a/apps/remix-ide/test-browser/tests/defaultLayout.test.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict' -const init = require('../helpers/init') -const sauce = require('./sauce') - -module.exports = { - before: function (browser, done) { - init(browser, done, 'http://127.0.0.1:8080', false) - }, - 'Loads Icon\'s Panel': function (browser) { - browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000) - .waitForElementVisible('div[data-id="verticalIconsHomeIcon"]') - .waitForElementVisible('div[plugin="fileExplorers"]') - .waitForElementVisible('div[plugin="pluginManager"]') - .waitForElementVisible('div[plugin="settings"]') - }, - - 'Loads Side Panel': function (browser) { - browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]') - .assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS') - .waitForElementVisible('div[data-id="filePanelFileExplorerTree"]') - .waitForElementVisible('li[key="browser/3_Ballot.sol"]') - }, - - 'Loads Main View': function (browser) { - browser.waitForElementVisible('div[data-id="mainPanelPluginsContainer"]') - .waitForElementVisible('div[data-id="landingPageHomeContainer"]') - .waitForElementVisible('div[data-id="landingPageHpSections"]') - .waitForElementVisible('div[data-id="terminalContainer"]') - }, - - 'Loads terminal': function (browser) { - browser - .waitForElementVisible('div[data-id="terminalCli"]', 10000) - .journalLastChildIncludes('Welcome to Remix') - }, - - 'Toggles Side Panel': function (browser) { - browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]') - .assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS') - .clickLaunchIcon('fileExplorers') - .assert.hidden('div[data-id="remixIdeSidePanel"]') - .clickLaunchIcon('fileExplorers') - .assert.visible('div[data-id="remixIdeSidePanel"]') - .assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS') - }, - - 'Toggles Terminal': function (browser) { - browser.waitForElementVisible('div[data-id="terminalContainer"]') - .assert.visible('div[data-id="terminalContainerDisplay"]') - .click('i[data-id="terminalToggleIcon"]') - .checkElementStyle('div[data-id="terminalToggleMenu"]', 'height', '35px') - .click('i[data-id="terminalToggleIcon"]') - .assert.visible('div[data-id="terminalContainerDisplay"]') - }, - - 'Toggles File Explorer Browser': function (browser) { - browser - .waitForElementVisible('div[data-id="filePanelFileExplorerTree"]') - .assert.visible('ul[key="browser"]') - .click('div[data-id="treeViewTogglebrowser"]') - .assert.hidden('ul[key="browser"]') - .click('div[data-id="treeViewTogglebrowser"]') - .assert.visible('ul[key="browser"]') - }, - - 'Switch Tabs using tabs icon': function (browser) { - browser - .waitForElementVisible('div[data-id="filePanelFileExplorerTree"]') - .openFile('browser/3_Ballot.sol') - .assert.containsText('div[title="browser/3_Ballot.sol"]', '3_Ballot.sol') - .click('span[class^=dropdownCaret]') - .click('#homeItem') - .assert.containsText('div[title="home"]', 'Home') - .end() - }, - - tearDown: sauce -} diff --git a/apps/remix-ide/test-browser/tests/editor.test.js b/apps/remix-ide/test-browser/tests/editor.test.js deleted file mode 100644 index c1875beef5..0000000000 --- a/apps/remix-ide/test-browser/tests/editor.test.js +++ /dev/null @@ -1,197 +0,0 @@ -'use strict' -const init = require('../helpers/init') -const sauce = require('./sauce') - -module.exports = { - - before: function (browser, done) { - init(browser, done) - }, - - 'Should zoom in editor': function (browser) { - browser.waitForElementVisible('div[data-id="mainPanelPluginsContainer"]') - .openFile('browser/1_Storage.sol') - .waitForElementVisible('*[data-id="editorInput"]') - .checkElementStyle('*[data-id="editorInput"]', 'font-size', '12px') - .click('*[data-id="tabProxyZoomIn"]') - .click('*[data-id="tabProxyZoomIn"]') - .checkElementStyle('*[data-id="editorInput"]', 'font-size', '14px') - }, - - 'Should zoom out editor': function (browser) { - browser.waitForElementVisible('*[data-id="editorInput"]') - .checkElementStyle('*[data-id="editorInput"]', 'font-size', '14px') - .click('*[data-id="tabProxyZoomOut"]') - .click('*[data-id="tabProxyZoomOut"]') - .checkElementStyle('*[data-id="editorInput"]', 'font-size', '12px') - }, - - 'Should display compile error in editor': function (browser) { - browser.waitForElementVisible('*[data-id="editorInput"]') - .waitForElementVisible('*[class="ace_content"]') - .click('*[class="ace_content"]') - .sendKeys('*[class="ace_text-input"]', 'error') - .pause(2000) - .waitForElementVisible('.ace_error') - }, - - 'Should minimize and maximize codeblock in editor': function (browser) { - browser.waitForElementVisible('*[data-id="editorInput"]') - .waitForElementVisible('.ace_open') - .click('.ace_start:nth-of-type(1)') - .waitForElementVisible('.ace_closed') - .click('.ace_start:nth-of-type(1)') - .waitForElementVisible('.ace_open') - }, - - 'Should add breakpoint to editor': function (browser) { - browser.waitForElementVisible('*[data-id="editorInput"]') - .waitForElementNotPresent('.ace_breakpoint') - .click('.ace_gutter-cell:nth-of-type(1)') - .waitForElementVisible('.ace_breakpoint') - }, - - 'Should load syntax highlighter for ace light theme': function (browser) { - browser.waitForElementVisible('*[data-id="editorInput"]') - .checkElementStyle('.ace_keyword', 'color', aceThemes.light.keyword) - .checkElementStyle('.ace_comment.ace_doc', 'color', aceThemes.light.comment) - .checkElementStyle('.ace_function', 'color', aceThemes.light.function) - .checkElementStyle('.ace_variable', 'color', aceThemes.light.variable) - }, - - 'Should load syntax highlighter for ace dark theme': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]') - .click('*[data-id="verticalIconsKindsettings"]') - .waitForElementVisible('*[data-id="settingsTabThemeDark"]') - .click('*[data-id="settingsTabThemeDark"]') - .pause(2000) - .waitForElementVisible('*[data-id="editorInput"]') - /* @todo(#2863) ch for class and not colors - .checkElementStyle('.ace_keyword', 'color', aceThemes.dark.keyword) - .checkElementStyle('.ace_comment.ace_doc', 'color', aceThemes.dark.comment) - .checkElementStyle('.ace_function', 'color', aceThemes.dark.function) - .checkElementStyle('.ace_variable', 'color', aceThemes.dark.variable) - */ - }, - - 'Should highlight source code': function (browser) { - browser.addFile('sourcehighlight.js', sourcehighlightScript) - .openFile('browser/sourcehighlight.js') - .executeScript('remix.exeCurrent()') - .editorScroll('down', 60) - .waitForElementPresent('.highlightLine32') - .checkElementStyle('.highlightLine32', 'background-color', 'rgb(8, 108, 181)') - .waitForElementPresent('.highlightLine40') - .checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)') - .waitForElementPresent('.highlightLine50') - .checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)') - }, - - 'Should remove 1 highlight from source code': function (browser) { - browser.addFile('removeSourcehighlightScript.js', removeSourcehighlightScript) - .openFile('browser/removeSourcehighlightScript.js') - .executeScript('remix.exeCurrent()') - .openFile('browser/3_Ballot.sol') - .waitForElementNotPresent('.highlightLine32') - .checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)') - .checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)') - }, - - 'Should remove all highlights from source code': function (browser) { - browser.addFile('removeAllSourcehighlightScript.js', removeAllSourcehighlightScript) - .openFile('browser/removeAllSourcehighlightScript.js') - .executeScript('remix.exeCurrent()') - .openFile('browser/3_Ballot.sol') - .waitForElementNotPresent('.highlightLine32') - .waitForElementNotPresent('.highlightLine40') - .waitForElementNotPresent('.highlightLine50') - .end() - }, - - tearDown: sauce -} - -var aceThemes = { - light: { - keyword: 'rgb(147, 15, 128)', - comment: 'rgb(35, 110, 36)', - function: 'rgb(0, 0, 162)', - variable: 'rgb(253, 151, 31)' - }, - dark: { - keyword: 'rgb(0, 105, 143)', - comment: 'rgb(85, 85, 85)', - function: 'rgb(0, 174, 239)', - variable: 'rgb(153, 119, 68)' - } -} - -const sourcehighlightScript = { - content: ` - (async () => { - try { - const pos = { - start: { - line: 32, - column: 3 - }, - end: { - line: 32, - column: 20 - } - } - await remix.call('editor', 'highlight', pos, 'browser/3_Ballot.sol') - - const pos2 = { - start: { - line: 40, - column: 3 - }, - end: { - line: 40, - column: 20 - } - } - await remix.call('editor', 'highlight', pos2, 'browser/3_Ballot.sol') - - const pos3 = { - start: { - line: 50, - column: 3 - }, - end: { - line: 50, - column: 20 - } - } - await remix.call('editor', 'highlight', pos3, 'browser/3_Ballot.sol') - } catch (e) { - console.log(e.message) - } - })() - ` -} - -const removeSourcehighlightScript = { - content: ` - (async () => { - try { - await remix.call('editor', 'discardHighlightAt', 32, 'browser/3_Ballot.sol') - } catch (e) { - console.log(e.message) - } - })() - ` -} - -const removeAllSourcehighlightScript = { - content: ` - (async () => { - try { - await remix.call('editor', 'discardHighlight') - } catch (e) { - console.log(e.message) - } - })() - ` -} diff --git a/apps/remix-ide/test-browser/tests/fileExplorer.test.js b/apps/remix-ide/test-browser/tests/fileExplorer.test.js deleted file mode 100644 index 7d6549a03f..0000000000 --- a/apps/remix-ide/test-browser/tests/fileExplorer.test.js +++ /dev/null @@ -1,109 +0,0 @@ -'use strict' -const init = require('../helpers/init') -const sauce = require('./sauce') -const path = require('path') -const testData = { - testFile1: path.resolve(__dirname + '/editor.test.js'), // eslint-disable-line - testFile2: path.resolve(__dirname + '/fileExplorer.test.js'), // eslint-disable-line - testFile3: path.resolve(__dirname + '/generalSettings.test.js') // eslint-disable-line -} - -module.exports = { - - before: function (browser, done) { - init(browser, done) - }, - - 'Should create a new file `5_New_contract.sol` in file explorer': function (browser) { - browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]') - .clickLaunchIcon('fileExplorers') - .assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS') - .click('*[data-id="fileExplorerNewFilecreateNewFile"]') - .waitForElementVisible('*[data-id="modalDialogContainer"]') - .setValue('*[data-id="modalDialogCustomPromptText"]', '5_New_contract.sol') - .modalFooterOKClick() - .waitForElementVisible('*[data-id="treeViewLibrowser/5_New_contract.sol"]', 7000) - }, - - 'Should rename `5_New_contract.sol` to 5_Renamed_Contract.sol': function (browser) { - browser - .waitForElementVisible('*[data-id="treeViewLibrowser/5_New_contract.sol"]') - .renameFile('browser/5_New_contract.sol', '5_Renamed_Contract.sol', 'browser/5_Renamed_Contract.sol') - .waitForElementVisible('*[data-id="treeViewLibrowser/5_Renamed_Contract.sol"]') - }, - - 'Should delete file `5_Renamed_Contract.sol` from file explorer': function (browser) { - browser - .waitForElementVisible('*[data-id="treeViewLibrowser/5_Renamed_Contract.sol"]') - .rightClick('[data-path="browser/5_Renamed_Contract.sol"]') - .click('*[id="menuitemdelete"]') - .waitForElementVisible('*[data-id="modalDialogContainer"]') - .modalFooterOKClick() - .waitForElementNotPresent('*[data-id="treeViewLibrowser/5_Renamed_Contract.sol"') - }, - - 'Should create a new folder': function (browser) { - browser - .waitForElementVisible('*[data-id="treeViewLibrowser/1_Storage.sol"]') - .rightClick('[data-path="browser/1_Storage.sol"]') - .click('*[id="menuitemcreate folder"]') - .waitForElementVisible('*[data-id="modalDialogContainer"]') - .setValue('*[data-id="modalDialogCustomPromptText"]', 'Browser_Tests') - .modalFooterOKClick() - .waitForElementVisible('*[data-id="treeViewLibrowser/Browser_Tests"]') - }, - - 'Should rename Browser_Tests folder to Browser_E2E_Tests': function (browser) { - browser - .waitForElementVisible('*[data-id="treeViewLibrowser/Browser_Tests"]') - .rightClick('[data-path="browser/Browser_Tests"]') - .click('*[id="menuitemrename"]') - .sendKeys('[data-path="browser/Browser_Tests"]', 'Browser_E2E_Tests') - .sendKeys('[data-path="browser/Browser_Tests"]', browser.Keys.ENTER) - .waitForElementVisible('*[data-id="treeViewLibrowser/Browser_E2E_Tests"]') - }, - - 'Should delete Browser_E2E_Tests folder': function (browser) { - browser - .waitForElementVisible('*[data-id="treeViewLibrowser/Browser_E2E_Tests"]') - .rightClick('[data-path="browser/Browser_E2E_Tests"]') - .click('*[id="menuitemdelete"]') - .waitForElementVisible('*[data-id="modalDialogContainer"]') - .modalFooterOKClick() - .waitForElementNotPresent('*[data-id="treeViewLibrowser/Browser_E2E_Tests"]') - }, - - 'Should publish all explorer files to github gist': function (browser) { - const runtimeBrowser = browser.capabilities.browserName - - browser - .waitForElementVisible('*[data-id="fileExplorerNewFilepublishToGist"]') - .click('*[data-id="fileExplorerNewFilepublishToGist"]') - .waitForElementVisible('*[data-id="modalDialogContainer"]') - .modalFooterOKClick() - .waitForElementVisible('*[data-id="modalDialogContainer"]', 7000) - .modalFooterOKClick() - .pause(2000) - .perform((done) => { - if (runtimeBrowser === 'chrome') { - browser.switchBrowserTab(1) - .assert.urlContains('https://gist.github.com') - .switchBrowserTab(0) - } - done() - }) - }, - - 'Should open local filesystem explorer': function (browser) { - browser.waitForElementVisible('*[data-id="filePanelFileExplorerTree"]') - .setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile1) - .setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile2) - .setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile3) - .waitForElementVisible('*[key="browser/editor.test.js"]') - .waitForElementVisible('*[key="browser/fileExplorer.test.js"]') - .waitForElementVisible('*[key="browser/generalSettings.test.js"]') - .end() - }, - - tearDown: sauce -} diff --git a/apps/remix-ide/test-browser/tests/fileManager_api.test.js b/apps/remix-ide/test-browser/tests/fileManager_api.test.js deleted file mode 100644 index d290142188..0000000000 --- a/apps/remix-ide/test-browser/tests/fileManager_api.test.js +++ /dev/null @@ -1,190 +0,0 @@ -'use strict' -var init = require('../helpers/init') -var sauce = require('./sauce') - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - - 'Should execute `file` api from file manager external api': function (browser) { - browser - .addFile('file.js', { content: executeFile }) - .executeScript(`remix.exeCurrent()`) - .pause(2000) - .journalLastChildIncludes('browser/file.js') - }, - - 'Should execute `exists` api from file manager external api': function (browser) { - browser - .addFile('exists.js', { content: executeExists }) - .executeScript(`remix.exeCurrent()`) - .pause(2000) - .journalChildIncludes('browser/exists.js true') - .journalChildIncludes('browser/non-exists.js false') - }, - - 'Should execute `open` api from file manager external api': function (browser) { - browser - .addFile('open.js', { content: executeOpen }) - .executeScript(`remix.exeCurrent()`) - .pause(2000) - .journalLastChildIncludes('browser/3_Ballot.sol') - }, - - 'Should execute `writeFile` api from file manager external api': function (browser) { - browser - .addFile('writeFile.js', { content: executeWriteFile }) - .executeScript(`remix.exeCurrent()`) - .pause(2000) - .openFile('browser/new_contract.sol') - .assert.containsText('[data-id="editorInput"]', 'pragma solidity ^0.6.0') - }, - - 'Should execute `readFile` api from file manager external api': function (browser) { - browser - .addFile('readFile.js', { content: executeReadFile }) - .executeScript(`remix.exeCurrent()`) - .pause(2000) - .journalLastChildIncludes('pragma solidity ^0.6.0') - }, - - 'Should execute `copyFile` api from file manager external api': function (browser) { - browser - .addFile('copyFile.js', { content: executeCopyFile }) - .executeScript(`remix.exeCurrent()`) - .pause(2000) - .journalLastChildIncludes('pragma solidity >=0.4.22 <0.7.0;') - }, - - 'Should execute `rename` api from file manager external api': function (browser) { - browser - .addFile('renameFile.js', { content: executeRename }) - .executeScript(`remix.exeCurrent()`) - .pause(2000) - .waitForElementPresent('[data-id="treeViewLibrowser/old_contract.sol"]') - }, - - 'Should execute `mkdir` api from file manager external api': function (browser) { - browser - .addFile('mkdirFile.js', { content: executeMkdir }) - .executeScript(`remix.exeCurrent()`) - .pause(2000) - .waitForElementPresent('[data-id="treeViewLibrowser/Test_Folder"]') - }, - - 'Should execute `readdir` api from file manager external api': function (browser) { - browser - .addFile('readdirFile.js', { content: executeReaddir }) - .executeScript(`remix.exeCurrent()`) - .pause(2000) - .journalLastChildIncludes('Test_Folder isDirectory true') - }, - - 'Should execute `remove` api from file manager external api': function (browser) { - browser - .addFile('removeFile.js', { content: executeRemove }) - .executeScript(`remix.exeCurrent()`) - .pause(2000) - .waitForElementNotPresent('[data-id="treeViewLibrowser/old_contract.sol"]') - .end() - }, - - tearDown: sauce -} - -const executeFile = ` - const run = async () => { - const result = await remix.call('fileManager', 'file') - - console.log(result) - } - - run() -` - -const executeExists = ` - const run = async () => { - const result1 = await remix.call('fileManager', 'exists', 'browser/exists.js') - const result2 = await remix.call('fileManager', 'exists', 'browser/non-exists.js') - - console.log('browser/exists.js ' + result1) - console.log('browser/non-exists.js ' + result2) - } - - run() -` - -const executeOpen = ` - const run = async () => { - await remix.call('fileManager', 'open', 'browser/3_Ballot.sol') - const result = await remix.call('fileManager', 'file') - - console.log(result) - } - - run() -` - -const executeWriteFile = ` - const run = async () => { - await remix.call('fileManager', 'writeFile', 'browser/new_contract.sol', 'pragma solidity ^0.6.0') - } - - run() -` - -const executeReadFile = ` - const run = async () => { - const result = await remix.call('fileManager', 'readFile', 'browser/new_contract.sol') - - console.log(result) - } - - run() -` - -const executeCopyFile = ` - const run = async () => { - await remix.call('fileManager', 'copyFile', 'browser/3_Ballot.sol', 'browser/new_contract.sol') - const result = await remix.call('fileManager', 'readFile', 'browser/new_contract.sol') - - console.log(result) - } - - run() -` - -const executeRename = ` - const run = async () => { - await remix.call('fileManager', 'rename', 'browser/new_contract.sol', 'browser/old_contract.sol') - } - - run() -` - -const executeMkdir = ` - const run = async () => { - await remix.call('fileManager', 'mkdir', 'browser/Test_Folder/') - } - - run() -` - -const executeReaddir = ` - const run = async () => { - const result = await remix.call('fileManager', 'readdir', 'browser/') - - console.log('Test_Folder isDirectory ', result["Test_Folder"].isDirectory) - } - - run() -` - -const executeRemove = ` - const run = async () => { - await remix.call('fileManager', 'remove', 'browser/old_contract.sol') - } - - run() -` diff --git a/apps/remix-ide/test-browser/tests/generalSettings.test.js b/apps/remix-ide/test-browser/tests/generalSettings.test.js deleted file mode 100644 index 887c804dda..0000000000 --- a/apps/remix-ide/test-browser/tests/generalSettings.test.js +++ /dev/null @@ -1,332 +0,0 @@ -'use strict' -const init = require('../helpers/init') -const sauce = require('./sauce') - -module.exports = { - before: function (browser, done) { - init(browser, done, 'http://127.0.0.1:8080', false) - }, - - 'Should display settings menu': function (browser) { - browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) - .click('*[data-id="landingPageStartSolidity"]') - .waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="verticalIconsKindsettings"]') - .waitForElementContainsText('h6[data-id="sidePanelSwapitTitle"]', 'SETTINGS') - }, - - 'Should open gitter channel in a new tab when `Gitter Channel Button` is clicked': function (browser) { - const runtimeBrowser = browser.capabilities.browserName - - browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') - .waitForElementVisible('*[data-id="settingsTabGitterChannelButton"]', 5000) - .click('*[data-id="settingsTabGitterChannelButton"]') - .pause(2000) - .perform((done) => { if (runtimeBrowser === 'chrome') { browser.switchBrowserTab(1).assert.urlContains('https://gitter.im/ethereum/remix') } done() }) - }, - - 'Should activate `generate contract metadata`': function (browser) { - browser.switchBrowserTab(0) - .waitForElementVisible('*[data-id="remixIdeSidePanel"]', 5000) - .waitForElementVisible('*[data-id="settingsTabGenerateContractMetadata"]', 5000) - .click('*[data-id="settingsTabGenerateContractMetadata"]') - .click('*[data-id="verticalIconsFileExplorerIcons"]') - .openFile('browser/3_Ballot.sol') - .click('*[data-id="verticalIconsKindsolidity"]') - .pause(2000) - .click('*[data-id="compilerContainerCompileBtn"]') - .pause(3000) - .click('*[data-id="verticalIconsKindfileExplorers"]') - .openFile('browser/artifacts/Ballot.json') - }, - - 'Should add new github access token': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="verticalIconsKindsettings"]') - .setValue('*[data-id="settingsTabGistAccessToken"]', '**********') - .click('*[data-id="settingsTabSaveGistToken"]') - .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000) - .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Access token saved') - }, - - 'Should copy github access token to clipboard': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="copyToClipboardCopyIcon"]') - .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000) - .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Copied value to clipboard.') - }, - - 'Should remove github access token': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="settingsTabRemoveGistToken"]') - .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000) - .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Access token removed') - .assert.containsText('*[data-id="settingsTabGistAccessToken"]', '') - }, - - 'Should load dark theme': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="settingsTabThemeDark"]') - .pause(2000) - .checkElementStyle(':root', '--primary', remixIdeThemes.dark.primary) - .checkElementStyle(':root', '--secondary', remixIdeThemes.dark.secondary) - .checkElementStyle(':root', '--success', remixIdeThemes.dark.success) - .checkElementStyle(':root', '--info', remixIdeThemes.dark.info) - .checkElementStyle(':root', '--warning', remixIdeThemes.dark.warning) - .checkElementStyle(':root', '--danger', remixIdeThemes.dark.danger) - }, - - 'Should load light theme': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="settingsTabThemeLight"]') - .pause(2000) - .checkElementStyle(':root', '--primary', remixIdeThemes.light.primary) - .checkElementStyle(':root', '--secondary', remixIdeThemes.light.secondary) - .checkElementStyle(':root', '--success', remixIdeThemes.light.success) - .checkElementStyle(':root', '--info', remixIdeThemes.light.info) - .checkElementStyle(':root', '--warning', remixIdeThemes.light.warning) - .checkElementStyle(':root', '--danger', remixIdeThemes.light.danger) - }, - - 'Should load Cerulean theme': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="settingsTabThemeCerulean"]') - .pause(5000) - .checkElementStyle(':root', '--primary', remixIdeThemes.curelean.primary) - .checkElementStyle(':root', '--secondary', remixIdeThemes.curelean.secondary) - .checkElementStyle(':root', '--success', remixIdeThemes.curelean.success) - .checkElementStyle(':root', '--info', remixIdeThemes.curelean.info) - .checkElementStyle(':root', '--warning', remixIdeThemes.curelean.warning) - .checkElementStyle(':root', '--danger', remixIdeThemes.curelean.danger) - }, - - 'Should load Flatly theme': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="settingsTabThemeFlatly"]') - .pause(2000) - .checkElementStyle(':root', '--primary', remixIdeThemes.flatly.primary) - .checkElementStyle(':root', '--secondary', remixIdeThemes.flatly.secondary) - .checkElementStyle(':root', '--success', remixIdeThemes.flatly.success) - .checkElementStyle(':root', '--info', remixIdeThemes.flatly.info) - .checkElementStyle(':root', '--warning', remixIdeThemes.flatly.warning) - .checkElementStyle(':root', '--danger', remixIdeThemes.flatly.danger) - }, - - 'Should load Lumen theme': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="settingsTabThemeLumen"]') - .pause(2000) - .checkElementStyle(':root', '--primary', remixIdeThemes.lumen.primary) - .checkElementStyle(':root', '--secondary', remixIdeThemes.lumen.secondary) - .checkElementStyle(':root', '--success', remixIdeThemes.lumen.success) - .checkElementStyle(':root', '--info', remixIdeThemes.lumen.info) - .checkElementStyle(':root', '--warning', remixIdeThemes.lumen.warning) - .checkElementStyle(':root', '--danger', remixIdeThemes.lumen.danger) - }, - - 'Should load Minty theme': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="settingsTabThemeMinty"]') - .pause(2000) - .checkElementStyle(':root', '--primary', remixIdeThemes.minty.primary) - .checkElementStyle(':root', '--secondary', remixIdeThemes.minty.secondary) - .checkElementStyle(':root', '--success', remixIdeThemes.minty.success) - .checkElementStyle(':root', '--info', remixIdeThemes.minty.info) - .checkElementStyle(':root', '--warning', remixIdeThemes.minty.warning) - .checkElementStyle(':root', '--danger', remixIdeThemes.minty.danger) - }, - - 'Should load Pulse theme': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="settingsTabThemePulse"]') - .pause(2000) - .checkElementStyle(':root', '--primary', remixIdeThemes.pulse.primary) - .checkElementStyle(':root', '--secondary', remixIdeThemes.pulse.secondary) - .checkElementStyle(':root', '--success', remixIdeThemes.pulse.success) - .checkElementStyle(':root', '--info', remixIdeThemes.pulse.info) - .checkElementStyle(':root', '--warning', remixIdeThemes.pulse.warning) - .checkElementStyle(':root', '--danger', remixIdeThemes.pulse.danger) - }, - - 'Should load Sandstone theme': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="settingsTabThemeSandstone"]') - .pause(2000) - .checkElementStyle(':root', '--primary', remixIdeThemes.sandstone.primary) - .checkElementStyle(':root', '--secondary', remixIdeThemes.sandstone.secondary) - .checkElementStyle(':root', '--success', remixIdeThemes.sandstone.success) - .checkElementStyle(':root', '--info', remixIdeThemes.sandstone.info) - .checkElementStyle(':root', '--warning', remixIdeThemes.sandstone.warning) - .checkElementStyle(':root', '--danger', remixIdeThemes.sandstone.danger) - }, - - 'Should load Spacelab theme': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="settingsTabThemeSpacelab"]') - .pause(2000) - .checkElementStyle(':root', '--primary', remixIdeThemes.spacelab.primary) - .checkElementStyle(':root', '--secondary', remixIdeThemes.spacelab.secondary) - .checkElementStyle(':root', '--success', remixIdeThemes.spacelab.success) - .checkElementStyle(':root', '--info', remixIdeThemes.spacelab.info) - .checkElementStyle(':root', '--warning', remixIdeThemes.spacelab.warning) - .checkElementStyle(':root', '--danger', remixIdeThemes.spacelab.danger) - }, - - 'Should load Yeti theme': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="settingsTabThemeYeti"]') - .pause(2000) - .checkElementStyle(':root', '--primary', remixIdeThemes.yeti.primary) - .checkElementStyle(':root', '--secondary', remixIdeThemes.yeti.secondary) - .checkElementStyle(':root', '--success', remixIdeThemes.yeti.success) - .checkElementStyle(':root', '--info', remixIdeThemes.yeti.info) - .checkElementStyle(':root', '--warning', remixIdeThemes.yeti.warning) - .checkElementStyle(':root', '--danger', remixIdeThemes.yeti.danger) - }, - - 'Should load Cyborg theme': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="settingsTabThemeCyborg"]') - .pause(2000) - .checkElementStyle(':root', '--primary', remixIdeThemes.cyborg.primary) - .checkElementStyle(':root', '--secondary', remixIdeThemes.cyborg.secondary) - .checkElementStyle(':root', '--success', remixIdeThemes.cyborg.success) - .checkElementStyle(':root', '--info', remixIdeThemes.cyborg.info) - .checkElementStyle(':root', '--warning', remixIdeThemes.cyborg.warning) - .checkElementStyle(':root', '--danger', remixIdeThemes.cyborg.danger) - }, - - 'Should load Darkly theme': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="settingsTabThemeDarkly"]') - .pause(2000) - .checkElementStyle(':root', '--primary', remixIdeThemes.darkly.primary) - .checkElementStyle(':root', '--secondary', remixIdeThemes.darkly.secondary) - .checkElementStyle(':root', '--success', remixIdeThemes.darkly.success) - .checkElementStyle(':root', '--info', remixIdeThemes.darkly.info) - .checkElementStyle(':root', '--warning', remixIdeThemes.darkly.warning) - .checkElementStyle(':root', '--danger', remixIdeThemes.darkly.danger) - }, - - 'Should load Superhero theme': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) - .click('*[data-id="settingsTabThemeSuperhero"]') - .pause(2000) - .checkElementStyle(':root', '--primary', remixIdeThemes.superhero.primary) - .checkElementStyle(':root', '--secondary', remixIdeThemes.superhero.secondary) - .checkElementStyle(':root', '--success', remixIdeThemes.superhero.success) - .checkElementStyle(':root', '--info', remixIdeThemes.superhero.info) - .checkElementStyle(':root', '--warning', remixIdeThemes.superhero.warning) - .checkElementStyle(':root', '--danger', remixIdeThemes.superhero.danger) - .end() - }, - - tearDown: sauce -} - -var remixIdeThemes = { - dark: { - primary: '#007aa6', - secondary: '#595c76', - success: '#32ba89', - info: '#086CB5', - warning: '#c97539', - danger: '#b84040' - }, - light: { - primary: '#007aa6', - secondary: '#a8b3bc', - success: '#32ba89', - info: '#007aa6', - warning: '#c97539', - danger: '#b84040' - }, - curelean: { - primary: '#2FA4E7', - secondary: '#e9ecef', - success: '#73A839', - info: '#033C73', - warning: '#DD5600', - danger: '#C71C22' - }, - flatly: { - primary: '#2C3E50', - secondary: '#95a5a6', - success: '#18BC9C', - info: '#3498DB', - warning: '#F39C12', - danger: '#E74C3C' - }, - lumen: { - primary: '#158CBA', - secondary: '#f0f0f0', - success: '#28B62C', - info: '#75CAEB', - warning: '#FF851B', - danger: '#FF4136' - }, - minty: { - primary: '#78C2AD', - secondary: '#F3969A', - success: '#56CC9D', - info: '#6CC3D5', - warning: '#FFCE67', - danger: '#FF7851' - }, - pulse: { - primary: '#593196', - secondary: '#A991D4', - success: '#13B955', - info: '#009CDC', - warning: '#EFA31D', - danger: '#FC3939' - }, - sandstone: { - primary: '#325D88', - secondary: '#8E8C84', - success: '#93C54B', - info: '#29ABE0', - warning: '#F47C3C', - danger: '#d9534f' - }, - spacelab: { - primary: '#446E9B', - secondary: '#999', - success: '#3CB521', - info: '#3399F3', - warning: '#D47500', - danger: '#CD0200' - }, - yeti: { - primary: '#008cba', - secondary: '#eee', - success: '#43ac6a', - info: '#5bc0de', - warning: '#E99002', - danger: '#F04124' - }, - cyborg: { - primary: '#2A9FD6', - secondary: '#555', - success: '#77B300', - info: '#9933CC', - warning: '#FF8800', - danger: '#CC0000' - }, - darkly: { - primary: '#375a7f', - secondary: '#444', - success: '#00bc8c', - info: '#3498DB', - warning: '#F39C12', - danger: '#E74C3C' - }, - superhero: { - primary: '#DF691A', - secondary: '#4E5D6C', - success: '#5cb85c', - info: '#5bc0de', - warning: '#f0ad4e', - danger: '#d9534f' - } -} diff --git a/apps/remix-ide/test-browser/tests/gist.test.js b/apps/remix-ide/test-browser/tests/gist.test.js deleted file mode 100644 index a939bcdc17..0000000000 --- a/apps/remix-ide/test-browser/tests/gist.test.js +++ /dev/null @@ -1,95 +0,0 @@ -'use strict' -const init = require('../helpers/init') -const sauce = require('./sauce') -const testData = { - validGistId: '1859c97c6e1efc91047d725d5225888e', - invalidGistId: '6368b389f9302v32902msk2402' -} -// 99266d6da54cc12f37f11586e8171546c7700d67 - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - 'UploadToGists': function (browser) { - /* - - set the access token - - publish to gist - - retrieve the gist - - switch to a file in the new gist - */ - console.log('token', process.env.gist_token) - const runtimeBrowser = browser.capabilities.browserName - - browser - .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) - .clickLaunchIcon('fileExplorers') - .rightClick('[data-path="browser/1_Storage.sol"]') - .click('*[id="menuitemcreate folder"]') - .waitForElementVisible('*[data-id="modalDialogContainer"]') - .setValue('*[data-id="modalDialogCustomPromptText"]', 'Browser_Tests') - .modalFooterOKClick() - .waitForElementVisible('*[data-id="treeViewLibrowser/Browser_Tests"]') - .addFile('File.sol', { content: '' }) - .click('*[data-id="fileExplorerNewFilepublishToGist"]') - .modalFooterOKClick() - .getModalBody((value, done) => { - const reg = /gist.github.com\/([^.]+)/ - const id = value.match(reg) - console.log('gist regex', id) - if (!id) { - browser.assert.fail('cannot get the gist id', '', '') - } else { - let gistid = id[1] - browser - .modalFooterCancelClick() - .executeScript(`remix.loadgist('${gistid}')`) - .perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('browser/gists') } done() }) - .openFile(`browser/gists/${gistid}/1_Storage.sol`) - .perform(done) - } - }) - }, - - 'Load Gist Modal': function (browser) { - browser.clickLaunchIcon('home') - .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) - .clickLaunchIcon('fileExplorers') - .scrollAndClick('*[data-id="landingPageImportFromGistButton"]') - .waitForElementVisible('*[data-id="modalDialogModalTitle"]') - .assert.containsText('*[data-id="modalDialogModalTitle"]', 'Load a Gist') - .waitForElementVisible('*[data-id="modalDialogModalBody"]') - .assert.containsText('*[data-id="modalDialogModalBody"]', 'Enter the ID of the Gist or URL you would like to load.') - .waitForElementVisible('*[data-id="modalDialogCustomPromptText"]') - .modalFooterCancelClick() - }, - - 'Display Error Message For Invalid Gist ID': function (browser) { - browser - .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) - .clickLaunchIcon('fileExplorers') - .scrollAndClick('*[data-id="landingPageImportFromGistButton"]') - .waitForElementVisible('*[data-id="modalDialogCustomPromptText"]') - .setValue('*[data-id="modalDialogCustomPromptText"]', testData.invalidGistId) - .modalFooterOKClick() - .waitForElementVisible('*[data-id="modalDialogModalBody"]') - .assert.containsText('*[data-id="modalDialogModalBody"]', 'Gist load error: Not Found') - .modalFooterOKClick() - }, - - 'Import From Gist For Valid Gist ID': function (browser) { - browser - .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) - .clickLaunchIcon('fileExplorers') - .scrollAndClick('*[data-id="landingPageImportFromGistButton"]') - .waitForElementVisible('*[data-id="modalDialogCustomPromptText"]') - .setValue('*[data-id="modalDialogCustomPromptText"]', testData.validGistId) - .modalFooterOKClick() - .openFile(`browser/gists/${testData.validGistId}/ApplicationRegistry`) - .waitForElementVisible(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry']`) - .assert.containsText(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry'] > span`, 'ApplicationRegistry') - .end() - }, - - tearDown: sauce -} diff --git a/apps/remix-ide/test-browser/tests/libraryDeployment.test.js b/apps/remix-ide/test-browser/tests/libraryDeployment.test.js deleted file mode 100644 index d8d83e1e5a..0000000000 --- a/apps/remix-ide/test-browser/tests/libraryDeployment.test.js +++ /dev/null @@ -1,118 +0,0 @@ -'use strict' -var init = require('../helpers/init') -var sauce = require('./sauce') - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - '@sources': function () { - return sources - }, - 'Add Lib Test File': function (browser) { - browser.addFile('Untitled5.sol', sources[0]['browser/Untitled5.sol']) - .clickLaunchIcon('udapp') - .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite - }, - 'Test Auto Deploy Lib': function (browser) { - let addressRef - browser.verifyContracts(['test']) - .selectContract('test') - .createContract('') - .getAddressAtPosition(0, (address) => { - console.log('testAutoDeployLib ' + address) - addressRef = address - }) - .waitForElementPresent('.instance:nth-of-type(2)') - .click('.instance:nth-of-type(2) > div > button') - .perform((done) => { - browser.testConstantFunction(addressRef, 'get - call', '', '0:\nuint256: 45').perform(() => { - done() - }) - }) - }, - 'Test Manual Deploy Lib': function (browser) { - console.log('testManualDeployLib') - browser.click('*[data-id="deployAndRunClearInstances"]') - .pause(5000) - .clickLaunchIcon('settings') - .click('#generatecontractmetadata') - .clickLaunchIcon('solidity') - .click('#compileTabView button[title="Compile"]') // that should generate the JSON artefact - .verifyContracts(['test']) - .selectContract('lib') // deploy lib - .createContract('') - .perform((done) => { - browser.getAddressAtPosition(0, (address) => { - console.log(address) - checkDeployShouldFail(browser, () => { - checkDeployShouldSucceed(browser, address, () => { - done() - }) - }) - }) - }) - .end() - }, - tearDown: sauce -} - -function checkDeployShouldFail (browser, callback) { - let config - browser.openFile('browser/artifacts').openFile('browser/artifacts/test.json') - .getEditorValue((content) => { - config = JSON.parse(content) - config.deploy['VM:-'].autoDeployLib = false - }) - .perform(() => { - browser.setEditorValue(JSON.stringify(config)) - }) - .openFile('browser/Untitled5.sol') - .selectContract('test') // deploy lib - .createContract('') - .assert.containsText('div[class^="terminal"]', '
is not a valid address') - .perform(() => { callback() }) -} - -function checkDeployShouldSucceed (browser, address, callback) { - let addressRef - let config - browser.openFile('browser/artifacts').openFile('browser/artifacts/test.json') - .getEditorValue((content) => { - config = JSON.parse(content) - config.deploy['VM:-'].autoDeployLib = false - config.deploy['VM:-']['linkReferences']['browser/Untitled5.sol'].lib = address - }) - .perform(() => { - browser.setEditorValue(JSON.stringify(config)) - }) - .openFile('browser/Untitled5.sol') - .selectContract('test') // deploy lib - .createContract('') - .getAddressAtPosition(1, (address) => { - addressRef = address - }) - .waitForElementPresent('.instance:nth-of-type(3)') - .click('.instance:nth-of-type(3) > div > button') - .perform(() => { - browser - .testConstantFunction(addressRef, 'get - call', '', '0:\nuint256: 45') - .perform(() => { callback() }) - }) -} - -var sources = [ - { - 'browser/Untitled5.sol': {content: `library lib { - function getInt () public view returns (uint) { - return 45; - } - } - - contract test { - function get () public view returns (uint) { - return lib.getInt(); - } - }`} - } -] diff --git a/apps/remix-ide/test-browser/tests/pluginManager.test.js b/apps/remix-ide/test-browser/tests/pluginManager.test.js deleted file mode 100644 index 53454f39b5..0000000000 --- a/apps/remix-ide/test-browser/tests/pluginManager.test.js +++ /dev/null @@ -1,152 +0,0 @@ -'use strict' -const init = require('../helpers/init') -const sauce = require('./sauce') -const testData = { - pluginName: 'remixIde', - pluginDisplayName: 'Remix IDE', - pluginUrl: 'https://remix-project.org/' -} - -module.exports = { - before: function (browser, done) { - init(browser, done, 'http://127.0.0.1:8080', false) - }, - - 'Should Load Plugin Manager': function (browser) { - browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') - .pause(3000) - .click('*[plugin="pluginManager"]') - .waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') - .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'PLUGIN MANAGER') - }, - - 'Should Search for plugins': function (browser) { - browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') - .click('*[data-id="pluginManagerComponentSearchInput"]') - .keys('debugger') - .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]') - .clearValue('*[data-id="pluginManagerComponentSearchInput"]') - .click('*[data-id="pluginManagerComponentSearchInput"]') - .keys('Vyper') - .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonvyper"]') - .clearValue('*[data-id="pluginManagerComponentSearchInput"]') - .click('*[data-id="pluginManagerComponentSearchInput"]') - .keys('ZoKrates') - .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonZoKrates"]') - .clearValue('*[data-id="pluginManagerComponentSearchInput"]') - .click('*[data-id="pluginManagerComponentSearchInput"]') - .keys(browser.Keys.ENTER) - }, - - 'Should activate plugins': function (browser) { - browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') - .click('*[data-id="pluginManagerComponentPluginManager"]') - .scrollAndClick('*[data-id="pluginManagerComponentActivateButtondebugger"]') - .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]') - .scrollAndClick('*[data-id="pluginManagerComponentActivateButtonvyper"]') - .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonvyper"]') - .scrollAndClick('*[data-id="pluginManagerComponentActivateButtonZoKrates"]') - .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonZoKrates"]') - }, - - 'Should deactivate plugins': function (browser) { - browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') - .click('*[data-id="pluginManagerComponentPluginManager"]') - .scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtondebugger"]') - .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]') - .scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtonvyper"]') - .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonvyper"]') - }, - - /* - 'Should grant plugin permission (ZOKRATES)': function (browser) { - browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') - .click('*[data-id="pluginManagerPermissionsButton"]') - .waitForElementVisible('*[data-id="pluginManagerSettingsPermissionForm"]') - .assert.containsText('*[data-id="pluginManagerSettingsPermissionForm"]', 'No Permission requested yet') - .modalFooterOKClick() - .click('*[data-id="verticalIconsFileExplorerIcons"]') - .openFile('browser/3_Ballot.sol') - .click('*[plugin="ZoKrates"]') - .pause(5000) - .frame(0) - .useXpath().click("//span[text()='Compile']") - .pause(2000) - .frameParent() - .useCss().waitForElementVisible('*[data-id="modalDialogContainer"]') - .assert.containsText('*[data-id="permissionHandlerMessage"]', 'ZOKRATES" WOULD LIKE TO ACCESS "FILE MANAGER" :') - .pause(2000) - .click('*[data-id="permissionHandlerRememberChoice"]') - .pause(2000) - .modalFooterOKClick() - }, - - 'Should revert plugin permission (ZOKRATES)': function (browser) { - browser.waitForElementVisible('*[data-id="verticalIconsSettingsIcons"]') - .click('*[data-id="verticalIconsSettingsIcons"]') - .waitForElementVisible('*[data-id="pluginManagerPermissionsButton"]') - .click('*[data-id="pluginManagerPermissionsButton"]') - .waitForElementVisible('*[data-id="modalDialogContainer"]') - .click('*[data-id="pluginManagerSettingsPermissionForm"]') - .pause(2000) - .click('*[data-id="pluginManagerSettingsClearAllPermission"]') - .pause(2000) - .assert.containsText('*[data-id="pluginManagerSettingsPermissionForm"]', 'No Permission requested yet') - .modalFooterOKClick() - }, - */ - - 'Should connect a local plugin': function (browser) { - browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') - .click('*[data-id="pluginManagerComponentPluginSearchButton"]') - .waitForElementVisible('*[data-id="modalDialogContainer"]') - .click('*[data-id="modalDialogModalBody"]') - .waitForElementVisible('*[data-id="localPluginName"]') - .setValue('*[data-id="localPluginName"]', testData.pluginName) - .setValue('*[data-id="localPluginDisplayName"]', testData.pluginDisplayName) - .setValue('*[data-id="localPluginUrl"]', testData.pluginUrl) - .click('*[data-id="localPluginRadioButtoniframe"]') - .click('*[data-id="localPluginRadioButtonsidePanel"]') - .click('*[data-id="modalDialogModalFooter"]') - .modalFooterOKClick() - .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonremixIde"]') - }, - - 'Should display error message for creating already existing plugin': function (browser) { - browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') - .click('*[data-id="pluginManagerComponentPluginSearchButton"]') - .waitForElementVisible('*[data-id="modalDialogContainer"]') - .click('*[data-id="modalDialogModalBody"]') - .waitForElementVisible('*[data-id="localPluginName"]') - .clearValue('*[data-id="localPluginName"]').setValue('*[data-id="localPluginName"]', testData.pluginName) - .clearValue('*[data-id="localPluginDisplayName"]').setValue('*[data-id="localPluginDisplayName"]', testData.pluginDisplayName) - .clearValue('*[data-id="localPluginUrl"]').setValue('*[data-id="localPluginUrl"]', testData.pluginUrl) - .click('*[data-id="localPluginRadioButtoniframe"]') - .click('*[data-id="localPluginRadioButtonsidePanel"]') - .click('*[data-id="modalDialogModalFooter"]') - .modalFooterOKClick() - .pause(5000) - .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)') - .pause(2000) - .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Cannot create Plugin : This name has already been used') - }, - - 'Should load back installed plugins after reload': function (browser) { - browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') - .getInstalledPlugins((plugins) => { - browser.refresh() - .waitForElementVisible('*[data-id="remixIdeSidePanel"]') - .pause(3000) - .perform((done) => { - plugins.forEach(plugin => { - if (plugin !== testData.pluginName) { - browser.waitForElementVisible(`[plugin="${plugin}"`) - } - }) - done() - }) - }) - .end() - }, - tearDown: sauce -} diff --git a/apps/remix-ide/test-browser/tests/publishContract.test.js b/apps/remix-ide/test-browser/tests/publishContract.test.js deleted file mode 100644 index 0cefb98bde..0000000000 --- a/apps/remix-ide/test-browser/tests/publishContract.test.js +++ /dev/null @@ -1,59 +0,0 @@ -'use strict' -var init = require('../helpers/init') -var sauce = require('./sauce') - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - '@sources': function () { - return [] - }, - 'Publish on IPFS': function (browser) { - browser - .waitForElementVisible('#icon-panel', 10000) - .clickLaunchIcon('fileExplorers') - .openFile('browser/3_Ballot.sol') - .verifyContracts(['Ballot']) - .click('#publishOnIpfs') - .getModalBody((value, done) => { - if (value.indexOf('Metadata of "ballot" was published successfully.') === -1) browser.assert.fail('ipfs deploy failed', '', '') - if (value.indexOf('dweb:/ipfs') === -1) browser.assert.fail('ipfs deploy failed', '', '') - done() - }) - .modalFooterOKClick() - }, - 'Publish on Swarm': '' + function (browser) { - browser - .click('#publishOnSwarm') - .getModalBody((value, done) => { - if (value.indexOf('Metadata of "ballot" was successfully.') === -1) browser.assert.fail('swarm deploy failed', '', '') - if (value.indexOf('bzz') === -1) browser.assert.fail('swarm deploy failed', '', '') - done() - }) - .modalFooterOKClick() - }, - 'Should publish contract metadata to ipfs on deploy': function (browser) { - browser - .waitForElementVisible('#icon-panel') - .clickLaunchIcon('fileExplorers') - .openFile('browser/1_Storage.sol') - .clickLaunchIcon('udapp') - .waitForElementVisible('*[data-id="contractDropdownIpfsCheckboxLabel"]') - .click('*[data-id="contractDropdownIpfsCheckboxLabel"]') - .click('*[data-id="Deploy - transact (not payable)"]') - .pause(5000) - .assert.containsText('*[data-id="modalDialogModalBody"]', 'Metadata of "storage" was published successfully.') - .modalFooterOKClick() - }, - 'Should remember choice after page refresh': function (browser) { - browser - .refresh() - .openFile('browser/1_Storage.sol') - .clickLaunchIcon('udapp') - .waitForElementVisible('*[data-id="contractDropdownIpfsCheckboxLabel"]') - .verify.elementPresent('*[data-id="contractDropdownIpfsCheckbox"]:checked') - .end() - }, - tearDown: sauce -} diff --git a/apps/remix-ide/test-browser/tests/recorder.test.js b/apps/remix-ide/test-browser/tests/recorder.test.js deleted file mode 100644 index 08b512a982..0000000000 --- a/apps/remix-ide/test-browser/tests/recorder.test.js +++ /dev/null @@ -1,297 +0,0 @@ -'use strict' -var sauce = require('./sauce') -var init = require('../helpers/init') - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - '@sources': function () { - return sources - }, - 'Test Recorder': function (browser) { - var addressRef - browser.addFile('scenario.json', {content: records}) - .pause(5000) - .clickLaunchIcon('udapp') - .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite - .click('div[class^="cardContainer"] i[class^="arrow"]') - .click('#runTabView .runtransaction') - .waitForElementPresent('.instance:nth-of-type(2)') - .click('.instance:nth-of-type(2) > div > button') - .waitForElementPresent('.instance:nth-of-type(3)') - .click('.instance:nth-of-type(3) > div > button') - .clickFunction('getInt - call') - .clickFunction('getAddress - call') - .clickFunction('getFromLib - call') - .waitForElementPresent('div[class^="contractActionsContainer"] div[class^="value"] ul') - .getAddressAtPosition(1, (address) => { - console.log('Test Recorder ' + address) - addressRef = address - }) - .perform((done) => { - browser.verifyCallReturnValue(addressRef, ['0:uint256: 1', '0:uint256: 3456', '0:address: 0xbBF289D846208c16EDc8474705C748aff07732dB']) - .perform(() => done()) - }) - .click('*[data-id="deployAndRunClearInstances"]') - .testContracts('testRecorder.sol', sources[0]['browser/testRecorder.sol'], ['testRecorder']) - .createContract('12') - .waitForElementPresent('.instance:nth-of-type(2)') - .click('.instance:nth-of-type(2) > div > button') - .clickFunction('set - transact (not payable)', {types: 'uint256 _p', values: '34'}) - .click('i.savetransaction') - .modalFooterOKClick() - .getEditorValue(function (result) { - var parsed = JSON.parse(result) - browser.assert.equal(JSON.stringify(parsed.transactions[0].record.parameters), JSON.stringify(scenario.transactions[0].record.parameters)) - browser.assert.equal(JSON.stringify(parsed.transactions[0].record.name), JSON.stringify(scenario.transactions[0].record.name)) - browser.assert.equal(JSON.stringify(parsed.transactions[0].record.type), JSON.stringify(scenario.transactions[0].record.type)) - browser.assert.equal(JSON.stringify(parsed.transactions[0].record.from), JSON.stringify(scenario.transactions[0].record.from)) - browser.assert.equal(JSON.stringify(parsed.transactions[0].record.contractName), JSON.stringify(scenario.transactions[0].record.contractName)) - - browser.assert.equal(JSON.stringify(parsed.transactions[1].record.parameters), JSON.stringify(scenario.transactions[1].record.parameters)) - browser.assert.equal(JSON.stringify(parsed.transactions[1].record.name), JSON.stringify(scenario.transactions[1].record.name)) - browser.assert.equal(JSON.stringify(parsed.transactions[1].record.type), JSON.stringify(scenario.transactions[1].record.type)) - browser.assert.equal(JSON.stringify(parsed.transactions[1].record.from), JSON.stringify(scenario.transactions[1].record.from)) - }) - .end() - }, - tearDown: sauce -} - -var sources = [{'browser/testRecorder.sol': {content: `contract testRecorder { - constructor(uint p) public { - - } - function set (uint _p) public { - - } -}`}}] - -var records = `{ - "accounts": { - "account{10}": "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c" - }, - "linkReferences": { - "testLib": "created{1512830014773}" - }, - "transactions": [ - { - "timestamp": 1512830014773, - "record": { - "value": "0", - "parameters": [], - "abi": "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a", - "contractName": "testLib", - "bytecode": "60606040523415600e57600080fd5b60968061001c6000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636d4ce63c146044575b600080fd5b604a6060565b6040518082815260200191505060405180910390f35b6000610d809050905600a165627a7a7230582022d123b15248b8176151f8d45c2dc132063bcc9bb8d5cd652aea7efae362c8050029", - "linkReferences": {}, - "inputs": "()", - "type": "constructor", - "from": "account{10}" - } - }, - { - "timestamp": 1512830015080, - "record": { - "value": "100", - "parameters": [ - 11 - ], - "abi": "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec", - "contractName": "test", - "bytecode": "60606040526040516020806102b183398101604052808051906020019091905050806000819055505061027a806100376000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632f30c6f61461006757806338cc48311461009e57806362738998146100f357806387cc10e11461011c575b600080fd5b61009c600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610145565b005b34156100a957600080fd5b6100b1610191565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100fe57600080fd5b6101066101bb565b6040518082815260200191505060405180910390f35b341561012757600080fd5b61012f6101c4565b6040518082815260200191505060405180910390f35b8160008190555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054905090565b600073__browser/ballot.sol:testLib____________636d4ce63c6000604051602001526040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b151561022e57600080fd5b6102c65a03f4151561023f57600080fd5b505050604051805190509050905600a165627a7a72305820e0b2510bb2890a0334bfe5613d96db3e72442e63b514cdeaee8fc2c6bbd19d3a0029", - "linkReferences": { - "browser/ballot.sol": { - "testLib": [ - { - "length": 20, - "start": 511 - } - ] - } - }, - "name": "", - "type": "constructor", - "inputs": "(uint256)", - "from": "account{10}" - } - }, - { - "timestamp": 1512830034180, - "record": { - "value": "1000000000000000000", - "parameters": [ - 1, - "created{1512830015080}" - ], - "to": "created{1512830015080}", - "abi": "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec", - "name": "set", - "inputs": "(uint256,address)", - "type": "function", - "from": "account{10}" - } - } - ], - "abis": { - "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a": [ - { - "constant": true, - "inputs": [], - "name": "get", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ], - "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec": [ - { - "constant": true, - "inputs": [], - "name": "getInt", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getFromLib", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getAddress", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_t", - "type": "uint256" - }, - { - "name": "_add", - "type": "address" - } - ], - "name": "set", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "name": "_r", - "type": "uint256" - } - ], - "payable": true, - "stateMutability": "payable", - "type": "constructor" - } - ] - } -}` - -var scenario = { - 'accounts': { - 'account{10}': '0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c' - }, - 'linkReferences': {}, - 'transactions': [ - { - 'timestamp': 1512912691086, - 'record': { - 'value': '0', - 'parameters': [ - "12" // eslint-disable-line - ], - 'abi': '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798', - 'contractName': 'testRecorder', - 'bytecode': '6060604052341561000f57600080fd5b6040516020806100cd833981016040528080519060200190919050505060938061003a6000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b1146044575b600080fd5b3415604e57600080fd5b606260048080359060200190919050506064565b005b505600a165627a7a723058204839660366b94f5f3c8c6da233a2c5fe95ad5635b5c8a2bb630a8b845d68ecdd0029', - 'linkReferences': {}, - 'name': '', - 'type': 'constructor', - 'inputs': '(uint256)', - 'from': 'account{10}' - } - }, - { - 'timestamp': 1512912696128, - 'record': { - 'value': '0', - 'parameters': [ - "34" // eslint-disable-line - ], - 'to': 'created{1512912691086}', - 'abi': '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798', - 'name': 'set', - 'inputs': '(uint256)', - 'type': 'function', - 'from': 'account{10}' - } - } - ], - 'abis': { - '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798': [ - { - 'constant': false, - 'inputs': [ - { - 'name': '_p', - 'type': 'uint256' - } - ], - 'name': 'set', - 'outputs': [], - 'payable': false, - 'stateMutability': 'nonpayable', - 'type': 'function' - }, - { - 'inputs': [ - { - 'name': 'p', - 'type': 'uint256' - } - ], - 'payable': false, - 'stateMutability': 'nonpayable', - 'type': 'constructor' - } - ] - } -} diff --git a/apps/remix-ide/test-browser/tests/remixd.test.js b/apps/remix-ide/test-browser/tests/remixd.test.js deleted file mode 100644 index 79142bc39c..0000000000 --- a/apps/remix-ide/test-browser/tests/remixd.test.js +++ /dev/null @@ -1,138 +0,0 @@ -'use strict' -var init = require('../helpers/init') -var sauce = require('./sauce') - -var assetsTestContract = `import "./contract.sol"; -contract Assets { - uint[] proposals; - function add(uint8 _numProposals) public { - proposals.length = _numProposals; - } -} -` - -var gmbhTestContract = `contract gmbh { - uint[] proposals; - function register(uint8 _numProposals) public { - proposals.length = _numProposals; - } -} -` -var sources = [ - { - 'localhost/folder1/contract2.sol': {content: 'contract test2 { function get () public returns (uint) { return 11; }}'} - }, - { - 'localhost/src/gmbh/company.sol': {content: assetsTestContract} - }, - { - 'localhost/src/gmbh/company.sol': {content: assetsTestContract}, - 'localhost/src/gmbh/contract.sol': {content: gmbhTestContract} - }, - { - 'browser/test_import_node_modules.sol': {content: 'import "openzeppelin-solidity/contracts/math/SafeMath.sol";'} - }, - { - 'browser/test_import_node_modules_with_github_import.sol': {content: 'import "openzeppelin-solidity/contracts/sample.sol";'} - } -] - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - '@sources': function () { - return sources - }, - 'Remixd': function (browser) { - runTests(browser) - }, - 'Import from node_modules ': function (browser) { - /* - when a relative import is used (i.e import "openzeppelin-solidity/contracts/math/SafeMath.sol") - remix (as well as truffle) try to resolve it against the node_modules and installed_contracts folder. - */ - - browser.waitForElementVisible('#icon-panel', 2000) - .clickLaunchIcon('fileExplorers') - .addFile('test_import_node_modules.sol', sources[3]['browser/test_import_node_modules.sol']) - .clickLaunchIcon('solidity') - .testContracts('test_import_node_modules.sol', sources[3]['browser/test_import_node_modules.sol'], ['SafeMath']) - }, - 'Import from node_modules and reference a github import': function (browser) { - browser.waitForElementVisible('#icon-panel', 2000) - .clickLaunchIcon('fileExplorers') - .addFile('test_import_node_modules_with_github_import.sol', sources[4]['browser/test_import_node_modules_with_github_import.sol']) - .clickLaunchIcon('solidity') - .setSolidityCompilerVersion('soljson-v0.6.2+commit.bacdbe57.js') // open-zeppelin moved to pragma ^0.6.0 - .testContracts('test_import_node_modules_with_github_import.sol', sources[4]['browser/test_import_node_modules_with_github_import.sol'], ['ERC20', 'test11']) - .clickLaunchIcon('pluginManager') - .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_remixd"] button') - .end() - }, - tearDown: sauce -} - -function runTests (browser, testData) { - var browserName = browser.options.desiredCapabilities.browserName - if (browserName === 'safari' || browserName === 'internet explorer') { - console.log('do not run remixd test for ' + browserName + ': sauce labs doesn\'t seems to handle websocket') - browser.end() - return - } - - browser - .waitForElementVisible('#icon-panel', 2000) - .clickLaunchIcon('fileExplorers') - .clickLaunchIcon('pluginManager') - .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_remixd"] button') - .waitForElementVisible('#modal-footer-ok', 2000) - .pause(2000) - .click('#modal-footer-ok') - .clickLaunchIcon('fileExplorers') - .waitForElementVisible('[data-path="localhost/folder1"]') - .click('[data-path="localhost/folder1"]') - .waitForElementVisible('[data-path="localhost/contract1.sol"]') - .assert.containsText('[data-path="localhost/contract1.sol"]', 'contract1.sol') - .assert.containsText('[data-path="localhost/contract2.sol"]', 'contract2.sol') - .waitForElementVisible('[data-path="localhost/folder1/contract1.sol"]') - .assert.containsText('[data-path="localhost/folder1/contract1.sol"]', 'contract1.sol') - .assert.containsText('[data-path="localhost/folder1/contract2.sol"]', 'contract2.sol') // load and test sub folder - .click('[data-path="localhost/folder1/contract2.sol"]') - .click('[data-path="localhost/folder1/contract1.sol"]') // open localhost/folder1/contract1.sol - .pause(1000) - .testEditorValue('contract test1 { function get () returns (uint) { return 10; }}') // check the content and replace by another - .setEditorValue('contract test1Changed { function get () returns (uint) { return 10; }}') - .testEditorValue('contract test1Changed { function get () returns (uint) { return 10; }}') - .setEditorValue('contract test1 { function get () returns (uint) { return 10; }}') - .click('[data-path="localhost/folder1/contract_' + browserName + '.sol"]') // rename a file and check - .pause(1000) - .renameFile('localhost/folder1/contract_' + browserName + '.sol', 'renamed_contract_' + browserName + '.sol', 'localhost/folder1/renamed_contract_' + browserName + '.sol') - .pause(1000) - .removeFile('localhost/folder1/contract_' + browserName + '_toremove.sol') - .perform(function (done) { - testImportFromRemixd(browser, () => { done() }) - }) - .clickLaunchIcon('fileExplorers') - .waitForElementVisible('[data-path="localhost/folder1"]') - .click('[data-path="localhost/folder1"]') - .click('[data-path="localhost/folder1"]') // click twice because remixd does not return nested folder details after update - .waitForElementVisible('[data-path="localhost/folder1/contract1.sol"]') - .waitForElementVisible('[data-path="localhost/folder1/renamed_contract_' + browserName + '.sol"]') // check if renamed file is preset - .waitForElementNotPresent('[data-path="localhost/folder1/contract_' + browserName + '.sol"]') // check if renamed (old) file is not present - .waitForElementNotPresent('[data-path="localhost/folder1/contract_' + browserName + '_toremove.sol"]') // check if removed (old) file is not present - .click('[data-path="localhost/folder1/renamed_contract_' + browserName + '.sol"]') -} - -function testImportFromRemixd (browser, callback) { - browser - .waitForElementVisible('[data-path="localhost/src"]', 100000) - .click('[data-path="localhost/src"]') - .waitForElementVisible('[data-path="localhost/src/gmbh"]', 100000) - .click('[data-path="localhost/src/gmbh"]') - .waitForElementVisible('[data-path="localhost/src/gmbh/company.sol"]', 100000) - .click('[data-path="localhost/src/gmbh/company.sol"]') - .pause(1000) - .verifyContracts(['Assets', 'gmbh']) - .perform(() => { callback() }) -} diff --git a/apps/remix-ide/test-browser/tests/runAndDeploy.js b/apps/remix-ide/test-browser/tests/runAndDeploy.js deleted file mode 100644 index 2cb2009010..0000000000 --- a/apps/remix-ide/test-browser/tests/runAndDeploy.js +++ /dev/null @@ -1,207 +0,0 @@ -'use strict' -var init = require('../helpers/init') -var sauce = require('./sauce') - -const passphrase = process.env.account_passphrase -const password = process.env.account_password - -module.exports = { - - before: function (browser, done) { - init(browser, done) - }, - - '@sources': function () { - return sources - }, - - 'Should load run and deploy tab': function (browser) { - browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') - .clickLaunchIcon('udapp') - .waitForElementPresent('*[data-id="sidePanelSwapitTitle"]') - .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEPLOY & RUN TRANSACTIONS') - }, - - 'Should sign message using account key': function (browser) { - browser.waitForElementPresent('*[data-id="settingsRemixRunSignMsg"]') - .click('*[data-id="settingsRemixRunSignMsg"]') - .pause(2000) - .waitForElementPresent('*[data-id="modalDialogCustomPromptText"]') - .setValue('*[data-id="modalDialogCustomPromptText"]', 'Remix is cool!') - .assert.elementNotPresent('*[data-id="settingsRemixRunSignMsgHash"]') - .assert.elementNotPresent('*[data-id="settingsRemixRunSignMsgSignature"]') - .modalFooterOKClick() - .waitForElementPresent('*[data-id="modalDialogContainer"]', 12000) - .assert.elementPresent('*[data-id="settingsRemixRunSignMsgHash"]') - .assert.elementPresent('*[data-id="settingsRemixRunSignMsgSignature"]') - .modalFooterOKClick() - }, - - 'Should deploy contract on JavascriptVM': function (browser) { - browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') - .clickLaunchIcon('fileExplorers') - .addFile('Greet.sol', sources[0]['browser/Greet.sol']) - .clickLaunchIcon('udapp') - .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') - .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') - .click('*[data-id="Deploy - transact (not payable)"]') - .pause(5000) - .testFunction('0xc39ee005c1e1368c84f02e458de4b41dbb966631a8714d15ef8362dada249ede', { - status: '0x1 Transaction mined and execution succeed', - 'transaction hash': '0xc39ee005c1e1368c84f02e458de4b41dbb966631a8714d15ef8362dada249ede' - }) - }, - - 'Should run low level interaction (fallback function)': function (browser) { - browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') - .waitForElementPresent('*[data-id="universalDappUiTitleExpander"]') - .click('*[data-id="universalDappUiTitleExpander"]') - .waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') - .click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') - .pause(5000) - .testFunction('0xfe718871ee0b4d03cdcac0e12e5b164efaf7e23ba952c07db76e62692867019b', { - status: '0x1 Transaction mined and execution succeed', - 'transaction hash': '0xfe718871ee0b4d03cdcac0e12e5b164efaf7e23ba952c07db76e62692867019b' - }) - }, - - 'Should connect to Goerli Test Network using MetaMask': function (browser) { - browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') - .setupMetamask(passphrase, password) - .click('.network-indicator__down-arrow') - .useXpath().click("//span[text()='Goerli Test Network']") - .useCss().switchBrowserTab(0) - .refresh() - .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) - .click('*[data-id="landingPageStartSolidity"]') - .pause(5000) - .clickLaunchIcon('udapp') - .waitForElementPresent('*[data-id="settingsSelectEnvOptions"]') - .click('*[data-id="settingsSelectEnvOptions"] option[id="injected-mode"]') - .waitForElementPresent('*[data-id="settingsNetworkEnv"]') - .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Goerli (5) network') - .switchBrowserTab(2) - .waitForElementPresent('.page-container__footer-button:nth-of-type(2)') - .click('.page-container__footer-button:nth-of-type(2)') - .switchBrowserTab(0) - }, - - 'Should deploy contract on Goerli Test Network using MetaMask': function (browser) { - browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') - .clickLaunchIcon('fileExplorers') - .openFile('browser/Greet.sol') - .clickLaunchIcon('udapp') - .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') - .click('*[data-id="Deploy - transact (not payable)"]') - .switchBrowserTab(2) - .waitForElementPresent('.transaction-status--unapproved') - .click('.transaction-status--unapproved') - .waitForElementPresent('.page-container__footer-button:nth-of-type(2)') - .click('.page-container__footer-button:nth-of-type(2)') - .waitForElementPresent('.transaction-status--submitted') - .pause(25000) - .switchBrowserTab(0) - }, - - 'Should run low level interaction (fallback function) on Goerli Test Network using MetaMask': function (browser) { - browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') - .waitForElementPresent('*[data-id="universalDappUiTitleExpander"]') - .click('*[data-id="universalDappUiTitleExpander"]') - .waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') - .click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') - .switchBrowserTab(2) - .waitForElementPresent('.transaction-status--unapproved') - .click('.transaction-status--unapproved') - .waitForElementPresent('.page-container__footer-button:nth-of-type(2)') - .click('.page-container__footer-button:nth-of-type(2)') - .waitForElementPresent('.transaction-status--submitted') - .pause(25000) - .switchBrowserTab(0) - }, - - 'Should connect to Ethereum Main Network using MetaMask': function (browser) { - browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') - .switchBrowserTab(2) - .waitForElementPresent('.network-indicator__down-arrow') - .click('.network-indicator__down-arrow') - .useXpath().click("//span[text()='Main Ethereum Network']") - .useCss().switchBrowserTab(0) - .refresh() - .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) - .click('*[data-id="landingPageStartSolidity"]') - .pause(5000) - .clickLaunchIcon('udapp') - .waitForElementPresent('*[data-id="settingsSelectEnvOptions"]') - .click('*[data-id="settingsSelectEnvOptions"] option[id="injected-mode"]') - .waitForElementPresent('*[data-id="settingsNetworkEnv"]') - .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Main (1) network') - }, - - 'Should deploy contract on Ethereum Main Network using MetaMask': function (browser) { - browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') - .clickLaunchIcon('fileExplorers') - .openFile('browser/Greet.sol') - .clickLaunchIcon('udapp') - .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') - .click('*[data-id="Deploy - transact (not payable)"]') - .waitForElementPresent('*[data-id="modalDialogContainer"]', 15000) - .pause(10000) - .assert.containsText('*[data-id="modalDialogModalBody"]', 'You are creating a transaction on the main network. Click confirm if you are sure to continue.') - .modalFooterCancelClick() - }, - - /* - * This test is using 3 differents services: - * - Metamask for getting the transaction - * - Source Verifier service for fetching the contract code - * - Ropsten node for retrieving the trace and storage - * - */ - 'Should debug Ropsten transaction with source highlighting using the source verifier service and MetaMask': function (browser) { - browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') - .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) - .switchBrowserTab(2) - .waitForElementPresent('.network-indicator__down-arrow') - .click('.network-indicator__down-arrow') - .useXpath().click("//span[text()='Ropsten Test Network']") // switch to Ropsten - .useCss().switchBrowserTab(0) - .refresh() - .clickLaunchIcon('pluginManager') // load debugger and source verification - // .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_source-verification"] button') - // debugger already activated .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_debugger"] button') - .clickLaunchIcon('udapp') - .waitForElementPresent('*[data-id="settingsSelectEnvOptions"]') - .click('*[data-id="settingsSelectEnvOptions"] option[id="injected-mode"]') // switch to Ropsten in udapp - .waitForElementPresent('*[data-id="settingsNetworkEnv"]') - .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Ropsten (3) network') - .clickLaunchIcon('debugger') - .setValue('*[data-id="debuggerTransactionInput"]', '0x959371506b8f6223d71c709ac2eb2d0158104dca2d76ca949f1662712cf0e6db') // debug tx - .click('*[data-id="debuggerTransactionStartButton"]') - .waitForElementVisible('*[data-id="treeViewDivto"]', 30000) - .assert.containsText('*[data-id="stepdetail"]', 'loaded address:\n0x3c943Fb816694d7D1f4C738e3e7823818a88DD6C') - .assert.containsText('*[data-id="solidityLocals"]', 'to: 0x6C3CCC7FBA111707D5A1AAF2758E9D4F4AC5E7B1') - .end() - }, - tearDown: sauce -} - -var sources = [ - { - 'browser/Greet.sol': { - content: - ` - pragma solidity ^0.6.0; - contract helloWorld { - string public message; - - fallback () external { - message = 'Hello World!'; - } - - function greet(string memory _message) public { - message = _message; - } - }` - } - } -] diff --git a/apps/remix-ide/test-browser/tests/sauce.js b/apps/remix-ide/test-browser/tests/sauce.js deleted file mode 100644 index c823e19e00..0000000000 --- a/apps/remix-ide/test-browser/tests/sauce.js +++ /dev/null @@ -1,60 +0,0 @@ - -// const https = require('https') - -module.exports = function sauce (callback) { - if (typeof callback === 'function') return callback() - /* - const currentTest = this.client.currentTest - const username = this.client.options.username - const sessionId = this.client.capabilities['webdriver.remote.sessionid'] - const accessKey = this.client.options.accessKey - - if (!username || !accessKey || !sessionId) { - console.log(this.client) - console.log('No username, accessKey or sessionId') - return callback() - } - - const passed = currentTest.results.passed === currentTest.results.tests - - const data = JSON.stringify({passed}) - - const requestPath = `/rest/v1/${username}/jobs/${sessionId}` - - function responseCallback (res) { - res.setEncoding('utf8') - console.log('Response: ', res.statusCode, JSON.stringify(res.headers)) - res.on('data', function onData (chunk) { - console.log('BODY: ' + chunk) - }) - res.on('end', function onEnd () { - console.info('Finished updating saucelabs') - callback() - }) - } - - try { - console.log('Updating saucelabs', requestPath) - - const req = https.request({ - hostname: 'saucelabs.com', - path: requestPath, - method: 'PUT', - auth: `${username}:${accessKey}`, - headers: { - 'Content-Type': 'application/json', - 'Content-Length': data.length - } - }, responseCallback) - - req.on('error', function onError (e) { - console.log('problem with request: ' + e.message) - }) - req.write(data) - req.end() - } catch (error) { - console.log('Error', error) - callback() - } - */ -} diff --git a/apps/remix-ide/test-browser/tests/signingMessage.test.js b/apps/remix-ide/test-browser/tests/signingMessage.test.js deleted file mode 100644 index 46a0b04980..0000000000 --- a/apps/remix-ide/test-browser/tests/signingMessage.test.js +++ /dev/null @@ -1,94 +0,0 @@ -'use strict' -var init = require('../helpers/init') -var sauce = require('./sauce') - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - '@sources': function () { - return sources - }, - 'Test Signature': function (browser) { - let hash, signature - browser - .clickLaunchIcon('udapp') - .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite - .signMessage('test message', (h, s) => { - hash = h - signature = s - console.log('hash', hash) - console.log('signature', signature) - browser.assert.ok(typeof hash.value === 'string', 'type of hash.value must be String') - browser.assert.ok(typeof signature.value === 'string', 'type of signature.value must be String') - }) - .addFile('signMassage.sol', sources[0]['browser/signMassage.sol']) - .openFile('browser/signMassage.sol') - .pause(5000) - .selectContract('ECVerify') - .createContract('') - .clickInstance(0) - .perform((done) => { - browser.getAddressAtPosition(0, (address) => { - // skip 'instance' part of e.g. 'instance0x692a70d2e424a56d2c6c27aa97d1a86395877b3a' - console.log('Test Signature address', address) - var inputs = `"${hash.value}","${signature.value}"` - console.log('Test Signature Input', inputs) - browser.clickFunction('ecrecovery - call', { types: 'bytes32 hash, bytes sig', values: inputs }) - .pause(5000) - .verifyCallReturnValue( - address, - ['0:address: 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c']) - .perform(() => { - done() - }) - }) - }) - .end() - }, - tearDown: sauce -} - -var sources = [ - { - 'browser/signMassage.sol': {content: ` - pragma solidity >=0.4.22 <0.7.0; - contract SignMassageTest { - function testRecovery(bytes32 h, uint8 v, bytes32 r, bytes32 s) public pure returns (address) { - return ecrecover(h, v, r, s); - } - } - - library ECVerify { - function ecrecovery(bytes32 hash, bytes memory sig) public pure returns (address) { - bytes32 r; - bytes32 s; - uint8 v; - - if (sig.length != 65) { - return address(0); - } - - assembly { - r := mload(add(sig, 32)) - s := mload(add(sig, 64)) - v := and(mload(add(sig, 65)), 255) - } - - if (v < 27) { - v += 27; - } - - if (v != 27 && v != 28) { - return address(0); - } - - return ecrecover(hash, v, r, s); - } - - function ecverify(bytes32 hash, bytes memory sig, address signer) public pure returns (bool) { - return signer == ecrecovery(hash, sig); - } - }`} - } -] diff --git a/apps/remix-ide/test-browser/tests/solidityImport.test.js b/apps/remix-ide/test-browser/tests/solidityImport.test.js deleted file mode 100644 index 3a1290c88e..0000000000 --- a/apps/remix-ide/test-browser/tests/solidityImport.test.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict' -var init = require('../helpers/init') -var sauce = require('./sauce') - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - '@sources': function () { - return sources - }, - 'Test Simple Contract': function (browser) { - browser.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['test1', 'test2']) - }, - 'Test Success Import': function (browser) { - browser.addFile('Untitled1.sol', sources[1]['browser/Untitled1.sol']) - .addFile('Untitled2.sol', sources[1]['browser/Untitled2.sol']) - .openFile('browser/Untitled1.sol') - .verifyContracts(['test6', 'test4', 'test5']) - }, - - 'Test Failed Import': function (browser) { - browser.addFile('Untitled3.sol', sources[2]['browser/Untitled3.sol']) - .clickLaunchIcon('solidity') - .assert.containsText('#compileTabView .error pre', 'not found browser/Untitled11.sol') - }, - - 'Test Github Import - from master branch': function (browser) { - browser - .setSolidityCompilerVersion('soljson-v0.6.2+commit.bacdbe57.js') // open-zeppelin moved to pragma ^0.6.0 (master branch) - .addFile('Untitled4.sol', sources[3]['browser/Untitled4.sol']) - .clickLaunchIcon('fileExplorers') - .verifyContracts(['test7', 'ERC20', 'SafeMath'], {wait: 10000}) - }, - - 'Test Github Import - from other branch': function (browser) { - browser - .setSolidityCompilerVersion('soljson-v0.5.0+commit.1d4f565a.js') // switch back to 0.5.0 : release-v2.3.0 branch is not solidity 0.6 compliant - .addFile('Untitled5.sol', sources[4]['browser/Untitled5.sol']) - .clickLaunchIcon('fileExplorers') - .verifyContracts(['test8', 'ERC20', 'SafeMath'], {wait: 10000}) - }, - - 'Test Github Import - no branch specified': function (browser) { - browser - .setSolidityCompilerVersion('soljson-v0.6.2+commit.bacdbe57.js') // open-zeppelin moved to pragma ^0.6.0 (master branch) - .addFile('Untitled6.sol', sources[5]['browser/Untitled6.sol']) - .clickLaunchIcon('fileExplorers') - .verifyContracts(['test10', 'ERC20', 'SafeMath'], {wait: 10000}) - }, - - 'Test Github Import - raw URL': function (browser) { - browser - .addFile('Untitled7.sol', sources[6]['browser/Untitled7.sol']) - .clickLaunchIcon('fileExplorers') - .verifyContracts(['test11', 'ERC20', 'SafeMath'], {wait: 10000}) - .end() - }, - tearDown: sauce -} - -var sources = [ - { - 'browser/Untitled.sol': {content: 'contract test1 {} contract test2 {}'} - }, - { - 'browser/Untitled1.sol': {content: 'import "./Untitled2.sol"; contract test6 {}'}, - 'browser/Untitled2.sol': {content: 'contract test4 {} contract test5 {}'} - }, - { - 'browser/Untitled3.sol': {content: 'import "./Untitled11.sol"; contract test6 {}'} - }, - { - 'browser/Untitled4.sol': {content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; contract test7 {}'} - }, - { - 'browser/Untitled5.sol': {content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.3.0/contracts/token/ERC20/ERC20.sol"; contract test8 {}'} - }, - { - 'browser/Untitled6.sol': {content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; contract test10 {}'} - }, - { - 'browser/Untitled7.sol': {content: 'import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC20/ERC20.sol"; contract test11 {}'} - } -] diff --git a/apps/remix-ide/test-browser/tests/solidityUnittests.test.js b/apps/remix-ide/test-browser/tests/solidityUnittests.test.js deleted file mode 100644 index a3dd412ee3..0000000000 --- a/apps/remix-ide/test-browser/tests/solidityUnittests.test.js +++ /dev/null @@ -1,381 +0,0 @@ -'use strict' -var init = require('../helpers/init') -var sauce = require('./sauce') - -module.exports = { - - before: function (browser, done) { - init(browser, done) - }, - - '@sources': function () { - return sources - }, - - 'Should launch solidity unit test plugin': function (browser) { - browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') - .clickLaunchIcon('fileExplorers') - .addFile('simple_storage.sol', sources[0]['browser/simple_storage.sol']) - .addFile('ks2a.sol', sources[0]['browser/ks2a.sol']) - .clickLaunchIcon('pluginManager') - .scrollAndClick('*[data-id="pluginManagerComponentActivateButtonsolidityUnitTesting"]') - .click('*[data-id="verticalIconsKindsolidityUnitTesting"]') - .waitForElementPresent('*[data-id="sidePanelSwapitTitle"]') - .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'SOLIDITY UNIT TESTING') - }, - - 'Should generate test file': function (browser) { - browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') - .clickLaunchIcon('fileExplorers') - .openFile('browser/simple_storage.sol') - .click('*[data-id="verticalIconsKindsolidityUnitTesting"]') - .waitForElementPresent('*[data-id="testTabGenerateTestFile"]') - .click('*[data-id="testTabGenerateTestFile"]') - .waitForElementPresent('*[title="browser/tests/simple_storage_test.sol"]') - .clickLaunchIcon('fileExplorers') - .pause(10000) - .openFile('browser/tests/simple_storage_test.sol') - .removeFile('browser/tests/simple_storage_test.sol') - }, - - 'Should run simple unit test `simple_storage_test.sol` ': function (browser) { - browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') - .addFile('tests/simple_storage_test.sol', sources[0]['browser/tests/simple_storage_test.sol']) - .click('*[data-id="verticalIconsKindsolidityUnitTesting"]') - .waitForElementPresent('*[data-id="testTabCheckAllTests"]') - .click('*[data-id="testTabCheckAllTests"]') - .clickElementAtPosition('.singleTestLabel', 1) - .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 80000) - .pause(5000) - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'MyTest (browser/tests/simple_storage_test.sol)') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Initial value should be100') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Value is set200') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Should fail for wrong value200') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Passing: 2') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Failing: 1') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'FAIL MyTest (browser/tests/simple_storage_test.sol)') - }, - - 'Should run advance unit test using natspec and experimental ABIEncoderV2 `ks2b_test.sol` ': function (browser) { - browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') - .clickLaunchIcon('fileExplorers') - .addFile('tests/ks2b_test.sol', sources[0]['browser/tests/ks2b_test.sol']) - .click('*[data-id="verticalIconsKindsolidityUnitTesting"]') - .waitForElementPresent('*[data-id="testTabCheckAllTests"]') - .click('*[data-id="testTabCheckAllTests"]') - .clickElementAtPosition('.singleTestLabel', 2) - .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) - .pause(5000) - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/ks2b_test.sol') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project exists') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong project owner') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong sender') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong value') - .pause(5000) - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project is fundable') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'owner is incorrect') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'wrong sender') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'wrong value') - }, - - 'Should stop unit tests during test execution` ': function (browser) { - browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') - .waitForElementPresent('*[data-id="testTabRunTestsTabRunAction"]') - .clickElementAtPosition('.singleTestLabel', 0) - .clickElementAtPosition('.singleTestLabel', 1) - .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') - .pause(5000) - .click('*[data-id="testTabRunTestsTabStopAction"]') - .pause(1000) - .assert.containsText('*[data-id="testTabRunTestsTabStopAction"]', 'Stopping') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/ks2b_test.sol') - .notContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/4_Ballot_test.sol') - .notContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/simple_storage_test.sol') - .pause(7000) - .assert.containsText('*[data-id="testTabTestsExecutionStopped"]', 'The test execution has been stopped') - }, - - 'Should fail on compilation': function (browser) { - browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') - .addFile('tests/compilationError_test.sol', sources[0]['browser/compilationError_test.sol']) - .clickLaunchIcon('fileExplorers') - .openFile('browser/tests/compilationError_test.sol') - .clickLaunchIcon('solidityUnitTesting') - .click('*[data-id="testTabCheckAllTests"]') - .clickElementAtPosition('.singleTestLabel', 3) - .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'SyntaxError: No visibility specified') - .assert.containsText('*[data-id="testTabTestsExecutionStoppedError"]', 'The test execution has been stopped because of error(s) in your test file') - }, - - 'Should fail on deploy': function (browser) { - browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') - .addFile('tests/deployError_test.sol', sources[0]['browser/tests/deployError_test.sol']) - .clickLaunchIcon('fileExplorers') - .openFile('browser/tests/deployError_test.sol') - .clickLaunchIcon('solidityUnitTesting') - .click('*[data-id="testTabCheckAllTests"]') - .clickElementAtPosition('.singleTestLabel', 4) - .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'contract deployment failed after trying twice') - }, - - 'Should fail when parameters are to method in test contract': function (browser) { - browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') - .addFile('tests/methodFailure_test.sol', sources[0]['browser/tests/methodFailure_test.sol']) - .clickLaunchIcon('fileExplorers') - .openFile('browser/tests/methodFailure_test.sol') - .clickLaunchIcon('solidityUnitTesting') - .click('*[data-id="testTabCheckAllTests"]') - .clickElementAtPosition('.singleTestLabel', 5) - .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', `Method 'add' can not have parameters inside a test contract`) - }, - - 'Changing current path': function (browser) { - browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') - .addFile('myTests/simple_storage_test.sol', sources[0]['browser/tests/simple_storage_test.sol']) - .clickLaunchIcon('solidityUnitTesting') - .setValue('*[data-id="uiPathInput"]', 'browser/myTests') - .clickElementAtPosition('.singleTestLabel', 0) - .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]') - .clearValue('*[data-id="uiPathInput"]') - .setValue('*[data-id="uiPathInput"]', 'browser/tests') - }, - - 'Solidity Unittests': function (browser) { - runTests(browser) - }, - - tearDown: sauce -} - -function runTests (browser) { - browser - .waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') - .clickLaunchIcon('fileExplorers') - .openFile('browser/3_Ballot.sol') - .clickLaunchIcon('solidityUnitTesting') - .pause(500) - .scrollAndClick('#runTestsTabRunAction') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) - .pause(5000) - .waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]') - .assert.containsText('#solidityUnittestsOutput', 'browser/tests/4_Ballot_test.sol') - .assert.containsText('#solidityUnittestsOutput', '✓ Check winning proposal') - .assert.containsText('#solidityUnittestsOutput', '✓ Check winnin proposal with return value') - .end() -} - -var sources = [ - { - 'browser/simple_storage.sol': { - content: ` - pragma solidity >=0.4.22 <0.7.0; - - contract SimpleStorage { - uint public storedData; - - constructor() public { - storedData = 100; - } - - function set(uint x) public { - storedData = x; - } - - function get() public view returns (uint retVal) { - return storedData; - } - } - ` - }, - 'browser/tests/simple_storage_test.sol': { - content: ` - pragma solidity >=0.4.22 <0.7.0; - import "remix_tests.sol"; - import "../simple_storage.sol"; - - contract MyTest { - SimpleStorage foo; - - function beforeEach() public { - foo = new SimpleStorage(); - } - - function initialValueShouldBe100() public returns (bool) { - return Assert.equal(foo.get(), 100, "initial value is not correct"); - } - - function valueIsSet200() public returns (bool) { - foo.set(200); - return Assert.equal(foo.get(), 200, "value is not 200"); - } - - function shouldFailForWrongValue200() public returns (bool) { - foo.set(300); - return Assert.equal(foo.get(), 200, "value is not 200"); - } - } - ` - }, - 'browser/ks2a.sol': { - content: ` - pragma solidity >=0.4.22 <0.6.0; - contract Kickstarter { - enum State { Started, Completed } - - struct Project { - address owner; - string name; - uint goal; - uint fundsAvailable; // added - uint amountContributed; // added - State state; - mapping(address => uint) funders; // added - } - - Project[] public projects; - - constructor() public { - } - - function createProject(string memory name, uint goal) public { - projects.length++; // new line - Project storage project = projects[projects.length - 1]; - project.name = name; - project.goal = goal; - project.owner = msg.sender; - project.state = State.Started; - } - - function fundProject(uint projectId) payable public { - Project storage project = projects[projectId]; - // require project exists - // PLEASE CHECK / or erase - // not this: require(projects[projectId].exists, "the project must exist to be funded"); - - // require for... underflow/overflow protection - project.funders[msg.sender] += msg.value; - project.amountContributed += msg.value; - project.fundsAvailable += msg.value; - - if (project.amountContributed >= project.goal) { - project.state = State.Completed; - } - } - - // this function is here because we can't use web3 when using the VM - function getContractBalance() public view returns(uint balance) { - return address(this).balance; - } - - } - ` - }, - 'browser/tests/ks2b_test.sol': { - content: ` - pragma solidity >=0.4.22 <0.6.0; - pragma experimental ABIEncoderV2; - - import "remix_tests.sol"; // this import is automatically injected by Remix. - import "remix_accounts.sol"; - import "../ks2a.sol"; - - contract kickstarterTest { - enum State { Started, Completed } - - Kickstarter kickstarter; - - function beforeAll () public { - kickstarter = new Kickstarter(); - kickstarter.createProject("ProjectA", 123000); - kickstarter.createProject("ProjectB", 100); - } - - /// #sender: account-1 - /// #value: 10000000 - function checkProjectExists () public payable { - (address owner, string memory name, uint goal, uint fundsAvailable, uint amountContributed, Kickstarter.State state) = kickstarter.projects(0); - Assert.equal(name, "ProjectA", "project name is incorrect"); - Assert.equal(goal, 123000, "funding goal is incorrect"); - Assert.equal(owner, address(this), "owner is incorrect"); - Assert.equal(msg.sender, TestsAccounts.getAccount(1), "wrong sender"); - Assert.equal(msg.value, 10000000, "wrong value"); - } - - /// #sender: account-1 - /// #value: 10000000 - function checkWrongProjectOwner () public payable { - (address owner,,,,,) = kickstarter.projects(0); - Assert.equal(owner, TestsAccounts.getAccount(0), "owner is incorrect"); //failing case - } - - /// #sender: account-1 - /// #value: 10000000 - function checkWrongSender () public payable { - Assert.equal(msg.sender, TestsAccounts.getAccount(0), "wrong sender"); //failing case - } - - /// #sender: account-1 - /// #value: 10000000 - function checkWrongValue () public payable { - Assert.equal(msg.value, 5000000, "wrong value"); //failing case - } - - function checkProjectIsFundable () public { - kickstarter.fundProject.value(120000)(0); - (address owner, string memory name, uint goal, uint fundsAvailable, uint amountContributed, Kickstarter.State state) = kickstarter.projects(0); - Assert.equal(amountContributed, 120000, "contributed amount is incorrect"); - } - - } - ` - }, - 'browser/compilationError_test.sol': { - content: ` - pragma solidity ^0.6.1; - - contract failOnCompilation { - fallback() { - - } - } - ` - }, - 'browser/tests/deployError_test.sol': { - content: ` - pragma solidity ^0.6.0; - - contract failingDeploy { - constructor() public { - revert('Deploy Failed'); - } - } - ` - }, - 'browser/tests/methodFailure_test.sol': { - content: ` - pragma solidity ^0.6.0; - - contract methodfailure { - function add(uint a, uint b) public { - uint c = a+b; - Assert.equal(a+b, c, "wrong value"); - } - } - ` - } - } -] diff --git a/apps/remix-ide/test-browser/tests/specialFunctions.test.js b/apps/remix-ide/test-browser/tests/specialFunctions.test.js deleted file mode 100644 index 9ee2457119..0000000000 --- a/apps/remix-ide/test-browser/tests/specialFunctions.test.js +++ /dev/null @@ -1,280 +0,0 @@ -'use strict' -var init = require('../helpers/init') -var sauce = require('./sauce') - -module.exports = { - before: function (browser, done) { - // this test suite also contribute testing https://github.com/ethereum/remix/pull/1497 and https://github.com/ethereum/remix-ide/pull/2898 - // quick explanation: - // the goal of https://github.com/ethereum/remix-ide/pull/2898 is to keep track of all the compiled contracts an not only the last one. - // this introduce an issue: if 2 compiled contracts have the same name, the second one override the first which is not wanted. - // fix's delivered by https://github.com/ethereum/remix/pull/1497: instead of getting contract by name, - // which result in name clashing we process the whole contract object (which contain bytecode, deployedbytecode, ...) - init(browser, done) - }, - '@sources': function () { - return sources - }, - 'Use special functions receive/fallback - both are declared, sending data': function (browser) { - browser.waitForElementVisible('#icon-panel', 10000) - .testContracts('receiveAndFallback.sol', sources[0]['browser/receiveAndFallback.sol'], ['CheckSpecials']) // compile - .clickLaunchIcon('udapp') - .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite - .selectContract('CheckSpecials') - .createContract('') // deploy - .clickInstance(0) - .perform((done) => { - browser.getAddressAtPosition(0, (address) => { - browser.sendLowLevelTx(address, '0', '0xaa') - .pause(1000) - .journalLastChildIncludes('to: CheckSpecials.(fallback)') - .journalLastChildIncludes('value: 0 wei') - .journalLastChildIncludes('data: 0xaa') - .perform(done) - }) - }) - }, - 'Use special functions receive/fallback - both are declared, failing sending data < 1 byte': function (browser) { - // don't need to redeploy it, same contract - browser.perform((done) => { - browser.getAddressAtPosition(0, (address) => { - browser.sendLowLevelTx(address, '0', '0xa') - .pause(1000) - .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`) - .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `The calldata should be a valid hexadecimal value with size of at least one byte.`) - .perform(done) - }) - }) - }, - 'Use special functions receive/fallback - both are declared, failing sending data with odd number of digits': function (browser) { - // don't need to redeploy it, same contract - browser.perform((done) => { - browser.getAddressAtPosition(0, (address) => { - browser.sendLowLevelTx(address, '0', '0x1aa') - .pause(1000) - .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`) - .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `The calldata should be a valid hexadecimal value.`) - .perform(done) - }) - }) - }, - 'Use special functions receive/fallback - both are declared - receive called, sending wei': function (browser) { - // don't need to redeploy it, same contract - browser.perform((done) => { - browser.getAddressAtPosition(0, (address) => { - browser.sendLowLevelTx(address, '1', '') - .pause(1000) - .journalLastChildIncludes('to: CheckSpecials.(receive)') - .journalLastChildIncludes('value: 1 wei') - .journalLastChildIncludes('data: 0x') - .perform(done) - }) - }) - }, - 'Use special functions receive/fallback - both are declared - fallback should fail cause not payable, sending data and wei': function (browser) { - // don't need to redeploy it, same contract - browser.perform((done) => { - browser.getAddressAtPosition(0, (address) => { - browser.sendLowLevelTx(address, '10', '0xaa') - .pause(1000) - .journalLastChildIncludes('to CheckSpecials.(fallback) errored:') - .journalLastChildIncludes('The called function should be payable if you send value') - .perform(done) - }) - }) - }, - 'Use special functions receive/fallback - only receive is declared, sending wei': function (browser) { - browser.waitForElementVisible('#icon-panel', 10000) - .testContracts('receiveOnly.sol', sources[1]['browser/receiveOnly.sol'], ['CheckSpecials']) - .clickLaunchIcon('udapp') - .selectContract('CheckSpecials') - .createContract('') - .clickInstance(1) - .perform((done) => { - browser.getAddressAtPosition(1, (address) => { - browser.sendLowLevelTx(address, '1', '') - .pause(1000) - .journalLastChildIncludes('to: CheckSpecials.(receive)') - .journalLastChildIncludes('value: 1 wei') - .journalLastChildIncludes('data: 0x') - .perform(done) - }) - }) - }, - 'Use special functions receive/fallback - only receive is declared, failing, fallback is not declared, sending data': function (browser) { - // don't need to redeploy it, same contract - browser.perform((done) => { - browser.getAddressAtPosition(1, (address) => { - browser.sendLowLevelTx(address, '0', '0xaa') - .pause(1000) - .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`) - .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `'Fallback' function is not defined`) - .perform(done) - }) - }) - }, - 'Use special functions receive/fallback - only fallback declared and is payable, sending wei': function (browser) { - browser.waitForElementVisible('#icon-panel', 10000) - .testContracts('fallbackOnlyPayable.sol', sources[2]['browser/fallbackOnlyPayable.sol'], ['CheckSpecials']) - .clickLaunchIcon('udapp') - .selectContract('CheckSpecials') - .createContract('') - .clickInstance(2) - .perform((done) => { - browser.getAddressAtPosition(2, (address) => { - browser.sendLowLevelTx(address, '1', '') - .pause(1000) - .journalLastChildIncludes('to: CheckSpecials.(fallback)') - .journalLastChildIncludes('value: 1 wei') - .journalLastChildIncludes('data: 0x') - .perform(done) - }) - }) - }, - 'Use special functions receive/fallback - only fallback is diclared and is payable, sending data and wei': function (browser) { - // don't need to redeploy it, same contract - browser.perform((done) => { - browser.getAddressAtPosition(2, (address) => { - browser.sendLowLevelTx(address, '1', '0xaa') - .pause(1000) - .journalLastChildIncludes('to: CheckSpecials.(fallback)') - .journalLastChildIncludes('value: 1 wei') - .journalLastChildIncludes('data: 0xaa') - .perform(done) - }) - }) - }, - 'Use special functions receive/fallback - only fallback is declared, fallback should fail cause not payable, sending wei': function (browser) { - browser.waitForElementVisible('#icon-panel', 10000) - .testContracts('fallbackOnlyNotPayable.sol', sources[3]['browser/fallbackOnlyNotPayable.sol'], ['CheckSpecials']) - .clickLaunchIcon('udapp') - .selectContract('CheckSpecials') - .createContract('') - .clickInstance(3) - .perform((done) => { - browser.getAddressAtPosition(3, (address) => { - browser.sendLowLevelTx(address, '1', '') - .pause(1000) - .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`) - .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `should have either 'receive' or payable 'fallback'`) - .perform(done) - }) - }) - }, - 'Use special functions receive/fallback - receive and fallback are declared, sending data and wei': function (browser) { - browser.waitForElementVisible('#icon-panel', 10000) - .testContracts('receiveAndFallbackBothPayable.sol', sources[4]['browser/receiveAndFallbackBothPayable.sol'], ['CheckSpecials']) - .clickLaunchIcon('udapp') - .selectContract('CheckSpecials') - .waitForElementVisible('#value') - .clearValue('#value') - .setValue('#value', 0) - .createContract('') - .clickInstance(4) - .pause(1000) - .perform((done) => { - browser.getAddressAtPosition(4, (address) => { - browser.sendLowLevelTx(address, '1', '0xaa') - .pause(1000) - .journalLastChildIncludes('to: CheckSpecials.(fallback)') - .journalLastChildIncludes('value: 1 wei') - .journalLastChildIncludes('data: 0xaa') - .perform(done) - }) - }) - }, - 'Use special functions receive/fallback - receive and fallback are declared and payable, sending wei': function (browser) { - browser.perform((done) => { - browser.getAddressAtPosition(4, (address) => { - browser.sendLowLevelTx(address, '1', '') - .pause(1000) - .journalLastChildIncludes('to: CheckSpecials.(receive)') - .journalLastChildIncludes('value: 1 wei') - .journalLastChildIncludes('data: 0x') - .perform(done) - }) - }) - }, - 'Use special functions receive/fallback - receive and fallback are not declared, sending nothing': function (browser) { - browser.waitForElementVisible('#icon-panel', 10000) - .testContracts('notSpecial.sol', sources[5]['browser/notSpecial.sol'], ['CheckSpecials']) - .clickLaunchIcon('udapp') - .selectContract('CheckSpecials') - .waitForElementVisible('#value') - .clearValue('#value') - .setValue('#value', 0) - .createContract('') - .clickInstance(5) - .pause(1000) - .perform((done) => { - browser.getAddressAtPosition(5, (address) => { - browser.sendLowLevelTx(address, '0', '') - .pause(1000) - .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`) - .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `Both 'receive' and 'fallback' functions are not defined`) - .perform(done) - }) - }) - .end() - }, - tearDown: sauce -} - -var sources = [ - { - 'browser/receiveAndFallback.sol': { - content: ` - contract CheckSpecials { - receive() payable external{} - fallback() external {} - } - ` - } - }, - { - 'browser/receiveOnly.sol': { - content: ` - contract CheckSpecials { - receive() payable external {} - } - ` - } - }, - { - 'browser/fallbackOnlyPayable.sol': { - content: ` - contract CheckSpecials { - fallback() payable external {} - } - ` - } - }, - { - 'browser/fallbackOnlyNotPayable.sol': { - content: ` - contract CheckSpecials { - fallback() external {} - } - ` - } - }, - { - 'browser/receiveAndFallbackBothPayable.sol': { - content: ` - contract CheckSpecials { - receive() payable external {} - fallback() payable external {} - } - ` - } - }, - { - 'browser/notSpecial.sol': { - content: ` - contract CheckSpecials { - function otherFallback() payable external {} - } - ` - } - } -] diff --git a/apps/remix-ide/test-browser/tests/staticAnalysis.test.js b/apps/remix-ide/test-browser/tests/staticAnalysis.test.js deleted file mode 100644 index 33ece096bb..0000000000 --- a/apps/remix-ide/test-browser/tests/staticAnalysis.test.js +++ /dev/null @@ -1,69 +0,0 @@ -'use strict' -var init = require('../helpers/init') -var sauce = require('./sauce') - -var sources = [ - { - 'browser/Untitled.sol': {content: ` -pragma solidity >=0.4.22 <0.6.0; -contract test1 { address test = tx.origin; } -contract test2 {} -contract TooMuchGas { - uint x; - function() external { - x++; - uint test; - uint test1; - } -}`}} -] - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - '@sources': function () { - return sources - }, - 'Static Analysis': function (browser) { - runTests(browser) - }, - tearDown: sauce -} - -function runTests (browser) { - browser - .waitForElementVisible('#icon-panel', 10000) - .clickLaunchIcon('solidity') - .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TooMuchGas', 'test1', 'test2']) - .clickLaunchIcon('solidityStaticAnalysis') - .click('#staticanalysisView button') - .waitForElementPresent('#staticanalysisresult .warning', 2000, true, function () { - listSelectorContains(['Use of tx.origin', - 'Fallback function of contract TooMuchGas requires too much gas', - 'TooMuchGas.() : Variables have very similar names "test" and "test1".'], - '#staticanalysisresult .warning', - browser, function () { - browser.end() - } - ) - }) -} - -function listSelectorContains (textsToFind, selector, browser, callback) { - browser.execute(function (selector) { - var items = document.querySelectorAll(selector) - var ret = [] - for (var k = 0; k < items.length; k++) { - ret.push(items[k].innerText) - } - return ret - }, [selector], function (result) { - console.log(result.value) - for (var k in textsToFind) { - console.log('testing `' + result.value[k] + '` against `' + textsToFind[k] + '`') - browser.assert.equal(result.value[k].indexOf(textsToFind[k]) !== -1, true) - } - callback() - }) -} diff --git a/apps/remix-ide/test-browser/tests/terminal.test.js b/apps/remix-ide/test-browser/tests/terminal.test.js deleted file mode 100644 index 135fd59a1b..0000000000 --- a/apps/remix-ide/test-browser/tests/terminal.test.js +++ /dev/null @@ -1,116 +0,0 @@ -'use strict' -var init = require('../helpers/init') -var sauce = require('./sauce') - -module.exports = { - before: function (browser, done) { - init(browser, done, 'http://127.0.0.1:8080?plugins=solidity,udapp', false) - }, - - 'Should execution a simple console command': function (browser) { - browser - .waitForElementVisible('*[data-id="terminalCli"]', 10000) - .executeScript('console.log(1 + 1)') - .journalLastChild('2') - }, - - 'Should clear console': function (browser) { - browser - .waitForElementVisible('*[data-id="terminalCli"]') - .journalChildIncludes('Welcome to Remix') - .click('#clearConsole') - .assert.containsText('*[data-id="terminalJournal"]', '') - }, - - 'Should display auto-complete menu': function (browser) { - browser - .waitForElementVisible('*[data-id="terminalCli"]') - .click('*[data-id="terminalCli"]') - .sendKeys('*[data-id="terminalCliInput"]', 'remix.') - .assert.visible('*[data-id="autoCompletePopUpAutoCompleteItem"]') - }, - - 'Should execute remix.help() command': function (browser) { - browser - .waitForElementVisible('*[data-id="terminalCli"]') - .executeScript('remix.help()') - .journalChildIncludes('remix.call(message: {name, key, payload})') - .journalChildIncludes('remix.getFile(path)') - .journalChildIncludes('remix.debug(hash)') - .journalChildIncludes('remix.loadgist(id)') - .journalChildIncludes('remix.loadurl(url)') - .journalChildIncludes('remix.setproviderurl(url)') - .journalChildIncludes('remix.execute(filepath)') - .journalChildIncludes('remix.exeCurrent()') - .journalChildIncludes('remix.help()') - .journalChildIncludes('remix.debugHelp()') - }, - - 'Should execute remix.debugHelp() command': function (browser) { - browser - .waitForElementVisible('*[data-id="terminalCli"]') - .executeScript('remix.debugHelp()') - .journalChildIncludes('Here are some examples of scripts that can be run (using remix.exeCurrent() or directly from the console)') - .journalChildIncludes('Please see https://www.npmjs.com/package/remix-debug for more informations') - }, - - 'Async/Await Script': function (browser) { - browser - .addFile('asyncAwait.js', { content: asyncAwait }) - .openFile('browser/asyncAwait.js') - .executeScript(`remix.execute('browser/asyncAwait.js')`) - .journalLastChild('Waiting Promise') - .pause(5500) - .journalLastChild('result - Promise Resolved') - }, - - 'Call Remix File Manager from a script': function (browser) { - browser - .addFile('asyncAwaitWithFileManagerAccess.js', { content: asyncAwaitWithFileManagerAccess }) - .openFile('browser/asyncAwaitWithFileManagerAccess.js') - .pause(5000) - .executeScript(`remix.execute('browser/asyncAwaitWithFileManagerAccess.js')`) - .pause(6000) - .journalLastChildIncludes('contract Ballot {') - .end() - }, - - tearDown: sauce -} - -const asyncAwait = ` - var p = function () { - return new Promise(function (resolve, reject) { - setTimeout(function () { - resolve("Promise Resolved") - }, 5000) - }) - } - - var run = async () => { - console.log('Waiting Promise') - var result = await p() - console.log('result - ', result) - } - - run() -` - -const asyncAwaitWithFileManagerAccess = ` - var p = function () { - return new Promise(function (resolve, reject) { - setTimeout(function () { - resolve("Promise Resolved") - }, 0) - }) - } - - var run = async () => { - console.log('Waiting Promise') - var result = await p() - let text = await remix.call('fileManager', 'readFile', 'browser/3_Ballot.sol') - console.log('result - ', text) - } - - run() -` diff --git a/apps/remix-ide/test-browser/tests/transactionExecution.test.js b/apps/remix-ide/test-browser/tests/transactionExecution.test.js deleted file mode 100644 index 8e1856fc49..0000000000 --- a/apps/remix-ide/test-browser/tests/transactionExecution.test.js +++ /dev/null @@ -1,210 +0,0 @@ -'use strict' -var init = require('../helpers/init') -var sauce = require('./sauce') - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - '@sources': function () { - return sources - }, - - 'Execute Simple Contract and Test Terminal': function (browser) { - browser.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TestContract']) - .clickLaunchIcon('udapp') - .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite - .click('#runTabView button[class^="instanceButton"]') - .waitForElementPresent('.instance:nth-of-type(2)') - .click('.instance:nth-of-type(2) > div > button') - .click('#runTabView .instance div[class^="title"]') - .click('#runTabView .instance div[class^="title"]') - .clickFunction('f - transact (not payable)') - .testFunction('0x38bb944fa4709ed9e163d6c670259f97284b4defd916d512a2fcc3f35bb53e03', - { - status: '0x1 Transaction mined and execution succeed', - 'transaction hash': '0x38bb944fa4709ed9e163d6c670259f97284b4defd916d512a2fcc3f35bb53e03', - 'decoded output': { '0': 'uint256: 8' } - }) - .pause(500) - .checkTerminalFilter('0x12332162e2e31397dc1e07ed0a1cf08f728e9b4487c6f9ed79d2f39410c92782', '') - .clickFunction('g - transact (not payable)') - .testFunction('0xab4f794ca0b531f27fc6eace623666b440facbf20e77615a057d728c67b500f0', - { - status: '0x1 Transaction mined and execution succeed', - 'transaction hash': '0xab4f794ca0b531f27fc6eace623666b440facbf20e77615a057d728c67b500f0', - 'decoded output': { - '0': 'uint256: 345', - '1': 'string: comment_comment_', - '2': 'bool: true', - '3': 'uint256: 4' - } - }) - .click('*[data-id="deployAndRunClearInstances"]') - }, - - 'Test Complex Return Values': function (browser) { - browser.testContracts('returnValues.sol', sources[1]['browser/returnValues.sol'], ['testReturnValues']) - .clickLaunchIcon('udapp') - .click('#runTabView button[class^="instanceButton"]') - .waitForElementPresent('.instance:nth-of-type(2)') - .click('.instance:nth-of-type(2) > div > button') - .clickFunction('retunValues1 - transact (not payable)') - .testFunction('0x09c6716a67f0f8c7a0ca2b3ddf59c25982da856a95aefd640b767f9b9feee39d', - { - status: '0x1 Transaction mined and execution succeed', - 'transaction hash': '0x09c6716a67f0f8c7a0ca2b3ddf59c25982da856a95aefd640b767f9b9feee39d', - 'decoded output': { - '0': 'bool: _b true', - '1': 'uint256: _u 345', - '2': 'int256: _i -345', - '3': 'address: _a 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c' - } - }) - .clickFunction('retunValues2 - transact (not payable)') - .testFunction('0xe884953e0695399d60914af3e1ea2dad59fe41f3c0c20665c130fa40dd0fb6bf', - { - status: '0x1 Transaction mined and execution succeed', - 'transaction hash': '0xe884953e0695399d60914af3e1ea2dad59fe41f3c0c20665c130fa40dd0fb6bf', - 'decoded output': { - '0': 'bytes1: _b 0x12', - '1': 'bytes2: _b2 0x1223', - '2': 'bytes3: _b3 0x000000', - '3': 'bytes: _blit 0x123498', - '4': 'bytes5: _b5 0x0432450000', - '5': 'bytes6: _b6 0x234553253200', - '6': 'string: _str this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string', - '7': 'bytes7: _b7 0x03252353253253', - '8': 'bytes22: _b22 0x32523523532532532523532500000000000000000000', - '9': 'bytes32: _b32 0x0325235325325235325235325235320000000000000000000000000000000000' - } - }).pause(500) - .clickFunction('retunValues3 - transact (not payable)') - .testFunction('0xb4108649d5e65a4a0776d6ac98c2c356540a7e99d641705a82352a845d467eb5', - { - status: '0x1 Transaction mined and execution succeed', - 'transaction hash': '0xb4108649d5e65a4a0776d6ac98c2c356540a7e99d641705a82352a845d467eb5', - 'decoded output': { - '0': 'uint8: _en 2', - '1': 'int256[5][]: _a1 1,-45,-78,56,60,-1,42,334,-45455,-446,1,10,-5435,45,-7' - } - }).click('*[data-id="deployAndRunClearInstances"]') - }, - - 'Test Complex Input Values': function (browser) { - browser.testContracts('inputValues.sol', sources[2]['browser/inputValues.sol'], ['test']) - .clickLaunchIcon('udapp') - .click('#runTabView button[class^="instanceButton"]') - .waitForElementPresent('.instance:nth-of-type(2)') - .click('.instance:nth-of-type(2) > div > button') - .clickFunction('inputValue1 - transact (not payable)', {types: 'uint256 _u, int256 _i, string _str', values: '"2343242", "-4324324", "string _ string _ string _ string _ string _ string _ string _ string _ string _ string _"'}) - .testFunction('0xe9678b5486674a0425301a1d7e925c22cfb9f7f7ec6242697d742009f7ef5b97', - { - status: '0x1 Transaction mined and execution succeed', - 'transaction hash': '0xe9678b5486674a0425301a1d7e925c22cfb9f7f7ec6242697d742009f7ef5b97', - 'decoded output': { - '0': 'uint256: _uret 2343242', - '1': 'int256: _iret -4324324', - '2': 'string: _strret string _ string _ string _ string _ string _ string _ string _ string _ string _ string _' - } - }) - .pause(500) - .clickFunction('inputValue2 - transact (not payable)', {types: 'uint256[3] _n, bytes8[4] _b8', values: '[1,2,3], ["0x1234000000000000", "0x1234000000000000","0x1234000000000000","0x1234000000000000"]'}) - .testFunction('0x21724b08c3699bda8375803f8dc842194aea370f2aac284e55144b452dca321f', { - status: '0x1 Transaction mined and execution succeed', - 'transaction hash': '0x21724b08c3699bda8375803f8dc842194aea370f2aac284e55144b452dca321f', - 'decoded output': { - '0': 'uint256[3]: _nret 1,2,3', - '1': 'bytes8[4]: _b8ret 0x1234000000000000,0x1234000000000000,0x1234000000000000,0x1234000000000000' - }, - logs: [ - { - 'from': '0x8c1ed7e19abaa9f23c476da86dc1577f1ef401f5', - 'topic': '0xd30981760edbf605bda8689e945f622877f230c9a77cbfbd448aa4b7d8ac6e7f', - 'event': 'event1', - 'args': { - '0': '-123', - '1': '123', - '2': { - 'hash': '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658', - 'type': 'Indexed' - }, - '3': '0x12340000', - '4': 'test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ', - '_i': '-123', - '_u': '123', - '_str': { - 'hash': '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658', - 'type': 'Indexed' - }, - '_b': '0x12340000', - '_notIndexed': 'test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ', - 'length': 5 - } - } - ] - }) - .click('*[data-id="deployAndRunClearInstances"]') - .end() - }, - - tearDown: sauce -} - -// @TODO test: bytes8[3][] type as input - -var sources = [ - {'browser/Untitled.sol': {content: ` - contract TestContract { function f() public returns (uint) { return 8; } - function g() public returns (uint, string memory, bool, uint) { - uint payment = 345; - bool payed = true; - string memory comment = "comment_comment_"; - uint month = 4; - return (payment, comment, payed, month); } }`}}, - {'browser/returnValues.sol': {content: ` - contract testReturnValues { - enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill } - function retunValues1 () public returns (bool _b, uint _u, int _i, address _a) { - _b = true; - _u = 345; - _i = -345; - _a = msg.sender; - } - - function retunValues2 () public returns (byte _b, bytes2 _b2, bytes3 _b3, bytes memory _blit, bytes5 _b5, bytes6 _b6, string memory _str, bytes7 _b7, bytes22 _b22, bytes32 _b32) { - _b = 0x12; - _b2 = 0x1223; - _b5 = hex"043245"; - _b6 = hex"2345532532"; - _b7 = hex"03252353253253"; - _b22 = hex"325235235325325325235325"; - _b32 = hex"032523532532523532523532523532"; - _blit = hex"123498"; - _str = "this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string"; - } - - function retunValues3 () public returns (ActionChoices _en, int[5][] memory _a1) { - _en = ActionChoices.GoStraight; - int[5][] memory a = new int[5][](3); - a[0] = [int(1),-45,-78,56,60]; - a[1] = [int(-1),42,334,-45455,-446]; - a[2] = [int(1),10,-5435,45,-7]; - _a1 = a; - } - }`}}, - {'browser/inputValues.sol': {content: ` - contract test { - event event1(int _i, uint indexed _u, string indexed _str, bytes4 _b, string _notIndexed); - function inputValue1 (uint _u, int _i, string memory _str) public returns (uint _uret, int _iret, string memory _strret) { - _uret = _u; - _iret = _i; - _strret = _str; - } - function inputValue2 (uint[3] memory _n, bytes8[4] memory _b8) public returns (uint[3] memory _nret, bytes8[4] memory _b8ret){ - _nret = _n; - _b8ret = _b8; - emit event1(-123, 123, "test", hex"1234", "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test "); - } -}`}} -] diff --git a/apps/remix-ide/test-browser/tests/txListener.test.js b/apps/remix-ide/test-browser/tests/txListener.test.js deleted file mode 100644 index 4dfbdb502b..0000000000 --- a/apps/remix-ide/test-browser/tests/txListener.test.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict' -var examples = require('../../src/app/editor/example-contracts') -var init = require('../helpers/init') -var sauce = require('./sauce') - -var sources = [ - {'browser/Untitled.sol': {content: examples.ballot.content}}, - {'browser/Untitled1.sol': {content: `contract test {}`}} -] - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - '@sources': function () { - return sources - }, - 'The sequence: Compiling / Deploying / Compiling another contract / calling the first contract - should display in the log the transaction with all the decoded information': function (browser) { - // https://github.com/ethereum/remix-ide/issues/2864 - browser - .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) - .clickLaunchIcon('solidity') - .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) - .clickLaunchIcon('udapp') - .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') - .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') - .click('*[data-id="Deploy - transact (not payable)"]') - .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]') - .click('*[data-id="universalDappUiTitleExpander"]') - .clickFunction('delegate - transact (not payable)', {types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'}) - .testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', - { - status: '0x1 Transaction mined and execution succeed', - 'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', - 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } - }) - .clickLaunchIcon('solidity') - .testContracts('Untitled1.sol', sources[1]['browser/Untitled1.sol'], ['test']) - .clickLaunchIcon('udapp') - .clickFunction('delegate - transact (not payable)', {types: 'address to', values: ''}) - .pause(5000) - .testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', - { - status: '0x0 Transaction mined but execution failed', - 'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', - 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } - }) - .end() - }, - - tearDown: sauce -} diff --git a/apps/remix-ide/test-browser/tests/usingWebWorker.test.js b/apps/remix-ide/test-browser/tests/usingWebWorker.test.js deleted file mode 100644 index 8a4854b884..0000000000 --- a/apps/remix-ide/test-browser/tests/usingWebWorker.test.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict' -var init = require('../helpers/init') -var sauce = require('./sauce') - -var sources = [ - {'browser/basic.sol': { content: - `pragma solidity >=0.2.0 <0.7.0; - - /** - * @title Basic contract - */ - contract Basic { - uint someVar; - constructor() public {} - }` - }} -] - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - '@sources': function () { - return sources - }, - 'Using Web Worker': function (browser) { - browser - .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) - .clickLaunchIcon('fileExplorers') - .addFile('browser/basic.sol', sources[0]['browser/basic.sol']) - .clickLaunchIcon('solidity') - .execute(function() { - document.getElementById('nightlies').checked = true - }) - .noWorkerErrorFor('soljson-v0.3.4+commit.7dab8902.js') - .noWorkerErrorFor('soljson-v0.6.5+commit.f956cc89.js') - .noWorkerErrorFor('soljson-v0.6.8-nightly.2020.5.14+commit.a6d0067b.js') - .noWorkerErrorFor('soljson-v0.6.0-nightly.2019.12.17+commit.d13438ee.js') - .noWorkerErrorFor('soljson-v0.4.26+commit.4563c3fc.js') - .execute(function() { - document.getElementById('nightlies').checked = false - }) - .end() - }, - - tearDown: sauce -} diff --git a/apps/remix-ide/test-browser/tests/workspace.test.js b/apps/remix-ide/test-browser/tests/workspace.test.js deleted file mode 100644 index bf5069c5b5..0000000000 --- a/apps/remix-ide/test-browser/tests/workspace.test.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' -const init = require('../helpers/init') -const sauce = require('./sauce') - -module.exports = { - before: function (browser, done) { - init(browser, done, 'http://127.0.0.1:8080?plugins=solidity,udapp', false) - }, - 'CheckSolidityActivatedAndUDapp': function (browser) { - browser - .waitForElementVisible('#icon-panel', 10000) - .clickLaunchIcon('solidity') - .clickLaunchIcon('udapp') - .end() - }, - tearDown: sauce -} diff --git a/workspace.json b/workspace.json index 1e3effcec3..d81084a528 100644 --- a/workspace.json +++ b/workspace.json @@ -108,7 +108,7 @@ "builder": "@nrwl/workspace:run-commands", "options": { "commands": [ - "TEST_SCRIPT='node_modules/.bin/nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js'; if [ {args.env} != undefined ]; then TEST_SCRIPT=${TEST_SCRIPT}' --env {args.env}'; else TEST_SCRIPT=${TEST_SCRIPT}' --env chrome'; fi; if [ {args.filePath} != undefined ]; then TEST_SCRIPT=${TEST_SCRIPT}' {args.filePath}'; fi; echo $TEST_SCRIPT; eval $TEST_SCRIPT;" + "TEST_SCRIPT='node_modules/.bin/nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js'; if [ {args.env} != undefined ]; then TEST_SCRIPT=${TEST_SCRIPT}' --env {args.env}'; else TEST_SCRIPT=${TEST_SCRIPT}' --env chrome'; fi; if [ {args.filePath} != undefined ]; then TEST_SCRIPT=${TEST_SCRIPT}' {args.filePath}'; fi; eval $TEST_SCRIPT;" ], "parallel": false }