-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2593 from ethereum/terminal-e2e-tests
Terminal e2e tests
- Loading branch information
Showing
11 changed files
with
103 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,5 +39,6 @@ module.exports = { | |
}) | ||
.end() | ||
}, | ||
|
||
tearDown: sauce | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |