Fix ballot test

pull/5370/head
David Disu 3 years ago committed by yann300
parent 63a90a1ef1
commit 09bed14503
  1. 2
      apps/remix-ide-e2e/src/commands/addAtAddressInstance.ts
  2. 3
      apps/remix-ide-e2e/src/commands/clickInstance.ts
  3. 5
      apps/remix-ide-e2e/src/tests/ballot.test.ts
  4. 4
      apps/remix-ide-e2e/src/tests/ballot_0_4_11.test.ts
  5. 4
      apps/remix-ide-e2e/src/tests/gist.test.ts
  6. 12
      libs/remix-lib/src/execution/txRunnerWeb3.ts
  7. 2
      libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx

@ -19,7 +19,7 @@ function addInstance (browser: NightwatchBrowser, address: string, isValidFormat
else { else {
browser.click('button[id^="runAndDeployAtAdressButton"]') browser.click('button[id^="runAndDeployAtAdressButton"]')
.execute(function () { .execute(function () {
const modal = document.querySelector('#modal-footer-ok') as HTMLElement const modal = document.querySelector('[data-id="fileSystem-modal-footer-ok-react"]') as HTMLElement
modal.click() modal.click()
}) })
} }

@ -3,8 +3,7 @@ import EventEmitter from 'events'
class ClickInstance extends EventEmitter { class ClickInstance extends EventEmitter {
command (this: NightwatchBrowser, index: number): NightwatchBrowser { command (this: NightwatchBrowser, index: number): NightwatchBrowser {
index = index + 2 const selector = `[data-id="universalDappUiTitleExpander${index}"]`
const selector = '.instance:nth-of-type(' + index + ') > div > button'
this.api.waitForElementPresent(selector).waitForElementContainsText(selector, '', 60000).scrollAndClick(selector).perform(() => { this.emit('complete') }) this.api.waitForElementPresent(selector).waitForElementContainsText(selector, '', 60000).scrollAndClick(selector).perform(() => { this.emit('complete') })
return this return this

@ -25,7 +25,7 @@ module.exports = {
.setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000)
.click('*[data-id="universalDappUiTitleExpander"]') .clickInstance(0)
.clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' })
.testFunction('last', .testFunction('last',
{ {
@ -70,7 +70,7 @@ module.exports = {
.addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3A', true, true) .addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3A', true, true)
.pause(500) .pause(500)
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000)
.click('*[data-id="universalDappUiTitleExpander"]') .clickInstance(0)
.clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' })
.testFunction('last', .testFunction('last',
{ {
@ -95,6 +95,7 @@ module.exports = {
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.pause(2000) .pause(2000)
.clearValue('input[placeholder="bytes32[] proposalNames"]')
.setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.clickInstance(0) .clickInstance(0)

@ -33,7 +33,7 @@ module.exports = {
.setValue('input[placeholder="uint8 _numProposals"]', '2') .setValue('input[placeholder="uint8 _numProposals"]', '2')
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000)
.click('*[data-id="universalDappUiTitleExpander"]') .clickInstance(0)
.clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' })
.testFunction('last', .testFunction('last',
{ {
@ -65,7 +65,7 @@ module.exports = {
.addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3A', true, true) .addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3A', true, true)
.pause(500) .pause(500)
.waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000)
.click('*[data-id="universalDappUiTitleExpander"]') .clickInstance(0)
.clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' })
.testFunction('last', .testFunction('last',
{ {

@ -135,9 +135,9 @@ module.exports = {
.clickLaunchIcon('filePanel') .clickLaunchIcon('filePanel')
.scrollAndClick('*[data-id="landingPageImportFromGistButton"]') .scrollAndClick('*[data-id="landingPageImportFromGistButton"]')
.waitForElementVisible('*[data-id="gisthandlerModalDialogModalBody-react"] input[data-id="modalDialogCustomPromp"]') .waitForElementVisible('*[data-id="gisthandlerModalDialogModalBody-react"] input[data-id="modalDialogCustomPromp"]')
.execute(() => { .execute(function () {
(document.querySelector('*[data-id="gisthandlerModalDialogModalBody-react"] input[data-id="modalDialogCustomPromp"]') as any).focus() (document.querySelector('*[data-id="gisthandlerModalDialogModalBody-react"] input[data-id="modalDialogCustomPromp"]') as any).focus()
}, [], () => {}) })
.setValue('*[data-id="gisthandlerModalDialogModalBody-react"] input[data-id="modalDialogCustomPromp"]', testData.validGistId) .setValue('*[data-id="gisthandlerModalDialogModalBody-react"] input[data-id="modalDialogCustomPromp"]', testData.validGistId)
.modalFooterOKClick('gisthandler') .modalFooterOKClick('gisthandler')
.openFile(`gist-${testData.validGistId}/README.txt`) .openFile(`gist-${testData.validGistId}/README.txt`)

@ -16,7 +16,6 @@ export class TxRunnerWeb3 {
} }
_executeTx (tx, network, txFee, api, promptCb, callback) { _executeTx (tx, network, txFee, api, promptCb, callback) {
console.log('tx: ', tx)
if (network && network.lastBlock && network.lastBlock.baseFeePerGas) { if (network && network.lastBlock && network.lastBlock.baseFeePerGas) {
// the sending stack (web3.js / metamask need to have the type defined) // the sending stack (web3.js / metamask need to have the type defined)
// this is to avoid the following issue: https://github.com/MetaMask/metamask-extension/issues/11824 // this is to avoid the following issue: https://github.com/MetaMask/metamask-extension/issues/11824
@ -58,7 +57,6 @@ export class TxRunnerWeb3 {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const receipt = await tryTillReceiptAvailable(resp, this.getWeb3()) const receipt = await tryTillReceiptAvailable(resp, this.getWeb3())
tx = await tryTillTxAvailable(resp, this.getWeb3()) tx = await tryTillTxAvailable(resp, this.getWeb3())
console.log(receipt, tx, receipt['transactionHash'])
resolve({ resolve({
receipt, receipt,
tx, tx,
@ -82,9 +80,6 @@ export class TxRunnerWeb3 {
data = '0x' + data data = '0x' + data
} }
console.log('data: ', data)
console.log('args: ', args)
return this.runInNode(args.from, args.to, data, args.value, args.gasLimit, args.useCall, args.timestamp, confirmationCb, gasEstimationForceSend, promptCb, callback) return this.runInNode(args.from, args.to, data, args.value, args.gasLimit, args.useCall, args.timestamp, confirmationCb, gasEstimationForceSend, promptCb, callback)
} }
@ -117,17 +112,10 @@ export class TxRunnerWeb3 {
} }
if (this._api.config.getUnpersistedProperty('doNotShowTransactionConfirmationAgain')) { if (this._api.config.getUnpersistedProperty('doNotShowTransactionConfirmationAgain')) {
console.log('tx: ', tx)
console.log('network: ', network)
console.log('this._api: ', this._api)
return this._executeTx(tx, network, null, this._api, promptCb, callback) return this._executeTx(tx, network, null, this._api, promptCb, callback)
} }
confirmCb(network, tx, tx['gas'], (txFee) => { confirmCb(network, tx, tx['gas'], (txFee) => {
console.log('tx: ', tx)
console.log('network: ', network)
console.log('txFee: ', txFee)
console.log('this._api: ', this._api)
return this._executeTx(tx, network, txFee, this._api, promptCb, callback) return this._executeTx(tx, network, txFee, this._api, promptCb, callback)
}, (error) => { }, (error) => {
callback(error) callback(error)

@ -204,7 +204,7 @@ export function UniversalDappUI (props: UdappProps) {
return ( return (
<div className={`instance udapp_instance udapp_run-instance border-dark ${toggleExpander ? 'udapp_hidesub' : 'bg-light'}`} id={`instance${address}`} data-shared="universalDappUiInstance"> <div className={`instance udapp_instance udapp_run-instance border-dark ${toggleExpander ? 'udapp_hidesub' : 'bg-light'}`} id={`instance${address}`} data-shared="universalDappUiInstance">
<div className="udapp_title alert alert-secondary"> <div className="udapp_title alert alert-secondary">
<button data-id="universalDappUiTitleExpander" className="btn udapp_titleExpander" onClick={toggleClass}> <button data-id={`universalDappUiTitleExpander${props.index}`} className="btn udapp_titleExpander" onClick={toggleClass}>
<i className={`fas ${toggleExpander ? 'fa-angle-right' : 'fa-angle-down'}`} aria-hidden="true"></i> <i className={`fas ${toggleExpander ? 'fa-angle-right' : 'fa-angle-down'}`} aria-hidden="true"></i>
</button> </button>
<div className="input-group udapp_nameNbuts"> <div className="input-group udapp_nameNbuts">

Loading…
Cancel
Save