diff --git a/test-browser/commands/modalFooterCancelClick.js b/test-browser/commands/modalFooterCancelClick.js new file mode 100644 index 0000000000..86adbc63b3 --- /dev/null +++ b/test-browser/commands/modalFooterCancelClick.js @@ -0,0 +1,17 @@ +const EventEmitter = require('events') + +class ModalFooterOKClick extends EventEmitter { + command () { + this.api.waitForElementVisible('#modal-footer-cancel').perform((client, done) => { + this.api.execute(function () { + document.querySelector('#modal-footer-cancel').click() + }, [], (result) => { + done() + this.emit('complete') + }) + }) + return this + } +} + +module.exports = ModalFooterOKClick diff --git a/test-browser/commands/modalFooterClick.js b/test-browser/commands/modalFooterClick.js deleted file mode 100644 index 132f70c905..0000000000 --- a/test-browser/commands/modalFooterClick.js +++ /dev/null @@ -1,17 +0,0 @@ -const EventEmitter = require('events') - -class ModalFooterClick extends EventEmitter { - command (cssSelector) { - this.api.waitForElementVisible(cssSelector).perform((client, done) => { - this.api.execute(function () { - document.querySelector(cssSelector).click() - }, [], (result) => { - done() - this.emit('complete') - }) - }) - return this - } -} - -module.exports = ModalFooterClick diff --git a/test-browser/commands/modalFooterOKClick.js b/test-browser/commands/modalFooterOKClick.js new file mode 100644 index 0000000000..b6c0db5b7c --- /dev/null +++ b/test-browser/commands/modalFooterOKClick.js @@ -0,0 +1,17 @@ +const EventEmitter = require('events') + +class ModalFooterOKClick extends EventEmitter { + command () { + this.api.waitForElementVisible('#modal-footer-ok').perform((client, done) => { + this.api.execute(function () { + document.querySelector('#modal-footer-ok').click() + }, [], (result) => { + done() + this.emit('complete') + }) + }) + return this + } +} + +module.exports = ModalFooterOKClick diff --git a/test-browser/tests/ballot.js b/test-browser/tests/ballot.js index e0c3cd0160..061f52bc42 100644 --- a/test-browser/tests/ballot.js +++ b/test-browser/tests/ballot.js @@ -60,7 +60,7 @@ module.exports = { 'Deploy and use Ballot using external web3': function (browser) { browser .click('#selectExEnvOptions #web3-mode') - .modalFooterClick('#modal-footer-ok') + .modalFooterOKClick() .clickLaunchIcon('solidity') .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .clickLaunchIcon('udapp') diff --git a/test-browser/tests/gist.js b/test-browser/tests/gist.js index b2217d750a..24761f9803 100644 --- a/test-browser/tests/gist.js +++ b/test-browser/tests/gist.js @@ -23,7 +23,7 @@ module.exports = { .waitForElementVisible('#icon-panel', 10000) .clickLaunchIcon('fileExplorers') .click('#publishToGist') - .modalFooterClick('#modal-footer-ok') + .modalFooterOKClick() .getModalBody((value, done) => { const reg = /gist.github.com\/([^.]+)/ const id = value.match(reg) @@ -33,7 +33,7 @@ module.exports = { } else { let gistid = id[1] browser - .modalFooterClick('#modal-footer-cancel') + .modalFooterCancelClick() .executeScript(`remix.loadgist('${gistid}')`) .switchFile('browser/gists') .switchFile(`browser/gists/${gistid}`) @@ -44,8 +44,8 @@ module.exports = { }, 'Load Gist Modal': function (browser) { browser - .waitForElementVisible('#icon-panel', 10000) - .clickLaunchIcon('fileExplorers') + .waitForElementVisible('#icon-panel') + .clickLaunchIcon('home') .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') .waitForElementVisible('h6.modal-title') .assert.containsText('h6.modal-title', 'Load a Gist') @@ -62,10 +62,10 @@ module.exports = { .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') .waitForElementVisible('#prompt_text') .setValue('#prompt_text', testData.invalidGistId) - .modalFooterClick('#modal-footer-ok') + .modalFooterOKClick() .waitForElementVisible('div.modal-body > div') .assert.containsText('div.modal-body > div', 'Gist load error: Not Found') - .modalFooterClick('#modal-footer-ok') + .modalFooterOKClick() }, 'Import From Gist For Valid Gist ID': function (browser) { @@ -75,7 +75,7 @@ module.exports = { .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') .waitForElementVisible('#prompt_text') .setValue('#prompt_text', testData.validGistId) - .modalFooterClick('#modal-footer-ok') + .modalFooterOKClick() .switchFile(`browser/gists/${testData.validGistId}`) .switchFile(`browser/gists/${testData.validGistId}/ApplicationRegistry`) .waitForElementVisible(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry']`) diff --git a/test-browser/tests/publishContract.js b/test-browser/tests/publishContract.js index 1722790ee2..9636d990a9 100644 --- a/test-browser/tests/publishContract.js +++ b/test-browser/tests/publishContract.js @@ -21,7 +21,7 @@ module.exports = { if (value.indexOf('dweb:/ipfs') === -1) browser.assert.fail('ipfs deploy failed', '', '') done() }) - .modalFooterClick('#modal-footer-ok') + .modalFooterOKClick() }, 'Publish on Swarm': function (browser) { browser diff --git a/test-browser/tests/recorder.js b/test-browser/tests/recorder.js index 260dc026e7..66d5da1cca 100644 --- a/test-browser/tests/recorder.js +++ b/test-browser/tests/recorder.js @@ -38,7 +38,7 @@ module.exports = { .click('.instance:nth-of-type(2) > div > button') .clickFunction('set - transact (not payable)', {types: 'uint256 _p', values: '34'}) .click('i.savetransaction') - .modalFooterClick('#modal-footer-ok') + .modalFooterOKClick() .getEditorValue(function (result) { var parsed = JSON.parse(result) browser.assert.equal(JSON.stringify(parsed.transactions[0].record.parameters), JSON.stringify(scenario.transactions[0].record.parameters))