diff --git a/apps/remix-ide-e2e/src/tests/pluginManager.test.ts b/apps/remix-ide-e2e/src/tests/pluginManager.test.ts index bd3225535b..037b24e168 100644 --- a/apps/remix-ide-e2e/src/tests/pluginManager.test.ts +++ b/apps/remix-ide-e2e/src/tests/pluginManager.test.ts @@ -150,5 +150,6 @@ module.exports = { }) .end() }, + tearDown: sauce } diff --git a/apps/remix-ide-e2e/src/tests/publishContract.test.ts b/apps/remix-ide-e2e/src/tests/publishContract.test.ts new file mode 100644 index 0000000000..2be4ac981d --- /dev/null +++ b/apps/remix-ide-e2e/src/tests/publishContract.test.ts @@ -0,0 +1,66 @@ +'use strict' +import { NightwatchBrowser } from "nightwatch" +import init from '../helpers/init' +import sauce from './sauce' + +module.exports = { + before: function (browser: NightwatchBrowser, done: VoidFunction) { + init(browser, done) + }, + + '@sources': function () { + return [] + }, + + 'Publish on IPFS': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('#icon-panel', 10000) + .clickLaunchIcon('fileExplorers') + .openFile('browser/3_Ballot.sol') + .verifyContracts(['Ballot']) + .click('#publishOnIpfs') + .getModalBody((value, done) => { + if (value.indexOf('Metadata of "ballot" was published successfully.') === -1) browser.assert.fail('ipfs deploy failed', '', '') + if (value.indexOf('dweb:/ipfs') === -1) browser.assert.fail('ipfs deploy failed', '', '') + done() + }) + .modalFooterOKClick() + }, + + 'Publish on Swarm': '' + function (browser: NightwatchBrowser) { + browser + .click('#publishOnSwarm') + .getModalBody((value, done) => { + if (value.indexOf('Metadata of "ballot" was successfully.') === -1) browser.assert.fail('swarm deploy failed', '', '') + if (value.indexOf('bzz') === -1) browser.assert.fail('swarm deploy failed', '', '') + done() + }) + .modalFooterOKClick() + }, + + 'Should publish contract metadata to ipfs on deploy': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('#icon-panel') + .clickLaunchIcon('fileExplorers') + .openFile('browser/1_Storage.sol') + .clickLaunchIcon('udapp') + .waitForElementVisible('*[data-id="contractDropdownIpfsCheckbox"]') + .click('*[data-id="contractDropdownIpfsCheckbox"]') + .click('*[data-id="Deploy - transact (not payable)"]') + .pause(5000) + .assert.containsText('*[data-id="modalDialogModalBody"]', 'Metadata of "storage" was published successfully.') + .modalFooterOKClick() + }, + + 'Should remember choice after page refresh': function (browser: NightwatchBrowser) { + browser + .refresh() + .openFile('browser/1_Storage.sol') + .clickLaunchIcon('udapp') + .waitForElementVisible('*[data-id="contractDropdownIpfsCheckbox"]') + .verify.elementPresent('*[data-id="contractDropdownIpfsCheckbox"]:checked') + .end() + }, + + tearDown: sauce +}