Merge pull request #2767 from ethereum/ipfs-checkbox

Ipfs Checkbox Fix & E2E Tests
pull/1/head
yann300 5 years ago committed by GitHub
commit 012bc7ed38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/app/tabs/runTab/contractDropdown.js
  2. 23
      test-browser/tests/publishContract.js

@ -71,7 +71,7 @@ class ContractDropdownUI {
setCheckedState (value) { setCheckedState (value) {
value = value === 'true' ? true : value === 'false' ? false : value value = value === 'true' ? true : value === 'false' ? false : value
this.ipfsCheckedState = value this.ipfsCheckedState = value
document.getElementById('deployAndRunPublishToIPFS').checked = value if (this.ipfsCheckbox) this.ipfsCheckbox.checked = value
} }
toggleCheckedState () { toggleCheckedState () {
@ -92,13 +92,13 @@ class ContractDropdownUI {
const savedConfig = window.localStorage.getItem(`ipfs/${this.exEnvironment}/${this.networkName}`) const savedConfig = window.localStorage.getItem(`ipfs/${this.exEnvironment}/${this.networkName}`)
this.ipfsCheckedState = savedConfig === 'true' ? true : false // eslint-disable-line this.ipfsCheckedState = savedConfig === 'true' ? true : false // eslint-disable-line
const ipfsCheckbox = this.ipfsCheckedState === true this.ipfsCheckbox = this.ipfsCheckedState === true
? yo`<input id="deployAndRunPublishToIPFS" class="mr-2" checked type="checkbox" onchange=${this.toggleCheckedState.bind(this)} >` ? yo`<input id="deployAndRunPublishToIPFS" data-id="contractDropdownIpfsCheckbox" class="mr-2" checked type="checkbox" onchange=${this.toggleCheckedState.bind(this)} >`
: yo`<input id="deployAndRunPublishToIPFS" class="mr-2" type="checkbox" onchange=${this.toggleCheckedState.bind(this)} >` : yo`<input id="deployAndRunPublishToIPFS" data-id="contractDropdownIpfsCheckbox" class="mr-2" type="checkbox" onchange=${this.toggleCheckedState.bind(this)} >`
this.deployCheckBox = yo` this.deployCheckBox = yo`
<div class="mt-2 d-flex align-items-start"> <div class="mt-2 d-flex align-items-start">
${ipfsCheckbox} ${this.ipfsCheckbox}
<label <label
for="deployAndRunPublishToIPFS" for="deployAndRunPublishToIPFS"
class="p-0 m-0" class="p-0 m-0"

@ -22,7 +22,6 @@ module.exports = {
done() done()
}) })
.modalFooterOKClick() .modalFooterOKClick()
.end()
}, },
'Publish on Swarm': '' + function (browser) { 'Publish on Swarm': '' + function (browser) {
browser browser
@ -32,6 +31,28 @@ module.exports = {
if (value.indexOf('bzz') === -1) browser.assert.fail('swarm deploy failed', '', '') if (value.indexOf('bzz') === -1) browser.assert.fail('swarm deploy failed', '', '')
done() done()
}) })
.modalFooterOKClick()
},
'Should publish contract metadata to ipfs on deploy': function (browser) {
browser
.waitForElementVisible('#icon-panel')
.clickLaunchIcon('fileExplorers')
.switchFile('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) {
browser
.refresh()
.switchFile('browser/1_Storage.sol')
.clickLaunchIcon('udapp')
.waitForElementVisible('*[data-id="contractDropdownIpfsCheckbox"]')
.verify.elementPresent('*[data-id="contractDropdownIpfsCheckbox"]:checked')
.end() .end()
}, },
tearDown: sauce tearDown: sauce

Loading…
Cancel
Save