Fixed remix-ide-e2e linting errors

pull/859/head
ioedeveloper 4 years ago
parent 8790f3949f
commit 3c96778d89
  1. 6
      .circleci/config.yml
  2. 4
      apps/remix-ide-e2e/.eslintrc
  3. 100
      apps/remix-ide-e2e/nightwatch.ts
  4. 4
      apps/remix-ide-e2e/src/commands/addAtAddressInstance.ts
  5. 2
      apps/remix-ide-e2e/src/commands/addFile.ts
  6. 4
      apps/remix-ide-e2e/src/commands/checkVariableDebug.ts
  7. 2
      apps/remix-ide-e2e/src/commands/clearEditableContent.ts
  8. 14
      apps/remix-ide-e2e/src/commands/clickElementAtPosition.ts
  9. 30
      apps/remix-ide-e2e/src/commands/clickFunction.ts
  10. 2
      apps/remix-ide-e2e/src/commands/clickInstance.ts
  11. 4
      apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts
  12. 10
      apps/remix-ide-e2e/src/commands/createContract.ts
  13. 6
      apps/remix-ide-e2e/src/commands/debugTransaction.ts
  14. 4
      apps/remix-ide-e2e/src/commands/editorScroll.ts
  15. 4
      apps/remix-ide-e2e/src/commands/executeScript.ts
  16. 20
      apps/remix-ide-e2e/src/commands/getAddressAtPosition.ts
  17. 6
      apps/remix-ide-e2e/src/commands/getEditorValue.ts
  18. 28
      apps/remix-ide-e2e/src/commands/getInstalledPlugins.ts
  19. 16
      apps/remix-ide-e2e/src/commands/getModalBody.ts
  20. 16
      apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts
  21. 2
      apps/remix-ide-e2e/src/commands/journalChildIncludes.ts
  22. 10
      apps/remix-ide-e2e/src/commands/journalLastChild.ts
  23. 16
      apps/remix-ide-e2e/src/commands/journalLastChildIncludes.ts
  24. 4
      apps/remix-ide-e2e/src/commands/modalFooterCancelClick.ts
  25. 4
      apps/remix-ide-e2e/src/commands/modalFooterOKClick.ts
  26. 4
      apps/remix-ide-e2e/src/commands/noWorkerErrorFor.ts
  27. 10
      apps/remix-ide-e2e/src/commands/notContainsText.ts
  28. 12
      apps/remix-ide-e2e/src/commands/openFile.ts
  29. 10
      apps/remix-ide-e2e/src/commands/removeFile.ts
  30. 8
      apps/remix-ide-e2e/src/commands/renamePath.ts
  31. 8
      apps/remix-ide-e2e/src/commands/rightClick.ts
  32. 12
      apps/remix-ide-e2e/src/commands/scrollAndClick.ts
  33. 4
      apps/remix-ide-e2e/src/commands/scrollInto.ts
  34. 2
      apps/remix-ide-e2e/src/commands/selectAccount.ts
  35. 2
      apps/remix-ide-e2e/src/commands/selectContract.ts
  36. 20
      apps/remix-ide-e2e/src/commands/sendLowLevelTx.ts
  37. 38
      apps/remix-ide-e2e/src/commands/setupMetamask.ts
  38. 22
      apps/remix-ide-e2e/src/commands/signMessage.ts
  39. 4
      apps/remix-ide-e2e/src/commands/switchBrowserTab.ts
  40. 8
      apps/remix-ide-e2e/src/commands/switchBrowserWindow.ts
  41. 4
      apps/remix-ide-e2e/src/commands/testConstantFunction.ts
  42. 4
      apps/remix-ide-e2e/src/commands/testContracts.ts
  43. 2
      apps/remix-ide-e2e/src/commands/testEditorValue.ts
  44. 50
      apps/remix-ide-e2e/src/commands/testFunction.ts
  45. 14
      apps/remix-ide-e2e/src/commands/validateValueInput.ts
  46. 2
      apps/remix-ide-e2e/src/commands/verifyCallReturnValue.ts
  47. 62
      apps/remix-ide-e2e/src/commands/verifyContracts.ts
  48. 12
      apps/remix-ide-e2e/src/examples/example-contracts.ts
  49. 8
      apps/remix-ide-e2e/src/helpers/init.ts
  50. 184
      apps/remix-ide-e2e/src/tests/ballot.test.ts
  51. 253
      apps/remix-ide-e2e/src/tests/ballot_0_4_11.test.ts
  52. 41
      apps/remix-ide-e2e/src/tests/compiler_api.test.ts
  53. 372
      apps/remix-ide-e2e/src/tests/debugger.test.ts
  54. 80
      apps/remix-ide-e2e/src/tests/defaultLayout.test.ts
  55. 134
      apps/remix-ide-e2e/src/tests/editor.test.ts
  56. 127
      apps/remix-ide-e2e/src/tests/fileExplorer.test.ts
  57. 96
      apps/remix-ide-e2e/src/tests/fileManager_api.test.ts
  58. 160
      apps/remix-ide-e2e/src/tests/generalSettings.test.ts
  59. 128
      apps/remix-ide-e2e/src/tests/gist.test.ts
  60. 10
      apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts
  61. 152
      apps/remix-ide-e2e/src/tests/pluginManager.test.ts
  62. 86
      apps/remix-ide-e2e/src/tests/publishContract.test.ts
  63. 235
      apps/remix-ide-e2e/src/tests/recorder.test.ts
  64. 48
      apps/remix-ide-e2e/src/tests/remixd.test.ts
  65. 259
      apps/remix-ide-e2e/src/tests/runAndDeploy.ts
  66. 42
      apps/remix-ide-e2e/src/tests/signingMessage.test.ts
  67. 80
      apps/remix-ide-e2e/src/tests/solidityImport.test.ts
  68. 214
      apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts
  69. 248
      apps/remix-ide-e2e/src/tests/specialFunctions.test.ts
  70. 19
      apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts
  71. 135
      apps/remix-ide-e2e/src/tests/terminal.test.ts
  72. 250
      apps/remix-ide-e2e/src/tests/transactionExecution.test.ts
  73. 60
      apps/remix-ide-e2e/src/tests/txListener.test.ts
  74. 44
      apps/remix-ide-e2e/src/tests/url.test.ts
  75. 47
      apps/remix-ide-e2e/src/tests/usingWebWorker.test.ts
  76. 30
      apps/remix-ide-e2e/src/tests/verticalIconsPanel.test.ts
  77. 22
      apps/remix-ide-e2e/src/tests/workspace.test.ts

@ -47,7 +47,7 @@ jobs:
- checkout - checkout
- run: npm install - run: npm install
- run: npm run lint - run: npm run lint
# - run: npm run lint remix-ide-e2e - run: npm run lint remix-ide-e2e
- run: npm run build:libs - run: npm run build:libs
- run: npm run build - run: npm run build
- run: - run:
@ -84,7 +84,7 @@ jobs:
- checkout - checkout
- run: npm install - run: npm install
- run: npm run lint - run: npm run lint
# - run: npm run lint remix-ide-e2e - run: npm run lint remix-ide-e2e
- run: npm run build:libs - run: npm run build:libs
- run: npm run build - run: npm run build
- run: - run:
@ -126,7 +126,7 @@ jobs:
- checkout - checkout
- run: npm install - run: npm install
- run: npm run lint - run: npm run lint
# - run: npm run lint remix-ide-e2e - run: npm run lint remix-ide-e2e
- run: npm run build:libs - run: npm run build:libs
- run: npm run build - run: npm run build
- run: - run:

@ -5,7 +5,9 @@
"files": ["**/*.ts"], "files": ["**/*.ts"],
"rules": { "rules": {
"no-undef": "off", "no-undef": "off",
"@typescript-eslint/no-var-requires": 0 "@typescript-eslint/no-var-requires": 0,
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error"
} }
} }
], ],

@ -4,79 +4,79 @@ const crxFile = fs.readFileSync('apps/remix-ide-e2e/src/extensions/chrome/metama
const metamaskExtension = Buffer.from(crxFile).toString('base64') const metamaskExtension = Buffer.from(crxFile).toString('base64')
module.exports = { module.exports = {
'src_folders': ['dist/apps/remix-ide-e2e/src/tests'], src_folders: ['dist/apps/remix-ide-e2e/src/tests'],
'output_folder': './reports/tests', output_folder: './reports/tests',
'custom_commands_path': ['dist/apps/remix-ide-e2e/src/commands'], custom_commands_path: ['dist/apps/remix-ide-e2e/src/commands'],
'custom_assertions_path': '', custom_assertions_path: '',
'page_objects_path': '', page_objects_path: '',
'globals_path': '', globals_path: '',
'test_settings': { test_settings: {
'default': { default: {
'selenium_port': 4444, selenium_port: 4444,
'selenium_host': 'localhost', selenium_host: 'localhost',
'globals': { globals: {
'waitForConditionTimeout': 10000, waitForConditionTimeout: 10000,
'asyncHookTimeout': 100000 asyncHookTimeout: 100000
}, },
'screenshots': { screenshots: {
'enabled': true, enabled: true,
'path': './reports/screenshots', path: './reports/screenshots',
'on_failure': true, on_failure: true,
'on_error': true on_error: true
}, },
'desiredCapabilities': { desiredCapabilities: {
'browserName': 'firefox', browserName: 'firefox',
'javascriptEnabled': true, javascriptEnabled: true,
'acceptSslCerts': true acceptSslCerts: true
}, },
'exclude': ['dist/apps/remix-ide-e2e/src/tests/runAndDeploy.js'] exclude: ['dist/apps/remix-ide-e2e/src/tests/runAndDeploy.js']
}, },
'chrome': { chrome: {
'desiredCapabilities': { desiredCapabilities: {
'browserName': 'chrome', browserName: 'chrome',
'javascriptEnabled': true, javascriptEnabled: true,
'acceptSslCerts': true, acceptSslCerts: true,
'goog:chromeOptions': { 'goog:chromeOptions': {
'args': ['window-size=2560,1440', 'start-fullscreen'] args: ['window-size=2560,1440', 'start-fullscreen']
} }
} }
}, },
'chrome-runAndDeploy': { 'chrome-runAndDeploy': {
'desiredCapabilities': { desiredCapabilities: {
'browserName': 'chrome', browserName: 'chrome',
'javascriptEnabled': true, javascriptEnabled: true,
'acceptSslCerts': true, acceptSslCerts: true,
'goog:chromeOptions': { 'goog:chromeOptions': {
'args': ['window-size=2560,1440', 'start-fullscreen'], args: ['window-size=2560,1440', 'start-fullscreen'],
'extensions': [metamaskExtension] extensions: [metamaskExtension]
} }
} }
}, },
'safari': { safari: {
'desiredCapabilities': { desiredCapabilities: {
'browserName': 'safari', browserName: 'safari',
'javascriptEnabled': true, javascriptEnabled: true,
'acceptSslCerts': true acceptSslCerts: true
} }
}, },
'ie': { ie: {
'desiredCapabilities': { desiredCapabilities: {
'browserName': 'internet explorer', browserName: 'internet explorer',
'javascriptEnabled': true, javascriptEnabled: true,
'acceptSslCerts': true acceptSslCerts: true
} }
}, },
'firefox': { firefox: {
'desiredCapabilities': { desiredCapabilities: {
'browserName': 'firefox', browserName: 'firefox',
'javascriptEnabled': true, javascriptEnabled: true,
'acceptSslCerts': true acceptSslCerts: true
} }
} }
} }

@ -1,5 +1,5 @@
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class addAtAddressInstance extends EventEmitter { class addAtAddressInstance extends EventEmitter {
command (this: NightwatchBrowser, address: string, isValidFormat: boolean, isValidChecksum: boolean): NightwatchBrowser { command (this: NightwatchBrowser, address: string, isValidFormat: boolean, isValidChecksum: boolean): NightwatchBrowser {
@ -19,7 +19,7 @@ function addInstance (browser: NightwatchBrowser, address: string, isValidFormat
.execute(function () { .execute(function () {
const ret = document.querySelector('div[class^="modal-body"] div').innerHTML const ret = document.querySelector('div[class^="modal-body"] div').innerHTML
const modal = document.querySelector('#modal-footer-ok') as HTMLElement const modal = document.querySelector('#modal-footer-ok') as HTMLElement
modal.click() modal.click()
return ret return ret
}, [], function (result) { }, [], function (result) {

@ -1,5 +1,5 @@
import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch' import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class AddFile extends EventEmitter { class AddFile extends EventEmitter {
command (this: NightwatchBrowser, name: string, content: NightwatchContractContent): NightwatchBrowser { command (this: NightwatchBrowser, name: string, content: NightwatchContractContent): NightwatchBrowser {

@ -1,5 +1,5 @@
import { NightwatchBrowser, NightwatchCheckVariableDebugValue } from 'nightwatch' import { NightwatchBrowser, NightwatchCheckVariableDebugValue } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
const deepequal = require('deep-equal') const deepequal = require('deep-equal')
@ -16,7 +16,7 @@ class CheckVariableDebug extends EventEmitter {
} }
function checkDebug (browser: NightwatchBrowser, id: string, debugValue: NightwatchCheckVariableDebugValue, done: VoidFunction) { function checkDebug (browser: NightwatchBrowser, id: string, debugValue: NightwatchCheckVariableDebugValue, done: VoidFunction) {
// id is soliditylocals or soliditystate // id is soliditylocals or soliditystate
browser.execute(function (id: string) { browser.execute(function (id: string) {
const elem = document.querySelector('#' + id + ' .dropdownrawcontent') as HTMLElement const elem = document.querySelector('#' + id + ' .dropdownrawcontent') as HTMLElement

@ -23,7 +23,7 @@ function clearContent (browser: NightwatchBrowser, cssSelector: string, callback
selection.addRange(range) selection.addRange(range)
}, [cssSelector], function () { }, [cssSelector], function () {
browser.sendKeys(cssSelector, browser.Keys.BACK_SPACE) browser.sendKeys(cssSelector, browser.Keys.BACK_SPACE)
.pause(5000) .pause(5000)
callback() callback()
}) })
} }

@ -15,13 +15,13 @@ class ClickElement extends EventEmitter {
function _clickElement (browser: NightwatchBrowser, cssSelector: string, index: number, cb: VoidFunction) { function _clickElement (browser: NightwatchBrowser, cssSelector: string, index: number, cb: VoidFunction) {
browser.waitForElementPresent(cssSelector) browser.waitForElementPresent(cssSelector)
.execute(function (cssSelector: string, index: number) { .execute(function (cssSelector: string, index: number) {
const elem = document.querySelectorAll(cssSelector)[index] as HTMLElement const elem = document.querySelectorAll(cssSelector)[index] as HTMLElement
elem.click() elem.click()
}, [cssSelector, index], function () { }, [cssSelector, index], function () {
cb() cb()
}) })
} }
module.exports = ClickElement module.exports = ClickElement

@ -1,24 +1,24 @@
import { NightwatchBrowser, NightwatchClickFunctionExpectedInput } from 'nightwatch' import { NightwatchBrowser, NightwatchClickFunctionExpectedInput } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class ClickFunction extends EventEmitter { class ClickFunction extends EventEmitter {
command (this: NightwatchBrowser, fnFullName: string, expectedInput?: NightwatchClickFunctionExpectedInput): NightwatchBrowser { command (this: NightwatchBrowser, fnFullName: string, expectedInput?: NightwatchClickFunctionExpectedInput): NightwatchBrowser {
this.api.waitForElementPresent('.instance button[title="' + fnFullName + '"]') this.api.waitForElementPresent('.instance button[title="' + fnFullName + '"]')
.perform(function (client, done) { .perform(function (client, done) {
client.execute(function () { client.execute(function () {
document.querySelector('#runTabView').scrollTop = document.querySelector('#runTabView').scrollHeight document.querySelector('#runTabView').scrollTop = document.querySelector('#runTabView').scrollHeight
}, [], function () { }, [], function () {
if (expectedInput) { if (expectedInput) {
client.setValue('#runTabView input[title="' + expectedInput.types + '"]', expectedInput.values, _ => _) client.setValue('#runTabView input[title="' + expectedInput.types + '"]', expectedInput.values, _ => _)
} }
done() done()
})
})
.scrollAndClick('.instance button[title="' + fnFullName + '"]')
.pause(2000)
.perform(() => {
this.emit('complete')
}) })
})
.scrollAndClick('.instance button[title="' + fnFullName + '"]')
.pause(2000)
.perform(() => {
this.emit('complete')
})
return this return this
} }
} }

@ -1,5 +1,5 @@
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class ClickInstance extends EventEmitter { class ClickInstance extends EventEmitter {
command (this: NightwatchBrowser, index: number): NightwatchBrowser { command (this: NightwatchBrowser, index: number): NightwatchBrowser {

@ -1,5 +1,5 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class ClickLaunchIcon extends EventEmitter { class ClickLaunchIcon extends EventEmitter {
command (this: NightwatchBrowser, icon: string): NightwatchBrowser { command (this: NightwatchBrowser, icon: string): NightwatchBrowser {

@ -1,5 +1,5 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class CreateContract extends EventEmitter { class CreateContract extends EventEmitter {
command (this: NightwatchBrowser, inputParams: string): NightwatchBrowser { command (this: NightwatchBrowser, inputParams: string): NightwatchBrowser {
@ -20,9 +20,9 @@ function createContract (browser: NightwatchBrowser, inputParams: string, callba
}) })
} else { } else {
browser browser
.click('#runTabView button[class^="instanceButton"]') .click('#runTabView button[class^="instanceButton"]')
.pause(500) .pause(500)
.perform(function () { callback() }) .perform(function () { callback() })
} }
} }

@ -1,5 +1,5 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class debugTransaction extends EventEmitter { class debugTransaction extends EventEmitter {
command (this: NightwatchBrowser, index = 0): NightwatchBrowser { command (this: NightwatchBrowser, index = 0): NightwatchBrowser {
@ -19,7 +19,7 @@ function checkStyle (browser: NightwatchBrowser, index: number, callback: VoidFu
debugBtn && debugBtn.click() debugBtn && debugBtn.click()
}, [index], function () { }, [index], function () {
browser.waitForElementVisible('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]').perform(() => callback()) browser.waitForElementVisible('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]').perform(() => callback())
}) })
} }

@ -1,5 +1,5 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
// fix for editor scroll // fix for editor scroll
class ScrollEditor extends EventEmitter { class ScrollEditor extends EventEmitter {

@ -1,5 +1,5 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class ExecuteScript extends EventEmitter { class ExecuteScript extends EventEmitter {
command (this: NightwatchBrowser, script: string): NightwatchBrowser { command (this: NightwatchBrowser, script: string): NightwatchBrowser {

@ -1,5 +1,5 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class GetAddressAtPosition extends EventEmitter { class GetAddressAtPosition extends EventEmitter {
command (this: NightwatchBrowser, index: number, cb: (pos: string) => void): NightwatchBrowser { command (this: NightwatchBrowser, index: number, cb: (pos: string) => void): NightwatchBrowser {
@ -16,16 +16,16 @@ class GetAddressAtPosition extends EventEmitter {
function getAddressAtPosition (browser: NightwatchBrowser, index: number, callback: (pos: string) => void) { function getAddressAtPosition (browser: NightwatchBrowser, index: number, callback: (pos: string) => void) {
browser.waitForElementPresent('*[data-shared="universalDappUiInstance"]') browser.waitForElementPresent('*[data-shared="universalDappUiInstance"]')
.execute(function (index) { .execute(function (index) {
const deployedContracts = document.querySelectorAll('*[data-shared="universalDappUiInstance"]') const deployedContracts = document.querySelectorAll('*[data-shared="universalDappUiInstance"]')
const id = deployedContracts[index].getAttribute('id') const id = deployedContracts[index].getAttribute('id')
return id.replace('instance', '') return id.replace('instance', '')
}, [index], function (result) { }, [index], function (result) {
const pos = typeof result.value === 'string' ? result.value : null const pos = typeof result.value === 'string' ? result.value : null
callback(pos) callback(pos)
}) })
} }
module.exports = GetAddressAtPosition module.exports = GetAddressAtPosition

@ -1,11 +1,11 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class GetEditorValue extends EventEmitter { class GetEditorValue extends EventEmitter {
command (this: NightwatchBrowser, callback: (content: string) => void): NightwatchBrowser { command (this: NightwatchBrowser, callback: (content: string) => void): NightwatchBrowser {
this.api.perform((client, done) => { this.api.perform((client, done) => {
this.api.execute(function () { this.api.execute(function () {
const elem: any = document.getElementById('input') const elem: any = document.getElementById('input')
return elem.editor.getValue() return elem.editor.getValue()
}, [], (result) => { }, [], (result) => {

@ -1,26 +1,26 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class GetInstalledPlugins extends EventEmitter { class GetInstalledPlugins extends EventEmitter {
command (this: NightwatchBrowser, cb: (plugins: string[]) => void): NightwatchBrowser { command (this: NightwatchBrowser, cb: (plugins: string[]) => void): NightwatchBrowser {
const browser = this.api const browser = this.api
browser.waitForElementPresent('[plugin]:not([plugin=""]') browser.waitForElementPresent('[plugin]:not([plugin=""]')
.perform((done) => { .perform((done) => {
browser.execute(function() { browser.execute(function () {
const pluginNames = [] const pluginNames = []
const plugins = document.querySelectorAll('[plugin]:not([plugin=""]') const plugins = document.querySelectorAll('[plugin]:not([plugin=""]')
plugins.forEach(plugin => { plugins.forEach(plugin => {
pluginNames.push(plugin.getAttribute('plugin')) pluginNames.push(plugin.getAttribute('plugin'))
})
return pluginNames
}, [], (result) => {
done()
Array.isArray(result.value) && cb(result.value)
this.emit('complete')
}) })
return pluginNames
}, [], (result) => {
done()
Array.isArray(result.value) && cb(result.value)
this.emit('complete')
}) })
})
return this return this
} }
} }

@ -1,17 +1,17 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class GetModalBody extends EventEmitter { class GetModalBody extends EventEmitter {
command (this: NightwatchBrowser, callback: (value: string, cb: VoidFunction) => void) { command (this: NightwatchBrowser, callback: (value: string, cb: VoidFunction) => void) {
this.api.waitForElementPresent('.modal-body') this.api.waitForElementPresent('.modal-body')
.getText('#modal-dialog', (result) => { .getText('#modal-dialog', (result) => {
console.log(result) console.log(result)
const value = typeof result.value === 'string' ? result.value : null const value = typeof result.value === 'string' ? result.value : null
callback(value, () => { callback(value, () => {
this.emit('complete') this.emit('complete')
})
}) })
})
return this return this
} }
} }

@ -1,8 +1,8 @@
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class GoToVmTraceStep extends EventEmitter { class GoToVmTraceStep extends EventEmitter {
command (this: NightwatchBrowser, step: number, incr?: number): NightwatchBrowser { command (this: NightwatchBrowser, step: number, incr?: number): NightwatchBrowser {
goToVMtraceStep(this.api, step, incr, () => { goToVMtraceStep(this.api, step, incr, () => {
this.emit('complete') this.emit('complete')
}) })
return this return this
@ -15,7 +15,7 @@ function goToVMtraceStep (browser: NightwatchBrowser, step: number, incr: number
return document.querySelector('#stepdetail').innerHTML return document.querySelector('#stepdetail').innerHTML
}, [], function (result) { }, [], function (result) {
console.log('goToVMtraceStep', result) console.log('goToVMtraceStep', result)
if (typeof result.value === 'string' && ( result.value.indexOf('vm trace step:') !== -1 && result.value.indexOf(step.toString()) !== -1)) { if (typeof result.value === 'string' && (result.value.indexOf('vm trace step:') !== -1 && result.value.indexOf(step.toString()) !== -1)) {
done() done()
} else if (incr > 1000) { } else if (incr > 1000) {
browser.assert.fail('goToVMtraceStep fails', 'info about error', '') browser.assert.fail('goToVMtraceStep fails', 'info about error', '')
@ -23,11 +23,11 @@ function goToVMtraceStep (browser: NightwatchBrowser, step: number, incr: number
} else { } else {
incr++ incr++
browser.click('#intoforward') browser.click('#intoforward')
.perform(() => { .perform(() => {
setTimeout(() => { setTimeout(() => {
goToVMtraceStep(browser, step, incr, done) goToVMtraceStep(browser, step, incr, done)
}, 200) }, 200)
}) })
} }
}) })
} }

@ -1,5 +1,5 @@
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
/* /*
Checks if any child elements of journal (console) contains a matching value. Checks if any child elements of journal (console) contains a matching value.

@ -1,13 +1,13 @@
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class JournalLastChild extends EventEmitter { class JournalLastChild extends EventEmitter {
command (this: NightwatchBrowser, val: string): NightwatchBrowser { command (this: NightwatchBrowser, val: string): NightwatchBrowser {
this.api this.api
.waitForElementVisible('*[data-id="terminalJournal"] > div:last-child', 10000) .waitForElementVisible('*[data-id="terminalJournal"] > div:last-child', 10000)
.assert.containsText('*[data-id="terminalJournal"] > div:last-child', val).perform(() => { .assert.containsText('*[data-id="terminalJournal"] > div:last-child', val).perform(() => {
this.emit('complete') this.emit('complete')
}) })
return this return this
} }
} }

@ -1,5 +1,5 @@
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
/* /*
Check if the last log in the console contains a specific text Check if the last log in the console contains a specific text
@ -7,13 +7,13 @@ import EventEmitter from "events"
class JournalLastChildIncludes extends EventEmitter { class JournalLastChildIncludes extends EventEmitter {
command (this: NightwatchBrowser, val: string): NightwatchBrowser { command (this: NightwatchBrowser, val: string): NightwatchBrowser {
this.api this.api
.waitForElementVisible('*[data-id="terminalJournal"] > div:last-child', 10000) .waitForElementVisible('*[data-id="terminalJournal"] > div:last-child', 10000)
.getText('*[data-id="terminalJournal"] > div:last-child', (result) => { .getText('*[data-id="terminalJournal"] > div:last-child', (result) => {
console.log('JournalLastChildIncludes', result.value) console.log('JournalLastChildIncludes', result.value)
if (typeof result.value === 'string' && result.value.indexOf(val) === -1) return this.api.assert.fail(`wait for ${val} in ${result.value}`) if (typeof result.value === 'string' && result.value.indexOf(val) === -1) return this.api.assert.fail(`wait for ${val} in ${result.value}`)
else this.api.assert.ok(true, `<*[data-id="terminalJournal"] > div:last-child> contains ${val}.`) else this.api.assert.ok(true, `<*[data-id="terminalJournal"] > div:last-child> contains ${val}.`)
this.emit('complete') this.emit('complete')
}) })
return this return this
} }
} }

@ -1,12 +1,12 @@
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class ModalFooterOKClick extends EventEmitter { class ModalFooterOKClick extends EventEmitter {
command (this: NightwatchBrowser): NightwatchBrowser { command (this: NightwatchBrowser): NightwatchBrowser {
this.api.waitForElementVisible('#modal-footer-cancel').perform((client, done) => { this.api.waitForElementVisible('#modal-footer-cancel').perform((client, done) => {
this.api.execute(function () { this.api.execute(function () {
const elem = document.querySelector('#modal-footer-cancel') as HTMLElement const elem = document.querySelector('#modal-footer-cancel') as HTMLElement
elem.click() elem.click()
}, [], () => { }, [], () => {
done() done()

@ -1,5 +1,5 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class ModalFooterOKClick extends EventEmitter { class ModalFooterOKClick extends EventEmitter {
command (this: NightwatchBrowser): NightwatchBrowser { command (this: NightwatchBrowser): NightwatchBrowser {

@ -1,5 +1,5 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class NoWorkerErrorFor extends EventEmitter { class NoWorkerErrorFor extends EventEmitter {
command (this: NightwatchBrowser, version: string): NightwatchBrowser { command (this: NightwatchBrowser, version: string): NightwatchBrowser {

@ -1,5 +1,5 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class NotContainsText extends EventEmitter { class NotContainsText extends EventEmitter {
command (this: NightwatchBrowser, cssSelector: string, text: string): NightwatchBrowser { command (this: NightwatchBrowser, cssSelector: string, text: string): NightwatchBrowser {
@ -9,9 +9,9 @@ class NotContainsText extends EventEmitter {
if (typeof result.value === 'string' && result.value.includes(text)) return this.api.assert.fail(`${cssSelector} contains ${text}.`) if (typeof result.value === 'string' && result.value.includes(text)) return this.api.assert.fail(`${cssSelector} contains ${text}.`)
else this.api.assert.ok(true, `${cssSelector} does not contains ${text}.`) else this.api.assert.ok(true, `${cssSelector} does not contains ${text}.`)
}) })
.perform(() => { .perform(() => {
this.emit('complete') this.emit('complete')
}) })
return this return this
} }
} }

@ -16,12 +16,12 @@ class OpenFile extends EventEmitter {
// click on fileExplorer can toggle it. We go through settings to be sure FE is open // click on fileExplorer can toggle it. We go through settings to be sure FE is open
function openFile (browser: NightwatchBrowser, name: string, done: VoidFunction) { function openFile (browser: NightwatchBrowser, name: string, done: VoidFunction) {
browser.clickLaunchIcon('settings').clickLaunchIcon('fileExplorers') browser.clickLaunchIcon('settings').clickLaunchIcon('fileExplorers')
.waitForElementVisible('li[data-id="treeViewLitreeViewItem' + name + '"') .waitForElementVisible('li[data-id="treeViewLitreeViewItem' + name + '"')
.click('li[data-id="treeViewLitreeViewItem' + name + '"') .click('li[data-id="treeViewLitreeViewItem' + name + '"')
.pause(2000) .pause(2000)
.perform(() => { .perform(() => {
done() done()
}) })
} }
module.exports = OpenFile module.exports = OpenFile

@ -1,4 +1,4 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
const EventEmitter = require('events') const EventEmitter = require('events')
@ -21,13 +21,13 @@ function removeFile (browser: NightwatchBrowser, path: string, done: VoidFunctio
const RIGHT_CLICK_BUTTON_CODE = 2 // the same for FF and IE const RIGHT_CLICK_BUTTON_CODE = 2 // the same for FF and IE
evt.initMouseEvent('contextmenu', true, true, evt.initMouseEvent('contextmenu', true, true,
element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false,
false, false, false, RIGHT_CLICK_BUTTON_CODE, null) false, false, false, RIGHT_CLICK_BUTTON_CODE, null)
if (Object.prototype.hasOwnProperty.call(document, 'createEventObject')) { if (Object.prototype.hasOwnProperty.call(document, 'createEventObject')) {
// dispatch for IE // dispatch for IE
return element.fireEvent('onclick', evt) return element.fireEvent('onclick', evt)
} else { } else {
// dispatch for firefox + others // dispatch for firefox + others
return !element.dispatchEvent(evt) return !element.dispatchEvent(evt)
} }
} }

@ -20,13 +20,13 @@ function renamePath (browser: NightwatchBrowser, path: string, newFileName: stri
const RIGHT_CLICK_BUTTON_CODE = 2 // the same for FF and IE const RIGHT_CLICK_BUTTON_CODE = 2 // the same for FF and IE
evt.initMouseEvent('contextmenu', true, true, evt.initMouseEvent('contextmenu', true, true,
element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false,
false, false, false, RIGHT_CLICK_BUTTON_CODE, null) false, false, false, RIGHT_CLICK_BUTTON_CODE, null)
if (Object.prototype.hasOwnProperty.call(document, 'createEventObject')) { if (Object.prototype.hasOwnProperty.call(document, 'createEventObject')) {
// dispatch for IE // dispatch for IE
return element.fireEvent('onclick', evt) return element.fireEvent('onclick', evt)
} else { } else {
// dispatch for firefox + others // dispatch for firefox + others
return !element.dispatchEvent(evt) return !element.dispatchEvent(evt)
} }
} }

@ -20,13 +20,13 @@ function rightClick (browser: NightwatchBrowser, cssSelector: string, callback:
const RIGHT_CLICK_BUTTON_CODE = 2 const RIGHT_CLICK_BUTTON_CODE = 2
evt.initMouseEvent('contextmenu', true, true, evt.initMouseEvent('contextmenu', true, true,
element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false,
false, false, false, RIGHT_CLICK_BUTTON_CODE, null) false, false, false, RIGHT_CLICK_BUTTON_CODE, null)
if (Object.prototype.hasOwnProperty.call(document, 'createEventObject')) { if (Object.prototype.hasOwnProperty.call(document, 'createEventObject')) {
// dispatch for IE // dispatch for IE
return element.fireEvent('onclick', evt) return element.fireEvent('onclick', evt)
} else { } else {
// dispatch for firefox + others // dispatch for firefox + others
return !element.dispatchEvent(evt) return !element.dispatchEvent(evt)
} }
}, [cssSelector], function () { }, [cssSelector], function () {

@ -1,14 +1,14 @@
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class scrollAndClick extends EventEmitter { class scrollAndClick extends EventEmitter {
command (this: NightwatchBrowser, target: string): NightwatchBrowser { command (this: NightwatchBrowser, target: string): NightwatchBrowser {
this.api this.api
.scrollInto(target) .scrollInto(target)
.click(target) .click(target)
.perform(() => { .perform(() => {
this.emit('complete') this.emit('complete')
}) })
return this return this
} }
} }

@ -1,5 +1,5 @@
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class ScrollInto extends EventEmitter { class ScrollInto extends EventEmitter {
command (this: NightwatchBrowser, target: string): NightwatchBrowser { command (this: NightwatchBrowser, target: string): NightwatchBrowser {
@ -15,7 +15,7 @@ class ScrollInto extends EventEmitter {
function _scrollInto (browser: NightwatchBrowser, target: string, cb: VoidFunction): void { function _scrollInto (browser: NightwatchBrowser, target: string, cb: VoidFunction): void {
browser.execute(function (target) { browser.execute(function (target) {
document.querySelector(target).scrollIntoView(({block: 'center'})) document.querySelector(target).scrollIntoView(({ block: 'center' }))
}, [target], function () { }, [target], function () {
cb() cb()
}) })

@ -1,5 +1,5 @@
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class SelectAccount extends EventEmitter { class SelectAccount extends EventEmitter {
command (this: NightwatchBrowser, account?: string): NightwatchBrowser { command (this: NightwatchBrowser, account?: string): NightwatchBrowser {

@ -1,5 +1,5 @@
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
const selector = '#runTabView select[class^="contractNames"]' const selector = '#runTabView select[class^="contractNames"]'

@ -1,19 +1,19 @@
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class sendLowLevelTx extends EventEmitter { class sendLowLevelTx extends EventEmitter {
command (this: NightwatchBrowser, address: string, value: string, callData: string): NightwatchBrowser { command (this: NightwatchBrowser, address: string, value: string, callData: string): NightwatchBrowser {
console.log('low level transact to ', address, value, callData) console.log('low level transact to ', address, value, callData)
this.api.waitForElementVisible(`#instance${address} #deployAndRunLLTxSendTransaction`, 1000) this.api.waitForElementVisible(`#instance${address} #deployAndRunLLTxSendTransaction`, 1000)
.clearValue(`#instance${address} #deployAndRunLLTxCalldata`) .clearValue(`#instance${address} #deployAndRunLLTxCalldata`)
.setValue(`#instance${address} #deployAndRunLLTxCalldata`, callData) .setValue(`#instance${address} #deployAndRunLLTxCalldata`, callData)
.waitForElementVisible('#value') .waitForElementVisible('#value')
.clearValue('#value') .clearValue('#value')
.setValue('#value', value) .setValue('#value', value)
.scrollAndClick(`#instance${address} #deployAndRunLLTxSendTransaction`) .scrollAndClick(`#instance${address} #deployAndRunLLTxSendTransaction`)
.perform(() => { .perform(() => {
this.emit('complete') this.emit('complete')
}) })
return this return this
} }
} }

@ -1,4 +1,4 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
const EventEmitter = require('events') const EventEmitter = require('events')
@ -16,25 +16,25 @@ class MetaMask extends EventEmitter {
function setupMetaMask (browser: NightwatchBrowser, passphrase: string, password: string, done: VoidFunction) { function setupMetaMask (browser: NightwatchBrowser, passphrase: string, password: string, done: VoidFunction) {
browser browser
.switchBrowserWindow('chrome-extension://poemojpkcjbpmcccohjnomjffeinlafe/home.html#initialize/welcome', 'MetaMask', (browser) => { .switchBrowserWindow('chrome-extension://poemojpkcjbpmcccohjnomjffeinlafe/home.html#initialize/welcome', 'MetaMask', (browser) => {
browser.waitForElementPresent('.first-time-flow__button') browser.waitForElementPresent('.first-time-flow__button')
.click('.first-time-flow__button') .click('.first-time-flow__button')
.waitForElementPresent('.select-action__select-button:nth-of-type(1) > .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') .click('.select-action__select-button:nth-of-type(1) > .first-time-flow__button')
.waitForElementPresent('.page-container__footer-button:nth-of-type(2)') .waitForElementPresent('.page-container__footer-button:nth-of-type(2)')
.click('.page-container__footer-button:nth-of-type(2)') .click('.page-container__footer-button:nth-of-type(2)')
.waitForElementPresent('.first-time-flow__textarea') .waitForElementPresent('.first-time-flow__textarea')
.setValue('.first-time-flow__textarea', passphrase) .setValue('.first-time-flow__textarea', passphrase)
.setValue('*[autocomplete="new-password"]', password) .setValue('*[autocomplete="new-password"]', password)
.setValue('*[autocomplete="confirm-password"]', password) .setValue('*[autocomplete="confirm-password"]', password)
.click('.first-time-flow__checkbox') .click('.first-time-flow__checkbox')
.click('.first-time-flow__button') .click('.first-time-flow__button')
.pause(5000) .pause(5000)
.click('.first-time-flow__button') .click('.first-time-flow__button')
.perform(() => { .perform(() => {
done() done()
})
}) })
})
} }
module.exports = MetaMask module.exports = MetaMask

@ -1,4 +1,4 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
const EventEmitter = require('events') const EventEmitter = require('events')
@ -18,15 +18,15 @@ class SelectContract extends EventEmitter {
function signMsg (browser: NightwatchBrowser, msg: string, cb: (hash: { value: string }, signature: { value: string }) => void) { function signMsg (browser: NightwatchBrowser, msg: string, cb: (hash: { value: string }, signature: { value: string }) => void) {
let hash, signature let hash, signature
browser browser
.waitForElementPresent('i[id="remixRunSignMsg"]') .waitForElementPresent('i[id="remixRunSignMsg"]')
.click('i[id="remixRunSignMsg"]') .click('i[id="remixRunSignMsg"]')
.waitForElementVisible('textarea[id="prompt_text"]') .waitForElementVisible('textarea[id="prompt_text"]')
.setValue('textarea[id="prompt_text"]', msg, () => { .setValue('textarea[id="prompt_text"]', msg, () => {
browser.modalFooterOKClick().perform( browser.modalFooterOKClick().perform(
(client, done) => { (client, done) => {
browser.waitForElementVisible('span[id="remixRunSignMsgHash"]').getText('span[id="remixRunSignMsgHash"]', (v) => { hash = v; done() }) browser.waitForElementVisible('span[id="remixRunSignMsgHash"]').getText('span[id="remixRunSignMsgHash"]', (v) => { hash = v; done() })
} }
) )
.perform( .perform(
(client, done) => { (client, done) => {
browser.waitForElementVisible('span[id="remixRunSignMsgSignature"]').getText('span[id="remixRunSignMsgSignature"]', (v) => { signature = v; done() }) browser.waitForElementVisible('span[id="remixRunSignMsgSignature"]').getText('span[id="remixRunSignMsgSignature"]', (v) => { signature = v; done() })
@ -38,7 +38,7 @@ function signMsg (browser: NightwatchBrowser, msg: string, cb: (hash: { value: s
cb(hash, signature) cb(hash, signature)
} }
) )
}) })
} }
module.exports = SelectContract module.exports = SelectContract

@ -1,5 +1,5 @@
import { NightwatchBrowser, NightwatchAPI } from "nightwatch" import { NightwatchBrowser, NightwatchAPI } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
/* /*
Switches between browser tabs Switches between browser tabs

@ -1,4 +1,4 @@
import { NightwatchBrowser, NightwatchCallbackResult } from "nightwatch" import { NightwatchBrowser, NightwatchCallbackResult } from 'nightwatch'
const EventEmitter = require('events') const EventEmitter = require('events')
@ -18,9 +18,9 @@ function switchWindow (browser: NightwatchBrowser, url: string, windowName: stri
return window.open('', windowName, 'width=2560, height=1440') return window.open('', windowName, 'width=2560, height=1440')
}, [windowName], (newWindow) => { }, [windowName], (newWindow) => {
browser.switchWindow(windowName) browser.switchWindow(windowName)
.url(url) .url(url)
.pause(5000) .pause(5000)
.assert.urlContains(url) .assert.urlContains(url)
if (cb) cb(browser, newWindow) if (cb) cb(browser, newWindow)
}) })
} }

@ -1,5 +1,5 @@
import { NightwatchBrowser, NightwatchTestConstantFunctionExpectedInput } from "nightwatch" import { NightwatchBrowser, NightwatchTestConstantFunctionExpectedInput } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class TestConstantFunction extends EventEmitter { class TestConstantFunction extends EventEmitter {
command (this: NightwatchBrowser, address: string, fnFullName: string, expectedInput: NightwatchTestConstantFunctionExpectedInput | null, expectedOutput: string): NightwatchBrowser { command (this: NightwatchBrowser, address: string, fnFullName: string, expectedInput: NightwatchTestConstantFunctionExpectedInput | null, expectedOutput: string): NightwatchBrowser {

@ -1,8 +1,8 @@
import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch' import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class TestContracts extends EventEmitter { class TestContracts extends EventEmitter {
command (this: NightwatchBrowser,fileName: string, contractCode: NightwatchContractContent, compiledContractNames: string[]): NightwatchBrowser { command (this: NightwatchBrowser, fileName: string, contractCode: NightwatchContractContent, compiledContractNames: string[]): NightwatchBrowser {
this.api.perform((done) => { this.api.perform((done) => {
testContracts(this.api, fileName, contractCode, compiledContractNames, () => { testContracts(this.api, fileName, contractCode, compiledContractNames, () => {
done() done()

@ -1,5 +1,5 @@
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class TestEditorValue extends EventEmitter { class TestEditorValue extends EventEmitter {
command (this: NightwatchBrowser, testvalue: string): NightwatchBrowser { command (this: NightwatchBrowser, testvalue: string): NightwatchBrowser {

@ -1,5 +1,5 @@
import { NightwatchBrowser, NightwatchTestFunctionExpectedInput } from 'nightwatch' import { NightwatchBrowser, NightwatchTestFunctionExpectedInput } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
const deepequal = require('deep-equal') const deepequal = require('deep-equal')
@ -10,38 +10,38 @@ class TestFunction extends EventEmitter {
const setLog = (index: number, value: string) => { logs[Object.keys(logs)[index]] = typeof value === 'string' ? value.trim() : value } const setLog = (index: number, value: string) => { logs[Object.keys(logs)[index]] = typeof value === 'string' ? value.trim() : value }
browser browser
.waitForElementVisible(`[data-id="block_tx${txHash}"]`) .waitForElementVisible(`[data-id="block_tx${txHash}"]`)
.click(`[data-id="block_tx${txHash}"]`) .click(`[data-id="block_tx${txHash}"]`)
.waitForElementVisible(`*[data-id="txLoggerTable${txHash}"]`) .waitForElementVisible(`*[data-id="txLoggerTable${txHash}"]`)
// fetch and format transaction logs as key => pair object // fetch and format transaction logs as key => pair object
.elements('css selector', `*[data-shared="key_${txHash}"]`, (res) => { .elements('css selector', `*[data-shared="key_${txHash}"]`, (res) => {
Array.isArray(res.value) && res.value.forEach(function (jsonWebElement) { Array.isArray(res.value) && res.value.forEach(function (jsonWebElement) {
const jsonWebElementId: string = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]] const jsonWebElementId: string = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]]
browser.elementIdText(jsonWebElementId, (jsonElement) => { browser.elementIdText(jsonWebElementId, (jsonElement) => {
const key = typeof jsonElement.value === 'string' ? jsonElement.value.trim() : null const key = typeof jsonElement.value === 'string' ? jsonElement.value.trim() : null
logs[key] = null logs[key] = null
})
}) })
}) })
}) .elements('css selector', `*[data-shared="pair_${txHash}"]`, (res) => {
.elements('css selector', `*[data-shared="pair_${txHash}"]`, (res) => { Array.isArray(res.value) && res.value.forEach(function (jsonWebElement, index) {
Array.isArray(res.value) && res.value.forEach(function (jsonWebElement, index) { const jsonWebElementId = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]]
const jsonWebElementId = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]]
browser.elementIdText(jsonWebElementId, (jsonElement) => {
browser.elementIdText(jsonWebElementId, (jsonElement) => { let value = jsonElement.value
let value = jsonElement.value
try {
try { value = JSON.parse(<string>jsonElement.value)
value = JSON.parse(<string>jsonElement.value) setLog(index, <string>value)
setLog(index, <string>value) } catch (e) {
} catch (e) { setLog(index, <string>value)
setLog(index, <string>value) }
} })
}) })
}) })
})
browser.perform(() => { browser.perform(() => {
Object.keys(expectedValue).forEach(key => { Object.keys(expectedValue).forEach(key => {

@ -6,13 +6,13 @@ class ValidateValueInput extends EventEmitter {
const browser = this.api const browser = this.api
browser.perform((done) => { browser.perform((done) => {
browser.clearValue(selector) browser.clearValue(selector)
.setValue(selector, valueTosSet) .setValue(selector, valueTosSet)
.execute(function (selector) { .execute(function (selector) {
const elem = document.querySelector(selector) as HTMLInputElement const elem = document.querySelector(selector) as HTMLInputElement
return elem.value return elem.value
}, [selector], function (result) { }, [selector], function (result) {
browser.assert.equal(result.value, expectedValue) browser.assert.equal(result.value, expectedValue)
}) })
done() done()
this.emit('complete') this.emit('complete')
}) })

@ -1,5 +1,5 @@
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class VerifyCallReturnValue extends EventEmitter { class VerifyCallReturnValue extends EventEmitter {
command (this: NightwatchBrowser, address: string, checks: string[]): NightwatchBrowser { command (this: NightwatchBrowser, address: string, checks: string[]): NightwatchBrowser {

@ -1,8 +1,8 @@
import { NightwatchBrowser, NightwatchCallbackResult } from 'nightwatch' import { NightwatchBrowser, NightwatchCallbackResult } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from 'events'
class VerifyContracts extends EventEmitter { class VerifyContracts extends EventEmitter {
command (this: NightwatchBrowser,compiledContractNames: string[], opts = { wait: 1000, version: null }): NightwatchBrowser { command (this: NightwatchBrowser, compiledContractNames: string[], opts = { wait: 1000, version: null }): NightwatchBrowser {
this.api.perform((done) => { this.api.perform((done) => {
verifyContracts(this.api, compiledContractNames, opts, () => { verifyContracts(this.api, compiledContractNames, opts, () => {
done() done()
@ -15,37 +15,37 @@ class VerifyContracts extends EventEmitter {
function getCompiledContracts (browser: NightwatchBrowser, opts: { wait: number, version?: string }, callback: (result: NightwatchCallbackResult<any>) => void) { function getCompiledContracts (browser: NightwatchBrowser, opts: { wait: number, version?: string }, callback: (result: NightwatchCallbackResult<any>) => void) {
browser browser
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.pause(opts.wait) .pause(opts.wait)
.waitForElementPresent('*[data-id="compiledContracts"] option') .waitForElementPresent('*[data-id="compiledContracts"] option')
.perform((done) => { .perform((done) => {
if (opts.version) { if (opts.version) {
browser browser
.click('*[data-id="compilation-details"]') .click('*[data-id="compilation-details"]')
.waitForElementVisible('*[data-id="treeViewDivcompiler"]') .waitForElementVisible('*[data-id="treeViewDivcompiler"]')
.pause(2000) .pause(2000)
.click('*[data-id="treeViewDivcompiler"]') .click('*[data-id="treeViewDivcompiler"]')
.waitForElementVisible('*[data-id="treeViewLicompiler/version"]') .waitForElementVisible('*[data-id="treeViewLicompiler/version"]')
.assert.containsText('*[data-id="treeViewLicompiler/version"]', `version:\n ${opts.version}`) .assert.containsText('*[data-id="treeViewLicompiler/version"]', `version:\n ${opts.version}`)
.perform(done) .perform(done)
} else done() } else done()
}) })
.execute(function () { .execute(function () {
const contracts = document.querySelectorAll('*[data-id="compiledContracts"] option') as NodeListOf<HTMLInputElement> const contracts = document.querySelectorAll('*[data-id="compiledContracts"] option') as NodeListOf<HTMLInputElement>
if (!contracts) { if (!contracts) {
return null return null
} else { } else {
const ret = [] const ret = []
for (let c = 0; c < contracts.length; c++) { for (let c = 0; c < contracts.length; c++) {
ret.push(contracts[c].value) ret.push(contracts[c].value)
}
return ret
} }
return ret }, [], function (result) {
} callback(result)
}, [], function (result) { })
callback(result)
})
} }
function verifyContracts (browser: NightwatchBrowser, compiledContractNames: string[], opts: { wait: number, version?: string }, callback: VoidFunction) { function verifyContracts (browser: NightwatchBrowser, compiledContractNames: string[], opts: { wait: number, version?: string }, callback: VoidFunction) {

@ -214,7 +214,7 @@ contract Ballot {
} }
} }
` `
// eslint-disable-next-line
const ballot_0_4_11 = `pragma solidity >=0.4.10 <0.7.0; const ballot_0_4_11 = `pragma solidity >=0.4.10 <0.7.0;
contract Ballot { contract Ballot {
@ -308,9 +308,9 @@ contract BallotTest {
` `
export default { export default {
storage: { name: '1_Storage.sol', content: storage }, storage: { name: '1_Storage.sol', content: storage },
owner: { name: '2_Owner.sol', content: owner }, owner: { name: '2_Owner.sol', content: owner },
ballot: { name: '3_Ballot.sol', content: ballot }, ballot: { name: '3_Ballot.sol', content: ballot },
ballot_0_4_11: { name: 'ballot_0_4_11.sol', content: ballot_0_4_11 }, ballot_0_4_11: { name: 'ballot_0_4_11.sol', content: ballot_0_4_11 },
ballot_test: { name: 'tests/4_Ballot_test.sol', content: ballotTest } ballot_test: { name: 'tests/4_Ballot_test.sol', content: ballotTest }
} }

@ -1,4 +1,4 @@
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
require('dotenv').config() require('dotenv').config()
@ -11,9 +11,9 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url
if (preloadPlugins) { if (preloadPlugins) {
initModules(browser, () => { initModules(browser, () => {
browser.clickLaunchIcon('solidity') browser.clickLaunchIcon('solidity')
.waitForElementVisible('[for="autoCompile"]') .waitForElementVisible('[for="autoCompile"]')
.click('[for="autoCompile"]') .click('[for="autoCompile"]')
.verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked') .verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked')
}) })
} }
}) })

@ -6,7 +6,7 @@ import sauce from './sauce'
import examples from '../examples/example-contracts' import examples from '../examples/example-contracts'
const sources = [ const sources = [
{'browser/Untitled.sol': { content: examples.ballot.content }} { 'browser/Untitled.sol': { content: examples.ballot.content } }
] ]
module.exports = { module.exports = {
@ -18,136 +18,136 @@ module.exports = {
}, },
'Deploy Ballot': function (browser: NightwatchBrowser) { 'Deploy Ballot': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
.setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]') .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
.click('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]')
.clickFunction('delegate - transact (not payable)', {types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'}) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' })
.testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', .testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', 'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
}) })
}, },
'Debug Ballot / delegate': function (browser: NightwatchBrowser) { 'Debug Ballot / delegate': function (browser: NightwatchBrowser) {
browser.pause(500) browser.pause(500)
.click('*[data-id="txLoggerDebugButton0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3"]') .click('*[data-id="txLoggerDebugButton0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3"]')
.waitForElementVisible('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]') .waitForElementVisible('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]')
// .clickLaunchIcon('debugger') // .clickLaunchIcon('debugger')
.click('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]') .click('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]')
.pause(2000) .pause(2000)
.waitForElementVisible('#stepdetail') .waitForElementVisible('#stepdetail')
.goToVMTraceStep(79) .goToVMTraceStep(79)
.pause(1000) .pause(1000)
.checkVariableDebug('soliditystate', stateCheck) .checkVariableDebug('soliditystate', stateCheck)
.checkVariableDebug('soliditylocals', localsCheck) .checkVariableDebug('soliditylocals', localsCheck)
}, },
'Access Ballot via at address': function (browser: NightwatchBrowser) { 'Access Ballot via at address': function (browser: NightwatchBrowser) {
browser.clickLaunchIcon('udapp') browser.clickLaunchIcon('udapp')
.click('*[data-id="universalDappUiUdappClose"]') .click('*[data-id="universalDappUiUdappClose"]')
.addFile('ballot.abi', { content: ballotABI }) .addFile('ballot.abi', { content: ballotABI })
.addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3B', true, false) .addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3B', true, false)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3A', true, true) .addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3A', true, true)
.pause(500) .pause(500)
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]') .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
.click('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]')
.clickFunction('delegate - transact (not payable)', {types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'}) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' })
.testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', .testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
{ {
status: 'false Transaction mined but execution failed', status: 'false Transaction mined but execution failed',
'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', 'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
}) })
}, },
'Deploy and use Ballot using external web3': function (browser: NightwatchBrowser) { 'Deploy and use Ballot using external web3': function (browser: NightwatchBrowser) {
browser browser
.click('*[data-id="settingsWeb3Mode"]') .click('*[data-id="settingsWeb3Mode"]')
.modalFooterOKClick() .modalFooterOKClick()
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.clickInstance(0) .clickInstance(0)
.click('*[data-id="terminalClearConsole"]') .click('*[data-id="terminalClearConsole"]')
.clickFunction('delegate - transact (not payable)', {types: 'address to', values: '0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c'}) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c' })
.journalLastChildIncludes('Ballot.delegate(address)') .journalLastChildIncludes('Ballot.delegate(address)')
.journalLastChildIncludes('data: 0x5c1...a733c') .journalLastChildIncludes('data: 0x5c1...a733c')
.end() .end()
}, },
tearDown: sauce tearDown: sauce
} }
const localsCheck = { const localsCheck = {
'to': { to: {
'value': '0x4B0897B0513FDC7C541B6D9D7E929C4E5364D2DB', value: '0x4B0897B0513FDC7C541B6D9D7E929C4E5364D2DB',
'type': 'address' type: 'address'
} }
} }
const stateCheck = { const stateCheck = {
'chairperson': { chairperson: {
'value': '0xCA35B7D915458EF540ADE6068DFE2F44E8FA733C', value: '0xCA35B7D915458EF540ADE6068DFE2F44E8FA733C',
'type': 'address', type: 'address',
'constant': false constant: false
}, },
'voters': { voters: {
'value': { value: {
'000000000000000000000000ca35b7d915458ef540ade6068dfe2f44e8fa733c': { '000000000000000000000000ca35b7d915458ef540ade6068dfe2f44e8fa733c': {
'value': { value: {
'weight': { weight: {
'value': '1', value: '1',
'type': 'uint256' type: 'uint256'
}, },
'voted': { voted: {
'value': false, value: false,
'type': 'bool' type: 'bool'
}, },
'delegate': { delegate: {
'value': '0x0000000000000000000000000000000000000000', value: '0x0000000000000000000000000000000000000000',
'type': 'address' type: 'address'
}, },
'vote': { vote: {
'value': '0', value: '0',
'type': 'uint256' type: 'uint256'
} }
}, },
'type': 'struct Ballot.Voter' type: 'struct Ballot.Voter'
} }
}, },
'type': 'mapping(address => struct Ballot.Voter)', type: 'mapping(address => struct Ballot.Voter)',
'constant': false constant: false
}, },
'proposals': { proposals: {
'value': [ value: [
{ {
'value': { value: {
'name': { name: {
'value': '0x48656C6C6F20576F726C64210000000000000000000000000000000000000000', value: '0x48656C6C6F20576F726C64210000000000000000000000000000000000000000',
'type': 'bytes32' type: 'bytes32'
}, },
'voteCount': { voteCount: {
'value': '0', value: '0',
'type': 'uint256' type: 'uint256'
} }
}, },
'type': 'struct Ballot.Proposal' type: 'struct Ballot.Proposal'
} }
], ],
'length': '0x1', length: '0x1',
'type': 'struct Ballot.Proposal[]', type: 'struct Ballot.Proposal[]',
'constant': false constant: false
} }
} }

@ -6,7 +6,7 @@ import sauce from './sauce'
import examples from '../examples/example-contracts' import examples from '../examples/example-contracts'
const sources = [ const sources = [
{'browser/Untitled.sol': { content: examples.ballot_0_4_11.content }} { 'browser/Untitled.sol': { content: examples.ballot_0_4_11.content } }
] ]
module.exports = { module.exports = {
@ -18,152 +18,151 @@ module.exports = {
}, },
'Compile Ballot with compiler version 0.4.11': function (browser: NightwatchBrowser) { 'Compile Ballot with compiler version 0.4.11': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.4.11+commit.68ef5810.js') .setSolidityCompilerVersion('soljson-v0.4.11+commit.68ef5810.js')
.waitForElementVisible('[for="autoCompile"]') .waitForElementVisible('[for="autoCompile"]')
.click('[for="autoCompile"]') .click('[for="autoCompile"]')
.verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked') .verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked')
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot'])
}, },
'Deploy Ballot': function (browser: NightwatchBrowser) { 'Deploy Ballot': function (browser: NightwatchBrowser) {
browser.pause(500) browser.pause(500)
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
.setValue('input[placeholder="uint8 _numProposals"]', '2') .setValue('input[placeholder="uint8 _numProposals"]', '2')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]') .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
.click('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]')
.clickFunction('delegate - transact (not payable)', {types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'}) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' })
.testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', .testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', 'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
}) })
}, },
'Debug Ballot / delegate': function (browser: NightwatchBrowser) { 'Debug Ballot / delegate': function (browser: NightwatchBrowser) {
browser.pause(500) browser.pause(500)
.click('*[data-id="txLoggerDebugButton0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3"]') .click('*[data-id="txLoggerDebugButton0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3"]')
.pause(2000) .pause(2000)
.waitForElementVisible('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]') .waitForElementVisible('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]')
.click('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]') .click('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]')
.pause(2000) .pause(2000)
.waitForElementVisible('#stepdetail') .waitForElementVisible('#stepdetail')
.goToVMTraceStep(20) .goToVMTraceStep(20)
.pause(1000) .pause(1000)
.checkVariableDebug('callstackpanel', ["0x692a70D2e424a56D2C6C27aA97D1a86395877b3A"]) .checkVariableDebug('callstackpanel', ['0x692a70D2e424a56D2C6C27aA97D1a86395877b3A'])
}, },
'Access Ballot via at address': function (browser: NightwatchBrowser) { 'Access Ballot via at address': function (browser: NightwatchBrowser) {
browser.clickLaunchIcon('udapp') browser.clickLaunchIcon('udapp')
.click('*[data-id="universalDappUiUdappClose"]') .click('*[data-id="universalDappUiUdappClose"]')
.addFile('ballot.abi', { content: ballotABI }) .addFile('ballot.abi', { content: ballotABI })
.addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3B', true, false) .addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3B', true, false)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3A', true, true) .addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3A', true, true)
.pause(500) .pause(500)
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]') .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
.click('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]')
.clickFunction('delegate - transact (not payable)', {types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'}) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' })
.testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', .testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', 'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
}) })
}, },
'Deploy and use Ballot using external web3': function (browser: NightwatchBrowser) { 'Deploy and use Ballot using external web3': function (browser: NightwatchBrowser) {
browser browser
.click('*[data-id="settingsWeb3Mode"]') .click('*[data-id="settingsWeb3Mode"]')
.modalFooterOKClick() .modalFooterOKClick()
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.setValue('input[placeholder="uint8 _numProposals"]', '2') .setValue('input[placeholder="uint8 _numProposals"]', '2')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.clickInstance(0) .clickInstance(0)
.click('*[data-id="terminalClearConsole"]') .click('*[data-id="terminalClearConsole"]')
.clickFunction('delegate - transact (not payable)', {types: 'address to', values: '0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c'}) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c' })
.journalLastChildIncludes('Ballot.delegate(address)') .journalLastChildIncludes('Ballot.delegate(address)')
.journalLastChildIncludes('data: 0x5c1...a733c') .journalLastChildIncludes('data: 0x5c1...a733c')
.end() .end()
}, },
tearDown: sauce tearDown: sauce
} }
const ballotABI = `[ const ballotABI = `[
{ {
"constant": false, "constant": false,
"inputs": [ "inputs": [
{ {
"name": "to", "name": "to",
"type": "address" "type": "address"
} }
], ],
"name": "delegate", "name": "delegate",
"outputs": [], "outputs": [],
"payable": false, "payable": false,
"type": "function", "type": "function",
"stateMutability": "nonpayable" "stateMutability": "nonpayable"
}, },
{ {
"constant": false, "constant": false,
"inputs": [], "inputs": [],
"name": "winningProposal", "name": "winningProposal",
"outputs": [ "outputs": [
{ {
"name": "_winningProposal", "name": "_winningProposal",
"type": "uint8" "type": "uint8"
} }
], ],
"payable": false, "payable": false,
"type": "function", "type": "function",
"stateMutability": "nonpayable" "stateMutability": "nonpayable"
}, },
{ {
"constant": false, "constant": false,
"inputs": [ "inputs": [
{ {
"name": "toVoter", "name": "toVoter",
"type": "address" "type": "address"
} }
], ],
"name": "giveRightToVote", "name": "giveRightToVote",
"outputs": [], "outputs": [],
"payable": false, "payable": false,
"type": "function", "type": "function",
"stateMutability": "nonpayable" "stateMutability": "nonpayable"
}, },
{ {
"constant": false, "constant": false,
"inputs": [ "inputs": [
{ {
"name": "toProposal", "name": "toProposal",
"type": "uint8" "type": "uint8"
} }
], ],
"name": "vote", "name": "vote",
"outputs": [], "outputs": [],
"payable": false, "payable": false,
"type": "function", "type": "function",
"stateMutability": "nonpayable" "stateMutability": "nonpayable"
}, },
{ {
"inputs": [ "inputs": [
{ {
"name": "_numProposals", "name": "_numProposals",
"type": "uint8" "type": "uint8"
} }
], ],
"payable": false, "payable": false,
"type": "constructor", "type": "constructor",
"stateMutability": "nonpayable" "stateMutability": "nonpayable"
} }
]` ]`

@ -6,50 +6,50 @@ import sauce from './sauce'
import examples from '../examples/example-contracts' import examples from '../examples/example-contracts'
const sources = [ const sources = [
{'browser/Untitled.sol': { content: examples.ballot.content }} { 'browser/Untitled.sol': { content: examples.ballot.content } }
] ]
module.exports = { module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) { before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done) init(browser, done)
}, },
'@sources': function () { '@sources': function () {
return sources return sources
}, },
'Should compile using "compileWithParamaters" API': function (browser: NightwatchBrowser) { 'Should compile using "compileWithParamaters" API': function (browser: NightwatchBrowser) {
browser browser
.addFile('test_jsCompile.js', { content: jsCompile }) .addFile('test_jsCompile.js', { content: jsCompile })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(5000) .pause(5000)
.journalChildIncludes(`"languageversion": "0.6.8+commit.0bbfe453"`) .journalChildIncludes('"languageversion": "0.6.8+commit.0bbfe453"')
}, },
'Should compile using "compileWithParamaters" API with optimization On': function (browser: NightwatchBrowser) { 'Should compile using "compileWithParamaters" API with optimization On': function (browser: NightwatchBrowser) {
browser browser
.addFile('test_jsCompileWithOptimization.js', { content: jsCompileWithOptimization }) .addFile('test_jsCompileWithOptimization.js', { content: jsCompileWithOptimization })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(10000) .pause(10000)
.journalChildIncludes(`\\"optimizer\\":{\\"enabled\\":true,\\"runs\\":300}`) .journalChildIncludes('\\"optimizer\\":{\\"enabled\\":true,\\"runs\\":300}')
}, },
'Should compile using "compileWithParamaters" API with optimization off check default runs': function (browser: NightwatchBrowser) { 'Should compile using "compileWithParamaters" API with optimization off check default runs': function (browser: NightwatchBrowser) {
browser browser
.addFile('test_jsCompileWithOptimizationDefault.js', { content: jsCompileWithOptimizationDefault }) .addFile('test_jsCompileWithOptimizationDefault.js', { content: jsCompileWithOptimizationDefault })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(10000) .pause(10000)
.journalChildIncludes(`\\"optimizer\\":{\\"enabled\\":false,\\"runs\\":200}`) .journalChildIncludes('\\"optimizer\\":{\\"enabled\\":false,\\"runs\\":200}')
}, },
'Should update the compiler configuration with "setCompilerConfig" API': function (browser: NightwatchBrowser) { 'Should update the compiler configuration with "setCompilerConfig" API': function (browser: NightwatchBrowser) {
browser browser
.addFile('test_updateConfiguration.js', { content: updateConfiguration }) .addFile('test_updateConfiguration.js', { content: updateConfiguration })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(5000) .pause(5000)
.addFile('test_updateConfiguration.sol', { content: simpleContract }) .addFile('test_updateConfiguration.sol', { content: simpleContract })
.verifyContracts(['StorageTestUpdateConfiguration'], { wait: 5000, version: '0.6.8+commit.0bbfe453' }) .verifyContracts(['StorageTestUpdateConfiguration'], { wait: 5000, version: '0.6.8+commit.0bbfe453' })
.end() .end()
}, },
tearDown: sauce tearDown: sauce
@ -140,7 +140,6 @@ const jsCompileWithOptimizationDefault = `(async () => {
} }
})()` })()`
const updateConfiguration = `(async () => { const updateConfiguration = `(async () => {
try { try {
const params = { const params = {

@ -15,89 +15,89 @@ module.exports = {
'Should launch debugger': function (browser: NightwatchBrowser) { 'Should launch debugger': function (browser: NightwatchBrowser) {
browser.addFile('blah.sol', sources[0]['browser/blah.sol']) browser.addFile('blah.sol', sources[0]['browser/blah.sol'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 45000) .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 45000)
.click('*[title="Deploy - transact (not payable)"]') .click('*[title="Deploy - transact (not payable)"]')
.debugTransaction(0) .debugTransaction(0)
.assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER') .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER')
}, },
'Should debug failing transaction': function (browser: NightwatchBrowser) { 'Should debug failing transaction': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]') browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="universalDappUiTitleExpander"]') .waitForElementPresent('*[data-id="universalDappUiTitleExpander"]')
.click('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]')
.scrollAndClick('*[title="string name, uint256 goal"]') .scrollAndClick('*[title="string name, uint256 goal"]')
.setValue('*[title="string name, uint256 goal"]', '"toast", 999') .setValue('*[title="string name, uint256 goal"]', '"toast", 999')
.click('*[data-id="createProject - transact (not payable)"]') .click('*[data-id="createProject - transact (not payable)"]')
.debugTransaction(1) .debugTransaction(1)
.pause(2000) .pause(2000)
.scrollAndClick('*[data-id="solidityLocals"]') .scrollAndClick('*[data-id="solidityLocals"]')
.assert.containsText('*[data-id="solidityLocals"]', 'toast') .assert.containsText('*[data-id="solidityLocals"]', 'toast')
.assert.containsText('*[data-id="solidityLocals"]', '999') .assert.containsText('*[data-id="solidityLocals"]', '999')
}, },
'Should debug transaction using slider': function (browser: NightwatchBrowser) { 'Should debug transaction using slider': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]') browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]')
.waitForElementVisible('*[data-id="slider"]') .waitForElementVisible('*[data-id="slider"]')
.click('*[data-id="slider"]') .click('*[data-id="slider"]')
.setValue('*[data-id="slider"]', '50') .setValue('*[data-id="slider"]', '50')
.pause(2000) .pause(2000)
.click('*[data-id="dropdownPanelSolidityLocals"]') .click('*[data-id="dropdownPanelSolidityLocals"]')
.assert.containsText('*[data-id="solidityLocals"]', 'no locals') .assert.containsText('*[data-id="solidityLocals"]', 'no locals')
.assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n92') .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n92')
}, },
'Should step back and forward transaction': function (browser: NightwatchBrowser) { 'Should step back and forward transaction': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]') browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]')
.waitForElementPresent('*[data-id="buttonNavigatorIntoBack"]') .waitForElementPresent('*[data-id="buttonNavigatorIntoBack"]')
.scrollAndClick('*[data-id="buttonNavigatorIntoBack"]') .scrollAndClick('*[data-id="buttonNavigatorIntoBack"]')
.pause(2000) .pause(2000)
.assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n91') .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n91')
.assert.containsText('*[data-id="stepdetail"]', 'execution step:\n91') .assert.containsText('*[data-id="stepdetail"]', 'execution step:\n91')
.click('*[data-id="buttonNavigatorIntoForward"]') .click('*[data-id="buttonNavigatorIntoForward"]')
.pause(2000) .pause(2000)
.assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n92') .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n92')
.assert.containsText('*[data-id="stepdetail"]', 'execution step:\n92') .assert.containsText('*[data-id="stepdetail"]', 'execution step:\n92')
}, },
'Should jump through breakpoints': function (browser: NightwatchBrowser) { 'Should jump through breakpoints': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="editorInput"]') browser.waitForElementVisible('*[data-id="editorInput"]')
.click('.ace_gutter-cell:nth-of-type(10)') .click('.ace_gutter-cell:nth-of-type(10)')
.click('.ace_gutter-cell:nth-of-type(20)') .click('.ace_gutter-cell:nth-of-type(20)')
.waitForElementVisible('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]') .waitForElementVisible('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]')
.click('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]') .click('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]')
.pause(2000) .pause(2000)
.assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n0') .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n0')
.assert.containsText('*[data-id="stepdetail"]', 'execution step:\n0') .assert.containsText('*[data-id="stepdetail"]', 'execution step:\n0')
.click('*[data-id="buttonNavigatorJumpNextBreakpoint"]') .click('*[data-id="buttonNavigatorJumpNextBreakpoint"]')
.pause(2000) .pause(2000)
.assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n184') .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n184')
.assert.containsText('*[data-id="stepdetail"]', 'execution step:\n184') .assert.containsText('*[data-id="stepdetail"]', 'execution step:\n184')
}, },
'Should display solidity imported code while debugging github import': function (browser: NightwatchBrowser) { 'Should display solidity imported code while debugging github import': function (browser: NightwatchBrowser) {
browser browser
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') .setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js')
.pause(2000) .pause(2000)
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.testContracts('externalImport.sol', sources[1]['browser/externalImport.sol'], ['ERC20']) .testContracts('externalImport.sol', sources[1]['browser/externalImport.sol'], ['ERC20'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 35000) .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 35000)
.selectContract('ERC20') .selectContract('ERC20')
.createContract('"tokenName", "symbol"') .createContract('"tokenName", "symbol"')
.debugTransaction(2) .debugTransaction(2)
.pause(2000) .pause(2000)
.waitForElementVisible('#stepdetail') .waitForElementVisible('#stepdetail')
.goToVMTraceStep(10) .goToVMTraceStep(10)
.getEditorValue((content) => { .getEditorValue((content) => {
browser.assert.ok(content.indexOf(`constructor (string memory name_, string memory symbol_) { browser.assert.ok(content.indexOf(`constructor (string memory name_, string memory symbol_) {
_name = name_; _name = name_;
_symbol = symbol_; _symbol = symbol_;
}`) != -1, }`) !== -1,
'current displayed content is not from the ERC20 source code') 'current displayed content is not from the ERC20 source code')
}) })
}, },
'Should display correct source highlighting while debugging a contract which has ABIEncoderV2': function (browser: NightwatchBrowser) { 'Should display correct source highlighting while debugging a contract which has ABIEncoderV2': function (browser: NightwatchBrowser) {
@ -107,21 +107,21 @@ module.exports = {
This is still an issue @todo(https://github.com/ethereum/remix-project/issues/481), so this test will fail when this issue is fixed This is still an issue @todo(https://github.com/ethereum/remix-project/issues/481), so this test will fail when this issue is fixed
*/ */
browser browser
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.6.12+commit.27d51765.js') .setSolidityCompilerVersion('soljson-v0.6.12+commit.27d51765.js')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/externalImport.sol"') .click('li[data-id="treeViewLitreeViewItembrowser/externalImport.sol"')
.testContracts('withABIEncoderV2.sol', sources[2]['browser/withABIEncoderV2.sol'], ['test']) .testContracts('withABIEncoderV2.sol', sources[2]['browser/withABIEncoderV2.sol'], ['test'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('test') .selectContract('test')
.createContract('') .createContract('')
.clickInstance(2) .clickInstance(2)
.clickFunction('test1 - transact (not payable)', {types: 'bytes userData', values: '0x000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000015b38da6a701c568545dcfcb03fcb875f56beddc4'}) .clickFunction('test1 - transact (not payable)', { types: 'bytes userData', values: '0x000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000015b38da6a701c568545dcfcb03fcb875f56beddc4' })
.debugTransaction(4) .debugTransaction(4)
.pause(2000) .pause(2000)
.waitForElementVisible('#stepdetail') .waitForElementVisible('#stepdetail')
.goToVMTraceStep(261) .goToVMTraceStep(261)
.pause(1000) .pause(1000)
/* /*
for the test below: for the test below:
source highlight should remain line `bytes32 idAsk = abi.decode(userData[:33], (bytes32));` source highlight should remain line `bytes32 idAsk = abi.decode(userData[:33], (bytes32));`
@ -130,86 +130,86 @@ module.exports = {
But the debugger uses now validSourcelocation, which means file is not -1. But the debugger uses now validSourcelocation, which means file is not -1.
In that case the source highlight at 261 should be the same as for step 262 In that case the source highlight at 261 should be the same as for step 262
*/ */
.waitForElementPresent('.highlightLine7') .waitForElementPresent('.highlightLine7')
.goToVMTraceStep(266) .goToVMTraceStep(266)
.pause(1000) .pause(1000)
.checkVariableDebug('soliditylocals', localVariable_step266_ABIEncoder) // locals should not be initiated at this point, only idAsk should .checkVariableDebug('soliditylocals', localVariable_step266_ABIEncoder) // locals should not be initiated at this point, only idAsk should
.goToVMTraceStep(717) .goToVMTraceStep(717)
.pause(5000) .pause(5000)
.checkVariableDebug('soliditylocals', localVariable_step717_ABIEncoder) // all locals should be initiaed .checkVariableDebug('soliditylocals', localVariable_step717_ABIEncoder) // all locals should be initiaed
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.clickInstance(2) .clickInstance(2)
}, },
'Should load more solidity locals array': function (browser: NightwatchBrowser) { 'Should load more solidity locals array': function (browser: NightwatchBrowser) {
browser browser
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('locals.sol', sources[3]['browser/locals.sol'], ['testLocals']) .testContracts('locals.sol', sources[3]['browser/locals.sol'], ['testLocals'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 40000) .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 40000)
.createContract('') .createContract('')
.pause(2000) .pause(2000)
.clickInstance(3) .clickInstance(3)
.clickFunction('t - transact (not payable)') .clickFunction('t - transact (not payable)')
.pause(2000) .pause(2000)
.debugTransaction(6) .debugTransaction(6)
.waitForElementVisible('*[data-id="slider"]') .waitForElementVisible('*[data-id="slider"]')
.click('*[data-id="slider"]') .click('*[data-id="slider"]')
.setValue('*[data-id="slider"]', '5000') .setValue('*[data-id="slider"]', '5000')
.waitForElementPresent('*[data-id="treeViewDivtreeViewItemarray"]') .waitForElementPresent('*[data-id="treeViewDivtreeViewItemarray"]')
.click('*[data-id="treeViewDivtreeViewItemarray"]') .click('*[data-id="treeViewDivtreeViewItemarray"]')
.waitForElementPresent('*[data-id="treeViewDivtreeViewLoadMore"]') .waitForElementPresent('*[data-id="treeViewDivtreeViewLoadMore"]')
.assert.containsText('*[data-id="solidityLocals"]', '9: 9 uint256') .assert.containsText('*[data-id="solidityLocals"]', '9: 9 uint256')
.notContainsText('*[data-id="solidityLocals"]', '10: 10 uint256') .notContainsText('*[data-id="solidityLocals"]', '10: 10 uint256')
}, },
'Should debug using generated sources': function (browser: NightwatchBrowser) { 'Should debug using generated sources': function (browser: NightwatchBrowser) {
browser browser
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.7.2+commit.51b20bc0.js') .setSolidityCompilerVersion('soljson-v0.7.2+commit.51b20bc0.js')
.pause(2000) .pause(2000)
.testContracts('withGeneratedSources.sol', sources[4]['browser/withGeneratedSources.sol'], ['A']) .testContracts('withGeneratedSources.sol', sources[4]['browser/withGeneratedSources.sol'], ['A'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.createContract('') .createContract('')
.clickInstance(4) .clickInstance(4)
.clickFunction('f - transact (not payable)', {types: 'uint256[] ', values: '[]'}) .clickFunction('f - transact (not payable)', { types: 'uint256[] ', values: '[]' })
.debugTransaction(8) .debugTransaction(8)
.pause(2000) .pause(2000)
.click('*[data-id="debuggerTransactionStartButton"]') // stop debugging .click('*[data-id="debuggerTransactionStartButton"]') // stop debugging
.click('*[data-id="debugGeneratedSourcesLabel"]') // select debug with generated sources .click('*[data-id="debugGeneratedSourcesLabel"]') // select debug with generated sources
.click('*[data-id="debuggerTransactionStartButton"]') // start debugging .click('*[data-id="debuggerTransactionStartButton"]') // start debugging
.pause(2000) .pause(2000)
.getEditorValue((content) => { .getEditorValue((content) => {
browser.assert.ok(content.indexOf('if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }') != -1, 'current displayed content is not a generated source') browser.assert.ok(content.indexOf('if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }') !== -1, 'current displayed content is not a generated source')
}) })
.click('*[data-id="debuggerTransactionStartButton"]') .click('*[data-id="debuggerTransactionStartButton"]')
}, },
'Should call the debugger api: getTrace': function (browser: NightwatchBrowser) { 'Should call the debugger api: getTrace': function (browser: NightwatchBrowser) {
browser browser
.addFile('test_jsGetTrace.js', { content: jsGetTrace }) .addFile('test_jsGetTrace.js', { content: jsGetTrace })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(3000) .pause(3000)
.journalChildIncludes(`{ "gas": "0x2dc6c0", "return": "0x", "structLogs":`) .journalChildIncludes('{ "gas": "0x2dc6c0", "return": "0x", "structLogs":')
}, },
'Should call the debugger api: debug': function (browser: NightwatchBrowser) { 'Should call the debugger api: debug': function (browser: NightwatchBrowser) {
browser browser
.addFile('test_jsDebug.js', { content: jsDebug }) .addFile('test_jsDebug.js', { content: jsDebug })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(3000) .pause(3000)
.clickLaunchIcon('debugger') .clickLaunchIcon('debugger')
.waitForElementVisible('*[data-id="slider"]') .waitForElementVisible('*[data-id="slider"]')
.click('*[data-id="slider"]') .click('*[data-id="slider"]')
.setValue('*[data-id="slider"]', '5') .setValue('*[data-id="slider"]', '5')
.pause(1000) .pause(1000)
/* /*
setting the slider to 5 leads to "vm trace step: 91" for chrome and "vm trace step: 92" for firefox setting the slider to 5 leads to "vm trace step: 91" for chrome and "vm trace step: 92" for firefox
=> There is something going wrong with the nightwatch API here. => There is something going wrong with the nightwatch API here.
As we are only testing if debugger is active, this is ok to keep that for now. As we are only testing if debugger is active, this is ok to keep that for now.
*/ */
.assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n9') .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n9')
.end() .end()
}, },
tearDown: sauce tearDown: sauce
@ -250,10 +250,11 @@ const sources = [
} }
}, },
{ {
'browser/externalImport.sol': {content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; contract test7 {}'} 'browser/externalImport.sol': { content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; contract test7 {}' }
}, },
{ {
'browser/withABIEncoderV2.sol': {content: ` 'browser/withABIEncoderV2.sol': {
content: `
pragma experimental ABIEncoderV2; pragma experimental ABIEncoderV2;
contract test { contract test {
@ -272,7 +273,8 @@ const sources = [
return abi.decode(userData[:4], (bytes4)); return abi.decode(userData[:4], (bytes4));
} }
} }
`} `
}
}, },
{ {
'browser/locals.sol': { 'browser/locals.sol': {
@ -302,68 +304,68 @@ const sources = [
} }
] ]
const localVariable_step266_ABIEncoder = { const localVariable_step266_ABIEncoder = { // eslint-disable-line
"<1>": { '<1>': {
"length": "0xNaN", length: '0xNaN',
"type": "bytes", type: 'bytes',
"value": "0x" value: '0x'
}, },
"<2>": { '<2>': {
"type": "bytes32", type: 'bytes32',
"value": "0x0000000000000000000000000000000000000000000000000000000000000000" value: '0x0000000000000000000000000000000000000000000000000000000000000000'
}, },
"<3>": { '<3>': {
"type": "bytes32", type: 'bytes32',
"value": "0x0000000000000000000000000000000000000000000000000000000000000000" value: '0x0000000000000000000000000000000000000000000000000000000000000000'
}, },
"<4>": { '<4>': {
"type": "uint256", type: 'uint256',
"value": "0" value: '0'
}, },
"idAsk": { idAsk: {
"type": "bytes32", type: 'bytes32',
"value": "0x0000000000000000000000000000000000000000000000000000000000000002" value: '0x0000000000000000000000000000000000000000000000000000000000000002'
}, },
"userData": { userData: {
"error": "<decoding failed - no decoder for calldata>", error: '<decoding failed - no decoder for calldata>',
"type": "bytes" type: 'bytes'
} }
} }
const localVariable_step717_ABIEncoder = { const localVariable_step717_ABIEncoder = { // eslint-disable-line
"<1>": { '<1>': {
"length": "0xd0", length: '0xd0',
"type": "bytes", type: 'bytes',
"value": "0x5b38da6a701c568545dcfcb03fcb875f56beddc45b38da6a701c568545dcfcb03fcb875f56beddc400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001" value: '0x5b38da6a701c568545dcfcb03fcb875f56beddc45b38da6a701c568545dcfcb03fcb875f56beddc400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001'
}, },
"<2>": { '<2>': {
"type": "bytes32", type: 'bytes32',
"value": "0x0000000000000000000000000000000000000000000000000000000000000002" value: '0x0000000000000000000000000000000000000000000000000000000000000002'
}, },
"<3>": { '<3>': {
"type": "bytes32", type: 'bytes32',
"value": "0x0000000000000000000000000000000000000000000000000000000000000001" value: '0x0000000000000000000000000000000000000000000000000000000000000001'
}, },
"<4>": { '<4>': {
"type": "uint256", type: 'uint256',
"value": "84" value: '84'
}, },
"idAsk": { idAsk: {
"type": "bytes32", type: 'bytes32',
"value": "0x0000000000000000000000000000000000000000000000000000000000000002" value: '0x0000000000000000000000000000000000000000000000000000000000000002'
}, },
"idOffer": { idOffer: {
"type": "bytes32", type: 'bytes32',
"value": "0x0000000000000000000000000000000000000000000000000000000000000001" value: '0x0000000000000000000000000000000000000000000000000000000000000001'
}, },
"ro": { ro: {
"length": "0xd0", length: '0xd0',
"type": "bytes", type: 'bytes',
"value": "0x5b38da6a701c568545dcfcb03fcb875f56beddc45b38da6a701c568545dcfcb03fcb875f56beddc400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001" value: '0x5b38da6a701c568545dcfcb03fcb875f56beddc45b38da6a701c568545dcfcb03fcb875f56beddc400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001'
}, },
"userData": { userData: {
"error": "<decoding failed - no decoder for calldata>", error: '<decoding failed - no decoder for calldata>',
"type": "bytes" type: 'bytes'
} }
} }

@ -10,74 +10,74 @@ module.exports = {
'Loads Icon\'s Panel': function (browser: NightwatchBrowser) { 'Loads Icon\'s Panel': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000) browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000)
.waitForElementVisible('div[data-id="verticalIconsHomeIcon"]') .waitForElementVisible('div[data-id="verticalIconsHomeIcon"]')
.waitForElementVisible('div[plugin="fileExplorers"]') .waitForElementVisible('div[plugin="fileExplorers"]')
.waitForElementVisible('div[plugin="pluginManager"]') .waitForElementVisible('div[plugin="pluginManager"]')
.waitForElementVisible('div[plugin="settings"]') .waitForElementVisible('div[plugin="settings"]')
}, },
'Loads Side Panel': function (browser: NightwatchBrowser) { 'Loads Side Panel': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]') browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]')
.assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS') .assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS')
.waitForElementVisible('div[data-id="filePanelFileExplorerTree"]') .waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/contracts"]') .waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/contracts"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/scripts"]') .waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/scripts"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/tests"]') .waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/tests"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/README.txt"]') .waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/README.txt"]')
}, },
'Loads Main View': function (browser: NightwatchBrowser) { 'Loads Main View': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('div[data-id="mainPanelPluginsContainer"]') browser.waitForElementVisible('div[data-id="mainPanelPluginsContainer"]')
.waitForElementVisible('div[data-id="landingPageHomeContainer"]') .waitForElementVisible('div[data-id="landingPageHomeContainer"]')
.waitForElementVisible('div[data-id="landingPageHpSections"]') .waitForElementVisible('div[data-id="landingPageHpSections"]')
.waitForElementVisible('div[data-id="terminalContainer"]') .waitForElementVisible('div[data-id="terminalContainer"]')
}, },
'Loads terminal': function (browser: NightwatchBrowser) { 'Loads terminal': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('div[data-id="terminalCli"]', 10000) .waitForElementVisible('div[data-id="terminalCli"]', 10000)
.journalLastChildIncludes('Welcome to Remix') .journalLastChildIncludes('Welcome to Remix')
}, },
'Toggles Side Panel': function (browser: NightwatchBrowser) { 'Toggles Side Panel': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]') browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]')
.assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS') .assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.assert.hidden('div[data-id="remixIdeSidePanel"]') .assert.hidden('div[data-id="remixIdeSidePanel"]')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.assert.visible('div[data-id="remixIdeSidePanel"]') .assert.visible('div[data-id="remixIdeSidePanel"]')
.assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS') .assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS')
}, },
'Toggles Terminal': function (browser: NightwatchBrowser) { 'Toggles Terminal': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('div[data-id="terminalContainer"]') browser.waitForElementVisible('div[data-id="terminalContainer"]')
.assert.visible('div[data-id="terminalContainerDisplay"]') .assert.visible('div[data-id="terminalContainerDisplay"]')
.click('i[data-id="terminalToggleIcon"]') .click('i[data-id="terminalToggleIcon"]')
.checkElementStyle('div[data-id="terminalToggleMenu"]', 'height', '35px') .checkElementStyle('div[data-id="terminalToggleMenu"]', 'height', '35px')
.click('i[data-id="terminalToggleIcon"]') .click('i[data-id="terminalToggleIcon"]')
.assert.visible('div[data-id="terminalContainerDisplay"]') .assert.visible('div[data-id="terminalContainerDisplay"]')
}, },
'Toggles File Explorer Browser': function (browser: NightwatchBrowser) { 'Toggles File Explorer Browser': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('div[data-id="filePanelFileExplorerTree"]') .waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
.waitForElementPresent('[data-id="treeViewLitreeViewItembrowser/contracts"]') .waitForElementPresent('[data-id="treeViewLitreeViewItembrowser/contracts"]')
.click('[data-path="browser"]') .click('[data-path="browser"]')
.waitForElementNotPresent('[data-id="treeViewLitreeViewItembrowser/contracts"]') .waitForElementNotPresent('[data-id="treeViewLitreeViewItembrowser/contracts"]')
.click('[data-path="browser"]') .click('[data-path="browser"]')
.waitForElementPresent('[data-id="treeViewLitreeViewItembrowser/contracts"]') .waitForElementPresent('[data-id="treeViewLitreeViewItembrowser/contracts"]')
}, },
'Switch Tabs using tabs icon': function (browser: NightwatchBrowser) { 'Switch Tabs using tabs icon': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('div[data-id="filePanelFileExplorerTree"]') .waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
.click('[data-id="treeViewLitreeViewItembrowser/contracts"]') .click('[data-id="treeViewLitreeViewItembrowser/contracts"]')
.openFile('browser/contracts/3_Ballot.sol') .openFile('browser/contracts/3_Ballot.sol')
.assert.containsText('div[title="browser/contracts/3_Ballot.sol"]', '3_Ballot.sol') .assert.containsText('div[title="browser/contracts/3_Ballot.sol"]', '3_Ballot.sol')
.click('span[class^=dropdownCaret]') .click('span[class^=dropdownCaret]')
.click('#homeItem') .click('#homeItem')
.assert.containsText('div[title="home"]', 'Home') .assert.containsText('div[title="home"]', 'Home')
.end() .end()
}, },
tearDown: sauce tearDown: sauce

@ -1,6 +1,6 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -12,64 +12,64 @@ module.exports = {
'Should zoom in editor': function (browser: NightwatchBrowser) { 'Should zoom in editor': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('div[data-id="mainPanelPluginsContainer"]') browser.waitForElementVisible('div[data-id="mainPanelPluginsContainer"]')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.waitForElementVisible('div[data-id="filePanelFileExplorerTree"]') .waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
.openFile('browser/contracts/1_Storage.sol') .openFile('browser/contracts/1_Storage.sol')
.waitForElementVisible('*[data-id="editorInput"]') .waitForElementVisible('*[data-id="editorInput"]')
.checkElementStyle('*[data-id="editorInput"]', 'font-size', '12px') .checkElementStyle('*[data-id="editorInput"]', 'font-size', '12px')
.click('*[data-id="tabProxyZoomIn"]') .click('*[data-id="tabProxyZoomIn"]')
.click('*[data-id="tabProxyZoomIn"]') .click('*[data-id="tabProxyZoomIn"]')
.checkElementStyle('*[data-id="editorInput"]', 'font-size', '14px') .checkElementStyle('*[data-id="editorInput"]', 'font-size', '14px')
}, },
'Should zoom out editor': function (browser: NightwatchBrowser) { 'Should zoom out editor': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="editorInput"]') browser.waitForElementVisible('*[data-id="editorInput"]')
.checkElementStyle('*[data-id="editorInput"]', 'font-size', '14px') .checkElementStyle('*[data-id="editorInput"]', 'font-size', '14px')
.click('*[data-id="tabProxyZoomOut"]') .click('*[data-id="tabProxyZoomOut"]')
.click('*[data-id="tabProxyZoomOut"]') .click('*[data-id="tabProxyZoomOut"]')
.checkElementStyle('*[data-id="editorInput"]', 'font-size', '12px') .checkElementStyle('*[data-id="editorInput"]', 'font-size', '12px')
}, },
'Should display compile error in editor': function (browser: NightwatchBrowser) { 'Should display compile error in editor': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="editorInput"]') browser.waitForElementVisible('*[data-id="editorInput"]')
.waitForElementVisible('*[class="ace_content"]') .waitForElementVisible('*[class="ace_content"]')
.click('*[class="ace_content"]') .click('*[class="ace_content"]')
.sendKeys('*[class="ace_text-input"]', 'error') .sendKeys('*[class="ace_text-input"]', 'error')
.pause(2000) .pause(2000)
.waitForElementVisible('.ace_error') .waitForElementVisible('.ace_error')
}, },
'Should minimize and maximize codeblock in editor': function (browser: NightwatchBrowser) { 'Should minimize and maximize codeblock in editor': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="editorInput"]') browser.waitForElementVisible('*[data-id="editorInput"]')
.waitForElementVisible('.ace_open') .waitForElementVisible('.ace_open')
.click('.ace_start:nth-of-type(1)') .click('.ace_start:nth-of-type(1)')
.waitForElementVisible('.ace_closed') .waitForElementVisible('.ace_closed')
.click('.ace_start:nth-of-type(1)') .click('.ace_start:nth-of-type(1)')
.waitForElementVisible('.ace_open') .waitForElementVisible('.ace_open')
}, },
'Should add breakpoint to editor': function (browser: NightwatchBrowser) { 'Should add breakpoint to editor': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="editorInput"]') browser.waitForElementVisible('*[data-id="editorInput"]')
.waitForElementNotPresent('.ace_breakpoint') .waitForElementNotPresent('.ace_breakpoint')
.click('.ace_gutter-cell:nth-of-type(1)') .click('.ace_gutter-cell:nth-of-type(1)')
.waitForElementVisible('.ace_breakpoint') .waitForElementVisible('.ace_breakpoint')
}, },
'Should load syntax highlighter for ace light theme': function (browser: NightwatchBrowser) { 'Should load syntax highlighter for ace light theme': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="editorInput"]') browser.waitForElementVisible('*[data-id="editorInput"]')
.checkElementStyle('.ace_keyword', 'color', aceThemes.light.keyword) .checkElementStyle('.ace_keyword', 'color', aceThemes.light.keyword)
.checkElementStyle('.ace_comment.ace_doc', 'color', aceThemes.light.comment) .checkElementStyle('.ace_comment.ace_doc', 'color', aceThemes.light.comment)
.checkElementStyle('.ace_function', 'color', aceThemes.light.function) .checkElementStyle('.ace_function', 'color', aceThemes.light.function)
.checkElementStyle('.ace_variable', 'color', aceThemes.light.variable) .checkElementStyle('.ace_variable', 'color', aceThemes.light.variable)
}, },
'Should load syntax highlighter for ace dark theme': function (browser: NightwatchBrowser) { 'Should load syntax highlighter for ace dark theme': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]') browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]')
.click('*[data-id="verticalIconsKindsettings"]') .click('*[data-id="verticalIconsKindsettings"]')
.waitForElementVisible('*[data-id="settingsTabThemeLabelDark"]') .waitForElementVisible('*[data-id="settingsTabThemeLabelDark"]')
.click('*[data-id="settingsTabThemeLabelDark"]') .click('*[data-id="settingsTabThemeLabelDark"]')
.pause(2000) .pause(2000)
.waitForElementVisible('*[data-id="editorInput"]') .waitForElementVisible('*[data-id="editorInput"]')
/* @todo(#2863) ch for class and not colors /* @todo(#2863) ch for class and not colors
.checkElementStyle('.ace_keyword', 'color', aceThemes.dark.keyword) .checkElementStyle('.ace_keyword', 'color', aceThemes.dark.keyword)
.checkElementStyle('.ace_comment.ace_doc', 'color', aceThemes.dark.comment) .checkElementStyle('.ace_comment.ace_doc', 'color', aceThemes.dark.comment)
@ -81,46 +81,46 @@ module.exports = {
'Should highlight source code': function (browser: NightwatchBrowser) { 'Should highlight source code': function (browser: NightwatchBrowser) {
// include all files here because switching between plugins in side-panel removes highlight // include all files here because switching between plugins in side-panel removes highlight
browser browser
.addFile('sourcehighlight.js', sourcehighlightScript) .addFile('sourcehighlight.js', sourcehighlightScript)
.addFile('removeSourcehighlightScript.js', removeSourcehighlightScript) .addFile('removeSourcehighlightScript.js', removeSourcehighlightScript)
.addFile('removeAllSourcehighlightScript.js', removeAllSourcehighlightScript) .addFile('removeAllSourcehighlightScript.js', removeAllSourcehighlightScript)
.openFile('browser/sourcehighlight.js') .openFile('browser/sourcehighlight.js')
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.editorScroll('down', 60) .editorScroll('down', 60)
.waitForElementPresent('.highlightLine32') .waitForElementPresent('.highlightLine32')
.checkElementStyle('.highlightLine32', 'background-color', 'rgb(8, 108, 181)') .checkElementStyle('.highlightLine32', 'background-color', 'rgb(8, 108, 181)')
.waitForElementPresent('.highlightLine40') .waitForElementPresent('.highlightLine40')
.checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)') .checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)')
.waitForElementPresent('.highlightLine50') .waitForElementPresent('.highlightLine50')
.checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)') .checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)')
}, },
'Should remove 1 highlight from source code': function (browser: NightwatchBrowser) { 'Should remove 1 highlight from source code': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/removeSourcehighlightScript.js"]') browser.waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/removeSourcehighlightScript.js"]')
.click('li[data-id="treeViewLitreeViewItembrowser/removeSourcehighlightScript.js"]') .click('li[data-id="treeViewLitreeViewItembrowser/removeSourcehighlightScript.js"]')
.pause(2000) .pause(2000)
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/contracts"]') .waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/contracts"]')
.click('li[data-id="treeViewLitreeViewItembrowser/contracts"]') .click('li[data-id="treeViewLitreeViewItembrowser/contracts"]')
.waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/contracts/3_Ballot.sol"]') .waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/contracts/3_Ballot.sol"]')
.click('li[data-id="treeViewLitreeViewItembrowser/contracts/3_Ballot.sol"]') .click('li[data-id="treeViewLitreeViewItembrowser/contracts/3_Ballot.sol"]')
.waitForElementNotPresent('.highlightLine32') .waitForElementNotPresent('.highlightLine32')
.checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)') .checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)')
.checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)') .checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)')
}, },
'Should remove all highlights from source code': function (browser: NightwatchBrowser) { 'Should remove all highlights from source code': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/removeAllSourcehighlightScript.js"]') browser.waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/removeAllSourcehighlightScript.js"]')
.click('li[data-id="treeViewLitreeViewItembrowser/removeAllSourcehighlightScript.js"]') .click('li[data-id="treeViewLitreeViewItembrowser/removeAllSourcehighlightScript.js"]')
.pause(2000) .pause(2000)
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/contracts/3_Ballot.sol"]') .waitForElementVisible('li[data-id="treeViewLitreeViewItembrowser/contracts/3_Ballot.sol"]')
.click('li[data-id="treeViewLitreeViewItembrowser/contracts/3_Ballot.sol"]') .click('li[data-id="treeViewLitreeViewItembrowser/contracts/3_Ballot.sol"]')
.pause(2000) .pause(2000)
.waitForElementNotPresent('.highlightLine32') .waitForElementNotPresent('.highlightLine32')
.waitForElementNotPresent('.highlightLine40') .waitForElementNotPresent('.highlightLine40')
.waitForElementNotPresent('.highlightLine50') .waitForElementNotPresent('.highlightLine50')
.end() .end()
}, },
tearDown: sauce tearDown: sauce

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
import * as path from 'path' import * as path from 'path'
@ -18,99 +18,98 @@ module.exports = {
'Should create a new file `5_New_contract.sol` in file explorer': function (browser: NightwatchBrowser) { 'Should create a new file `5_New_contract.sol` in file explorer': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]') browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS') .assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS')
.click('*[data-id="fileExplorerNewFilecreateNewFile"]') .click('*[data-id="fileExplorerNewFilecreateNewFile"]')
.pause(1000) .pause(1000)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/blank"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/blank"]')
.sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', '5_New_contract.sol') .sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', '5_New_contract.sol')
.sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', browser.Keys.ENTER) .sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', browser.Keys.ENTER)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_New_contract.sol"]', 7000) .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_New_contract.sol"]', 7000)
}, },
'Should rename `5_New_contract.sol` to 5_Renamed_Contract.sol': function (browser: NightwatchBrowser) { 'Should rename `5_New_contract.sol` to 5_Renamed_Contract.sol': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_New_contract.sol"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_New_contract.sol"]')
.renamePath('browser/5_New_contract.sol', '5_Renamed_Contract.sol', 'browser/5_Renamed_Contract.sol') .renamePath('browser/5_New_contract.sol', '5_Renamed_Contract.sol', 'browser/5_Renamed_Contract.sol')
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"]')
}, },
'Should delete file `5_Renamed_Contract.sol` from file explorer': function (browser: NightwatchBrowser) { 'Should delete file `5_Renamed_Contract.sol` from file explorer': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"]')
.rightClick('[data-path="browser/5_Renamed_Contract.sol"]') .rightClick('[data-path="browser/5_Renamed_Contract.sol"]')
.click('*[id="menuitemdelete"]') .click('*[id="menuitemdelete"]')
.waitForElementVisible('*[data-id="browserModalDialogContainer-react"]') .waitForElementVisible('*[data-id="browserModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.waitForElementNotPresent('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"') .waitForElementNotPresent('*[data-id="treeViewLitreeViewItembrowser/5_Renamed_Contract.sol"')
}, },
'Should create a new folder': function (browser: NightwatchBrowser) { 'Should create a new folder': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/README.txt"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/README.txt"]')
.click('[data-id="fileExplorerNewFilecreateNewFolder"]') .click('[data-id="fileExplorerNewFilecreateNewFolder"]')
.pause(1000) .pause(1000)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/blank"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/blank"]')
.sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', 'Browser_Tests') .sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', 'Browser_Tests')
.sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', browser.Keys.ENTER) .sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', browser.Keys.ENTER)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]')
}, },
'Should rename Browser_Tests folder to Browser_E2E_Tests': function (browser: NightwatchBrowser) { 'Should rename Browser_Tests folder to Browser_E2E_Tests': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]')
.renamePath('browser/Browser_Tests', 'Browser_E2E_Tests', 'browser/Browser_E2E_Tests') .renamePath('browser/Browser_Tests', 'Browser_E2E_Tests', 'browser/Browser_E2E_Tests')
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]')
}, },
'Should delete Browser_E2E_Tests folder': function (browser: NightwatchBrowser) { 'Should delete Browser_E2E_Tests folder': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]')
.rightClick('[data-path="browser/Browser_E2E_Tests"]') .rightClick('[data-path="browser/Browser_E2E_Tests"]')
.click('*[id="menuitemdelete"]') .click('*[id="menuitemdelete"]')
.waitForElementVisible('*[data-id="browserModalDialogContainer-react"]') .waitForElementVisible('*[data-id="browserModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.waitForElementNotPresent('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]') .waitForElementNotPresent('*[data-id="treeViewLitreeViewItembrowser/Browser_E2E_Tests"]')
}, },
'Should publish all explorer files to github gist': function (browser: NightwatchBrowser) { 'Should publish all explorer files to github gist': function (browser: NightwatchBrowser) {
const runtimeBrowser = browser.options.desiredCapabilities.browserName const runtimeBrowser = browser.options.desiredCapabilities.browserName
browser.refresh() browser.refresh()
.pause(10000) .pause(10000)
.waitForElementVisible('*[data-id="fileExplorerNewFilepublishToGist"]') .waitForElementVisible('*[data-id="fileExplorerNewFilepublishToGist"]')
.click('*[data-id="fileExplorerNewFilepublishToGist"]') .click('*[data-id="fileExplorerNewFilepublishToGist"]')
.waitForElementVisible('*[data-id="browserModalDialogContainer-react"]') .waitForElementVisible('*[data-id="browserModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.pause(2000) .pause(2000)
.waitForElementVisible('*[data-id="browserModalDialogContainer-react"]') .waitForElementVisible('*[data-id="browserModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.pause(2000) .pause(2000)
.perform((done) => { .perform((done) => {
if (runtimeBrowser === 'chrome') { if (runtimeBrowser === 'chrome') {
browser.switchBrowserTab(1) browser.switchBrowserTab(1)
.assert.urlContains('https://gist.github.com') .assert.urlContains('https://gist.github.com')
.switchBrowserTab(0) .switchBrowserTab(0)
} }
done() done()
}) })
}, },
'Should open local filesystem explorer': function (browser: NightwatchBrowser) { 'Should open local filesystem explorer': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="filePanelFileExplorerTree"]') browser.waitForElementVisible('*[data-id="filePanelFileExplorerTree"]')
.setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile1) .setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile1)
.setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile2) .setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile2)
.setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile3) .setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile3)
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/editor.test.js"]') .waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/editor.test.js"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/fileExplorer.test.js"]') .waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/fileExplorer.test.js"]')
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/generalSettings.test.js"]') .waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/generalSettings.test.js"]')
.end() .end()
}, },
tearDown: sauce tearDown: sauce
} }

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -10,94 +10,94 @@ module.exports = {
'Should execute `file` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `file` api from file manager external api': function (browser: NightwatchBrowser) {
browser browser
.addFile('file.js', { content: executeFile }) .addFile('file.js', { content: executeFile })
.executeScript(`remix.exeCurrent()`) .executeScript('remix.exeCurrent()')
.pause(5000) .pause(5000)
.journalLastChildIncludes('browser/file.js') .journalLastChildIncludes('browser/file.js')
}, },
'Should execute `exists` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `exists` api from file manager external api': function (browser: NightwatchBrowser) {
browser browser
.addFile('exists.js', { content: executeExists }) .addFile('exists.js', { content: executeExists })
.executeScript(`remix.exeCurrent()`) .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.journalChildIncludes('browser/exists.js true') .journalChildIncludes('browser/exists.js true')
.journalChildIncludes('browser/non-exists.js false') .journalChildIncludes('browser/non-exists.js false')
}, },
'Should execute `open` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `open` api from file manager external api': function (browser: NightwatchBrowser) {
browser browser
.addFile('open.js', { content: executeOpen }) .addFile('open.js', { content: executeOpen })
.executeScript(`remix.exeCurrent()`) .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.journalLastChildIncludes('browser/contracts/3_Ballot.sol') .journalLastChildIncludes('browser/contracts/3_Ballot.sol')
}, },
'Should execute `writeFile` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `writeFile` api from file manager external api': function (browser: NightwatchBrowser) {
browser browser
.addFile('writeFile.js', { content: executeWriteFile }) .addFile('writeFile.js', { content: executeWriteFile })
.executeScript(`remix.exeCurrent()`) .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.openFile('browser/new_contract.sol') .openFile('browser/new_contract.sol')
.assert.containsText('[data-id="editorInput"]', 'pragma solidity ^0.6.0') .assert.containsText('[data-id="editorInput"]', 'pragma solidity ^0.6.0')
}, },
'Should execute `readFile` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `readFile` api from file manager external api': function (browser: NightwatchBrowser) {
browser browser
.addFile('readFile.js', { content: executeReadFile }) .addFile('readFile.js', { content: executeReadFile })
.executeScript(`remix.exeCurrent()`) .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.journalLastChildIncludes('pragma solidity ^0.6.0') .journalLastChildIncludes('pragma solidity ^0.6.0')
}, },
'Should execute `copyFile` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `copyFile` api from file manager external api': function (browser: NightwatchBrowser) {
browser browser
.addFile('copyFile.js', { content: executeCopyFile }) .addFile('copyFile.js', { content: executeCopyFile })
.executeScript(`remix.exeCurrent()`) .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.journalLastChildIncludes('pragma solidity >=0.7.0 <0.8.0;') .journalLastChildIncludes('pragma solidity >=0.7.0 <0.8.0;')
}, },
'Should execute `rename` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `rename` api from file manager external api': function (browser: NightwatchBrowser) {
browser browser
.addFile('renameFile.js', { content: executeRename }) .addFile('renameFile.js', { content: executeRename })
.executeScript(`remix.exeCurrent()`) .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.waitForElementPresent('[data-id="treeViewLitreeViewItembrowser/old_contract.sol"]') .waitForElementPresent('[data-id="treeViewLitreeViewItembrowser/old_contract.sol"]')
}, },
'Should execute `mkdir` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `mkdir` api from file manager external api': function (browser: NightwatchBrowser) {
browser browser
.addFile('mkdirFile.js', { content: executeMkdir }) .addFile('mkdirFile.js', { content: executeMkdir })
.executeScript(`remix.exeCurrent()`) .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.waitForElementPresent('[data-id="treeViewLitreeViewItembrowser/Test_Folder"]') .waitForElementPresent('[data-id="treeViewLitreeViewItembrowser/Test_Folder"]')
}, },
'Should execute `readdir` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `readdir` api from file manager external api': function (browser: NightwatchBrowser) {
browser browser
.addFile('readdirFile.js', { content: executeReaddir }) .addFile('readdirFile.js', { content: executeReaddir })
.executeScript(`remix.exeCurrent()`) .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.journalLastChildIncludes('Test_Folder isDirectory true') .journalLastChildIncludes('Test_Folder isDirectory true')
}, },
'Should execute `remove` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `remove` api from file manager external api': function (browser: NightwatchBrowser) {
browser browser
.addFile('removeFile.js', { content: executeRemove }) .addFile('removeFile.js', { content: executeRemove })
.executeScript(`remix.exeCurrent()`) .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.waitForElementNotPresent('[data-id="treeViewLitreeViewItembrowser/old_contract.sol"]') .waitForElementNotPresent('[data-id="treeViewLitreeViewItembrowser/old_contract.sol"]')
}, },
// TODO: Fix remove root directory prefix for browser and localhost // TODO: Fix remove root directory prefix for browser and localhost
'Should execute `remove` api from file manager external api on a folder': '' + function (browser: NightwatchBrowser) { 'Should execute `remove` api from file manager external api on a folder': '' + function (browser: NightwatchBrowser) {
browser browser
.addFile('test_jsRemoveFolder.js', { content: executeRemoveOnFolder }) .addFile('test_jsRemoveFolder.js', { content: executeRemoveOnFolder })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
.pause(2000) .pause(2000)
.waitForElementNotPresent('[data-id="treeViewLitreeViewItembrowser/tests"]') .waitForElementNotPresent('[data-id="treeViewLitreeViewItembrowser/tests"]')
.end() .end()
}, },
tearDown: sauce tearDown: sauce

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -10,125 +10,125 @@ module.exports = {
'Should display settings menu': function (browser: NightwatchBrowser) { 'Should display settings menu': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.click('*[data-id="landingPageStartSolidity"]') .click('*[data-id="landingPageStartSolidity"]')
.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) .waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.click('*[data-id="verticalIconsKindsettings"]') .click('*[data-id="verticalIconsKindsettings"]')
.waitForElementContainsText('h6[data-id="sidePanelSwapitTitle"]', 'SETTINGS') .waitForElementContainsText('h6[data-id="sidePanelSwapitTitle"]', 'SETTINGS')
}, },
'Should activate `generate contract metadata`': function (browser) { 'Should activate `generate contract metadata`': function (browser) {
browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 5000) browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 5000)
.waitForElementVisible('*[data-id="settingsTabGenerateContractMetadataLabel"]', 5000) .waitForElementVisible('*[data-id="settingsTabGenerateContractMetadataLabel"]', 5000)
.click('*[data-id="verticalIconsFileExplorerIcons"]') .click('*[data-id="verticalIconsFileExplorerIcons"]')
.click('[data-id="treeViewLitreeViewItembrowser/contracts"]') .click('[data-id="treeViewLitreeViewItembrowser/contracts"]')
.openFile('browser/contracts/3_Ballot.sol') .openFile('browser/contracts/3_Ballot.sol')
.click('*[data-id="verticalIconsKindsolidity"]') .click('*[data-id="verticalIconsKindsolidity"]')
.pause(2000) .pause(2000)
.click('*[data-id="compilerContainerCompileBtn"]') .click('*[data-id="compilerContainerCompileBtn"]')
.pause(3000) .pause(3000)
.click('*[data-id="verticalIconsKindfileExplorers"]') .click('*[data-id="verticalIconsKindfileExplorers"]')
.openFile('browser/contracts/artifacts/Ballot.json') .openFile('browser/contracts/artifacts/Ballot.json')
.openFile('browser/contracts/artifacts/Ballot_metadata.json') .openFile('browser/contracts/artifacts/Ballot_metadata.json')
.getEditorValue((content) => { .getEditorValue((content) => {
const metadata = JSON.parse(content) const metadata = JSON.parse(content)
browser.assert.equal(metadata.language, 'Solidity') browser.assert.equal(metadata.language, 'Solidity')
}) })
}, },
'Should add new github access token': function (browser: NightwatchBrowser) { 'Should add new github access token': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.click('*[data-id="verticalIconsKindsettings"]') .click('*[data-id="verticalIconsKindsettings"]')
.setValue('*[data-id="settingsTabGistAccessToken"]', '**********') .setValue('*[data-id="settingsTabGistAccessToken"]', '**********')
.click('*[data-id="settingsTabSaveGistToken"]') .click('*[data-id="settingsTabSaveGistToken"]')
.waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000) .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000)
.assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Access token has been saved') .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Access token has been saved')
}, },
'Should copy github access token to clipboard': function (browser: NightwatchBrowser) { 'Should copy github access token to clipboard': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.click('*[data-id="copyToClipboardCopyIcon"]') .click('*[data-id="copyToClipboardCopyIcon"]')
.waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000) .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000)
.assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Copied value to clipboard.') .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Copied value to clipboard.')
}, },
'Should remove github access token': function (browser: NightwatchBrowser) { 'Should remove github access token': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.click('*[data-id="settingsTabRemoveGistToken"]') .click('*[data-id="settingsTabRemoveGistToken"]')
.waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000) .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-shared="tooltipPopup"]:nth-last-of-type(1)', 'Access token removed')
.assert.containsText('*[data-id="settingsTabGistAccessToken"]', '') .assert.containsText('*[data-id="settingsTabGistAccessToken"]', '')
}, },
'Should load dark theme': function (browser: NightwatchBrowser) { 'Should load dark theme': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.click('*[data-id="settingsTabThemeLabelDark"]') .click('*[data-id="settingsTabThemeLabelDark"]')
.pause(2000) .pause(2000)
.checkElementStyle(':root', '--primary', remixIdeThemes.dark.primary) .checkElementStyle(':root', '--primary', remixIdeThemes.dark.primary)
.checkElementStyle(':root', '--secondary', remixIdeThemes.dark.secondary) .checkElementStyle(':root', '--secondary', remixIdeThemes.dark.secondary)
.checkElementStyle(':root', '--success', remixIdeThemes.dark.success) .checkElementStyle(':root', '--success', remixIdeThemes.dark.success)
.checkElementStyle(':root', '--info', remixIdeThemes.dark.info) .checkElementStyle(':root', '--info', remixIdeThemes.dark.info)
.checkElementStyle(':root', '--warning', remixIdeThemes.dark.warning) .checkElementStyle(':root', '--warning', remixIdeThemes.dark.warning)
.checkElementStyle(':root', '--danger', remixIdeThemes.dark.danger) .checkElementStyle(':root', '--danger', remixIdeThemes.dark.danger)
}, },
'Should load light theme': function (browser: NightwatchBrowser) { 'Should load light theme': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.click('*[data-id="settingsTabThemeLabelLight"]') .click('*[data-id="settingsTabThemeLabelLight"]')
.pause(2000) .pause(2000)
.checkElementStyle(':root', '--primary', remixIdeThemes.light.primary) .checkElementStyle(':root', '--primary', remixIdeThemes.light.primary)
.checkElementStyle(':root', '--secondary', remixIdeThemes.light.secondary) .checkElementStyle(':root', '--secondary', remixIdeThemes.light.secondary)
.checkElementStyle(':root', '--success', remixIdeThemes.light.success) .checkElementStyle(':root', '--success', remixIdeThemes.light.success)
.checkElementStyle(':root', '--info', remixIdeThemes.light.info) .checkElementStyle(':root', '--info', remixIdeThemes.light.info)
.checkElementStyle(':root', '--warning', remixIdeThemes.light.warning) .checkElementStyle(':root', '--warning', remixIdeThemes.light.warning)
.checkElementStyle(':root', '--danger', remixIdeThemes.light.danger) .checkElementStyle(':root', '--danger', remixIdeThemes.light.danger)
}, },
'Should load Cerulean theme': function (browser: NightwatchBrowser) { 'Should load Cerulean theme': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.click('*[data-id="settingsTabThemeLabelCerulean"]') .click('*[data-id="settingsTabThemeLabelCerulean"]')
.pause(5000) .pause(5000)
.checkElementStyle(':root', '--primary', remixIdeThemes.curelean.primary) .checkElementStyle(':root', '--primary', remixIdeThemes.curelean.primary)
.checkElementStyle(':root', '--secondary', remixIdeThemes.curelean.secondary) .checkElementStyle(':root', '--secondary', remixIdeThemes.curelean.secondary)
.checkElementStyle(':root', '--success', remixIdeThemes.curelean.success) .checkElementStyle(':root', '--success', remixIdeThemes.curelean.success)
.checkElementStyle(':root', '--info', remixIdeThemes.curelean.info) .checkElementStyle(':root', '--info', remixIdeThemes.curelean.info)
.checkElementStyle(':root', '--warning', remixIdeThemes.curelean.warning) .checkElementStyle(':root', '--warning', remixIdeThemes.curelean.warning)
.checkElementStyle(':root', '--danger', remixIdeThemes.curelean.danger) .checkElementStyle(':root', '--danger', remixIdeThemes.curelean.danger)
}, },
'Should load Flatly theme': function (browser: NightwatchBrowser) { 'Should load Flatly theme': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.click('*[data-id="settingsTabThemeLabelFlatly"]') .click('*[data-id="settingsTabThemeLabelFlatly"]')
.pause(2000) .pause(2000)
.checkElementStyle(':root', '--primary', remixIdeThemes.flatly.primary) .checkElementStyle(':root', '--primary', remixIdeThemes.flatly.primary)
.checkElementStyle(':root', '--secondary', remixIdeThemes.flatly.secondary) .checkElementStyle(':root', '--secondary', remixIdeThemes.flatly.secondary)
.checkElementStyle(':root', '--success', remixIdeThemes.flatly.success) .checkElementStyle(':root', '--success', remixIdeThemes.flatly.success)
.checkElementStyle(':root', '--info', remixIdeThemes.flatly.info) .checkElementStyle(':root', '--info', remixIdeThemes.flatly.info)
.checkElementStyle(':root', '--warning', remixIdeThemes.flatly.warning) .checkElementStyle(':root', '--warning', remixIdeThemes.flatly.warning)
.checkElementStyle(':root', '--danger', remixIdeThemes.flatly.danger) .checkElementStyle(':root', '--danger', remixIdeThemes.flatly.danger)
}, },
'Should load Spacelab theme': function (browser) { 'Should load Spacelab theme': function (browser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.click('*[data-id="settingsTabThemeLabelSpacelab"]') .click('*[data-id="settingsTabThemeLabelSpacelab"]')
.pause(2000) .pause(2000)
.checkElementStyle(':root', '--primary', remixIdeThemes.spacelab.primary) .checkElementStyle(':root', '--primary', remixIdeThemes.spacelab.primary)
.checkElementStyle(':root', '--secondary', remixIdeThemes.spacelab.secondary) .checkElementStyle(':root', '--secondary', remixIdeThemes.spacelab.secondary)
.checkElementStyle(':root', '--success', remixIdeThemes.spacelab.success) .checkElementStyle(':root', '--success', remixIdeThemes.spacelab.success)
.checkElementStyle(':root', '--info', remixIdeThemes.spacelab.info) .checkElementStyle(':root', '--info', remixIdeThemes.spacelab.info)
.checkElementStyle(':root', '--warning', remixIdeThemes.spacelab.warning) .checkElementStyle(':root', '--warning', remixIdeThemes.spacelab.warning)
.checkElementStyle(':root', '--danger', remixIdeThemes.spacelab.danger) .checkElementStyle(':root', '--danger', remixIdeThemes.spacelab.danger)
}, },
'Should load Cyborg theme': function (browser) { 'Should load Cyborg theme': function (browser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000) browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.click('*[data-id="settingsTabThemeLabelCyborg"]') .click('*[data-id="settingsTabThemeLabelCyborg"]')
.pause(2000) .pause(2000)
.checkElementStyle(':root', '--primary', remixIdeThemes.cyborg.primary) .checkElementStyle(':root', '--primary', remixIdeThemes.cyborg.primary)
.checkElementStyle(':root', '--secondary', remixIdeThemes.cyborg.secondary) .checkElementStyle(':root', '--secondary', remixIdeThemes.cyborg.secondary)
.checkElementStyle(':root', '--success', remixIdeThemes.cyborg.success) .checkElementStyle(':root', '--success', remixIdeThemes.cyborg.success)
.checkElementStyle(':root', '--info', remixIdeThemes.cyborg.info) .checkElementStyle(':root', '--info', remixIdeThemes.cyborg.info)
.checkElementStyle(':root', '--warning', remixIdeThemes.cyborg.warning) .checkElementStyle(':root', '--warning', remixIdeThemes.cyborg.warning)
.checkElementStyle(':root', '--danger', remixIdeThemes.cyborg.danger) .checkElementStyle(':root', '--danger', remixIdeThemes.cyborg.danger)
}, },
tearDown: sauce tearDown: sauce

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -14,7 +14,7 @@ module.exports = {
init(browser, done) init(browser, done)
}, },
UploadToGists: function (browser: NightwatchBrowser) { UploadToGists: function (browser: NightwatchBrowser) {
/* /*
- set the access token - set the access token
- publish to gist - publish to gist
- retrieve the gist - retrieve the gist
@ -24,81 +24,81 @@ module.exports = {
const runtimeBrowser = browser.options.desiredCapabilities.browserName const runtimeBrowser = browser.options.desiredCapabilities.browserName
browser browser
.refresh() .refresh()
.pause(10000) .pause(10000)
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.click('[data-id="fileExplorerNewFilecreateNewFolder"]') .click('[data-id="fileExplorerNewFilecreateNewFolder"]')
.pause(1000) .pause(1000)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/blank"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/blank"]')
.sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', 'Browser_Tests') .sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', 'Browser_Tests')
.sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', browser.Keys.ENTER) .sendKeys('*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items', browser.Keys.ENTER)
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]')
.addFile('File.sol', { content: '' }) .addFile('File.sol', { content: '' })
.click('*[data-id="fileExplorerNewFilepublishToGist"]') .click('*[data-id="fileExplorerNewFilepublishToGist"]')
.waitForElementVisible('*[data-id="browserModalDialogContainer-react"]') .waitForElementVisible('*[data-id="browserModalDialogContainer-react"]')
.pause(2000) .pause(2000)
.click('.modal-ok') .click('.modal-ok')
.pause(10000) .pause(10000)
.getText('[data-id="browserModalDialogModalBody-react"]', (result) => { .getText('[data-id="browserModalDialogModalBody-react"]', (result) => {
console.log(result) console.log(result)
const value = typeof result.value === 'string' ? result.value : null const value = typeof result.value === 'string' ? result.value : null
const reg = /gist.github.com\/([^.]+)/ const reg = /gist.github.com\/([^.]+)/
const id = value.match(reg) const id = value.match(reg)
console.log('gist regex', id) console.log('gist regex', id)
if (!id) { if (!id) {
browser.assert.fail('cannot get the gist id', '', '') browser.assert.fail('cannot get the gist id', '', '')
} else { } else {
const gistid = id[1] const gistid = id[1]
browser browser
.click('[data-id="browser-modal-footer-cancel-react"]') .click('[data-id="browser-modal-footer-cancel-react"]')
.executeScript(`remix.loadgist('${gistid}')`) .executeScript(`remix.loadgist('${gistid}')`)
.perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('browser/gists') } done() }) .perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('browser/gists') } done() })
.waitForElementVisible(`[data-id="treeViewLitreeViewItembrowser/gists/${gistid}"]`) .waitForElementVisible(`[data-id="treeViewLitreeViewItembrowser/gists/${gistid}"]`)
.click(`[data-id="treeViewLitreeViewItembrowser/gists/${gistid}"]`) .click(`[data-id="treeViewLitreeViewItembrowser/gists/${gistid}"]`)
.openFile(`browser/gists/${gistid}/README.txt`) .openFile(`browser/gists/${gistid}/README.txt`)
} }
}) })
}, },
'Load Gist Modal': function (browser: NightwatchBrowser) { 'Load Gist Modal': function (browser: NightwatchBrowser) {
browser.clickLaunchIcon('home') browser.clickLaunchIcon('home')
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.scrollAndClick('*[data-id="landingPageImportFromGistButton"]') .scrollAndClick('*[data-id="landingPageImportFromGistButton"]')
.waitForElementVisible('*[data-id="modalDialogModalTitle"]') .waitForElementVisible('*[data-id="modalDialogModalTitle"]')
.assert.containsText('*[data-id="modalDialogModalTitle"]', 'Load a Gist') .assert.containsText('*[data-id="modalDialogModalTitle"]', 'Load a Gist')
.waitForElementVisible('*[data-id="modalDialogModalBody"]') .waitForElementVisible('*[data-id="modalDialogModalBody"]')
.assert.containsText('*[data-id="modalDialogModalBody"]', 'Enter the ID of the Gist or URL you would like to load.') .assert.containsText('*[data-id="modalDialogModalBody"]', 'Enter the ID of the Gist or URL you would like to load.')
.waitForElementVisible('*[data-id="modalDialogCustomPromptText"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
.modalFooterCancelClick() .modalFooterCancelClick()
}, },
'Display Error Message For Invalid Gist ID': function (browser: NightwatchBrowser) { 'Display Error Message For Invalid Gist ID': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.scrollAndClick('*[data-id="landingPageImportFromGistButton"]') .scrollAndClick('*[data-id="landingPageImportFromGistButton"]')
.waitForElementVisible('*[data-id="modalDialogCustomPromptText"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
.setValue('*[data-id="modalDialogCustomPromptText"]', testData.invalidGistId) .setValue('*[data-id="modalDialogCustomPromptText"]', testData.invalidGistId)
.modalFooterOKClick() .modalFooterOKClick()
.waitForElementVisible('*[data-id="modalDialogModalBody"]') .waitForElementVisible('*[data-id="modalDialogModalBody"]')
.assert.containsText('*[data-id="modalDialogModalBody"]', 'Gist load error: Not Found') .assert.containsText('*[data-id="modalDialogModalBody"]', 'Gist load error: Not Found')
.modalFooterOKClick() .modalFooterOKClick()
}, },
'Import From Gist For Valid Gist ID': function (browser: NightwatchBrowser) { 'Import From Gist For Valid Gist ID': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.scrollAndClick('*[data-id="landingPageImportFromGistButton"]') .scrollAndClick('*[data-id="landingPageImportFromGistButton"]')
.waitForElementVisible('*[data-id="modalDialogCustomPromptText"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
.setValue('*[data-id="modalDialogCustomPromptText"]', testData.validGistId) .setValue('*[data-id="modalDialogCustomPromptText"]', testData.validGistId)
.modalFooterOKClick() .modalFooterOKClick()
.openFile(`browser/gists/${testData.validGistId}/ApplicationRegistry`) .openFile(`browser/gists/${testData.validGistId}/ApplicationRegistry`)
.waitForElementVisible(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry']`) .waitForElementVisible(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry']`)
.assert.containsText(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry'] > span`, 'ApplicationRegistry') .assert.containsText(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry'] > span`, 'ApplicationRegistry')
.end() .end()
}, },
tearDown: sauce tearDown: sauce

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -93,7 +93,7 @@ function checkDeployShouldSucceed (browser: NightwatchBrowser, address: string,
.getEditorValue((content) => { .getEditorValue((content) => {
config = JSON.parse(content) config = JSON.parse(content)
config.deploy['VM:-'].autoDeployLib = false config.deploy['VM:-'].autoDeployLib = false
config.deploy['VM:-']['linkReferences']['browser/Untitled5.sol'].lib = address config.deploy['VM:-'].linkReferences['browser/Untitled5.sol'].lib = address
}) })
.perform(() => { .perform(() => {
browser.setEditorValue(JSON.stringify(config)) browser.setEditorValue(JSON.stringify(config))
@ -116,7 +116,8 @@ function checkDeployShouldSucceed (browser: NightwatchBrowser, address: string,
const sources = [ const sources = [
{ {
'browser/Untitled5.sol': {content: `library lib { 'browser/Untitled5.sol': {
content: `library lib {
function getInt () public view returns (uint) { function getInt () public view returns (uint) {
return 45; return 45;
} }
@ -126,6 +127,7 @@ const sources = [
function get () public view returns (uint) { function get () public view returns (uint) {
return lib.getInt(); return lib.getInt();
} }
}`} }`
}
} }
] ]

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -16,52 +16,52 @@ module.exports = {
'Should Load Plugin Manager': function (browser: NightwatchBrowser) { 'Should Load Plugin Manager': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]')
.pause(3000) .pause(3000)
.click('*[plugin="pluginManager"]') .click('*[plugin="pluginManager"]')
.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') .waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'PLUGIN MANAGER') .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'PLUGIN MANAGER')
}, },
'Should Search for plugins': function (browser: NightwatchBrowser) { 'Should Search for plugins': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.click('*[data-id="pluginManagerComponentSearchInput"]') .click('*[data-id="pluginManagerComponentSearchInput"]')
.keys('debugger') .keys('debugger')
.waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]') .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]')
.clearValue('*[data-id="pluginManagerComponentSearchInput"]') .clearValue('*[data-id="pluginManagerComponentSearchInput"]')
.click('*[data-id="pluginManagerComponentSearchInput"]') .click('*[data-id="pluginManagerComponentSearchInput"]')
.keys('Vyper') .keys('Vyper')
.waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonvyper"]') .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonvyper"]')
.clearValue('*[data-id="pluginManagerComponentSearchInput"]') .clearValue('*[data-id="pluginManagerComponentSearchInput"]')
.click('*[data-id="pluginManagerComponentSearchInput"]') .click('*[data-id="pluginManagerComponentSearchInput"]')
.keys('ZoKrates') .keys('ZoKrates')
.waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonZoKrates"]') .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonZoKrates"]')
.clearValue('*[data-id="pluginManagerComponentSearchInput"]') .clearValue('*[data-id="pluginManagerComponentSearchInput"]')
.click('*[data-id="pluginManagerComponentSearchInput"]') .click('*[data-id="pluginManagerComponentSearchInput"]')
.keys(browser.Keys.ENTER) .keys(browser.Keys.ENTER)
}, },
'Should activate plugins': function (browser: NightwatchBrowser) { 'Should activate plugins': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.click('*[data-id="pluginManagerComponentPluginManager"]') .click('*[data-id="pluginManagerComponentPluginManager"]')
.scrollAndClick('*[data-id="pluginManagerComponentActivateButtondebugger"]') .scrollAndClick('*[data-id="pluginManagerComponentActivateButtondebugger"]')
.pause(2000) .pause(2000)
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]') .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]')
.scrollAndClick('*[data-id="pluginManagerComponentActivateButtonvyper"]') .scrollAndClick('*[data-id="pluginManagerComponentActivateButtonvyper"]')
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonvyper"]') .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonvyper"]')
.scrollAndClick('*[data-id="pluginManagerComponentActivateButtonZoKrates"]') .scrollAndClick('*[data-id="pluginManagerComponentActivateButtonZoKrates"]')
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonZoKrates"]') .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonZoKrates"]')
}, },
'Should deactivate plugins': function (browser: NightwatchBrowser) { 'Should deactivate plugins': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.click('*[data-id="pluginManagerComponentPluginManager"]') .click('*[data-id="pluginManagerComponentPluginManager"]')
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]') .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]')
.pause(2000) .pause(2000)
.scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtondebugger"]') .scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtondebugger"]')
.waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]') .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]')
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonvyper"]') .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonvyper"]')
.scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtonvyper"]') .scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtonvyper"]')
.waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonvyper"]') .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonvyper"]')
}, },
/* /*
@ -104,56 +104,56 @@ module.exports = {
'Should connect a local plugin': function (browser: NightwatchBrowser) { 'Should connect a local plugin': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.click('*[data-id="pluginManagerComponentPluginSearchButton"]') .click('*[data-id="pluginManagerComponentPluginSearchButton"]')
.waitForElementVisible('*[data-id="modalDialogContainer"]') .waitForElementVisible('*[data-id="modalDialogContainer"]')
.click('*[data-id="modalDialogModalBody"]') .click('*[data-id="modalDialogModalBody"]')
.waitForElementVisible('*[data-id="localPluginName"]') .waitForElementVisible('*[data-id="localPluginName"]')
.setValue('*[data-id="localPluginName"]', testData.pluginName) .setValue('*[data-id="localPluginName"]', testData.pluginName)
.setValue('*[data-id="localPluginDisplayName"]', testData.pluginDisplayName) .setValue('*[data-id="localPluginDisplayName"]', testData.pluginDisplayName)
.setValue('*[data-id="localPluginUrl"]', testData.pluginUrl) .setValue('*[data-id="localPluginUrl"]', testData.pluginUrl)
.click('*[data-id="localPluginRadioButtoniframe"]') .click('*[data-id="localPluginRadioButtoniframe"]')
.click('*[data-id="localPluginRadioButtonsidePanel"]') .click('*[data-id="localPluginRadioButtonsidePanel"]')
.click('*[data-id="modalDialogModalFooter"]') .click('*[data-id="modalDialogModalFooter"]')
.modalFooterOKClick() .modalFooterOKClick()
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonremixIde"]') .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonremixIde"]')
}, },
'Should display error message for creating already existing plugin': function (browser: NightwatchBrowser) { 'Should display error message for creating already existing plugin': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.click('*[data-id="pluginManagerComponentPluginSearchButton"]') .click('*[data-id="pluginManagerComponentPluginSearchButton"]')
.waitForElementVisible('*[data-id="modalDialogContainer"]') .waitForElementVisible('*[data-id="modalDialogContainer"]')
.click('*[data-id="modalDialogModalBody"]') .click('*[data-id="modalDialogModalBody"]')
.waitForElementVisible('*[data-id="localPluginName"]') .waitForElementVisible('*[data-id="localPluginName"]')
.clearValue('*[data-id="localPluginName"]').setValue('*[data-id="localPluginName"]', testData.pluginName) .clearValue('*[data-id="localPluginName"]').setValue('*[data-id="localPluginName"]', testData.pluginName)
.clearValue('*[data-id="localPluginDisplayName"]').setValue('*[data-id="localPluginDisplayName"]', testData.pluginDisplayName) .clearValue('*[data-id="localPluginDisplayName"]').setValue('*[data-id="localPluginDisplayName"]', testData.pluginDisplayName)
.clearValue('*[data-id="localPluginUrl"]').setValue('*[data-id="localPluginUrl"]', testData.pluginUrl) .clearValue('*[data-id="localPluginUrl"]').setValue('*[data-id="localPluginUrl"]', testData.pluginUrl)
.click('*[data-id="localPluginRadioButtoniframe"]') .click('*[data-id="localPluginRadioButtoniframe"]')
.click('*[data-id="localPluginRadioButtonsidePanel"]') .click('*[data-id="localPluginRadioButtonsidePanel"]')
.click('*[data-id="modalDialogModalFooter"]') .click('*[data-id="modalDialogModalFooter"]')
.modalFooterOKClick() .modalFooterOKClick()
.pause(5000) .pause(5000)
.waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)') .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)')
.pause(2000) .pause(2000)
.assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Cannot create Plugin : This name has already been used') .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: NightwatchBrowser) { 'Should load back installed plugins after reload': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]') browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.getInstalledPlugins((plugins) => { .getInstalledPlugins((plugins) => {
browser.refresh() browser.refresh()
.waitForElementVisible('*[data-id="remixIdeSidePanel"]') .waitForElementVisible('*[data-id="remixIdeSidePanel"]')
.pause(3000) .pause(3000)
.perform((done) => { .perform((done) => {
plugins.forEach(plugin => { plugins.forEach(plugin => {
if (plugin !== testData.pluginName) { if (plugin !== testData.pluginName) {
browser.waitForElementVisible(`[plugin="${plugin}"`) browser.waitForElementVisible(`[plugin="${plugin}"`)
} }
}) })
done() done()
})
}) })
}) .end()
.end()
}, },
tearDown: sauce tearDown: sauce
} }

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -14,60 +14,60 @@ module.exports = {
'Publish on IPFS': function (browser: NightwatchBrowser) { 'Publish on IPFS': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('#icon-panel', 10000) .waitForElementVisible('#icon-panel', 10000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.click('[data-id="treeViewLitreeViewItembrowser/contracts"]') .click('[data-id="treeViewLitreeViewItembrowser/contracts"]')
.openFile('browser/contracts/3_Ballot.sol') .openFile('browser/contracts/3_Ballot.sol')
.verifyContracts(['Ballot']) .verifyContracts(['Ballot'])
.click('#publishOnIpfs') .click('#publishOnIpfs')
.pause(8000) .pause(8000)
.getModalBody((value, done) => { .getModalBody((value, done) => {
if (value.indexOf('Metadata of "ballot" was published successfully.') === -1) browser.assert.fail('ipfs deploy failed', '', '') 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', '', '') if (value.indexOf('dweb:/ipfs') === -1) browser.assert.fail('ipfs deploy failed', '', '')
done() done()
}) })
.modalFooterOKClick() .modalFooterOKClick()
}, },
'Publish on Swarm': '' + function (browser: NightwatchBrowser) { 'Publish on Swarm': '' + function (browser: NightwatchBrowser) {
browser browser
.click('#publishOnSwarm') .click('#publishOnSwarm')
.pause(8000) .pause(8000)
.getModalBody((value, done) => { .getModalBody((value, done) => {
if (value.indexOf('Metadata of "ballot" was successfully.') === -1) browser.assert.fail('swarm deploy failed', '', '') 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', '', '') if (value.indexOf('bzz') === -1) browser.assert.fail('swarm deploy failed', '', '')
done() done()
}) })
.modalFooterOKClick() .modalFooterOKClick()
}, },
'Should publish contract metadata to ipfs on deploy': function (browser: NightwatchBrowser) { 'Should publish contract metadata to ipfs on deploy': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('#icon-panel') .waitForElementVisible('#icon-panel')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.openFile('browser/contracts/1_Storage.sol') .openFile('browser/contracts/1_Storage.sol')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="contractDropdownIpfsCheckbox"]') .waitForElementPresent('*[data-id="contractDropdownIpfsCheckbox"]')
.click('*[data-id="contractDropdownIpfsCheckbox"]') .click('*[data-id="contractDropdownIpfsCheckbox"]')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.pause(8000) .pause(8000)
.getModalBody((value, done) => { .getModalBody((value, done) => {
if (value.indexOf('Metadata of "storage" was published successfully.') === -1) browser.assert.fail('ipfs deploy failed', '', '') if (value.indexOf('Metadata of "storage" was published successfully.') === -1) browser.assert.fail('ipfs deploy failed', '', '')
done() done()
}) })
.modalFooterOKClick() .modalFooterOKClick()
}, },
'Should remember choice after page refresh': function (browser: NightwatchBrowser) { 'Should remember choice after page refresh': function (browser: NightwatchBrowser) {
browser browser
.refresh() .refresh()
.waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/contracts"]') .waitForElementVisible('[data-id="treeViewLitreeViewItembrowser/contracts"]')
.click('[data-id="treeViewLitreeViewItembrowser/contracts"]') .click('[data-id="treeViewLitreeViewItembrowser/contracts"]')
.openFile('browser/contracts/1_Storage.sol') .openFile('browser/contracts/1_Storage.sol')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="contractDropdownIpfsCheckbox"]') .waitForElementPresent('*[data-id="contractDropdownIpfsCheckbox"]')
.verify.elementPresent('*[data-id="contractDropdownIpfsCheckbox"]:checked') .verify.elementPresent('*[data-id="contractDropdownIpfsCheckbox"]:checked')
.end() .end()
}, },
tearDown: sauce tearDown: sauce

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -14,94 +14,99 @@ module.exports = {
'Test Recorder': function (browser: NightwatchBrowser) { 'Test Recorder': function (browser: NightwatchBrowser) {
let addressRef let addressRef
browser.addFile('scenario.json', {content: records}) browser.addFile('scenario.json', { content: records })
.pause(5000) .pause(5000)
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
.click('div[class^="cardContainer"] i[class^="arrow"]') .click('div[class^="cardContainer"] i[class^="arrow"]')
.click('#runTabView .runtransaction') .click('#runTabView .runtransaction')
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2) > div > button') .click('.instance:nth-of-type(2) > div > button')
.waitForElementPresent('.instance:nth-of-type(3)') .waitForElementPresent('.instance:nth-of-type(3)')
.click('.instance:nth-of-type(3) > div > button') .click('.instance:nth-of-type(3) > div > button')
.clickFunction('getInt - call') .clickFunction('getInt - call')
.clickFunction('getAddress - call') .clickFunction('getAddress - call')
.clickFunction('getFromLib - call') .clickFunction('getFromLib - call')
.waitForElementPresent('div[class^="contractActionsContainer"] div[class^="value"] ul') .waitForElementPresent('div[class^="contractActionsContainer"] div[class^="value"] ul')
.getAddressAtPosition(1, (address) => { .getAddressAtPosition(1, (address) => {
console.log('Test Recorder ' + address) console.log('Test Recorder ' + address)
addressRef = address addressRef = address
}) })
.perform((done) => { .perform((done) => {
browser.verifyCallReturnValue(addressRef, ['0:uint256: 1', '0:uint256: 3456', '0:address: 0xbBF289D846208c16EDc8474705C748aff07732dB']) browser.verifyCallReturnValue(addressRef, ['0:uint256: 1', '0:uint256: 3456', '0:address: 0xbBF289D846208c16EDc8474705C748aff07732dB'])
.perform(() => done()) .perform(() => done())
}) })
.click('*[data-id="deployAndRunClearInstances"]') .click('*[data-id="deployAndRunClearInstances"]')
.testContracts('testRecorder.sol', sources[0]['browser/testRecorder.sol'], ['testRecorder']) .testContracts('testRecorder.sol', sources[0]['browser/testRecorder.sol'], ['testRecorder'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.createContract('12') .createContract('12')
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2) > div > button') .click('.instance:nth-of-type(2) > div > button')
.clickFunction('set - transact (not payable)', {types: 'uint256 _p', values: '34'}) .clickFunction('set - transact (not payable)', { types: 'uint256 _p', values: '34' })
.click('i.savetransaction') .click('i.savetransaction')
.modalFooterOKClick() .modalFooterOKClick()
.getEditorValue(function (result) { .getEditorValue(function (result) {
const parsed = JSON.parse(result) const 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.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.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.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.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[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.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.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.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)) browser.assert.equal(JSON.stringify(parsed.transactions[1].record.from), JSON.stringify(scenario.transactions[1].record.from))
}) })
}, },
'Record more than one contract': function (browser: NightwatchBrowser) { 'Record more than one contract': function (browser: NightwatchBrowser) {
// deploy 2 contracts (2 different ABIs), save the record, reexecute and test one of the function. // deploy 2 contracts (2 different ABIs), save the record, reexecute and test one of the function.
let addressRef
browser browser
.click('*[data-id="deployAndRunClearInstances"]') .click('*[data-id="deployAndRunClearInstances"]')
.testContracts('multipleContracts.sol', sources[1]['browser/multipleContracts.sol'], ['t1est', 't2est']) .testContracts('multipleContracts.sol', sources[1]['browser/multipleContracts.sol'], ['t1est', 't2est'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('t1est') .selectContract('t1est')
.pause(1000) .pause(1000)
.createContract('') .createContract('')
.clickInstance(0) .clickInstance(0)
.selectContract('t2est') .selectContract('t2est')
.pause(1000) .pause(1000)
.createContract('') .createContract('')
.click('i.savetransaction') .click('i.savetransaction')
.modalFooterOKClick() .modalFooterOKClick()
.click('*[data-id="deployAndRunClearInstances"]') // clear udapp .click('*[data-id="deployAndRunClearInstances"]') // clear udapp
.click('*[data-id="terminalClearConsole"]') // clear terminal .click('*[data-id="terminalClearConsole"]') // clear terminal
.click('#runTabView .runtransaction') .click('#runTabView .runtransaction')
.clickInstance(1) .clickInstance(1)
.pause(1000) .pause(1000)
.clickFunction('set2 - transact (not payable)', {types: 'uint256 _po', values: '10'}) .clickFunction('set2 - transact (not payable)', { types: 'uint256 _po', values: '10' })
.testFunction('0xa88bf726e706480f61f04a066452929030c0a0216cc6923106f863963339bdb7', .testFunction('0xa88bf726e706480f61f04a066452929030c0a0216cc6923106f863963339bdb7',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0xa88bf726e706480f61f04a066452929030c0a0216cc6923106f863963339bdb7', 'transaction hash': '0xa88bf726e706480f61f04a066452929030c0a0216cc6923106f863963339bdb7',
'decoded input': {"uint256 _po":{"type":"BigNumber","hex":"0x0a"}} 'decoded input': { 'uint256 _po': { type: 'BigNumber', hex: '0x0a' } }
}) })
.end() .end()
}, },
tearDown: sauce tearDown: sauce
} }
const sources = [{'browser/testRecorder.sol': {content: `contract testRecorder { const sources = [{
'browser/testRecorder.sol': {
content: `contract testRecorder {
constructor(uint p) public { constructor(uint p) public {
} }
function set (uint _p) public { function set (uint _p) public {
} }
}`}}, }`
{'browser/multipleContracts.sol': {content: `contract t1est { }
},
{
'browser/multipleContracts.sol': {
content: `contract t1est {
uint p; uint p;
t2est t; t2est t;
constructor () public { constructor () public {
@ -120,7 +125,9 @@ contract t2est {
function set2(uint _po) public { function set2(uint _po) public {
p = _po; p = _po;
} }
}`}} }`
}
}
] ]
const records = `{ const records = `{
@ -282,70 +289,70 @@ const records = `{
}` }`
const scenario = { const scenario = {
'accounts': { accounts: {
'account{10}': '0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c' 'account{10}': '0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c'
}, },
'linkReferences': {}, linkReferences: {},
'transactions': [ transactions: [
{ {
'timestamp': 1512912691086, timestamp: 1512912691086,
'record': { record: {
'value': '0', value: '0',
'parameters': [ parameters: [
"12" // eslint-disable-line "12" // eslint-disable-line
], ],
'abi': '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798', abi: '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798',
'contractName': 'testRecorder', contractName: 'testRecorder',
'bytecode': '6060604052341561000f57600080fd5b6040516020806100cd833981016040528080519060200190919050505060938061003a6000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b1146044575b600080fd5b3415604e57600080fd5b606260048080359060200190919050506064565b005b505600a165627a7a723058204839660366b94f5f3c8c6da233a2c5fe95ad5635b5c8a2bb630a8b845d68ecdd0029', bytecode: '6060604052341561000f57600080fd5b6040516020806100cd833981016040528080519060200190919050505060938061003a6000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b1146044575b600080fd5b3415604e57600080fd5b606260048080359060200190919050506064565b005b505600a165627a7a723058204839660366b94f5f3c8c6da233a2c5fe95ad5635b5c8a2bb630a8b845d68ecdd0029',
'linkReferences': {}, linkReferences: {},
'name': '', name: '',
'type': 'constructor', type: 'constructor',
'inputs': '(uint256)', inputs: '(uint256)',
'from': 'account{10}' from: 'account{10}'
} }
}, },
{ {
'timestamp': 1512912696128, timestamp: 1512912696128,
'record': { record: {
'value': '0', value: '0',
'parameters': [ parameters: [
"34" // eslint-disable-line "34" // eslint-disable-line
], ],
'to': 'created{1512912691086}', to: 'created{1512912691086}',
'abi': '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798', abi: '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798',
'name': 'set', name: 'set',
'inputs': '(uint256)', inputs: '(uint256)',
'type': 'function', type: 'function',
'from': 'account{10}' from: 'account{10}'
} }
} }
], ],
'abis': { abis: {
'0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798': [ '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798': [
{ {
'constant': false, constant: false,
'inputs': [ inputs: [
{ {
'name': '_p', name: '_p',
'type': 'uint256' type: 'uint256'
} }
], ],
'name': 'set', name: 'set',
'outputs': [], outputs: [],
'payable': false, payable: false,
'stateMutability': 'nonpayable', stateMutability: 'nonpayable',
'type': 'function' type: 'function'
}, },
{ {
'inputs': [ inputs: [
{ {
'name': 'p', name: 'p',
'type': 'uint256' type: 'uint256'
} }
], ],
'payable': false, payable: false,
'stateMutability': 'nonpayable', stateMutability: 'nonpayable',
'type': 'constructor' type: 'constructor'
} }
] ]
} }

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -21,20 +21,20 @@ const gmbhTestContract = `contract gmbh {
` `
const sources = [ const sources = [
{ {
'localhost/folder1/contract2.sol': {content: 'contract test2 { function get () public returns (uint) { return 11; }}'} '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/company.sol': {content: assetsTestContract}, 'localhost/src/gmbh/company.sol': { content: assetsTestContract },
'localhost/src/gmbh/contract.sol': {content: gmbhTestContract} '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.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";'} 'browser/test_import_node_modules_with_github_import.sol': { content: 'import "openzeppelin-solidity/contracts/sample.sol";' }
} }
] ]
@ -47,7 +47,7 @@ module.exports = {
return sources return sources
}, },
'Remixd': function (browser) { Remixd: function (browser) {
runTests(browser) runTests(browser)
}, },
'Import from node_modules ': function (browser) { 'Import from node_modules ': function (browser) {
@ -57,32 +57,32 @@ module.exports = {
*/ */
browser.waitForElementVisible('#icon-panel', 2000) browser.waitForElementVisible('#icon-panel', 2000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.addFile('test_import_node_modules.sol', sources[3]['browser/test_import_node_modules.sol']) .addFile('test_import_node_modules.sol', sources[3]['browser/test_import_node_modules.sol'])
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('test_import_node_modules.sol', sources[3]['browser/test_import_node_modules.sol'], ['SafeMath']) .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) { 'Import from node_modules and reference a github import': function (browser) {
browser.waitForElementVisible('#icon-panel', 2000) browser.waitForElementVisible('#icon-panel', 2000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.addFile('test_import_node_modules_with_github_import.sol', sources[4]['browser/test_import_node_modules_with_github_import.sol']) .addFile('test_import_node_modules_with_github_import.sol', sources[4]['browser/test_import_node_modules_with_github_import.sol'])
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') // open-zeppelin moved to pragma ^0.8.0 .setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') // open-zeppelin moved to pragma ^0.8.0
.testContracts('test_import_node_modules_with_github_import.sol', sources[4]['browser/test_import_node_modules_with_github_import.sol'], ['ERC20', 'test11']) .testContracts('test_import_node_modules_with_github_import.sol', sources[4]['browser/test_import_node_modules_with_github_import.sol'], ['ERC20', 'test11'])
}, },
'Run git status': function (browser) { 'Run git status': function (browser) {
browser browser
.executeScript('git status') .executeScript('git status')
.pause(3000) .pause(3000)
.journalLastChildIncludes('On branch ') .journalLastChildIncludes('On branch ')
}, },
'Close Remixd': function (browser) { 'Close Remixd': function (browser) {
browser browser
.clickLaunchIcon('pluginManager') .clickLaunchIcon('pluginManager')
.scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_remixd"] button') .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_remixd"] button')
.end() .end()
}, },
tearDown: sauce tearDown: sauce
} }

@ -1,6 +1,5 @@
'use strict' 'use strict'
import { doesNotThrow } from 'assert' import { NightwatchBrowser } from 'nightwatch'
import { NightwatchBrowser } from "nightwatch"
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -19,147 +18,147 @@ module.exports = {
'Should load run and deploy tab': function (browser: NightwatchBrowser) { 'Should load run and deploy tab': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="sidePanelSwapitTitle"]') .waitForElementPresent('*[data-id="sidePanelSwapitTitle"]')
.assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEPLOY & RUN TRANSACTIONS') .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEPLOY & RUN TRANSACTIONS')
}, },
'Should load run and deploy tab and check value validation': function (browser: NightwatchBrowser) { 'Should load run and deploy tab and check value validation': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
.assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEPLOY & RUN TRANSACTIONS') .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEPLOY & RUN TRANSACTIONS')
.validateValueInput('#value', '0000', '0') .validateValueInput('#value', '0000', '0')
.validateValueInput('#value', '', '0') .validateValueInput('#value', '', '0')
.validateValueInput('#value', 'dragon', '0') .validateValueInput('#value', 'dragon', '0')
}, },
'Should sign message using account key': function (browser: NightwatchBrowser) { 'Should sign message using account key': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="settingsRemixRunSignMsg"]') browser.waitForElementPresent('*[data-id="settingsRemixRunSignMsg"]')
.click('*[data-id="settingsRemixRunSignMsg"]') .click('*[data-id="settingsRemixRunSignMsg"]')
.pause(2000) .pause(2000)
.waitForElementPresent('*[data-id="modalDialogCustomPromptText"]') .waitForElementPresent('*[data-id="modalDialogCustomPromptText"]')
.setValue('*[data-id="modalDialogCustomPromptText"]', 'Remix is cool!') .setValue('*[data-id="modalDialogCustomPromptText"]', 'Remix is cool!')
.assert.elementNotPresent('*[data-id="settingsRemixRunSignMsgHash"]') .assert.elementNotPresent('*[data-id="settingsRemixRunSignMsgHash"]')
.assert.elementNotPresent('*[data-id="settingsRemixRunSignMsgSignature"]') .assert.elementNotPresent('*[data-id="settingsRemixRunSignMsgSignature"]')
.modalFooterOKClick() .modalFooterOKClick()
.waitForElementPresent('*[data-id="modalDialogContainer"]', 12000) .waitForElementPresent('*[data-id="modalDialogContainer"]', 12000)
.assert.elementPresent('*[data-id="settingsRemixRunSignMsgHash"]') .assert.elementPresent('*[data-id="settingsRemixRunSignMsgHash"]')
.assert.elementPresent('*[data-id="settingsRemixRunSignMsgSignature"]') .assert.elementPresent('*[data-id="settingsRemixRunSignMsgSignature"]')
.modalFooterOKClick() .modalFooterOKClick()
}, },
'Should deploy contract on JavascriptVM': function (browser: NightwatchBrowser) { 'Should deploy contract on JavascriptVM': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.addFile('Greet.sol', sources[0]['browser/Greet.sol']) .addFile('Greet.sol', sources[0]['browser/Greet.sol'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
.waitForElementPresent('*[data-id="Deploy - transact (not payable)"]', 45000) .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]', 45000)
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.pause(5000) .pause(5000)
.testFunction('0x82f6c88a909b49d6cc003fb302a6e0184c3f08e942b62e1c95dec326d4c6020b', { .testFunction('0x82f6c88a909b49d6cc003fb302a6e0184c3f08e942b62e1c95dec326d4c6020b', {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0x82f6c88a909b49d6cc003fb302a6e0184c3f08e942b62e1c95dec326d4c6020b' 'transaction hash': '0x82f6c88a909b49d6cc003fb302a6e0184c3f08e942b62e1c95dec326d4c6020b'
}) })
}, },
'Should run low level interaction (fallback function)': function (browser: NightwatchBrowser) { 'Should run low level interaction (fallback function)': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
.waitForElementPresent('*[data-id="universalDappUiTitleExpander"]') .waitForElementPresent('*[data-id="universalDappUiTitleExpander"]')
.click('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]')
.waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') .waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]')
.click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') .click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]')
.pause(5000) .pause(5000)
.testFunction('0xfe718871ee0b4d03cdcac0e12e5b164efaf7e23ba952c07db76e62692867019b', { .testFunction('0xfe718871ee0b4d03cdcac0e12e5b164efaf7e23ba952c07db76e62692867019b', {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0xfe718871ee0b4d03cdcac0e12e5b164efaf7e23ba952c07db76e62692867019b' 'transaction hash': '0xfe718871ee0b4d03cdcac0e12e5b164efaf7e23ba952c07db76e62692867019b'
}) })
.end() .end()
}, },
'Should connect to Goerli Test Network using MetaMask': '' + function (browser: NightwatchBrowser) { 'Should connect to Goerli Test Network using MetaMask': '' + function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
.setupMetamask(passphrase, password) .setupMetamask(passphrase, password)
.click('.network-indicator__down-arrow') .click('.network-indicator__down-arrow')
.useXpath().click("//span[text()='Goerli Test Network']") .useXpath().click("//span[text()='Goerli Test Network']")
.useCss().switchBrowserTab(0) .useCss().switchBrowserTab(0)
.refresh() .refresh()
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.click('*[data-id="landingPageStartSolidity"]') .click('*[data-id="landingPageStartSolidity"]')
.pause(5000) .pause(5000)
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="settingsSelectEnvOptions"]') .waitForElementPresent('*[data-id="settingsSelectEnvOptions"]')
.click('*[data-id="settingsSelectEnvOptions"] option[id="injected-mode"]') .click('*[data-id="settingsSelectEnvOptions"] option[id="injected-mode"]')
.waitForElementPresent('*[data-id="settingsNetworkEnv"]') .waitForElementPresent('*[data-id="settingsNetworkEnv"]')
.assert.containsText('*[data-id="settingsNetworkEnv"]', 'Goerli (5) network') .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Goerli (5) network')
.switchBrowserTab(2) .switchBrowserTab(2)
.waitForElementPresent('.page-container__footer-button:nth-of-type(2)') .waitForElementPresent('.page-container__footer-button:nth-of-type(2)')
.click('.page-container__footer-button:nth-of-type(2)') .click('.page-container__footer-button:nth-of-type(2)')
.switchBrowserTab(0) .switchBrowserTab(0)
}, },
'Should deploy contract on Goerli Test Network using MetaMask': '' + function (browser: NightwatchBrowser) { 'Should deploy contract on Goerli Test Network using MetaMask': '' + function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.openFile('browser/Greet.sol') .openFile('browser/Greet.sol')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.switchBrowserTab(2) .switchBrowserTab(2)
.waitForElementPresent('.transaction-status--unapproved') .waitForElementPresent('.transaction-status--unapproved')
.click('.transaction-status--unapproved') .click('.transaction-status--unapproved')
.waitForElementPresent('.page-container__footer-button:nth-of-type(2)') .waitForElementPresent('.page-container__footer-button:nth-of-type(2)')
.click('.page-container__footer-button:nth-of-type(2)') .click('.page-container__footer-button:nth-of-type(2)')
.waitForElementPresent('.transaction-status--submitted') .waitForElementPresent('.transaction-status--submitted')
.pause(25000) .pause(25000)
.switchBrowserTab(0) .switchBrowserTab(0)
}, },
'Should run low level interaction (fallback function) on Goerli Test Network using MetaMask': '' + function (browser: NightwatchBrowser) { 'Should run low level interaction (fallback function) on Goerli Test Network using MetaMask': '' + function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
.waitForElementPresent('*[data-id="universalDappUiTitleExpander"]') .waitForElementPresent('*[data-id="universalDappUiTitleExpander"]')
.click('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]')
.waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') .waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]')
.click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') .click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]')
.switchBrowserTab(2) .switchBrowserTab(2)
.waitForElementPresent('.transaction-status--unapproved') .waitForElementPresent('.transaction-status--unapproved')
.click('.transaction-status--unapproved') .click('.transaction-status--unapproved')
.waitForElementPresent('.page-container__footer-button:nth-of-type(2)') .waitForElementPresent('.page-container__footer-button:nth-of-type(2)')
.click('.page-container__footer-button:nth-of-type(2)') .click('.page-container__footer-button:nth-of-type(2)')
.waitForElementPresent('.transaction-status--submitted') .waitForElementPresent('.transaction-status--submitted')
.pause(25000) .pause(25000)
.switchBrowserTab(0) .switchBrowserTab(0)
.end() .end()
}, },
'Should connect to Ethereum Main Network using MetaMask': '' + function (browser: NightwatchBrowser) { 'Should connect to Ethereum Main Network using MetaMask': '' + function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
.switchBrowserTab(2) .switchBrowserTab(2)
.waitForElementPresent('.network-indicator__down-arrow') .waitForElementPresent('.network-indicator__down-arrow')
.click('.network-indicator__down-arrow') .click('.network-indicator__down-arrow')
.useXpath().click("//span[text()='Main Ethereum Network']") .useXpath().click("//span[text()='Main Ethereum Network']")
.useCss().switchBrowserTab(0) .useCss().switchBrowserTab(0)
.refresh() .refresh()
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.click('*[data-id="landingPageStartSolidity"]') .click('*[data-id="landingPageStartSolidity"]')
.pause(5000) .pause(5000)
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="settingsSelectEnvOptions"]') .waitForElementPresent('*[data-id="settingsSelectEnvOptions"]')
.click('*[data-id="settingsSelectEnvOptions"] option[id="injected-mode"]') .click('*[data-id="settingsSelectEnvOptions"] option[id="injected-mode"]')
.waitForElementPresent('*[data-id="settingsNetworkEnv"]') .waitForElementPresent('*[data-id="settingsNetworkEnv"]')
.assert.containsText('*[data-id="settingsNetworkEnv"]', 'Main (1) network') .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Main (1) network')
}, },
'Should deploy contract on Ethereum Main Network using MetaMask': '' + function (browser: NightwatchBrowser) { 'Should deploy contract on Ethereum Main Network using MetaMask': '' + function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option') browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.openFile('browser/Greet.sol') .openFile('browser/Greet.sol')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.waitForElementPresent('*[data-id="modalDialogContainer"]', 15000) .waitForElementPresent('*[data-id="modalDialogContainer"]', 15000)
.pause(10000) .pause(10000)
.assert.containsText('*[data-id="modalDialogModalBody"]', 'You are creating a transaction on the main network. Click confirm if you are sure to continue.') .assert.containsText('*[data-id="modalDialogModalBody"]', 'You are creating a transaction on the main network. Click confirm if you are sure to continue.')
.modalFooterCancelClick() .modalFooterCancelClick()
}, },
/* /*
@ -171,35 +170,35 @@ module.exports = {
*/ */
'Should debug Ropsten transaction with source highlighting using the source verifier service and MetaMask': '' + function (browser: NightwatchBrowser) { 'Should debug Ropsten transaction with source highlighting using the source verifier service and MetaMask': '' + function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]') browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.switchBrowserTab(2) .switchBrowserTab(2)
.waitForElementPresent('.network-indicator__down-arrow') .waitForElementPresent('.network-indicator__down-arrow')
.click('.network-indicator__down-arrow') .click('.network-indicator__down-arrow')
.useXpath().click("//span[text()='Ropsten Test Network']") // switch to Ropsten .useXpath().click("//span[text()='Ropsten Test Network']") // switch to Ropsten
.useCss().switchBrowserTab(0) .useCss().switchBrowserTab(0)
.refresh() .refresh()
.clickLaunchIcon('pluginManager') // load debugger and source verification .clickLaunchIcon('pluginManager') // load debugger and source verification
// .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_source-verification"] button') // .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_source-verification"] button')
// debugger already activated .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_debugger"] button') // debugger already activated .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_debugger"] button')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="settingsSelectEnvOptions"]') .waitForElementPresent('*[data-id="settingsSelectEnvOptions"]')
.click('*[data-id="settingsSelectEnvOptions"] option[id="injected-mode"]') // switch to Ropsten in udapp .click('*[data-id="settingsSelectEnvOptions"] option[id="injected-mode"]') // switch to Ropsten in udapp
.waitForElementPresent('*[data-id="settingsNetworkEnv"]') .waitForElementPresent('*[data-id="settingsNetworkEnv"]')
.assert.containsText('*[data-id="settingsNetworkEnv"]', 'Ropsten (3) network') .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Ropsten (3) network')
.clickLaunchIcon('debugger') .clickLaunchIcon('debugger')
.setValue('*[data-id="debuggerTransactionInput"]', '0x959371506b8f6223d71c709ac2eb2d0158104dca2d76ca949f1662712cf0e6db') // debug tx .setValue('*[data-id="debuggerTransactionInput"]', '0x959371506b8f6223d71c709ac2eb2d0158104dca2d76ca949f1662712cf0e6db') // debug tx
.click('*[data-id="debuggerTransactionStartButton"]') .click('*[data-id="debuggerTransactionStartButton"]')
.waitForElementVisible('*[data-id="treeViewDivto"]', 30000) .waitForElementVisible('*[data-id="treeViewDivto"]', 30000)
.assert.containsText('*[data-id="stepdetail"]', 'loaded address:\n0x3c943Fb816694d7D1f4C738e3e7823818a88DD6C') .assert.containsText('*[data-id="stepdetail"]', 'loaded address:\n0x3c943Fb816694d7D1f4C738e3e7823818a88DD6C')
.assert.containsText('*[data-id="solidityLocals"]', 'to: 0x6C3CCC7FBA111707D5A1AAF2758E9D4F4AC5E7B1') .assert.containsText('*[data-id="solidityLocals"]', 'to: 0x6C3CCC7FBA111707D5A1AAF2758E9D4F4AC5E7B1')
}, },
'Call web3.eth.getAccounts() using Injected web3 (Metamask)': '' + function (browser: NightwatchBrowser) { 'Call web3.eth.getAccounts() using Injected web3 (Metamask)': '' + function (browser: NightwatchBrowser) {
browser browser
.executeScript(`web3.eth.getAccounts()`) .executeScript('web3.eth.getAccounts()')
.pause(2000) .pause(2000)
.journalLastChildIncludes(`[ "0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f" ]`) .journalLastChildIncludes('[ "0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f" ]')
.end() .end()
}, },
tearDown: sauce tearDown: sauce
} }

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -15,16 +15,16 @@ module.exports = {
'Test Signature': function (browser: NightwatchBrowser) { 'Test Signature': function (browser: NightwatchBrowser) {
let hash, signature let hash, signature
browser browser
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
.signMessage('test message', (h, s) => { .signMessage('test message', (h, s) => {
hash = h hash = h
signature = s signature = s
console.log('hash', hash) console.log('hash', hash)
console.log('signature', signature) console.log('signature', signature)
browser.assert.ok(typeof hash.value === 'string', 'type of hash.value must be String') 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') browser.assert.ok(typeof signature.value === 'string', 'type of signature.value must be String')
}) })
.addFile('signMassage.sol', sources[0]['browser/signMassage.sol']) .addFile('signMassage.sol', sources[0]['browser/signMassage.sol'])
.openFile('browser/signMassage.sol') .openFile('browser/signMassage.sol')
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
@ -41,13 +41,13 @@ module.exports = {
const inputs = `"${hash.value}","${signature.value}"` const inputs = `"${hash.value}","${signature.value}"`
console.log('Test Signature Input', inputs) console.log('Test Signature Input', inputs)
browser.clickFunction('ecrecovery - call', { types: 'bytes32 hash, bytes sig', values: inputs }) browser.clickFunction('ecrecovery - call', { types: 'bytes32 hash, bytes sig', values: inputs })
.pause(5000) .pause(5000)
.verifyCallReturnValue( .verifyCallReturnValue(
address, address,
['0:address: 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c']) ['0:address: 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c'])
.perform(() => { .perform(() => {
done() done()
}) })
}) })
}) })
.end() .end()
@ -57,7 +57,8 @@ module.exports = {
const sources = [ const sources = [
{ {
'browser/signMassage.sol': {content: ` 'browser/signMassage.sol': {
content: `
pragma solidity >=0.4.22 <0.8.0; pragma solidity >=0.4.22 <0.8.0;
contract SignMassageTest { contract SignMassageTest {
function testRecovery(bytes32 h, uint8 v, bytes32 r, bytes32 s) public pure returns (address) { function testRecovery(bytes32 h, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
@ -95,6 +96,7 @@ const sources = [
function ecverify(bytes32 hash, bytes memory sig, address signer) public pure returns (bool) { function ecverify(bytes32 hash, bytes memory sig, address signer) public pure returns (bool) {
return signer == ecrecovery(hash, sig); return signer == ecrecovery(hash, sig);
} }
}`} }`
}
} }
] ]

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -34,80 +34,80 @@ module.exports = {
.setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') // open-zeppelin moved to pragma ^0.8.0 (master branch) .setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') // open-zeppelin moved to pragma ^0.8.0 (master branch)
.addFile('Untitled4.sol', sources[3]['browser/Untitled4.sol']) .addFile('Untitled4.sol', sources[3]['browser/Untitled4.sol'])
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.verifyContracts(['test7', 'ERC20'], {wait: 10000}) .verifyContracts(['test7', 'ERC20'], { wait: 10000 })
}, },
'Test Github Import - from other branch': function (browser: NightwatchBrowser) { 'Test Github Import - from other branch': function (browser: NightwatchBrowser) {
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 .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']) .addFile('Untitled5.sol', sources[4]['browser/Untitled5.sol'])
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.verifyContracts(['test8', 'ERC20', 'SafeMath'], {wait: 10000}) .verifyContracts(['test8', 'ERC20', 'SafeMath'], { wait: 10000 })
}, },
'Test Github Import - no branch specified': function (browser: NightwatchBrowser) { 'Test Github Import - no branch specified': function (browser: NightwatchBrowser) {
browser browser
.setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') // open-zeppelin moved to pragma ^0.8.0 (master branch) .setSolidityCompilerVersion('soljson-v0.8.0+commit.c7dfd78e.js') // open-zeppelin moved to pragma ^0.8.0 (master branch)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/README.txt"') .click('li[data-id="treeViewLitreeViewItembrowser/README.txt"')
.addFile('Untitled6.sol', sources[5]['browser/Untitled6.sol']) .addFile('Untitled6.sol', sources[5]['browser/Untitled6.sol'])
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.verifyContracts(['test10', 'ERC20'], {wait: 10000}) .verifyContracts(['test10', 'ERC20'], { wait: 10000 })
}, },
'Test Github Import - raw URL': function (browser: NightwatchBrowser) { 'Test Github Import - raw URL': function (browser: NightwatchBrowser) {
browser browser
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/README.txt"') .click('li[data-id="treeViewLitreeViewItembrowser/README.txt"')
.addFile('Untitled7.sol', sources[6]['browser/Untitled7.sol']) .addFile('Untitled7.sol', sources[6]['browser/Untitled7.sol'])
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.verifyContracts(['test11', 'ERC20'], {wait: 10000}) .verifyContracts(['test11', 'ERC20'], { wait: 10000 })
}, },
'Test switch to a github import from a solidity warning': function (browser: NightwatchBrowser) { 'Test switch to a github import from a solidity warning': function (browser: NightwatchBrowser) {
browser browser
.setSolidityCompilerVersion('soljson-v0.7.4+commit.3f05b770.js') .setSolidityCompilerVersion('soljson-v0.7.4+commit.3f05b770.js')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItembrowser/README.txt"') .click('li[data-id="treeViewLitreeViewItembrowser/README.txt"')
.addFile('Untitled8.sol', sources[7]['browser/Untitled8.sol']) .addFile('Untitled8.sol', sources[7]['browser/Untitled8.sol'])
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.waitForElementPresent('[data-id="compiledErrors"] div:nth-child(3)', 45000) .waitForElementPresent('[data-id="compiledErrors"] div:nth-child(3)', 45000)
.scrollAndClick('[data-id="compiledErrors"] div:nth-child(3)') // click on error which point to ERC20 code .scrollAndClick('[data-id="compiledErrors"] div:nth-child(3)') // click on error which point to ERC20 code
.pause(5000) .pause(5000)
.getEditorValue((content) => { .getEditorValue((content) => {
browser.assert.ok(content.indexOf(`contract ERC20 is Context, IERC20`) != -1, browser.assert.ok(content.indexOf('contract ERC20 is Context, IERC20') !== -1,
'current displayed content should be from the ERC20 source code') 'current displayed content should be from the ERC20 source code')
}) })
.end() .end()
}, },
tearDown: sauce tearDown: sauce
} }
const sources = [ const sources = [
{ {
'browser/Untitled.sol': {content: 'contract test1 {} contract test2 {}'} 'browser/Untitled.sol': { content: 'contract test1 {} contract test2 {}' }
}, },
{ {
'browser/Untitled1.sol': {content: 'import "./Untitled2.sol"; contract test6 {}'}, 'browser/Untitled1.sol': { content: 'import "./Untitled2.sol"; contract test6 {}' },
'browser/Untitled2.sol': {content: 'contract test4 {} contract test5 {}'} 'browser/Untitled2.sol': { content: 'contract test4 {} contract test5 {}' }
}, },
{ {
'browser/Untitled3.sol': {content: 'import "./Untitled11.sol"; contract test6 {}'} '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/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/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/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 {}'} 'browser/Untitled7.sol': { content: 'import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC20/ERC20.sol"; contract test11 {}' }
}, },
{ {
'browser/Untitled8.sol': {content: 'import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC20/ERC20.sol"; contract test12 {}'} 'browser/Untitled8.sol': { content: 'import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC20/ERC20.sol"; contract test12 {}' }
} }
] ]

@ -1,6 +1,6 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -16,145 +16,145 @@ module.exports = {
'Should launch solidity unit test plugin': function (browser: NightwatchBrowser) { 'Should launch solidity unit test plugin': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.addFile('simple_storage.sol', sources[0]['browser/simple_storage.sol']) .addFile('simple_storage.sol', sources[0]['browser/simple_storage.sol'])
.addFile('ks2a.sol', sources[0]['browser/ks2a.sol']) .addFile('ks2a.sol', sources[0]['browser/ks2a.sol'])
.clickLaunchIcon('pluginManager') .clickLaunchIcon('pluginManager')
.scrollAndClick('*[data-id="pluginManagerComponentActivateButtonsolidityUnitTesting"]') .scrollAndClick('*[data-id="pluginManagerComponentActivateButtonsolidityUnitTesting"]')
.click('*[data-id="verticalIconsKindsolidityUnitTesting"]') .click('*[data-id="verticalIconsKindsolidityUnitTesting"]')
.waitForElementPresent('*[data-id="sidePanelSwapitTitle"]') .waitForElementPresent('*[data-id="sidePanelSwapitTitle"]')
.assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'SOLIDITY UNIT TESTING') .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'SOLIDITY UNIT TESTING')
}, },
'Should generate test file': function (browser: NightwatchBrowser) { 'Should generate test file': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.openFile('browser/simple_storage.sol') .openFile('browser/simple_storage.sol')
.click('*[data-id="verticalIconsKindsolidityUnitTesting"]') .click('*[data-id="verticalIconsKindsolidityUnitTesting"]')
.waitForElementPresent('*[data-id="testTabGenerateTestFile"]') .waitForElementPresent('*[data-id="testTabGenerateTestFile"]')
.click('*[data-id="testTabGenerateTestFile"]') .click('*[data-id="testTabGenerateTestFile"]')
.waitForElementPresent('*[title="browser/tests/simple_storage_test.sol"]') .waitForElementPresent('*[title="browser/tests/simple_storage_test.sol"]')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.pause(10000) .pause(10000)
.openFile('browser/tests/simple_storage_test.sol') .openFile('browser/tests/simple_storage_test.sol')
.removeFile('browser/tests/simple_storage_test.sol') .removeFile('browser/tests/simple_storage_test.sol')
}, },
'Should run simple unit test `simple_storage_test.sol` ': function (browser: NightwatchBrowser) { 'Should run simple unit test `simple_storage_test.sol` ': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.addFile('tests/simple_storage_test.sol', sources[0]['browser/tests/simple_storage_test.sol']) .addFile('tests/simple_storage_test.sol', sources[0]['browser/tests/simple_storage_test.sol'])
.click('*[data-id="verticalIconsKindsolidityUnitTesting"]') .click('*[data-id="verticalIconsKindsolidityUnitTesting"]')
.waitForElementPresent('*[data-id="testTabCheckAllTests"]') .waitForElementPresent('*[data-id="testTabCheckAllTests"]')
.click('*[data-id="testTabCheckAllTests"]') .click('*[data-id="testTabCheckAllTests"]')
.clickElementAtPosition('.singleTestLabel', 1) .clickElementAtPosition('.singleTestLabel', 1)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 80000) .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 80000)
.pause(5000) .pause(5000)
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'MyTest (browser/tests/simple_storage_test.sol)') .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"]', '✓ Initial value should be100')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Value is set200') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Value is set200')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Should fail for wrong value200') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Should fail for wrong value200')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Passing: 2') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Passing: 2')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Failing: 1') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Failing: 1')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'FAIL MyTest (browser/tests/simple_storage_test.sol)') .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: NightwatchBrowser) { 'Should run advance unit test using natspec and experimental ABIEncoderV2 `ks2b_test.sol` ': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.addFile('tests/ks2b_test.sol', sources[0]['browser/tests/ks2b_test.sol']) .addFile('tests/ks2b_test.sol', sources[0]['browser/tests/ks2b_test.sol'])
.click('*[data-id="verticalIconsKindsolidityUnitTesting"]') .click('*[data-id="verticalIconsKindsolidityUnitTesting"]')
.waitForElementPresent('*[data-id="testTabCheckAllTests"]') .waitForElementPresent('*[data-id="testTabCheckAllTests"]')
.click('*[data-id="testTabCheckAllTests"]') .click('*[data-id="testTabCheckAllTests"]')
.clickElementAtPosition('.singleTestLabel', 2) .clickElementAtPosition('.singleTestLabel', 2)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
.pause(5000) .pause(5000)
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/ks2b_test.sol') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/ks2b_test.sol')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project exists') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project exists')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong project owner') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong project owner')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong sender') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong sender')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong value') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong value')
.pause(5000) .pause(5000)
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project is fundable') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project is fundable')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'owner is incorrect') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'owner is incorrect')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'wrong sender') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'wrong sender')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'wrong value') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'wrong value')
}, },
'Should stop unit tests during test execution` ': function (browser: NightwatchBrowser) { 'Should stop unit tests during test execution` ': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.waitForElementPresent('*[data-id="testTabRunTestsTabRunAction"]') .waitForElementPresent('*[data-id="testTabRunTestsTabRunAction"]')
.clickElementAtPosition('.singleTestLabel', 0) .clickElementAtPosition('.singleTestLabel', 0)
.clickElementAtPosition('.singleTestLabel', 1) .clickElementAtPosition('.singleTestLabel', 1)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.pause(5000) .pause(5000)
.click('*[data-id="testTabRunTestsTabStopAction"]') .click('*[data-id="testTabRunTestsTabStopAction"]')
// .pause(1000) // .pause(1000)
.assert.containsText('*[data-id="testTabRunTestsTabStopAction"]', 'Stopping') .assert.containsText('*[data-id="testTabRunTestsTabStopAction"]', 'Stopping')
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/ks2b_test.sol') .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/4_Ballot_test.sol')
.notContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/simple_storage_test.sol') .notContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/simple_storage_test.sol')
.pause(7000) .pause(7000)
.assert.containsText('*[data-id="testTabTestsExecutionStopped"]', 'The test execution has been stopped') .assert.containsText('*[data-id="testTabTestsExecutionStopped"]', 'The test execution has been stopped')
}, },
'Should fail on compilation': function (browser: NightwatchBrowser) { 'Should fail on compilation': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.addFile('tests/compilationError_test.sol', sources[0]['browser/compilationError_test.sol']) .addFile('tests/compilationError_test.sol', sources[0]['browser/compilationError_test.sol'])
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.openFile('browser/tests/compilationError_test.sol') .openFile('browser/tests/compilationError_test.sol')
.clickLaunchIcon('solidityUnitTesting') .clickLaunchIcon('solidityUnitTesting')
.click('*[data-id="testTabCheckAllTests"]') .click('*[data-id="testTabCheckAllTests"]')
.clickElementAtPosition('.singleTestLabel', 3) .clickElementAtPosition('.singleTestLabel', 3)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]') .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'SyntaxError: No visibility specified') .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') .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: NightwatchBrowser) { 'Should fail on deploy': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.addFile('tests/deployError_test.sol', sources[0]['browser/tests/deployError_test.sol']) .addFile('tests/deployError_test.sol', sources[0]['browser/tests/deployError_test.sol'])
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.openFile('browser/tests/deployError_test.sol') .openFile('browser/tests/deployError_test.sol')
.clickLaunchIcon('solidityUnitTesting') .clickLaunchIcon('solidityUnitTesting')
.click('*[data-id="testTabCheckAllTests"]') .click('*[data-id="testTabCheckAllTests"]')
.clickElementAtPosition('.singleTestLabel', 4) .clickElementAtPosition('.singleTestLabel', 4)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]') .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'contract deployment failed after trying twice') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'contract deployment failed after trying twice')
}, },
'Should fail when parameters are to method in test contract': function (browser: NightwatchBrowser) { 'Should fail when parameters are to method in test contract': function (browser: NightwatchBrowser) {
browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.addFile('tests/methodFailure_test.sol', sources[0]['browser/tests/methodFailure_test.sol']) .addFile('tests/methodFailure_test.sol', sources[0]['browser/tests/methodFailure_test.sol'])
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.openFile('browser/tests/methodFailure_test.sol') .openFile('browser/tests/methodFailure_test.sol')
.clickLaunchIcon('solidityUnitTesting') .clickLaunchIcon('solidityUnitTesting')
.click('*[data-id="testTabCheckAllTests"]') .click('*[data-id="testTabCheckAllTests"]')
.clickElementAtPosition('.singleTestLabel', 5) .clickElementAtPosition('.singleTestLabel', 5)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]') .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]')
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', `Method 'add' can not have parameters inside a test contract`) .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Method \'add\' can not have parameters inside a test contract')
}, },
'Changing current path': function (browser: NightwatchBrowser) { 'Changing current path': function (browser: NightwatchBrowser) {
browser browser
.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]') .waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
.addFile('myTests/simple_storage_test.sol', sources[0]['browser/tests/simple_storage_test.sol']) .addFile('myTests/simple_storage_test.sol', sources[0]['browser/tests/simple_storage_test.sol'])
.clickLaunchIcon('solidityUnitTesting') .clickLaunchIcon('solidityUnitTesting')
.setValue('*[data-id="uiPathInput"]', 'browser/myTests') .setValue('*[data-id="uiPathInput"]', 'browser/myTests')
.clickElementAtPosition('.singleTestLabel', 0) .clickElementAtPosition('.singleTestLabel', 0)
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]') .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]')
.clearValue('*[data-id="uiPathInput"]') .clearValue('*[data-id="uiPathInput"]')
.setValue('*[data-id="uiPathInput"]', 'browser/tests') .setValue('*[data-id="uiPathInput"]', 'browser/tests')
}, },
'Solidity Unittests': function (browser: NightwatchBrowser) { 'Solidity Unittests': function (browser: NightwatchBrowser) {

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -20,22 +20,22 @@ module.exports = {
'Use special functions receive/fallback - both are declared, sending data': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - both are declared, sending data': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('#icon-panel', 10000) browser.waitForElementVisible('#icon-panel', 10000)
.testContracts('receiveAndFallback.sol', sources[0]['browser/receiveAndFallback.sol'], ['CheckSpecials']) // compile .testContracts('receiveAndFallback.sol', sources[0]['browser/receiveAndFallback.sol'], ['CheckSpecials']) // compile
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
.selectContract('CheckSpecials') .selectContract('CheckSpecials')
.createContract('') // deploy .createContract('') // deploy
.clickInstance(0) .clickInstance(0)
.perform((done) => { .perform((done) => {
browser.getAddressAtPosition(0, (address) => { browser.getAddressAtPosition(0, (address) => {
browser.sendLowLevelTx(address, '0', '0xaa') browser.sendLowLevelTx(address, '0', '0xaa')
.pause(1000) .pause(1000)
.journalLastChildIncludes('to: CheckSpecials.(fallback)') .journalLastChildIncludes('to: CheckSpecials.(fallback)')
.journalLastChildIncludes('value: 0 wei') .journalLastChildIncludes('value: 0 wei')
.journalLastChildIncludes('data: 0xaa') .journalLastChildIncludes('data: 0xaa')
.perform(done) .perform(done)
})
}) })
})
}, },
'Use special functions receive/fallback - both are declared, failing sending data < 1 byte': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - both are declared, failing sending data < 1 byte': function (browser: NightwatchBrowser) {
@ -43,10 +43,10 @@ module.exports = {
browser.perform((done) => { browser.perform((done) => {
browser.getAddressAtPosition(0, (address) => { browser.getAddressAtPosition(0, (address) => {
browser.sendLowLevelTx(address, '0', '0xa') browser.sendLowLevelTx(address, '0', '0xa')
.pause(1000) .pause(1000)
.waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`) .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.`) .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, 'The calldata should be a valid hexadecimal value with size of at least one byte.')
.perform(done) .perform(done)
}) })
}) })
}, },
@ -55,10 +55,10 @@ module.exports = {
browser.perform((done) => { browser.perform((done) => {
browser.getAddressAtPosition(0, (address) => { browser.getAddressAtPosition(0, (address) => {
browser.sendLowLevelTx(address, '0', '0x1aa') browser.sendLowLevelTx(address, '0', '0x1aa')
.pause(1000) .pause(1000)
.waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`) .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`)
.assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `The calldata should be a valid hexadecimal value.`) .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, 'The calldata should be a valid hexadecimal value.')
.perform(done) .perform(done)
}) })
}) })
}, },
@ -67,11 +67,11 @@ module.exports = {
browser.perform((done) => { browser.perform((done) => {
browser.getAddressAtPosition(0, (address) => { browser.getAddressAtPosition(0, (address) => {
browser.sendLowLevelTx(address, '1', '') browser.sendLowLevelTx(address, '1', '')
.pause(1000) .pause(1000)
.journalLastChildIncludes('to: CheckSpecials.(receive)') .journalLastChildIncludes('to: CheckSpecials.(receive)')
.journalLastChildIncludes('value: 1 wei') .journalLastChildIncludes('value: 1 wei')
.journalLastChildIncludes('data: 0x') .journalLastChildIncludes('data: 0x')
.perform(done) .perform(done)
}) })
}) })
}, },
@ -80,146 +80,146 @@ module.exports = {
browser.perform((done) => { browser.perform((done) => {
browser.getAddressAtPosition(0, (address) => { browser.getAddressAtPosition(0, (address) => {
browser.sendLowLevelTx(address, '10', '0xaa') browser.sendLowLevelTx(address, '10', '0xaa')
.pause(1000) .pause(1000)
.journalLastChildIncludes('to CheckSpecials.(fallback) errored:') .journalLastChildIncludes('to CheckSpecials.(fallback) errored:')
.journalLastChildIncludes('The called function should be payable if you send value') .journalLastChildIncludes('The called function should be payable if you send value')
.perform(done) .perform(done)
}) })
}) })
}, },
'Use special functions receive/fallback - only receive is declared, sending wei': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - only receive is declared, sending wei': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('#icon-panel', 10000) browser.waitForElementVisible('#icon-panel', 10000)
.testContracts('receiveOnly.sol', sources[1]['browser/receiveOnly.sol'], ['CheckSpecials']) .testContracts('receiveOnly.sol', sources[1]['browser/receiveOnly.sol'], ['CheckSpecials'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('CheckSpecials') .selectContract('CheckSpecials')
.createContract('') .createContract('')
.clickInstance(1) .clickInstance(1)
.perform((done) => { .perform((done) => {
browser.getAddressAtPosition(1, (address) => { browser.getAddressAtPosition(1, (address) => {
browser.sendLowLevelTx(address, '1', '') browser.sendLowLevelTx(address, '1', '')
.pause(1000) .pause(1000)
.journalLastChildIncludes('to: CheckSpecials.(receive)') .journalLastChildIncludes('to: CheckSpecials.(receive)')
.journalLastChildIncludes('value: 1 wei') .journalLastChildIncludes('value: 1 wei')
.journalLastChildIncludes('data: 0x') .journalLastChildIncludes('data: 0x')
.perform(done) .perform(done)
})
}) })
})
}, },
'Use special functions receive/fallback - only receive is declared, failing, fallback is not declared, sending data': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - only receive is declared, failing, fallback is not declared, sending data': function (browser: NightwatchBrowser) {
// don't need to redeploy it, same contract // don't need to redeploy it, same contract
browser.perform((done) => { browser.perform((done) => {
browser.getAddressAtPosition(1, (address) => { browser.getAddressAtPosition(1, (address) => {
browser.sendLowLevelTx(address, '0', '0xaa') browser.sendLowLevelTx(address, '0', '0xaa')
.pause(1000) .pause(1000)
.waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`) .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`)
.assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `'Fallback' function is not defined`) .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, '\'Fallback\' function is not defined')
.perform(done) .perform(done)
}) })
}) })
}, },
'Use special functions receive/fallback - only fallback declared and is payable, sending wei': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - only fallback declared and is payable, sending wei': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('#icon-panel', 10000) browser.waitForElementVisible('#icon-panel', 10000)
.testContracts('fallbackOnlyPayable.sol', sources[2]['browser/fallbackOnlyPayable.sol'], ['CheckSpecials']) .testContracts('fallbackOnlyPayable.sol', sources[2]['browser/fallbackOnlyPayable.sol'], ['CheckSpecials'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('CheckSpecials') .selectContract('CheckSpecials')
.createContract('') .createContract('')
.clickInstance(2) .clickInstance(2)
.perform((done) => { .perform((done) => {
browser.getAddressAtPosition(2, (address) => { browser.getAddressAtPosition(2, (address) => {
browser.sendLowLevelTx(address, '1', '') browser.sendLowLevelTx(address, '1', '')
.pause(1000) .pause(1000)
.journalLastChildIncludes('to: CheckSpecials.(fallback)') .journalLastChildIncludes('to: CheckSpecials.(fallback)')
.journalLastChildIncludes('value: 1 wei') .journalLastChildIncludes('value: 1 wei')
.journalLastChildIncludes('data: 0x') .journalLastChildIncludes('data: 0x')
.perform(done) .perform(done)
})
}) })
})
}, },
'Use special functions receive/fallback - only fallback is diclared and is payable, sending data and wei': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - only fallback is diclared and is payable, sending data and wei': function (browser: NightwatchBrowser) {
// don't need to redeploy it, same contract // don't need to redeploy it, same contract
browser.perform((done) => { browser.perform((done) => {
browser.getAddressAtPosition(2, (address) => { browser.getAddressAtPosition(2, (address) => {
browser.sendLowLevelTx(address, '1', '0xaa') browser.sendLowLevelTx(address, '1', '0xaa')
.pause(1000) .pause(1000)
.journalLastChildIncludes('to: CheckSpecials.(fallback)') .journalLastChildIncludes('to: CheckSpecials.(fallback)')
.journalLastChildIncludes('value: 1 wei') .journalLastChildIncludes('value: 1 wei')
.journalLastChildIncludes('data: 0xaa') .journalLastChildIncludes('data: 0xaa')
.perform(done) .perform(done)
}) })
}) })
}, },
'Use special functions receive/fallback - only fallback is declared, fallback should fail cause not payable, sending wei': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - only fallback is declared, fallback should fail cause not payable, sending wei': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('#icon-panel', 10000) browser.waitForElementVisible('#icon-panel', 10000)
.testContracts('fallbackOnlyNotPayable.sol', sources[3]['browser/fallbackOnlyNotPayable.sol'], ['CheckSpecials']) .testContracts('fallbackOnlyNotPayable.sol', sources[3]['browser/fallbackOnlyNotPayable.sol'], ['CheckSpecials'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('CheckSpecials') .selectContract('CheckSpecials')
.createContract('') .createContract('')
.clickInstance(3) .clickInstance(3)
.perform((done) => { .perform((done) => {
browser.getAddressAtPosition(3, (address) => { browser.getAddressAtPosition(3, (address) => {
browser.sendLowLevelTx(address, '1', '') browser.sendLowLevelTx(address, '1', '')
.pause(1000) .pause(1000)
.waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`) .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`)
.assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `should have either 'receive' or payable 'fallback'`) .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, 'should have either \'receive\' or payable \'fallback\'')
.perform(done) .perform(done)
})
}) })
})
}, },
'Use special functions receive/fallback - receive and fallback are declared, sending data and wei': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - receive and fallback are declared, sending data and wei': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('#icon-panel', 10000) browser.waitForElementVisible('#icon-panel', 10000)
.testContracts('receiveAndFallbackBothPayable.sol', sources[4]['browser/receiveAndFallbackBothPayable.sol'], ['CheckSpecials']) .testContracts('receiveAndFallbackBothPayable.sol', sources[4]['browser/receiveAndFallbackBothPayable.sol'], ['CheckSpecials'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('CheckSpecials') .selectContract('CheckSpecials')
.waitForElementVisible('#value') .waitForElementVisible('#value')
.clearValue('#value') .clearValue('#value')
.setValue('#value', '0') .setValue('#value', '0')
.createContract('') .createContract('')
.clickInstance(4) .clickInstance(4)
.pause(1000) .pause(1000)
.perform((done) => { .perform((done) => {
browser.getAddressAtPosition(4, (address) => { browser.getAddressAtPosition(4, (address) => {
browser.sendLowLevelTx(address, '1', '0xaa') browser.sendLowLevelTx(address, '1', '0xaa')
.pause(1000) .pause(1000)
.journalLastChildIncludes('to: CheckSpecials.(fallback)') .journalLastChildIncludes('to: CheckSpecials.(fallback)')
.journalLastChildIncludes('value: 1 wei') .journalLastChildIncludes('value: 1 wei')
.journalLastChildIncludes('data: 0xaa') .journalLastChildIncludes('data: 0xaa')
.perform(done) .perform(done)
})
}) })
})
}, },
'Use special functions receive/fallback - receive and fallback are declared and payable, sending wei': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - receive and fallback are declared and payable, sending wei': function (browser: NightwatchBrowser) {
browser.perform((done) => { browser.perform((done) => {
browser.getAddressAtPosition(4, (address) => { browser.getAddressAtPosition(4, (address) => {
browser.sendLowLevelTx(address, '1', '') browser.sendLowLevelTx(address, '1', '')
.pause(1000) .pause(1000)
.journalLastChildIncludes('to: CheckSpecials.(receive)') .journalLastChildIncludes('to: CheckSpecials.(receive)')
.journalLastChildIncludes('value: 1 wei') .journalLastChildIncludes('value: 1 wei')
.journalLastChildIncludes('data: 0x') .journalLastChildIncludes('data: 0x')
.perform(done) .perform(done)
}) })
}) })
}, },
'Use special functions receive/fallback - receive and fallback are not declared, sending nothing': function (browser: NightwatchBrowser) { 'Use special functions receive/fallback - receive and fallback are not declared, sending nothing': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('#icon-panel', 10000) browser.waitForElementVisible('#icon-panel', 10000)
.testContracts('notSpecial.sol', sources[5]['browser/notSpecial.sol'], ['CheckSpecials']) .testContracts('notSpecial.sol', sources[5]['browser/notSpecial.sol'], ['CheckSpecials'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('CheckSpecials') .selectContract('CheckSpecials')
.waitForElementVisible('#value') .waitForElementVisible('#value')
.clearValue('#value') .clearValue('#value')
.setValue('#value', '0') .setValue('#value', '0')
.createContract('') .createContract('')
.clickInstance(5) .clickInstance(5)
.pause(1000) .pause(1000)
.perform((done) => { .perform((done) => {
browser.getAddressAtPosition(5, (address) => { browser.getAddressAtPosition(5, (address) => {
browser.sendLowLevelTx(address, '0', '') browser.sendLowLevelTx(address, '0', '')
.pause(1000) .pause(1000)
.waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`) .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`)
.assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `Both 'receive' and 'fallback' functions are not defined`) .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, 'Both \'receive\' and \'fallback\' functions are not defined')
.perform(done) .perform(done)
})
}) })
}) .end()
.end()
}, },
tearDown: sauce tearDown: sauce
} }

@ -1,11 +1,12 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
const sources = [ const sources = [
{ {
'browser/Untitled.sol': {content: ` 'browser/Untitled.sol': {
content: `
pragma solidity >=0.6.0 <0.8.0; pragma solidity >=0.6.0 <0.8.0;
contract test1 { address test = tx.origin; } contract test1 { address test = tx.origin; }
contract test2 {} contract test2 {}
@ -16,7 +17,9 @@ contract TooMuchGas {
uint test; uint test;
uint test1; uint test1;
} }
}`}} }`
}
}
] ]
module.exports = { module.exports = {
@ -44,11 +47,11 @@ function runTests (browser: NightwatchBrowser) {
listSelectorContains(['Use of tx.origin', listSelectorContains(['Use of tx.origin',
'Fallback function of contract TooMuchGas requires too much gas', 'Fallback function of contract TooMuchGas requires too much gas',
'TooMuchGas.() : Variables have very similar names "test" and "test1".', 'TooMuchGas.() : Variables have very similar names "test" and "test1".',
'TooMuchGas.() : Variables have very similar names "test" and "test1".' ], 'TooMuchGas.() : Variables have very similar names "test" and "test1".'],
'#staticanalysisresult .warning', '#staticanalysisresult .warning',
browser, function () { browser, function () {
browser.end() browser.end()
} }
) )
}) })
} }

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -10,115 +10,114 @@ module.exports = {
'Should execution a simple console command': function (browser: NightwatchBrowser) { 'Should execution a simple console command': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="terminalCli"]', 10000) .waitForElementVisible('*[data-id="terminalCli"]', 10000)
.executeScript('console.log(1 + 1)') .executeScript('console.log(1 + 1)')
.journalLastChild('2') .journalLastChild('2')
}, },
'Should clear console': function (browser: NightwatchBrowser) { 'Should clear console': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="terminalCli"]') .waitForElementVisible('*[data-id="terminalCli"]')
.journalChildIncludes('Welcome to Remix') .journalChildIncludes('Welcome to Remix')
.click('#clearConsole') .click('#clearConsole')
.assert.containsText('*[data-id="terminalJournal"]', '') .assert.containsText('*[data-id="terminalJournal"]', '')
}, },
'Should display auto-complete menu': function (browser: NightwatchBrowser) { 'Should display auto-complete menu': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="terminalCli"]') .waitForElementVisible('*[data-id="terminalCli"]')
.click('*[data-id="terminalCli"]') .click('*[data-id="terminalCli"]')
.sendKeys('*[data-id="terminalCliInput"]', 'remix.') .sendKeys('*[data-id="terminalCliInput"]', 'remix.')
.assert.visible('*[data-id="autoCompletePopUpAutoCompleteItem"]') .assert.visible('*[data-id="autoCompletePopUpAutoCompleteItem"]')
}, },
'Should execute remix.help() command': function (browser: NightwatchBrowser) { 'Should execute remix.help() command': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="terminalCli"]') .waitForElementVisible('*[data-id="terminalCli"]')
.executeScript('remix.help()') .executeScript('remix.help()')
.journalChildIncludes('remix.loadgist(id)') .journalChildIncludes('remix.loadgist(id)')
.journalChildIncludes('remix.loadurl(url)') .journalChildIncludes('remix.loadurl(url)')
.journalChildIncludes('remix.execute(filepath)') .journalChildIncludes('remix.execute(filepath)')
.journalChildIncludes('remix.exeCurrent()') .journalChildIncludes('remix.exeCurrent()')
.journalChildIncludes('remix.help()') .journalChildIncludes('remix.help()')
}, },
'Async/Await Script': function (browser: NightwatchBrowser) { 'Async/Await Script': function (browser: NightwatchBrowser) {
browser browser
.addFile('asyncAwait.js', { content: asyncAwait }) .addFile('asyncAwait.js', { content: asyncAwait })
.openFile('browser/asyncAwait.js') .openFile('browser/asyncAwait.js')
.executeScript(`remix.execute('browser/asyncAwait.js')`) .executeScript('remix.execute(\'browser/asyncAwait.js\')')
.journalLastChild('Waiting Promise') .journalLastChild('Waiting Promise')
.pause(5500) .pause(5500)
.journalLastChild('result - Promise Resolved') .journalLastChild('result - Promise Resolved')
}, },
'Call Remix File Manager from a script': function (browser: NightwatchBrowser) { 'Call Remix File Manager from a script': function (browser: NightwatchBrowser) {
browser browser
.addFile('asyncAwaitWithFileManagerAccess.js', { content: asyncAwaitWithFileManagerAccess }) .addFile('asyncAwaitWithFileManagerAccess.js', { content: asyncAwaitWithFileManagerAccess })
.openFile('browser/asyncAwaitWithFileManagerAccess.js') .openFile('browser/asyncAwaitWithFileManagerAccess.js')
.pause(5000) .pause(5000)
.executeScript(`remix.execute('browser/asyncAwaitWithFileManagerAccess.js')`) .executeScript('remix.execute(\'browser/asyncAwaitWithFileManagerAccess.js\')')
.pause(6000) .pause(6000)
.journalLastChildIncludes('contract Ballot {') .journalLastChildIncludes('contract Ballot {')
}, },
'Call web3.eth.getAccounts() using JavaScript VM': function (browser: NightwatchBrowser) { 'Call web3.eth.getAccounts() using JavaScript VM': function (browser: NightwatchBrowser) {
browser browser
.executeScript(`web3.eth.getAccounts()`) .executeScript('web3.eth.getAccounts()')
.pause(2000) .pause(2000)
.journalLastChildIncludes(`[ "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4", "0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2", "0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db", "0x78731D3Ca6b7E34aC0F824c42a7cC18A495cabaB", "0x617F2E2fD72FD9D5503197092aC168c91465E7f2", "0x17F6AD8Ef982297579C203069C1DbfFE4348c372", "0x5c6B0f7Bf3E7ce046039Bd8FABdfD3f9F5021678", "0x03C6FcED478cBbC9a4FAB34eF9f40767739D1Ff7", "0x1aE0EA34a72D944a8C7603FfB3eC30a6669E454C", "0x0A098Eda01Ce92ff4A4CCb7A4fFFb5A43EBC70DC", "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c", "0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C", "0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB", "0x583031D1113aD414F02576BD6afaBfb302140225", "0xdD870fA1b7C4700F2BD7f44238821C26f7392148" ]`) .journalLastChildIncludes('[ "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4", "0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2", "0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db", "0x78731D3Ca6b7E34aC0F824c42a7cC18A495cabaB", "0x617F2E2fD72FD9D5503197092aC168c91465E7f2", "0x17F6AD8Ef982297579C203069C1DbfFE4348c372", "0x5c6B0f7Bf3E7ce046039Bd8FABdfD3f9F5021678", "0x03C6FcED478cBbC9a4FAB34eF9f40767739D1Ff7", "0x1aE0EA34a72D944a8C7603FfB3eC30a6669E454C", "0x0A098Eda01Ce92ff4A4CCb7A4fFFb5A43EBC70DC", "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c", "0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C", "0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB", "0x583031D1113aD414F02576BD6afaBfb302140225", "0xdD870fA1b7C4700F2BD7f44238821C26f7392148" ]')
}, },
'Call web3.eth.getAccounts() using Web3 Provider': function (browser: NightwatchBrowser) { 'Call web3.eth.getAccounts() using Web3 Provider': function (browser: NightwatchBrowser) {
browser browser
.click('*[data-id="terminalClearConsole"]') // clear the terminal .click('*[data-id="terminalClearConsole"]') // clear the terminal
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.click('*[data-id="settingsWeb3Mode"]') .click('*[data-id="settingsWeb3Mode"]')
.modalFooterOKClick() .modalFooterOKClick()
.executeScript(`web3.eth.getAccounts()`) .executeScript('web3.eth.getAccounts()')
.pause(2000) .pause(2000)
.journalLastChildIncludes(`[ "`) // we check if an array is present, don't need to check for the content .journalLastChildIncludes('[ "') // we check if an array is present, don't need to check for the content
.journalLastChildIncludes('" ]') .journalLastChildIncludes('" ]')
.journalLastChildIncludes('", "') .journalLastChildIncludes('", "')
}, },
'Call Remix File Resolver (external URL) from a script': function (browser: NightwatchBrowser) { 'Call Remix File Resolver (external URL) from a script': function (browser: NightwatchBrowser) {
browser browser
.click('*[data-id="terminalClearConsole"]') // clear the terminal .click('*[data-id="terminalClearConsole"]') // clear the terminal
.addFile('resolveExternalUrlAndSave.js', { content: resolveExternalUrlAndSave }) .addFile('resolveExternalUrlAndSave.js', { content: resolveExternalUrlAndSave })
.openFile('browser/resolveExternalUrlAndSave.js') .openFile('browser/resolveExternalUrlAndSave.js')
.pause(1000) .pause(1000)
.executeScript(`remix.execute('browser/resolveExternalUrlAndSave.js')`) .executeScript('remix.execute(\'browser/resolveExternalUrlAndSave.js\')')
.pause(6000) .pause(6000)
.journalLastChildIncludes('Implementation of the {IERC20} interface.') .journalLastChildIncludes('Implementation of the {IERC20} interface.')
.openFile('browser/github/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol') .openFile('browser/github/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol')
}, },
'Call Remix File Resolver (internal URL) from a script': function (browser: NightwatchBrowser) { 'Call Remix File Resolver (internal URL) from a script': function (browser: NightwatchBrowser) {
browser browser
.click('*[data-id="terminalClearConsole"]') // clear the terminal .click('*[data-id="terminalClearConsole"]') // clear the terminal
.addFile('resolveUrl.js', { content: resolveUrl }) .addFile('resolveUrl.js', { content: resolveUrl })
.openFile('browser/resolveUrl.js') .openFile('browser/resolveUrl.js')
.pause(1000) .pause(1000)
.executeScript(`remix.execute('browser/resolveUrl.js')`) .executeScript('remix.execute(\'browser/resolveUrl.js\')')
.pause(6000) .pause(6000)
.journalLastChildIncludes('contract Ballot {') .journalLastChildIncludes('contract Ballot {')
}, },
'Call Remix File Resolver (internal URL) from a script and specify a path': function (browser: NightwatchBrowser) { 'Call Remix File Resolver (internal URL) from a script and specify a path': function (browser: NightwatchBrowser) {
browser browser
.click('*[data-id="terminalClearConsole"]') // clear the terminal .click('*[data-id="terminalClearConsole"]') // clear the terminal
.addFile('resolveExternalUrlAndSaveToaPath.js', { content: resolveExternalUrlAndSaveToaPath }) .addFile('resolveExternalUrlAndSaveToaPath.js', { content: resolveExternalUrlAndSaveToaPath })
.openFile('browser/resolveExternalUrlAndSaveToaPath.js') .openFile('browser/resolveExternalUrlAndSaveToaPath.js')
.pause(1000) .pause(1000)
.executeScript(`remix.execute('browser/resolveExternalUrlAndSaveToaPath.js')`) .executeScript('remix.execute(\'browser/resolveExternalUrlAndSaveToaPath.js\')')
.pause(6000) .pause(6000)
.journalLastChildIncludes('abstract contract ERC20Burnable') .journalLastChildIncludes('abstract contract ERC20Burnable')
.openFile('browser/github/newFile.sol') .openFile('browser/github/newFile.sol')
.end() .end()
}, },
tearDown: sauce tearDown: sauce
} }

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { NightwatchBrowser } from "nightwatch" import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init' import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
@ -13,35 +13,35 @@ module.exports = {
'Execute Simple Contract and Test Terminal': function (browser: NightwatchBrowser) { 'Execute Simple Contract and Test Terminal': function (browser: NightwatchBrowser) {
browser.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TestContract']) browser.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TestContract'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
.click('#runTabView button[class^="instanceButton"]') .click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2) > div > button') .click('.instance:nth-of-type(2) > div > button')
.click('#runTabView .instance div[class^="title"]') .click('#runTabView .instance div[class^="title"]')
.click('#runTabView .instance div[class^="title"]') .click('#runTabView .instance div[class^="title"]')
.clickFunction('f - transact (not payable)') .clickFunction('f - transact (not payable)')
.testFunction('0x38bb944fa4709ed9e163d6c670259f97284b4defd916d512a2fcc3f35bb53e03', .testFunction('0x38bb944fa4709ed9e163d6c670259f97284b4defd916d512a2fcc3f35bb53e03',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0x38bb944fa4709ed9e163d6c670259f97284b4defd916d512a2fcc3f35bb53e03', 'transaction hash': '0x38bb944fa4709ed9e163d6c670259f97284b4defd916d512a2fcc3f35bb53e03',
'decoded output': { '0': 'uint256: 8' } 'decoded output': { 0: 'uint256: 8' }
}) })
.pause(500) .pause(500)
.checkTerminalFilter('0x12332162e2e31397dc1e07ed0a1cf08f728e9b4487c6f9ed79d2f39410c92782', '') .checkTerminalFilter('0x12332162e2e31397dc1e07ed0a1cf08f728e9b4487c6f9ed79d2f39410c92782', '')
.clickFunction('g - transact (not payable)') .clickFunction('g - transact (not payable)')
.testFunction('0xab4f794ca0b531f27fc6eace623666b440facbf20e77615a057d728c67b500f0', .testFunction('0xab4f794ca0b531f27fc6eace623666b440facbf20e77615a057d728c67b500f0',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0xab4f794ca0b531f27fc6eace623666b440facbf20e77615a057d728c67b500f0', 'transaction hash': '0xab4f794ca0b531f27fc6eace623666b440facbf20e77615a057d728c67b500f0',
'decoded output': { 'decoded output': {
'0': 'uint256: 345', 0: 'uint256: 345',
'1': 'string: comment_comment_', 1: 'string: comment_comment_',
'2': 'bool: true', 2: 'bool: true',
'3': 'uint256: 4' 3: 'uint256: 4'
} }
}) })
.click('*[data-id="deployAndRunClearInstances"]') .click('*[data-id="deployAndRunClearInstances"]')
}, },
'Test Complex Return Values': function (browser: NightwatchBrowser) { 'Test Complex Return Values': function (browser: NightwatchBrowser) {
@ -52,100 +52,100 @@ module.exports = {
.click('.instance:nth-of-type(2) > div > button') .click('.instance:nth-of-type(2) > div > button')
.clickFunction('retunValues1 - transact (not payable)') .clickFunction('retunValues1 - transact (not payable)')
.testFunction('0x09c6716a67f0f8c7a0ca2b3ddf59c25982da856a95aefd640b767f9b9feee39d', .testFunction('0x09c6716a67f0f8c7a0ca2b3ddf59c25982da856a95aefd640b767f9b9feee39d',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0x09c6716a67f0f8c7a0ca2b3ddf59c25982da856a95aefd640b767f9b9feee39d', 'transaction hash': '0x09c6716a67f0f8c7a0ca2b3ddf59c25982da856a95aefd640b767f9b9feee39d',
'decoded output': { 'decoded output': {
'0': 'bool: _b true', 0: 'bool: _b true',
'1': 'uint256: _u 345', 1: 'uint256: _u 345',
'2': 'int256: _i -345', 2: 'int256: _i -345',
'3': 'address: _a 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c' 3: 'address: _a 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c'
} }
}) })
.clickFunction('retunValues2 - transact (not payable)') .clickFunction('retunValues2 - transact (not payable)')
.testFunction('0xe884953e0695399d60914af3e1ea2dad59fe41f3c0c20665c130fa40dd0fb6bf', .testFunction('0xe884953e0695399d60914af3e1ea2dad59fe41f3c0c20665c130fa40dd0fb6bf',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0xe884953e0695399d60914af3e1ea2dad59fe41f3c0c20665c130fa40dd0fb6bf', 'transaction hash': '0xe884953e0695399d60914af3e1ea2dad59fe41f3c0c20665c130fa40dd0fb6bf',
'decoded output': { 'decoded output': {
'0': 'bytes1: _b 0x12', 0: 'bytes1: _b 0x12',
'1': 'bytes2: _b2 0x1223', 1: 'bytes2: _b2 0x1223',
'2': 'bytes3: _b3 0x000000', 2: 'bytes3: _b3 0x000000',
'3': 'bytes: _blit 0x123498', 3: 'bytes: _blit 0x123498',
'4': 'bytes5: _b5 0x0432450000', 4: 'bytes5: _b5 0x0432450000',
'5': 'bytes6: _b6 0x234553253200', 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', 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', 7: 'bytes7: _b7 0x03252353253253',
'8': 'bytes22: _b22 0x32523523532532532523532500000000000000000000', 8: 'bytes22: _b22 0x32523523532532532523532500000000000000000000',
'9': 'bytes32: _b32 0x0325235325325235325235325235320000000000000000000000000000000000' 9: 'bytes32: _b32 0x0325235325325235325235325235320000000000000000000000000000000000'
} }
}).pause(500) }).pause(500)
.clickFunction('retunValues3 - transact (not payable)') .clickFunction('retunValues3 - transact (not payable)')
.testFunction('0xb4108649d5e65a4a0776d6ac98c2c356540a7e99d641705a82352a845d467eb5', .testFunction('0xb4108649d5e65a4a0776d6ac98c2c356540a7e99d641705a82352a845d467eb5',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0xb4108649d5e65a4a0776d6ac98c2c356540a7e99d641705a82352a845d467eb5', 'transaction hash': '0xb4108649d5e65a4a0776d6ac98c2c356540a7e99d641705a82352a845d467eb5',
'decoded output': { 'decoded output': {
'0': 'uint8: _en 2', 0: 'uint8: _en 2',
'1': 'int256[5][]: _a1 1,-45,-78,56,60,-1,42,334,-45455,-446,1,10,-5435,45,-7' 1: 'int256[5][]: _a1 1,-45,-78,56,60,-1,42,334,-45455,-446,1,10,-5435,45,-7'
} }
}).click('*[data-id="deployAndRunClearInstances"]') }).click('*[data-id="deployAndRunClearInstances"]')
}, },
'Test Complex Input Values': function (browser: NightwatchBrowser) { 'Test Complex Input Values': function (browser: NightwatchBrowser) {
browser.testContracts('inputValues.sol', sources[2]['browser/inputValues.sol'], ['test']) browser.testContracts('inputValues.sol', sources[2]['browser/inputValues.sol'], ['test'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.click('#runTabView button[class^="instanceButton"]') .click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2) > div > button') .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 _"'}) .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', .testFunction('0xe9678b5486674a0425301a1d7e925c22cfb9f7f7ec6242697d742009f7ef5b97',
{ {
status: 'true 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: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0x21724b08c3699bda8375803f8dc842194aea370f2aac284e55144b452dca321f', 'transaction hash': '0xe9678b5486674a0425301a1d7e925c22cfb9f7f7ec6242697d742009f7ef5b97',
'decoded output': { 'decoded output': {
'0': 'uint256[3]: _nret 1,2,3', 0: 'uint256: _uret 2343242',
'1': 'bytes8[4]: _b8ret 0x1234000000000000,0x1234000000000000,0x1234000000000000,0x1234000000000000' 1: 'int256: _iret -4324324',
}, 2: 'string: _strret string _ string _ string _ string _ string _ string _ string _ string _ string _ string _'
logs: [ }
{
'from': '0x8c1eD7e19abAa9f23c476dA86Dc1577F1Ef401f5',
'topic': '0xd30981760edbf605bda8689e945f622877f230c9a77cbfbd448aa4b7d8ac6e7f',
'event': 'event1',
'args': {
'0': '-123',
'1': '123',
'2': {
"_isIndexed":true,
'hash': '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658'
},
'3': '0x12340000',
'4': 'test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test '
}
}
]
}) })
.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: 'true 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: {
_isIndexed: true,
hash: '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658'
},
3: '0x12340000',
4: 'test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test '
}
}
]
})
.click('*[data-id="deployAndRunClearInstances"]') .click('*[data-id="deployAndRunClearInstances"]')
}, },
'Should Compile and Deploy a contract which has an event declaring a function as parameter': function (browser: NightwatchBrowser) { 'Should Compile and Deploy a contract which has an event declaring a function as parameter': function (browser: NightwatchBrowser) {
browser.testContracts('eventFunctionInput.sol', sources[3]['browser/eventFunctionInput.sol'], ['C']) browser.testContracts('eventFunctionInput.sol', sources[3]['browser/eventFunctionInput.sol'], ['C'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
.click('#runTabView button[class^="instanceButton"]') .click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('.instance:nth-of-type(2)')
.end() .end()
}, },
tearDown: sauce tearDown: sauce
@ -154,15 +154,21 @@ module.exports = {
// @TODO test: bytes8[3][] type as input // @TODO test: bytes8[3][] type as input
const sources = [ const sources = [
{'browser/Untitled.sol': {content: ` {
'browser/Untitled.sol': {
content: `
contract TestContract { function f() public returns (uint) { return 8; } contract TestContract { function f() public returns (uint) { return 8; }
function g() public returns (uint, string memory, bool, uint) { function g() public returns (uint, string memory, bool, uint) {
uint payment = 345; uint payment = 345;
bool payed = true; bool payed = true;
string memory comment = "comment_comment_"; string memory comment = "comment_comment_";
uint month = 4; uint month = 4;
return (payment, comment, payed, month); } }`}}, return (payment, comment, payed, month); } }`
{'browser/returnValues.sol': {content: ` }
},
{
'browser/returnValues.sol': {
content: `
contract testReturnValues { contract testReturnValues {
enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill } enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill }
function retunValues1 () public returns (bool _b, uint _u, int _i, address _a) { function retunValues1 () public returns (bool _b, uint _u, int _i, address _a) {
@ -192,8 +198,12 @@ const sources = [
a[2] = [int(1),10,-5435,45,-7]; a[2] = [int(1),10,-5435,45,-7];
_a1 = a; _a1 = a;
} }
}`}}, }`
{'browser/inputValues.sol': {content: ` }
},
{
'browser/inputValues.sol': {
content: `
contract test { contract test {
event event1(int _i, uint indexed _u, string indexed _str, bytes4 _b, string _notIndexed); 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) { function inputValue1 (uint _u, int _i, string memory _str) public returns (uint _uret, int _iret, string memory _strret) {
@ -206,11 +216,17 @@ const sources = [
_b8ret = _b8; _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 "); emit event1(-123, 123, "test", hex"1234", "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ");
} }
}`}}, }`
// https://github.com/ethereum/remix-project/issues/404 }
{'browser/eventFunctionInput.sol': {content: ` },
// https://github.com/ethereum/remix-project/issues/404
{
'browser/eventFunctionInput.sol': {
content: `
pragma solidity >= 0.7.0; pragma solidity >= 0.7.0;
contract C { contract C {
event Test(function() external); event Test(function() external);
}`}} }`
}
}
] ]

@ -5,8 +5,8 @@ import sauce from './sauce'
import examples from '../examples/example-contracts' import examples from '../examples/example-contracts'
const sources = [ const sources = [
{'browser/Untitled.sol': {content: examples.ballot.content}}, { 'browser/Untitled.sol': { content: examples.ballot.content } },
{'browser/Untitled1.sol': {content: `contract test {}`}} { 'browser/Untitled1.sol': { content: 'contract test {}' } }
] ]
module.exports = { module.exports = {
@ -19,34 +19,34 @@ module.exports = {
'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: NightwatchBrowser) { '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: NightwatchBrowser) {
// https://github.com/ethereum/remix-ide/issues/2864 // https://github.com/ethereum/remix-ide/issues/2864
browser browser
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
.setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]') .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
.click('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]')
.clickFunction('delegate - transact (not payable)', {types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'}) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' })
.testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', .testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
{ {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', 'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
}) })
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('Untitled1.sol', sources[1]['browser/Untitled1.sol'], ['test']) .testContracts('Untitled1.sol', sources[1]['browser/Untitled1.sol'], ['test'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.clickFunction('delegate - transact (not payable)', {types: 'address to', values: ''}) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '' })
.pause(5000) .pause(5000)
.testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', .testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
{ {
status: 'false Transaction mined but execution failed', status: 'false Transaction mined but execution failed',
'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', 'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
}) })
.end() .end()
}, },
tearDown: sauce tearDown: sauce

@ -6,14 +6,14 @@ import sauce from './sauce'
import examples from '../examples/example-contracts' import examples from '../examples/example-contracts'
const sources = [ const sources = [
{'browser/Untitled.sol': { content: examples.ballot.content }} { 'browser/Untitled.sol': { content: examples.ballot.content } }
] ]
module.exports = { module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) { before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done, 'http://127.0.0.1:8080/#optimize=true&runs=300&evmVersion=istanbul&version=soljson-v0.7.4+commit.3f05b770.js&code=cHJhZ21hIHNvbGlkaXR5ID49MC42LjAgPDAuNy4wOwoKaW1wb3J0ICJodHRwczovL2dpdGh1Yi5jb20vT3BlblplcHBlbGluL29wZW56ZXBwZWxpbi1jb250cmFjdHMvYmxvYi9tYXN0ZXIvY29udHJhY3RzL2FjY2Vzcy9Pd25hYmxlLnNvbCI7Cgpjb250cmFjdCBHZXRQYWlkIGlzIE93bmFibGUgewogIGZ1bmN0aW9uIHdpdGhkcmF3KCkgZXh0ZXJuYWwgb25seU93bmVyIHsKICB9Cn0') init(browser, done, 'http://127.0.0.1:8080/#optimize=true&runs=300&evmVersion=istanbul&version=soljson-v0.7.4+commit.3f05b770.js&code=cHJhZ21hIHNvbGlkaXR5ID49MC42LjAgPDAuNy4wOwoKaW1wb3J0ICJodHRwczovL2dpdGh1Yi5jb20vT3BlblplcHBlbGluL29wZW56ZXBwZWxpbi1jb250cmFjdHMvYmxvYi9tYXN0ZXIvY29udHJhY3RzL2FjY2Vzcy9Pd25hYmxlLnNvbCI7Cgpjb250cmFjdCBHZXRQYWlkIGlzIE93bmFibGUgewogIGZ1bmN0aW9uIHdpdGhkcmF3KCkgZXh0ZXJuYWwgb25seU93bmVyIHsKICB9Cn0')
}, },
'@sources': function () { '@sources': function () {
return sources return sources
}, },
@ -22,36 +22,36 @@ module.exports = {
browser browser
.getEditorValue((content) => { .getEditorValue((content) => {
browser.assert.ok(content.indexOf( browser.assert.ok(content.indexOf(
'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol') != -1, 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol') !== -1,
'code has not been loaded') 'code has not been loaded')
}) })
}, },
'Should load using URL compiler params': function (browser: NightwatchBrowser) { 'Should load using URL compiler params': function (browser: NightwatchBrowser) {
browser browser
.assert.containsText('#versionSelector option[selected="selected"]', '0.7.4+commit.3f05b770') .assert.containsText('#versionSelector option[selected="selected"]', '0.7.4+commit.3f05b770')
.assert.containsText('#evmVersionSelector option[selected="selected"]', 'istanbul') .assert.containsText('#evmVersionSelector option[selected="selected"]', 'istanbul')
.verify.elementPresent('#optimize:checked') .verify.elementPresent('#optimize:checked')
.verify.attributeEquals('#runs', 'value', '300') .verify.attributeEquals('#runs', 'value', '300')
}, },
'Should load using compiler from link passed in remix URL': function (browser: NightwatchBrowser) { 'Should load using compiler from link passed in remix URL': function (browser: NightwatchBrowser) {
browser browser
.url('http://127.0.0.1:8080/#version=https://solidity-blog.s3.eu-central-1.amazonaws.com/data/08preview/soljson.js') .url('http://127.0.0.1:8080/#version=https://solidity-blog.s3.eu-central-1.amazonaws.com/data/08preview/soljson.js')
.refresh() .refresh()
.pause(5000) .pause(5000)
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.pause(5000) .pause(5000)
.assert.containsText('#versionSelector option[selected="selected"]', 'custom') .assert.containsText('#versionSelector option[selected="selected"]', 'custom')
// default values // default values
.assert.containsText('#evmVersionSelector option[selected="selected"]', 'default') .assert.containsText('#evmVersionSelector option[selected="selected"]', 'default')
.verify.elementPresent('#optimize') .verify.elementPresent('#optimize')
.assert.elementNotPresent('#optimize:checked') .assert.elementNotPresent('#optimize:checked')
.verify.elementPresent('#runs:disabled') .verify.elementPresent('#runs:disabled')
.click('[for="optimize"') .click('[for="optimize"')
.verify.attributeEquals('#runs', 'value', '200') .verify.attributeEquals('#runs', 'value', '200')
.end() .end()
}, },
tearDown: sauce tearDown: sauce
} }

@ -4,7 +4,9 @@ import init from '../helpers/init'
import sauce from './sauce' import sauce from './sauce'
const sources = [ const sources = [
{'browser/basic.sol': { content: {
'browser/basic.sol': {
content:
`pragma solidity >=0.2.0 <0.7.0; `pragma solidity >=0.2.0 <0.7.0;
/** /**
@ -14,7 +16,8 @@ const sources = [
uint someVar; uint someVar;
constructor() public {} constructor() public {}
}` }`
}} }
}
] ]
module.exports = { module.exports = {
@ -26,26 +29,26 @@ module.exports = {
}, },
'Using Web Worker': function (browser: NightwatchBrowser) { 'Using Web Worker': function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.addFile('basic.sol', sources[0]['browser/basic.sol']) .addFile('basic.sol', sources[0]['browser/basic.sol'])
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.execute(function() { .execute(function () {
const elem = document.getElementById('nightlies') as HTMLInputElement const elem = document.getElementById('nightlies') as HTMLInputElement
elem.checked = true elem.checked = true
}) })
.noWorkerErrorFor('soljson-v0.3.4+commit.7dab8902.js') .noWorkerErrorFor('soljson-v0.3.4+commit.7dab8902.js')
.noWorkerErrorFor('soljson-v0.6.5+commit.f956cc89.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.8-nightly.2020.5.14+commit.a6d0067b.js')
.noWorkerErrorFor('soljson-v0.6.0-nightly.2019.12.17+commit.d13438ee.js') .noWorkerErrorFor('soljson-v0.6.0-nightly.2019.12.17+commit.d13438ee.js')
.noWorkerErrorFor('soljson-v0.4.26+commit.4563c3fc.js') .noWorkerErrorFor('soljson-v0.4.26+commit.4563c3fc.js')
.execute(function() { .execute(function () {
const elem = document.getElementById('nightlies') as HTMLInputElement const elem = document.getElementById('nightlies') as HTMLInputElement
elem.checked = false elem.checked = false
}) })
.end() .end()
}, },
tearDown: sauce tearDown: sauce

@ -10,25 +10,25 @@ module.exports = {
'Checks vertical icons panelcontex menu': function (browser: NightwatchBrowser) { 'Checks vertical icons panelcontex menu': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000) browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000)
.waitForElementVisible('*[data-id="verticalIconsKindpluginManager"]') .waitForElementVisible('*[data-id="verticalIconsKindpluginManager"]')
.click('*[data-id="verticalIconsKindpluginManager"]') .click('*[data-id="verticalIconsKindpluginManager"]')
.scrollAndClick('*[data-id="pluginManagerComponentActivateButtondebugger"]') .scrollAndClick('*[data-id="pluginManagerComponentActivateButtondebugger"]')
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]', 7000) .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]', 7000)
.rightClick('[data-id="verticalIconsKinddebugger"]') .rightClick('[data-id="verticalIconsKinddebugger"]')
.waitForElementVisible('*[id="menuitemdeactivate"]') .waitForElementVisible('*[id="menuitemdeactivate"]')
.waitForElementVisible('*[id="menuitemdocumentation"]') .waitForElementVisible('*[id="menuitemdocumentation"]')
.click('*[data-id="remixIdeIconPanel"]') .click('*[data-id="remixIdeIconPanel"]')
}, },
'Checks vertical icons panel contex menu deactivate': function (browser: NightwatchBrowser) { 'Checks vertical icons panel contex menu deactivate': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000) browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000)
.waitForElementVisible('*[data-id="verticalIconsKinddebugger"]', 7000) .waitForElementVisible('*[data-id="verticalIconsKinddebugger"]', 7000)
.rightClick('[data-id="verticalIconsKinddebugger"]') .rightClick('[data-id="verticalIconsKinddebugger"]')
.click('*[id="menuitemdeactivate"]') .click('*[id="menuitemdeactivate"]')
.click('*[data-id="verticalIconsKindsettings"]') .click('*[data-id="verticalIconsKindsettings"]')
.click('*[data-id="verticalIconsKindpluginManager"]') .click('*[data-id="verticalIconsKindpluginManager"]')
.scrollInto('*[data-id="pluginManagerComponentActivateButtondebugger"]') .scrollInto('*[data-id="pluginManagerComponentActivateButtondebugger"]')
.waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]') .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]')
}, },
tearDown: sauce tearDown: sauce

@ -8,26 +8,26 @@ module.exports = {
init(browser, done, 'http://127.0.0.1:8080?activate=solidity,udapp&call=fileManager//open//contracts/3_Ballot.sol&deactivate=home', false) init(browser, done, 'http://127.0.0.1:8080?activate=solidity,udapp&call=fileManager//open//contracts/3_Ballot.sol&deactivate=home', false)
}, },
'CheckSolidityActivatedAndUDapp': function (browser: NightwatchBrowser) { CheckSolidityActivatedAndUDapp: function (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('#icon-panel', 10000) .waitForElementVisible('#icon-panel', 10000)
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
}, },
'Editor should be focused on the 3_Ballot.sol': function (browser: NightwatchBrowser) { 'Editor should be focused on the 3_Ballot.sol': function (browser: NightwatchBrowser) {
browser browser
.pause(5000) .pause(5000)
.getEditorValue((content) => { .getEditorValue((content) => {
browser.assert.ok(content.indexOf('contract Ballot {') != -1, 'content doesn\'t include Ballot contract') browser.assert.ok(content.indexOf('contract Ballot {') !== -1, 'content doesn\'t include Ballot contract')
}) })
}, },
'Home page should be deactivated': function (browser: NightwatchBrowser) { 'Home page should be deactivated': function (browser: NightwatchBrowser) {
browser browser
.waitForElementNotPresent('[data-id="landingPageHomeContainer"]') .waitForElementNotPresent('[data-id="landingPageHomeContainer"]')
.end() .end()
}, },
tearDown: sauce tearDown: sauce
} }

Loading…
Cancel
Save