Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions apps/remix-ide-e2e/src/tests/compiler_api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ module.exports = {
.journalChildIncludes(`\\"optimizer\\":{\\"enabled\\":true,\\"runs\\":300}`)
},

'Should compile using "compileWithParamaters" API with optimization off check default runs': function (browser: NightwatchBrowser) {
browser
.addFile('test_jsCompileWithOptimizationDefault.js', { content: jsCompileWithOptimizationDefault })
.executeScript('remix.exeCurrent()')
.pause(10000)
.journalChildIncludes(`\\"optimizer\\":{\\"enabled\\":false,\\"runs\\":200}`)
},

'Should update the compiler configuration with "setCompilerConfig" API': function (browser: NightwatchBrowser) {
browser
.addFile('test_updateConfiguration.js', { content: updateConfiguration })
Expand Down Expand Up @@ -111,11 +119,28 @@ const jsCompileWithOptimization = `(async () => {
}
const result = await remix.call('solidity', 'compileWithParameters', contract, params)
console.log('result ', result)
} catch (e) {
console.log(e.message)
}
})()`

const jsCompileWithOptimizationDefault = `(async () => {
try {
const contract = {
"storage.sol": {content : \`${simpleContract}\` }
}
console.log('compile')
const params = {
optimize: false,
}
const result = await remix.call('solidity', 'compileWithParameters', contract, params)
console.log('result ', result)
} catch (e) {
console.log(e.message)
}
})()`


const updateConfiguration = `(async () => {
try {
const params = {
Expand Down
4 changes: 3 additions & 1 deletion apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class CompilerContainer {
id="runs"
placeholder="200"
type="number"
title="Number of optimisation runs."
title="Estimated number of times each opcode of the deployed code will be executed across the life-time of the contract."
onchange=${() => this.onchangeRuns()}
>`
if (this.compileTabLogic.optimize) this._view.runs.removeAttribute('disabled')
Expand Down Expand Up @@ -346,7 +346,9 @@ class CompilerContainer {
this.compileTabLogic.setOptimize(!!this._view.optimize.checked)
if (this.compileTabLogic.optimize) {
this._view.runs.removeAttribute('disabled')
this.compileTabLogic.setRuns(parseInt(this._view.runs.value))
} else {
this.compileTabLogic.setRuns(200)
this._view.runs.setAttribute('disabled', '')
}
this.compileIfAutoCompileOn()
Expand Down