remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/test-browser/commands/addAtAddressInstance.js

34 lines
1.1 KiB

const EventEmitter = require('events')
class addAtAddressInstance extends EventEmitter {
command (address, isValidFormat, isValidChecksum) {
this.api.perform((done) => {
addInstance(this.api, address, isValidFormat, isValidChecksum, () => {
done()
this.emit('complete')
})
})
return this
}
}
function addInstance (browser, address, isValidFormat, isValidChecksum, callback) {
browser.clickLaunchIcon('udapp').clearValue('.ataddressinput').setValue('.ataddressinput', address, function () {
browser.click('button[id^="runAndDeployAtAdressButton"]')
.execute(function () {
var ret = document.querySelector('div[class^="modal-body"] div').innerHTML
document.querySelector('#modal-footer-ok').click()
return ret
}, [], function (result) {
if (!isValidFormat) {
browser.assert.equal(result.value, 'Invalid address.')
} else if (!isValidChecksum) {
browser.assert.equal(result.value, 'Invalid checksum address.')
}
callback()
})
})
}
module.exports = addAtAddressInstance