From b66eed39481f26ecea3cbd9c1863369ade0149c1 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 19 Sep 2022 15:19:31 +0200 Subject: [PATCH] compilerloaded --- apps/remix-ide-e2e/src/commands/verifyLoad.ts | 5 ++ .../src/lib/compiler-container.tsx | 75 ++++++++++--------- 2 files changed, 46 insertions(+), 34 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/verifyLoad.ts b/apps/remix-ide-e2e/src/commands/verifyLoad.ts index e7a35f21ff..89b22c3701 100644 --- a/apps/remix-ide-e2e/src/commands/verifyLoad.ts +++ b/apps/remix-ide-e2e/src/commands/verifyLoad.ts @@ -23,6 +23,11 @@ class VerifyLoad extends EventEmitter { locateStrategy: 'xpath', timeout: 60000 }) + .waitForElementPresent({ + selector: "//span[@data-id='compilerloaded']", + locateStrategy: 'xpath', + timeout: 60000 + }) .perform((done) => { done() this.emit('complete') diff --git a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx index 5c9d67a0af..0281d505c8 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx @@ -227,13 +227,13 @@ export const CompilerContainer = (props: CompilerContainerProps) => { if (state.useFileConfiguration) if (state.createFileOnce) { api.fileExists(defaultPath).then((exists) => { - if (!exists || state.useFileConfiguration ) createNewConfigFile() + if (!exists || state.useFileConfiguration) createNewConfigFile() }) setState(prevState => { return { ...prevState, createFileOnce: false } }) } - + setState(prevState => { api.setAppParameter('useFileConfiguration', !state.useFileConfiguration) return { ...prevState, useFileConfiguration: !state.useFileConfiguration } @@ -281,7 +281,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { 'Create', async () => await createNewConfigFile(), 'Cancel', - () => { + () => { setShowFilePathInput(false) } ) @@ -436,7 +436,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { compileIcon.current.setAttribute('title', 'compiler is loading, please wait a few moments.') compileIcon.current.classList.add('remixui_spinningIcon') setState(prevState => { - return { ...prevState, compilerLicense: 'Compiler is loading. License will be displayed once compiler is loaded'} + return { ...prevState, compilerLicense: 'Compiler is loading. License will be displayed once compiler is loaded' } }) _updateLanguageSelector() setDisableCompileButton(true) @@ -453,6 +453,13 @@ export const CompilerContainer = (props: CompilerContainerProps) => { const isDisabled = !compiledFileName || (compiledFileName && !isSolFileSelected(compiledFileName)) setDisableCompileButton(isDisabled) + + // just for e2e + // eslint-disable-next-line no-case-declarations + const loadedElement = document.createElement('span') + loadedElement.setAttribute('data-id', 'compilerloaded') + loadedElement.setAttribute('data-version', state.selectedVersion) + document.body.appendChild(loadedElement) } const compilationFinished = () => { @@ -555,22 +562,22 @@ export const CompilerContainer = (props: CompilerContainerProps) => { const _shouldBeAdded = (version) => { return !version.includes('nightly') || - (version.includes('nightly') && state.includeNightlies) + (version.includes('nightly') && state.includeNightlies) } const promptCompiler = () => { // custom url https://solidity-blog.s3.eu-central-1.amazonaws.com/data/08preview/soljson.js - modal('Add a custom compiler', promptMessage('URL'), 'OK', addCustomCompiler, 'Cancel', () => {}) + modal('Add a custom compiler', promptMessage('URL'), 'OK', addCustomCompiler, 'Cancel', () => { }) } const showCompilerLicense = () => { - modal('Compiler License', state.compilerLicense ? state.compilerLicense : 'License not available', 'OK', () => {}) + modal('Compiler License', state.compilerLicense ? state.compilerLicense : 'License not available', 'OK', () => { }) } const promptMessage = (message) => { return ( <> - { message } + {message} ) @@ -709,7 +716,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { setToggleExpander(!toggleExpander) } - return ( + return (
@@ -717,11 +724,11 @@ export const CompilerContainer = (props: CompilerContainerProps) => { promptCompiler()} title="Add a custom compiler with URL"> showCompilerLicense()} title="See compiler license"> - handleLoadVersion(e.target.value)} className="custom-select" id="versionSelector" disabled={state.allversions.length <= 0}> + {state.allversions.length <= 0 && } + {state.allversions.length <= 0 && } + {state.customVersions.map((url, i) => )} + {state.allversions.map((build, i) => { return _shouldBeAdded(build.longVersion) ? : null @@ -826,12 +833,12 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
- { (!showFilePathInput && state.useFileConfiguration) && {} : async()=>{ await openFile()}} + onClick={configFilePath === '' ? () => { } : async () => { await openFile() }} className="py-2 remixui_compilerConfigPath" - >{configFilePath === '' ? 'No file selected.' : configFilePath} } - { (!showFilePathInput && !state.useFileConfiguration) && {configFilePath} } + >{configFilePath === '' ? 'No file selected.' : configFilePath}} + {(!showFilePathInput && !state.useFileConfiguration) && {configFilePath}} { } }} /> - { !showFilePathInput && } + {!showFilePathInput && }
- + {compilerLoadedVersion ? : ''} -
+
+
@@ -893,11 +900,11 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
                     
                     /**
- * @title ContractName
- * @dev ContractDescription
- * @custom:dev-run-script file_path
- */
- contract ContractName {'{}'}
+ * @title ContractName
+ * @dev ContractDescription
+ * @custom:dev-run-script file_path
+ */
+ contract ContractName {'{}'}
Click to know more @@ -912,7 +919,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
-
+
)