Skip to content

Commit fb0c531

Browse files
authored
Merge branch 'master' into cookbook-font-focus
2 parents 23a9921 + 1f63933 commit fb0c531

File tree

4 files changed

+53
-14
lines changed

4 files changed

+53
-14
lines changed

apps/remix-ide-e2e/src/tests/script-runner.test.ts

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ const tests = {
2828
.click('button[data-id="script-config"]')
2929
.waitForElementVisible('[data-id="sr-loaded-default"]')
3030
.waitForElementVisible('[data-id="dependency-ethers-^5"]')
31-
.waitForElementVisible('[data-id="sr-load-ethers6"]')
31+
.waitForElementVisible('[data-id="sr-notloaded-ethers6"]')
3232
},
3333
'Should load script runner ethers6': function (browser: NightwatchBrowser) {
3434
browser
35-
.click('[data-id="sr-load-ethers6"]')
35+
.click('[data-id="sr-notloaded-ethers6"]')
3636
.waitForElementVisible('[data-id="sr-loaded-ethers6"]')
3737
.waitForElementPresent('[data-id="dependency-ethers-^6"]')
3838
},
@@ -74,6 +74,7 @@ const tests = {
7474
.waitForElementPresent('*[data-id="create-semaphore"]')
7575
.scrollAndClick('*[data-id="create-semaphore"]')
7676
.modalFooterOKClick('TemplatesSelection')
77+
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcircuits/semaphore.circom"]')
7778
.waitForElementVisible({
7879
locateStrategy: 'xpath',
7980
selector: "//li[@data-id='UIScriptRunner' and @role='tab']"
@@ -82,9 +83,37 @@ const tests = {
8283
locateStrategy: 'xpath',
8384
selector: "//li[@data-id='UIScriptRunner' and @role='tab']"
8485
})
85-
.waitForElementVisible('[data-id="sr-load-default"]')
86+
.waitForElementVisible('[data-id="sr-loaded-default"]')
8687
.waitForElementVisible('[data-id="dependency-ethers-^5"]')
87-
.waitForElementVisible('[data-id="sr-load-zksyncv6"]')
88+
.waitForElementVisible('[data-id="sr-notloaded-zksyncv6"]')
89+
},
90+
'open template that sets a config': function (browser: NightwatchBrowser) {
91+
browser
92+
.waitForElementVisible('*[data-id="workspacesMenuDropdown"]')
93+
.click('*[data-id="workspacesMenuDropdown"]')
94+
.click('*[data-id="workspacecreate"]')
95+
.waitForElementPresent('*[data-id="create-introToEIP7702"]')
96+
.scrollAndClick('*[data-id="create-introToEIP7702"]')
97+
.modalFooterOKClick('TemplatesSelection')
98+
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts/Example7702.sol"]')
99+
.waitForElementVisible({
100+
locateStrategy: 'xpath',
101+
selector: "//li[@data-id='UIScriptRunner' and @role='tab']"
102+
})
103+
.click({
104+
locateStrategy: 'xpath',
105+
selector: "//li[@data-id='UIScriptRunner' and @role='tab']"
106+
})
107+
.waitForElementVisible('[data-id="sr-notloaded-default"]')
108+
.waitForElementVisible('[data-id="sr-loaded-ethers6"]')
109+
},
110+
'reset to default after template': function (browser: NightwatchBrowser) {
111+
browser
112+
.refreshPage()
113+
.waitForElementVisible('button[data-id="script-config"]')
114+
.click('button[data-id="script-config"]')
115+
.waitForElementVisible('[data-id="sr-notloaded-default"]')
116+
.waitForElementVisible('[data-id="sr-loaded-ethers6"]')
88117
},
89118
'switch to default workspace that should be on ethers6': function (browser: NightwatchBrowser) {
90119
browser
@@ -99,7 +128,9 @@ const tests = {
99128
})
100129
.waitForElementVisible('[data-id="sr-loaded-ethers6"]')
101130
.waitForElementPresent('[data-id="dependency-ethers-^6"]')
102-
}
131+
},
132+
133+
103134
}
104135

105136
module.exports = tests

apps/remix-ide/src/app/plugins/script-runner-bridge.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,18 @@ export class ScriptRunnerBridgePlugin extends Plugin {
7878
this.renderComponent()
7979
})
8080

81+
this.plugin.on('fileManager', 'fileAdded', async (file: string) => {
82+
if (file && file === configFileName) {
83+
await this.loadCustomConfig()
84+
await this.loadConfigurations()
85+
this.renderComponent()
86+
}
87+
})
88+
8189
this.plugin.on('fileManager', 'fileSaved', async (file: string) => {
82-
if (file === configFileName && this.enableCustomScriptRunner) {
90+
if (file && file === configFileName) {
8391
await this.loadCustomConfig()
92+
await this.loadConfigurations()
8493
this.renderComponent()
8594
}
8695
})

apps/vyper/src/app/utils/compiler.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ export async function compile(url: string, contract: Contract): Promise<VyperCom
8282
[contractName] : { content : contract.content }
8383
}
8484
}
85-
console.log('compilePackage', `${url}compile`)
86-
let response = await axios.post(`${url}compile`, compilePackage )
8785

86+
let response = await axios.post(`${url.endsWith('/') ? url + 'compile' : url + '/compile'}`, compilePackage )
8887
if (response.status === 404) {
8988
throw new Error(`Vyper compiler not found at "${url}".`)
9089
}
@@ -97,17 +96,17 @@ console.log('compilePackage', `${url}compile`)
9796
response = null
9897
let result: any
9998

100-
const status = await (await axios.get(url + 'status/' + compileCode , {
99+
const status = await (await axios.get(`${url.endsWith('/') ? url + 'status/' : url + '/status/'}`+ compileCode , {
101100
method: 'Get'
102101
})).data
103102
if (status === 'SUCCESS') {
104-
result = await(await axios.get(url + 'artifacts/' + compileCode , {
103+
result = await(await axios.get(`${url.endsWith('/') ? url + 'artifacts/' : url + '/artifacts/'}` + compileCode , {
105104
method: 'Get'
106105
})).data
107106

108107
return result
109108
} else if (status === 'FAILED') {
110-
const intermediate = await(await axios.get(url + 'exceptions/' + compileCode , {
109+
const intermediate = await(await axios.get(`${url.endsWith('/') ? url + 'exceptions/' : url + '/exceptions/'}` + compileCode , {
111110
method: 'Get'
112111
})).data
113112
return intermediate
@@ -189,7 +188,7 @@ export async function compileContract(contract: string, compilerUrl: string, set
189188
title: 'Compiling'
190189
})
191190
// try {
192-
let output = await compile(compilerUrl, _contract)
191+
const output = await compile(compilerUrl, _contract)
193192
if (output && output[0] && output[0].status === 'failed') {
194193
remixClient.changeStatus({
195194
key: 'failed',

libs/remix-ui/scriptrunner/src/lib/components/config-section.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export default function ConfigSection(props: ConfigSectionProps) {
4242
checked={(props.activeConfig && props.activeConfig.name === props.config.name)}
4343
/>
4444
<label className="pointer form-check-label custom-control-label" htmlFor={`${props.config.title || props.config.name}`}
45-
data-id={`sr-load-${props.config.name}`}>
46-
<div data-id={`sr-loaded-${props.config.name}`} className="pl-2">{props.config.title || props.config.name}</div>
45+
data-id={`sr-${(props.activeConfig && props.activeConfig.name === props.config.name)?'loaded':'notloaded'}-${props.config.name}`}>
46+
<div className="pl-2">{props.config.title || props.config.name}</div>
4747
</label>
4848
</div>
4949
</section>

0 commit comments

Comments
 (0)