Resolved merge conflict

pull/1/head
ioedeveloper 5 years ago
commit a6eb6bb34a
  1. 5
      package.json
  2. 3
      src/app/panels/terminal.js
  3. 2
      src/app/ui/auto-complete-popup.js
  4. 3
      test-browser/commands/executeScript.js
  5. 30
      test-browser/commands/journalChildIncludes.js
  6. 4
      test-browser/commands/journalLastChild.js
  7. 6
      test-browser/commands/journalLastChildIncludes.js
  8. 17
      test-browser/tests/console.js
  9. 1
      test-browser/tests/gist.js
  10. 1
      test-browser/tests/importFromGist.js
  11. 59
      test-browser/tests/terminal.js

@ -172,14 +172,13 @@
"nightwatch_local_specialFunctions": "nightwatch ./test-browser/tests/specialFunctions.js --config nightwatch.js --env chrome ",
"nightwatch_local_solidityUnittests": "nightwatch ./test-browser/tests/solidityUnittests.js --config nightwatch.js --env chrome ",
"nightwatch_local_remixd": "nightwatch ./test-browser/tests/remixd.js --config nightwatch.js --env chrome ",
"nightwatch_local_console": "nightwatch ./test-browser/tests/console.js --config nightwatch.js --env chrome ",
"nightwatch_local_terminal": "nightwatch ./test-browser/tests/terminal.js --config nightwatch.js --env chrome ",
"nightwatch_local_gist": "nightwatch ./test-browser/tests/gist.js --config nightwatch.js --env chrome ",
"nightwatch_local_importFromGist": "nightwatch ./test-browser/tests/importFromGist.js --config nightwatch.js --env chrome ",
"nightwatch_local_workspace": "nightwatch ./test-browser/tests/workspace.js --config nightwatch.js --env chrome ",
"nightwatch_local_defaultLayout": "nightwatch ./test-browser/tests/defaultLayout.js --config nightwatch.js --env chrome ",
"nightwatch_local_pluginManager": "nightwatch ./test-browser/tests/pluginManager.js --config nightwatch.js --env chrome ",
"nightwatch_local_publishContract": "nightwatch ./test-browser/tests/publishContract.js --config nightwatch.js --env chrome ",
"nightwatch_local_pluginManager": "nightwatch ./test-browser/tests/pluginManager.js --config nightwatch.js --env chrome ",
"nightwatch_local_publishContract": "nightwatch ./test-browser/tests/publishContract.js --config nightwatch.js --env chrome ",
"onchange": "onchange build/app.js -- npm-run-all lint",
"prepublish": "mkdirp build; npm-run-all -ls downloadsolc_root build",
"remixd": "remixd -s ./contracts --remix-ide http://127.0.0.1:8080",

@ -113,13 +113,14 @@ class Terminal extends Plugin {
render () {
var self = this
if (self._view.el) return self._view.el
self._view.journal = yo`<div id="journal" class=${css.journal}></div>`
self._view.journal = yo`<div id="journal" class=${css.journal} data-id="terminalJournal"></div>`
self._view.input = yo`
<span class=${css.input} onload=${() => { this.focus() }} onpaste=${paste} onkeydown=${change}></span>
`
self._view.input.setAttribute('spellcheck', 'false')
self._view.input.setAttribute('contenteditable', 'true')
self._view.input.setAttribute('id', 'terminalCliInput')
self._view.input.setAttribute('data-id', 'terminalCliInput')
self._view.input.innerText = '\n'
self._view.cli = yo`

@ -41,7 +41,7 @@ class AutoCompletePopup {
<div>
${self.data._options.map((item, index) => {
return yo`
<div class="${css.autoCompleteItem} ${css.listHandlerHide} item ${self._selectedElement === index ? 'border border-primary' : ''}">
<div data-id="autoCompletePopUpAutoCompleteItem" class="${css.autoCompleteItem} ${css.listHandlerHide} item ${self._selectedElement === index ? 'border border-primary' : ''}">
<div value=${index} onclick=${(event) => { self.handleSelect(event.srcElement.innerText) }}>
${getKeyOf(item)}
</div>

@ -3,7 +3,8 @@ const EventEmitter = require('events')
class ExecuteScript extends EventEmitter {
command (script) {
this.api
.click('#terminalCli')
.clearValue('span[data-id="terminalCliInput"]')
.click('div[data-id="terminalCli"]')
.keys(script)
.keys(this.api.Keys.ENTER)
.keys(this.api.Keys.ENTER) // that's a bug... sometimes we need to press 2 times to execute a command

@ -0,0 +1,30 @@
const EventEmitter = require('events')
/*
Checks if any child elements of journal (console) contains a matching value.
*/
class JournalChildIncludes extends EventEmitter {
command (val) {
let isTextFound = false
const browser = this.api
this.api.elements('css selector', '*[data-id="terminalJournal"]', (res) => {
res.value.forEach(function (jsonWebElement) {
const jsonWebElementId = jsonWebElement.ELEMENT
browser.elementIdText(jsonWebElementId, (jsonElement) => {
const text = jsonElement.value
if (text.indexOf(val) !== -1) isTextFound = true
})
})
})
browser.perform(() => {
browser.assert.ok(isTextFound, isTextFound ? `<*[data-id="terminalJournal"]> contains ${val}.` : `${val} not found in <*[data-id="terminalJournal"]> div:last-child>`)
this.emit('complete')
})
return this
}
}
module.exports = JournalChildIncludes

@ -3,8 +3,8 @@ const EventEmitter = require('events')
class JournalLastChild extends EventEmitter {
command (val) {
this.api
.waitForElementVisible('#journal > div:last-child', 10000)
.assert.containsText('#journal > div:last-child', val).perform(() => {
.waitForElementVisible('*[data-id="terminalJournal"] > div:last-child', 10000)
.assert.containsText('*[data-id="terminalJournal"] > div:last-child', val).perform(() => {
this.emit('complete')
})
return this

@ -6,11 +6,11 @@ const EventEmitter = require('events')
class JournalLastChildIncludes extends EventEmitter {
command (val) {
this.api
.waitForElementVisible('#journal > div:last-child', 10000)
.getText('#journal > div:last-child', (result) => {
.waitForElementVisible('*[data-id="terminalJournal"] > div:last-child', 10000)
.getText('*[data-id="terminalJournal"] > div:last-child', (result) => {
console.log('JournalLastChildIncludes', result.value)
if (result.value.indexOf(val) === -1) return this.api.assert.fail(`wait for ${val} in ${result.value}`)
else this.api.assert.ok(`<#journal > div:last-child> contains ${val}.`)
else this.api.assert.ok(`<*[data-id="terminalJournal"] > div:last-child> contains ${val}.`)
this.emit('complete')
})
return this

@ -1,17 +0,0 @@
'use strict'
var init = require('../helpers/init')
var sauce = require('./sauce')
module.exports = {
before: function (browser, done) {
init(browser, done)
},
'SimpleExecutionConsole': function (browser) {
browser
.waitForElementVisible('#terminalCli', 10000)
.executeScript('1+1')
.journalLastChild('2')
.end()
},
tearDown: sauce
}

@ -39,5 +39,6 @@ module.exports = {
})
.end()
},
tearDown: sauce
}

@ -11,6 +11,7 @@ module.exports = {
before: function (browser, done) {
init(browser, done)
},
'Load Gist Modal': function (browser) {
browser
.waitForElementVisible('#icon-panel', 10000)

@ -0,0 +1,59 @@
'use strict'
var init = require('../helpers/init')
var sauce = require('./sauce')
module.exports = {
before: function (browser, done) {
init(browser, done, 'http://127.0.0.1:8080?plugins=solidity,udapp', false)
},
'Should execution a simple console command': function (browser) {
browser
.waitForElementVisible('*[data-id="terminalCli"]', 10000)
.executeScript('1+1')
.journalLastChild('2')
},
'Should clear console': function (browser) {
browser
.waitForElementVisible('*[data-id="terminalCli"]')
.journalChildIncludes('Welcome to Remix')
.click('#clearConsole')
.assert.containsText('*[data-id="terminalJournal"]', '')
},
'Should display auto-complete menu': function (browser) {
browser
.waitForElementVisible('*[data-id="terminalCli"]')
.click('*[data-id="terminalCli"]')
.keys('remix.')
.assert.visible('*[data-id="autoCompletePopUpAutoCompleteItem"]')
},
'Should execute remix.help() command': function (browser) {
browser
.waitForElementVisible('*[data-id="terminalCli"]')
.executeScript('remix.help()')
.journalChildIncludes('remix.call(message: {name, key, payload})')
.journalChildIncludes('remix.getFile(path)')
.journalChildIncludes('remix.debug(hash)')
.journalChildIncludes('remix.loadgist(id)')
.journalChildIncludes('remix.loadurl(url)')
.journalChildIncludes('remix.setproviderurl(url)')
.journalChildIncludes('remix.execute(filepath)')
.journalChildIncludes('remix.exeCurrent()')
.journalChildIncludes('remix.help()')
.journalChildIncludes('remix.debugHelp()')
},
'Should execute remix.debugHelp() command': function (browser) {
browser
.waitForElementVisible('*[data-id="terminalCli"]')
.executeScript('remix.debugHelp()')
.journalChildIncludes('Here are some examples of scripts that can be run (using remix.exeCurrent() or directly from the console)')
.journalChildIncludes('Please see https://www.npmjs.com/package/remix-debug for more informations')
.end()
},
tearDown: sauce
}
Loading…
Cancel
Save