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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,7 @@ apps/remixdesktop/log_input_signals.txt
apps/remixdesktop/log_input_signals_new.txt
logs
apps/remix-ide-e2e/src/extensions/chrome/metamask
apps/remix-ide-e2e/tmp/
apps/remix-ide-e2e/tmp/

# IDE - Cursor
.cursor/
12 changes: 6 additions & 6 deletions apps/remix-ide-e2e/src/local-plugin/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,25 +125,25 @@ function App() {
<label>events</label>
<Logger id="events" log={events}></Logger>
<input className="form-control w-100" type="text" id="payload" placeholder="Enter payload here..." value={payload} onChange={handleChange} data-id="payload-input" />
{profiles.map((profile: Profile) => {
const methods = profile.methods.map((method: string) => {
{profiles.map((profile: Profile, index: number) => {
const methods = profile.methods.map((method: string, index: number) => {
return (
<button id={`${profile.name}-${method}-${profile.name}`} data-id={`${profile.name}-${method}`} key={method} className="btn btn-primary btn-sm ms-1 mb-1" onClick={async () => await clientMethod(profile, method)}>
<button id={`${profile.name}-${method}-${profile.name}`} data-id={`${profile.name}-${method}`} key={index} className="btn btn-primary btn-sm ms-1 mb-1" onClick={async () => await clientMethod(profile, method)}>
{method}
</button>
)
})
const events = profile.events
? profile.events.map((event: string) => {
? profile.events.map((event: string, index: number) => {
return (
<label key={event} className="m-1">
<label key={index} className="m-1">
{event}
</label>
)
})
: null
return (
<div key={profile.name} className="small border-bottom">
<div key={index} className="small border-bottom">
<label className="text-uppercase">{profile.name}</label>
<br/>
{methods}
Expand Down
98 changes: 5 additions & 93 deletions apps/remix-ide-e2e/src/tests/ballot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,105 +143,15 @@ module.exports = {

'Compile Ballot using config file #group2': function (browser: NightwatchBrowser) {
browser
.addFile('cf.json', { content: configFile })
.openFile('remix.config.json')
.setEditorValue(configFile)
.clickLaunchIcon('solidity')
.waitForElementVisible('*[data-id="scConfigExpander"]')
.click('*[data-id="scConfigExpander"]')
.waitForElementVisible('*[data-id="scFileConfiguration"]', 10000)
.click('*[data-id="scFileConfiguration"]')
// the input field behaves badly, it would often not receive the value, so retrying it a few times for now is the best thing to do
.waitForElementVisible({
selector: '*[data-id="scConfigChangeFilePath"]',
abortOnFailure: false
}, 10000)
.click({
selector: '*[data-id="scConfigChangeFilePath"]',
suppressNotFoundErrors: true,
timeout: 1000
})
.click({
selector: '*[data-id="scConfigChangeFilePath"]',
suppressNotFoundErrors: true,
timeout: 1000
})
.click({
selector: '*[data-id="scConfigChangeFilePath"]',
suppressNotFoundErrors: true,
timeout: 1000
})

.waitForElementVisible('*[data-id="scConfigFilePathInput"]', 10000)
.sendKeys('*[data-id="scConfigFilePathInput"]', 'cf.json')
.sendKeys('*[data-id="scConfigFilePathInput"]', browser.Keys.ENTER)

.isVisible({
selector:"//*[@class='py-2 remixui_compilerConfigPath' and contains(.,'cf.json')]",
suppressNotFoundErrors: true,
locateStrategy: 'xpath'
}, (okVisible) => {
// if it's not there yet, try again
if (!okVisible.value) {
browser.waitForElementVisible({
selector: '*[data-id="scConfigChangeFilePath"]',
abortOnFailure: false
}, 10000)
.click({
selector: '*[data-id="scConfigChangeFilePath"]',
suppressNotFoundErrors: true,
timeout: 1000
})
.click({
selector: '*[data-id="scConfigChangeFilePath"]',
suppressNotFoundErrors: true,
timeout: 1000
})
.click({
selector: '*[data-id="scConfigChangeFilePath"]',
suppressNotFoundErrors: true,
timeout: 1000
})

.waitForElementVisible('*[data-id="scConfigFilePathInput"]', 10000)
.sendKeys('*[data-id="scConfigFilePathInput"]', 'cf.json')
.sendKeys('*[data-id="scConfigFilePathInput"]', browser.Keys.ENTER)
}
})

.isVisible({
selector:"//*[@class='py-2 remixui_compilerConfigPath' and contains(.,'cf.json')]",
suppressNotFoundErrors: true,
locateStrategy: 'xpath'
}, (okVisible) => {
if (!okVisible.value) {
// if it's still not there, try again
browser.waitForElementVisible({
selector: '*[data-id="scConfigChangeFilePath"]',
abortOnFailure: false
}, 10000)
.click({
selector: '*[data-id="scConfigChangeFilePath"]',
suppressNotFoundErrors: true,
timeout: 1000
})
.click({
selector: '*[data-id="scConfigChangeFilePath"]',
suppressNotFoundErrors: true,
timeout: 1000
})
.click({
selector: '*[data-id="scConfigChangeFilePath"]',
suppressNotFoundErrors: true,
timeout: 1000
})

.waitForElementVisible('*[data-id="scConfigFilePathInput"]', 10000)
.sendKeys('*[data-id="scConfigFilePathInput"]', 'cf.json')
.sendKeys('*[data-id="scConfigFilePathInput"]', browser.Keys.ENTER)
}
})

.pause(5000)
.openFile('Untitled.sol')
.click('[data-id="compile-action"]')
.verifyContracts(['Ballot'], { wait: 2000, runs: '300' })
},

Expand Down Expand Up @@ -499,6 +409,7 @@ const ballotABI = `[

const configFile = `
{
"solidity-compiler": {
"language": "Solidity",
"settings": {
"optimizer": {
Expand All @@ -509,6 +420,7 @@ const configFile = `
"*": {
"": ["ast"],
"*": ["abi", "metadata", "devdoc", "userdoc", "storageLayout", "evm.legacyAssembly", "evm.bytecode", "evm.deployedBytecode", "evm.methodIdentifiers", "evm.gasEstimates", "evm.assembly"]
}
}
}
}
Expand Down
20 changes: 12 additions & 8 deletions apps/remix-ide-e2e/src/tests/plugin_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ const clearPayLoad = async (browser: NightwatchBrowser) => {
const clickButton = async (browser: NightwatchBrowser, buttonText: string, waitResult: boolean = true) => { // eslint-disable-line
return new Promise((resolve) => {
browser
.scrollInto(`[data-id='${buttonText}']`)
.pause(1000)
.useXpath()
.waitForElementVisible(`//*[@data-id='${buttonText}']`).pause(100)
.click(`//*[@data-id='${buttonText}']`, async () => {
Expand Down Expand Up @@ -167,7 +169,7 @@ module.exports = {
})
},

'Should connect a local plugin': function (browser: NightwatchBrowser) {
'Should connect a local plugin ': function (browser: NightwatchBrowser) {
browser.addLocalPlugin(localPluginData, true)
// @ts-ignore
.frame(0).useXpath()
Expand Down Expand Up @@ -239,6 +241,7 @@ module.exports = {
tests: { isDirectory: true },
'README.txt': { isDirectory: false },
'.prettierrc.json': { isDirectory: false },
'remix.config.json': { isDirectory: false }
}, null, '/')
},
'Should throw error on current file #group7': async function (browser: NightwatchBrowser) {
Expand Down Expand Up @@ -295,11 +298,12 @@ module.exports = {
await clickAndCheckLog(browser, 'filePanel-createWorkspace', null, null, 'testspace')
await clickAndCheckLog(browser, 'filePanel-getCurrentWorkspace', { name: 'testspace', isLocalhost: false, absolutePath: '.workspaces/testspace' }, null, null)
await clickAndCheckLog(browser, 'fileManager-readdir', {
contracts: { isDirectory: true },
scripts: { isDirectory: true },
tests: { isDirectory: true },
'README.txt': { isDirectory: false },
'.prettierrc.json': { isDirectory: false }
"contracts": { "isDirectory": true },
"scripts": { "isDirectory": true },
"tests": { "isDirectory": true },
"README.txt": { "isDirectory": false },
".prettierrc.json": { "isDirectory": false },
"remix.config.json": { "isDirectory": false },
}, null, '/')
},
'Should get all workspaces #group2': async function (browser: NightwatchBrowser) {
Expand All @@ -326,14 +330,14 @@ module.exports = {
// DGIT
'Should have changes on new workspace #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel-createWorkspace', null, null, 'dgit')
await clickAndCheckLog(browser, 'dgitApi-status', [[".prettierrc.json",0,2,0], ["README.txt",0,2,0],["contracts/1_Storage.sol",0,2,0],["contracts/2_Owner.sol",0,2,0],["contracts/3_Ballot.sol",0,2,0],["scripts/deploy_with_ethers.ts",0,2,0],["scripts/deploy_with_web3.ts",0,2,0],["scripts/ethers-lib.ts",0,2,0],["scripts/web3-lib.ts",0,2,0],["tests/Ballot_test.sol",0,2,0],["tests/storage.test.js",0,2,0]], null, null)
await clickAndCheckLog(browser, 'dgitApi-status', [[".prettierrc.json",0,2,0], ["README.txt",0,2,0],["contracts/1_Storage.sol",0,2,0],["contracts/2_Owner.sol",0,2,0],["contracts/3_Ballot.sol",0,2,0],["remix.config.json",0,2,0],["scripts/deploy_with_ethers.ts",0,2,0],["scripts/deploy_with_web3.ts",0,2,0],["scripts/ethers-lib.ts",0,2,0],["scripts/web3-lib.ts",0,2,0],["tests/Ballot_test.sol",0,2,0],["tests/storage.test.js",0,2,0]], null, null)
},

'Should stage contract #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'dgitApi-add', null, null, {
filepath: 'contracts/1_Storage.sol'
})
await clickAndCheckLog(browser, 'dgitApi-status', [[".prettierrc.json",0,2,0],["README.txt",0,2,0],["contracts/1_Storage.sol",0,2,2],["contracts/2_Owner.sol",0,2,0],["contracts/3_Ballot.sol",0,2,0],["scripts/deploy_with_ethers.ts",0,2,0],["scripts/deploy_with_web3.ts",0,2,0],["scripts/ethers-lib.ts",0,2,0],["scripts/web3-lib.ts",0,2,0],["tests/Ballot_test.sol",0,2,0],["tests/storage.test.js",0,2,0]], null, null)
await clickAndCheckLog(browser, 'dgitApi-status', [[".prettierrc.json",0,2,0],["README.txt",0,2,0],["contracts/1_Storage.sol",0,2,2],["contracts/2_Owner.sol",0,2,0],["contracts/3_Ballot.sol",0,2,0],["remix.config.json",0,2,0],["scripts/deploy_with_ethers.ts",0,2,0],["scripts/deploy_with_web3.ts",0,2,0],["scripts/ethers-lib.ts",0,2,0],["scripts/web3-lib.ts",0,2,0],["tests/Ballot_test.sol",0,2,0],["tests/storage.test.js",0,2,0]], null, null)
},
'Should commit changes #group3': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'dgitApi-commit', null, null, { author: { name: 'Remix', email: 'Remix' }, message: 'commit-message' })
Expand Down
9 changes: 4 additions & 5 deletions apps/remix-ide-e2e/src/tests/script-runner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,19 @@ const tests = {
.waitForElementVisible('label[data-id="sr-loaded-ethers6"]', 100000)
.waitForElementPresent('[data-id="dependency-ethers-^6"]', 2000)
},
'Should have config file in .remix/script.config.json': function (browser: NightwatchBrowser) {
'Should have config file in remix.config.json': function (browser: NightwatchBrowser) {
browser
.frameParent()
// .clickLaunchIcon('filePanel')
.waitForElementVisible('[data-path=".remix"]')
.waitForElementVisible('[data-id="treeViewDivDraggableItem.remix/script.config.json"]')
.openFile('.remix/script.config.json')
.waitForElementVisible('[data-id="treeViewDivDraggableItemremix.config.json"]')
.openFile('remix.config.json')
},
'check config file content': function (browser: NightwatchBrowser) {
browser
.getEditorValue((content) => {
console.log(JSON.parse(content))
const parsed = JSON.parse(content)
browser.assert.ok(parsed.defaultConfig === 'ethers6', 'config file content is correct')
browser.assert.ok(parsed['script-runner'].defaultConfig === 'ethers6', 'config file content is correct')
})
},
'execute ethers6 script': function (browser: NightwatchBrowser) {
Expand Down
3 changes: 2 additions & 1 deletion apps/remix-ide-e2e/src/tests/workspace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,12 @@ module.exports = {
.currentWorkspaceIs('workspace_blank')
.waitForElementPresent('*[data-id="treeViewUltreeViewMenu"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItem.prettierrc.json"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemremix.config.json"]')
.execute(function () {
const fileList = document.querySelector('*[data-id="treeViewUltreeViewMenu"]')
return fileList.getElementsByTagName('li').length;
}, [], function (result) {
browser.assert.equal(result.value, 1, 'Incorrect number of files');
browser.assert.equal(result.value, 2, 'Incorrect number of files');
});
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default class CodeParserCompiler {
this.compiler.set('evmVersion', state.evmVersion)
this.compiler.set('language', state.language)
this.compiler.set('runs', state.runs)
this.compiler.set('useFileConfiguration', true)
this.compiler.set('useFileConfiguration', state.useFileConfiguration)
this.compiler.set('compilerRetriggerMode', CompilerRetriggerMode.retrigger)

const configFileContent =
Expand Down
60 changes: 47 additions & 13 deletions apps/remix-ide/src/app/plugins/script-runner-bridge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const profile = {
maintainedBy: 'Remix',
}

const configFileName = '.remix/script.config.json'
const oldConfigFileName = '.remix/script.config.json'
const configFileName = 'remix.config.json'

let baseUrl = 'https://remix-project-org.github.io/script-runner-generator'
const customBuildUrl = 'http://localhost:4000/build' // this will be used when the server is ready
Expand Down Expand Up @@ -73,6 +74,23 @@ export class ScriptRunnerBridgePlugin extends Plugin {
dependencies: [],
},
}
const oldConfigExists = await this.plugin.call('fileManager', 'exists', oldConfigFileName)
const configExists = await this.plugin.call('fileManager', 'exists', configFileName)

if (oldConfigExists) {
const oldConfigContent = await this.plugin.call('fileManager', 'readFile', oldConfigFileName)
const oldConfig = JSON.parse(oldConfigContent)

if (configExists) {
const configContent = await this.plugin.call('fileManager', 'readFile', configFileName)
const config = JSON.parse(configContent)
config['script-runner'] = oldConfig
await this.plugin.call('fileManager', 'writeFile', configFileName, JSON.stringify(config, null, 2))
} else {
await this.plugin.call('fileManager', 'writeFile', configFileName, JSON.stringify({ 'script-runner': oldConfig }, null, 2))
}
await this.plugin.call('fileManager', 'remove', '.remix')
}
await this.loadCustomConfig()
await this.loadConfigurations()
this.renderComponent()
Expand Down Expand Up @@ -259,7 +277,18 @@ export class ScriptRunnerBridgePlugin extends Plugin {
try {
const content = await this.plugin.call('fileManager', 'readFile', configFileName)
const parsed = JSON.parse(content)
this.customConfig = parsed

if (parsed['script-runner']) {
this.customConfig = parsed['script-runner']
} else {
this.customConfig = {
defaultConfig: 'default',
customConfig: {
baseConfiguration: 'default',
dependencies: [],
},
}
}
} catch (e) {
this.customConfig = {
defaultConfig: 'default',
Expand All @@ -274,7 +303,7 @@ export class ScriptRunnerBridgePlugin extends Plugin {
async openCustomConfig() {

try {
await this.plugin.call('fileManager', 'open', '.remix/script.config.json')
await this.plugin.call('fileManager', 'open', 'remix.config.json')
} catch (e) {}
}

Expand All @@ -297,16 +326,21 @@ export class ScriptRunnerBridgePlugin extends Plugin {
}

async saveCustomConfig(content: ScriptRunnerConfig) {
if (content.customConfig.dependencies.length === 0 && content.defaultConfig === 'default') {
try {
const exists = await this.plugin.call('fileManager', 'exists', '.remix/script.config.json')
if (exists) {
await this.plugin.call('fileManager', 'remove', '.remix/script.config.json')
}
} catch (e) {}
return
}
await this.plugin.call('fileManager', 'writeFile', '.remix/script.config.json', JSON.stringify(content, null, 2))
try {
const exists = await this.plugin.call('fileManager', 'exists', configFileName)
if (exists) {
const configContent = await this.plugin.call('fileManager', 'readFile', configFileName)
const config = JSON.parse(configContent)

config['script-runner'] = content
await this.plugin.call('fileManager', 'writeFile', configFileName, JSON.stringify(config, null, 2))
this.plugin.call('notification', 'toast', 'Updated script runner config in remix.config.json')
} else {
await this.plugin.call('fileManager', 'writeFile', configFileName, JSON.stringify({ 'script-runner': content }, null, 2))
this.plugin.call('notification', 'toast', 'Created script runner config in remix.config.json')
}
} catch (e) {}
return
}

async activateCustomScriptRunner(config: customScriptRunnerConfig) {
Expand Down
6 changes: 4 additions & 2 deletions apps/remix-ide/src/app/tabs/compile-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import * as packageJson from '../../../../../package.json'
import { compilerConfigChangedToastMsg, compileToastMsg } from '@remix-ui/helper'
import { isNative } from '../../remixAppManager'
import { Registry } from '@remix-project/remix-lib'

const remixConfigPath = 'remix.config.json'
const profile = {
name: 'solidity',
displayName: 'Solidity compiler',
Expand Down Expand Up @@ -139,12 +141,12 @@ export default class CompileTab extends CompilerApiMixin(ViewPlugin) { // implem
group: 6
})
this.on('fileManager', 'fileSaved', async (file) => {
if(await this.getAppParameter('configFilePath') === file) {
if(file === remixConfigPath) {
this.emit('configFileChanged', file)
}
})
this.on('fileManager', 'fileAdded', async (file) => {
if(await this.getAppParameter('configFilePath') === file) {
if(file === remixConfigPath) {
this.emit('configFileChanged', file)
}
})
Expand Down
Loading