Merge branch 'master' into theme-hacker-owl

pull/1527/head
U.M Andrew 3 years ago committed by GitHub
commit 4628c07dee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      apps/remix-ide-e2e/src/tests/url.test.ts
  2. 22
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx

@ -159,7 +159,7 @@ module.exports = {
.expect.element('[data-id="contractGUIUpgradeImplementation"]').to.be.selected
},
'Should load using URL compiler params': function (browser: NightwatchBrowser) {
'Should load using various URL compiler params': function (browser: NightwatchBrowser) {
browser
.pause(5000)
.url('http://127.0.0.1:8080/#optimize=true&runs=300&autoCompile=true&evmVersion=istanbul&version=soljson-v0.7.4+commit.3f05b770.js&language=Yul')
@ -173,6 +173,16 @@ module.exports = {
.verify.elementPresent('#optimize:checked')
.verify.elementPresent('#autoCompile:checked')
.verify.attributeEquals('#runs', 'value', '300')
.url('http://127.0.0.1:8080/#version=0.8.7')
.refresh()
.pause(5000)
.clickLaunchIcon('solidity')
.assert.containsText('#versionSelector option[data-id="selected"]', '0.8.7+commit.e28d00a7')
.url('http://127.0.0.1:8080/#version=0.8.15+commit.e14f2714')
.refresh()
.pause(5000)
.clickLaunchIcon('solidity')
.assert.containsText('#versionSelector option[data-id="selected"]', '0.8.15+commit.e14f2714')
},
'Should load using compiler from link passed in remix URL': function (browser: NightwatchBrowser) {

@ -309,12 +309,22 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
allVersions = [...allVersions, ...versions]
selectedVersion = state.defaultVersion
if (api.getCompilerParameters().version) selectedVersion = api.getCompilerParameters().version
// Check if version is a URL and corresponding filename starts with 'soljson'
if (selectedVersion.startsWith('https://')) {
const urlArr = selectedVersion.split('/')
if (urlArr[urlArr.length - 1].startsWith('soljson')) isURL = true
if (api.getCompilerParameters().version) {
const versionFromURL = api.getCompilerParameters().version
// Check if version is a URL and corresponding filename starts with 'soljson'
if (versionFromURL.startsWith('https://')) {
const urlArr = versionFromURL.split('/')
if (urlArr[urlArr.length - 1].startsWith('soljson')) {
isURL = true
selectedVersion = versionFromURL
}
} else {
// URL version can be like 0.8.7+commit.e28d00a7, 0.8.7 or soljson-v0.8.7+commit.e28d00a7.js
const selectedVersionArr = versions.filter(obj => obj.path === versionFromURL || obj.longVersion === versionFromURL || obj.version === versionFromURL)
// for version like 0.8.15, there will be more than one elements in the array
// In that case too, index 0 will have non-nightly version object
if (selectedVersionArr.length) selectedVersion = selectedVersionArr[0].path
}
}
if (wasmRes.event.type !== 'error') {
allVersionsWasm = JSON.parse(wasmRes.json).builds.slice().reverse()

Loading…
Cancel
Save