diff --git a/package.json b/package.json index 58d8473d26..e41886cd83 100644 --- a/package.json +++ b/package.json @@ -172,7 +172,7 @@ "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/console.js --config nightwatch.js --env chrome ", "nightwatch_local_gist": "nightwatch ./test-browser/tests/gist.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 ", diff --git a/test-browser/commands/modalFooterCancelClick.js b/test-browser/commands/modalFooterCancelClick.js deleted file mode 100644 index 86adbc63b3..0000000000 --- a/test-browser/commands/modalFooterCancelClick.js +++ /dev/null @@ -1,17 +0,0 @@ -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 new file mode 100644 index 0000000000..132f70c905 --- /dev/null +++ b/test-browser/commands/modalFooterClick.js @@ -0,0 +1,17 @@ +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 deleted file mode 100644 index b6c0db5b7c..0000000000 --- a/test-browser/commands/modalFooterOKClick.js +++ /dev/null @@ -1,17 +0,0 @@ -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 061f52bc42..e0c3cd0160 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') - .modalFooterOKClick() + .modalFooterClick('#modal-footer-ok') .clickLaunchIcon('solidity') .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .clickLaunchIcon('udapp') diff --git a/test-browser/tests/console.js b/test-browser/tests/console.js deleted file mode 100644 index 5a31c9dcad..0000000000 --- a/test-browser/tests/console.js +++ /dev/null @@ -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 -} diff --git a/test-browser/tests/gist.js b/test-browser/tests/gist.js index 0e75718373..b2217d750a 100644 --- a/test-browser/tests/gist.js +++ b/test-browser/tests/gist.js @@ -1,6 +1,10 @@ 'use strict' const init = require('../helpers/init') const sauce = require('./sauce') +const testData = { + validGistId: '1859c97c6e1efc91047d725d5225888e', + invalidGistId: '6368b389f9302v32902msk2402' +} // 99266d6da54cc12f37f11586e8171546c7700d67 module.exports = { @@ -19,7 +23,7 @@ module.exports = { .waitForElementVisible('#icon-panel', 10000) .clickLaunchIcon('fileExplorers') .click('#publishToGist') - .modalFooterOKClick() + .modalFooterClick('#modal-footer-ok') .getModalBody((value, done) => { const reg = /gist.github.com\/([^.]+)/ const id = value.match(reg) @@ -29,7 +33,7 @@ module.exports = { } else { let gistid = id[1] browser - .modalFooterCancelClick() + .modalFooterClick('#modal-footer-cancel') .executeScript(`remix.loadgist('${gistid}')`) .switchFile('browser/gists') .switchFile(`browser/gists/${gistid}`) @@ -37,6 +41,45 @@ module.exports = { .perform(done) } }) + }, + 'Load Gist Modal': function (browser) { + browser + .waitForElementVisible('#icon-panel', 10000) + .clickLaunchIcon('fileExplorers') + .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') + .waitForElementVisible('h6.modal-title') + .assert.containsText('h6.modal-title', 'Load a Gist') + .waitForElementVisible('div.modal-body > div') + .assert.containsText('div.modal-body > div', 'Enter the ID of the Gist or URL you would like to load.') + .waitForElementVisible('#prompt_text') + .click('#modal-footer-cancel') + }, + + 'Display Error Message For Invalid Gist ID': function (browser) { + browser + .waitForElementVisible('#icon-panel', 10000) + .clickLaunchIcon('fileExplorers') + .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') + .waitForElementVisible('#prompt_text') + .setValue('#prompt_text', testData.invalidGistId) + .modalFooterClick('#modal-footer-ok') + .waitForElementVisible('div.modal-body > div') + .assert.containsText('div.modal-body > div', 'Gist load error: Not Found') + .modalFooterClick('#modal-footer-ok') + }, + + 'Import From Gist For Valid Gist ID': function (browser) { + browser + .waitForElementVisible('#icon-panel', 10000) + .clickLaunchIcon('fileExplorers') + .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') + .waitForElementVisible('#prompt_text') + .setValue('#prompt_text', testData.validGistId) + .modalFooterClick('#modal-footer-ok') + .switchFile(`browser/gists/${testData.validGistId}`) + .switchFile(`browser/gists/${testData.validGistId}/ApplicationRegistry`) + .waitForElementVisible(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry']`) + .assert.containsText(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry'] > span`, 'ApplicationRegistry') .end() }, tearDown: sauce diff --git a/test-browser/tests/importFromGist.js b/test-browser/tests/importFromGist.js deleted file mode 100644 index 9099495830..0000000000 --- a/test-browser/tests/importFromGist.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict' -const init = require('../helpers/init') -const sauce = require('./sauce') - -const testData = { - validGistId: '1859c97c6e1efc91047d725d5225888e', - invalidGistId: '6368b389f9302v32902msk2402' -} - -module.exports = { - before: function (browser, done) { - init(browser, done) - }, - 'Load Gist Modal': function (browser) { - browser - .waitForElementVisible('#icon-panel', 10000) - .clickLaunchIcon('fileExplorers') - .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') - .waitForElementVisible('h6.modal-title') - .assert.containsText('h6.modal-title', 'Load a Gist') - .waitForElementVisible('div.modal-body > div') - .assert.containsText('div.modal-body > div', 'Enter the ID of the Gist or URL you would like to load.') - .waitForElementVisible('#prompt_text') - .click('#modal-footer-cancel') - }, - - 'Display Error Message For Invalid Gist ID': function (browser) { - browser - .waitForElementVisible('#icon-panel', 10000) - .clickLaunchIcon('fileExplorers') - .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') - .waitForElementVisible('#prompt_text') - .setValue('#prompt_text', testData.invalidGistId) - .modalFooterOKClick() - .waitForElementVisible('div.modal-body > div') - .assert.containsText('div.modal-body > div', 'Gist load error: Not Found') - .modalFooterOKClick() - }, - - 'Import From Gist For Valid Gist ID': function (browser) { - browser - .waitForElementVisible('#icon-panel', 10000) - .clickLaunchIcon('fileExplorers') - .scrollAndClick('div.file > div.btn-group > button:nth-child(1)') - .waitForElementVisible('#prompt_text') - .setValue('#prompt_text', testData.validGistId) - .modalFooterOKClick() - .switchFile(`browser/gists/${testData.validGistId}`) - .switchFile(`browser/gists/${testData.validGistId}/ApplicationRegistry`) - .waitForElementVisible(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry']`) - .assert.containsText(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry'] > span`, 'ApplicationRegistry') - .end() - }, - - tearDown: sauce -} diff --git a/test-browser/tests/publishContract.js b/test-browser/tests/publishContract.js index 9636d990a9..1722790ee2 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() }) - .modalFooterOKClick() + .modalFooterClick('#modal-footer-ok') }, 'Publish on Swarm': function (browser) { browser diff --git a/test-browser/tests/recorder.js b/test-browser/tests/recorder.js index 66d5da1cca..260dc026e7 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') - .modalFooterOKClick() + .modalFooterClick('#modal-footer-ok') .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)) diff --git a/test-browser/tests/terminal.js b/test-browser/tests/terminal.js index e69de29bb2..5a31c9dcad 100644 --- a/test-browser/tests/terminal.js +++ b/test-browser/tests/terminal.js @@ -0,0 +1,17 @@ +'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 +}