diff --git a/apps/remix-ide-e2e/src/commands/waitForElementNotContainsText.ts b/apps/remix-ide-e2e/src/commands/waitForElementNotContainsText.ts new file mode 100644 index 0000000000..8f4696c431 --- /dev/null +++ b/apps/remix-ide-e2e/src/commands/waitForElementNotContainsText.ts @@ -0,0 +1,28 @@ +import { NightwatchBrowser } from 'nightwatch' +import EventEmitter from 'events' + +class waitForElementNotContainsText extends EventEmitter { + command (this: NightwatchBrowser, id: string, value: string, timeout = 10000): NightwatchBrowser { + let waitId // eslint-disable-line + let currentValue + const runid = setInterval(() => { + this.api.getText(id, (result) => { + currentValue = result.value + if (typeof result.value === 'string' && result.value.indexOf(value) !== -1) { + clearInterval(runid) + clearTimeout(waitId) + this.api.assert.ok(false, `WaitForElementContainsText ${id} contains ${value} . It should not`) + this.emit('complete') + } + }) + }, 200) + + waitId = setTimeout(() => { + clearInterval(runid) + this.api.assert.ok(true, `"${value}" wasn't found.`) + }, timeout) + return this + } +} + +module.exports = waitForElementNotContainsText diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index a611600e30..c0b6b52c25 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -356,6 +356,8 @@ module.exports = { }) .useCss() .waitForElementContainsText('*[data-id="terminalJournal"]', 'test running free function', 120000) + .waitForElementNotContainsText('*[data-id="terminalJournal"]', `test running free function + test running free function`, 2000) } } diff --git a/apps/remix-ide-e2e/src/types/index.d.ts b/apps/remix-ide-e2e/src/types/index.d.ts index 4c356ca76f..ada7b9cca9 100644 --- a/apps/remix-ide-e2e/src/types/index.d.ts +++ b/apps/remix-ide-e2e/src/types/index.d.ts @@ -69,6 +69,7 @@ declare module 'nightwatch' { switchWorkspace: (workspaceName: string) => NightwatchBrowser switchEnvironment: (provider: string) => NightwatchBrowser connectToExternalHttpProvider: (url: string, identifier: string) => NightwatchBrowser + waitForElementNotContainsText: (id: string, value: string, timeout: number = 10000) => NightwatchBrowser } export interface NightwatchBrowser { diff --git a/apps/remix-ide/src/app/plugins/solidity-script.tsx b/apps/remix-ide/src/app/plugins/solidity-script.tsx index 4da5425a34..36a287689e 100644 --- a/apps/remix-ide/src/app/plugins/solidity-script.tsx +++ b/apps/remix-ide/src/app/plugins/solidity-script.tsx @@ -73,13 +73,13 @@ export class SolidityScript extends Plugin { from: accounts[0], data: bytecode } - const receipt = await web3.eth.sendTransaction(tx) + const receipt = await web3.eth.sendTransaction(tx, null, { checkRevertBeforeSending: false, ignoreGasPricing: true }) tx = { from: accounts[0], to: receipt.contractAddress, data: '0x69d4394b' // function remixRun() public } - const receiptCall = await web3.eth.sendTransaction(tx) + const receiptCall = await web3.eth.sendTransaction(tx, null, { checkRevertBeforeSending: false, ignoreGasPricing: true }) const hhlogs = await web3.remix.getHHLogsForTx(receiptCall.transactionHash) diff --git a/apps/remix-ide/src/blockchain/execution-context.js b/apps/remix-ide/src/blockchain/execution-context.js index 7a37c0aac6..7c33bb4f27 100644 --- a/apps/remix-ide/src/blockchain/execution-context.js +++ b/apps/remix-ide/src/blockchain/execution-context.js @@ -7,7 +7,7 @@ const _paq = window._paq = window._paq || [] let web3 -const config = { defaultTransactionType: '0x0', ignoreGasPricing: true } +const config = { defaultTransactionType: '0x0' } if (typeof window !== 'undefined' && typeof window.ethereum !== 'undefined') { var injectedProvider = window.ethereum web3 = new Web3(injectedProvider) diff --git a/apps/remix-ide/src/blockchain/providers/vm.ts b/apps/remix-ide/src/blockchain/providers/vm.ts index 913bfad2a8..3ae7f6a154 100644 --- a/apps/remix-ide/src/blockchain/providers/vm.ts +++ b/apps/remix-ide/src/blockchain/providers/vm.ts @@ -62,6 +62,7 @@ export class VMProvider { } } this.web3 = new Web3(this.provider as LegacySendAsyncProvider) + this.web3.setConfig({ defaultTransactionType: '0x0' }) extend(this.web3) this.executionContext.setWeb3(this.executionContext.getProvider(), this.web3) resolve({}) diff --git a/libs/ghaction-helper/src/methods.ts b/libs/ghaction-helper/src/methods.ts index 16c5a5f2d4..9bfa470033 100644 --- a/libs/ghaction-helper/src/methods.ts +++ b/libs/ghaction-helper/src/methods.ts @@ -11,7 +11,7 @@ const providerConfig = { blockNumber: global.blockNumber || null } -const config = { defaultTransactionType: '0x0', ignoreGasPricing: true } +const config = { defaultTransactionType: '0x0' } global.remixProvider = new Provider(providerConfig) global.remixProvider.init() global.web3Provider = new ethers.providers.Web3Provider(global.remixProvider) diff --git a/libs/remix-debug/test/vmCall.ts b/libs/remix-debug/test/vmCall.ts index b00a506983..e9d6e28012 100644 --- a/libs/remix-debug/test/vmCall.ts +++ b/libs/remix-debug/test/vmCall.ts @@ -23,7 +23,7 @@ async function sendTx (web3, from, to, value, data, cb) { value, data, gas: 7000000 - }) + }, null, { checkRevertBeforeSending: false, ignoreGasPricing: true }) cb(null, receipt.transactionHash) return receipt.transactionHash } catch (e) { diff --git a/libs/remix-lib/src/execution/txRunnerWeb3.ts b/libs/remix-lib/src/execution/txRunnerWeb3.ts index a7f1cce7ac..02d343b475 100644 --- a/libs/remix-lib/src/execution/txRunnerWeb3.ts +++ b/libs/remix-lib/src/execution/txRunnerWeb3.ts @@ -65,7 +65,7 @@ export class TxRunnerWeb3 { promptCb( async (value) => { try { - const res = await (this.getWeb3() as any).eth.personal.sendTransaction({...tx, value}) + const res = await (this.getWeb3() as any).eth.personal.sendTransaction({...tx, value}, { checkRevertBeforeSending: false, ignoreGasPricing: true }) cb(null, res.transactionHash) } catch (e) { console.log(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `) @@ -81,7 +81,7 @@ export class TxRunnerWeb3 { ) } else { try { - const res = await this.getWeb3().eth.sendTransaction(tx, null, { checkRevertBeforeSending: false }) + const res = await this.getWeb3().eth.sendTransaction(tx, null, { checkRevertBeforeSending: false, ignoreGasPricing: true}) cb(null, res.transactionHash) } catch (e) { console.log(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `)