-
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 #1961 from ethereum/refactorBrowserTest
Refactor browser test
- Loading branch information
Showing
22 changed files
with
222 additions
and
248 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,3 @@ | ||
{ | ||
"plugins": ["fast-async", | ||
"check-es2015-constants", | ||
"transform-es2015-arrow-functions", | ||
"transform-es2015-block-scoped-functions", | ||
"transform-es2015-block-scoping", | ||
"transform-es2015-classes", | ||
"transform-es2015-computed-properties", | ||
"transform-es2015-destructuring", | ||
"transform-object-rest-spread", | ||
"transform-es2015-duplicate-keys", | ||
"transform-es2015-for-of", | ||
"transform-es2015-function-name", | ||
"transform-es2015-literals", | ||
"transform-es2015-object-super", | ||
"transform-es2015-parameters", | ||
"transform-es2015-shorthand-properties", | ||
"transform-es2015-spread", | ||
"transform-es2015-sticky-regex", | ||
"transform-es2015-unicode-regex", | ||
"transform-object-assign", | ||
] | ||
} | ||
"presets": ["@babel/preset-env"] | ||
} |
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
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,25 @@ | ||
const EventEmitter = require('events') | ||
|
||
class ClickFunction extends EventEmitter { | ||
command (fnFullName, expectedInput) { | ||
this.api.waitForElementPresent('.instance button[title="' + fnFullName + '"]') | ||
.perform(function (client, done) { | ||
client.execute(function () { | ||
document.querySelector('#runTabView').scrollTop = document.querySelector('#runTabView').scrollHeight | ||
}, [], function () { | ||
if (expectedInput) { | ||
client.setValue('#runTabView input[title="' + expectedInput.types + '"]', expectedInput.values, function () {}) | ||
} | ||
done() | ||
}) | ||
}) | ||
.click('.instance button[title="' + fnFullName + '"]') | ||
.pause(500) | ||
.perform(() => { | ||
this.emit('complete') | ||
}) | ||
return this | ||
} | ||
} | ||
|
||
module.exports = ClickFunction |
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,12 @@ | ||
const EventEmitter = require('events') | ||
|
||
class ClickLaunchIcon extends EventEmitter { | ||
command (icon) { | ||
this.api.click('#icon-panel div[plugin="' + icon + '"]').perform(() => { | ||
this.emit('complete') | ||
}) | ||
return this | ||
} | ||
} | ||
|
||
module.exports = ClickLaunchIcon |
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,18 @@ | ||
const EventEmitter = require('events') | ||
|
||
class GetEditorValue extends EventEmitter { | ||
command (callback) { | ||
this.api.perform((client, done) => { | ||
this.api.execute(function (value) { | ||
return document.getElementById('input').editor.getValue() | ||
}, [], (result) => { | ||
done(result.value) | ||
callback(result.value) | ||
this.emit('complete') | ||
}) | ||
}) | ||
return this | ||
} | ||
} | ||
|
||
module.exports = GetEditorValue |
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,17 @@ | ||
const EventEmitter = require('events') | ||
|
||
class ModalFooterOKClick extends EventEmitter { | ||
command () { | ||
this.api.perform((client, done) => { | ||
this.api.execute(function () { | ||
document.querySelector('#modal-footer-ok').click() | ||
}, [], (result) => { | ||
done() | ||
this.emit('complete') | ||
}) | ||
}) | ||
return this | ||
} | ||
} | ||
|
||
module.exports = ModalFooterOKClick |
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,23 @@ | ||
const EventEmitter = require('events') | ||
|
||
class ScrollInto extends EventEmitter { | ||
command (target) { | ||
this.api.perform((client, done) => { | ||
_scrollInto(this.api, target, () => { | ||
done() | ||
this.emit('complete') | ||
}) | ||
}) | ||
return this | ||
} | ||
} | ||
|
||
function _scrollInto (browser, target, cb) { | ||
browser.execute(function (target) { | ||
document.querySelector(target).scrollIntoView() | ||
}, [target], function () { | ||
cb() | ||
}) | ||
} | ||
|
||
module.exports = ScrollInto |
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,20 @@ | ||
const EventEmitter = require('events') | ||
|
||
class SetEditorValue extends EventEmitter { | ||
command (value, callback) { | ||
this.api.perform((client, done) => { | ||
this.api.execute(function (value) { | ||
document.getElementById('input').editor.session.setValue(value) | ||
}, [value], (result) => { | ||
done() | ||
if (callback) { | ||
callback.call(this.api) | ||
} | ||
this.emit('complete') | ||
}) | ||
}) | ||
return this | ||
} | ||
} | ||
|
||
module.exports = SetEditorValue |
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,14 @@ | ||
const EventEmitter = require('events') | ||
|
||
class TestEditorValue extends EventEmitter { | ||
command (testvalue, callback) { | ||
this.api.getEditorValue((value) => { | ||
this.api.assert.equal(testvalue, value) | ||
callback() | ||
this.emit('complete') | ||
}) | ||
return this | ||
} | ||
} | ||
|
||
module.exports = TestEditorValue |
Oops, something went wrong.