From 4d702acd5461f144af6718c33fe56cd4e0aa7257 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 21 Sep 2022 11:40:05 +0200 Subject: [PATCH] some fixes --- apps/remix-ide-e2e/src/commands/checkVariableDebug.ts | 4 +--- apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts | 4 +--- apps/remix-ide-e2e/src/helpers/init.ts | 4 +--- apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts | 4 ++-- apps/remix-ide-e2e/src/tests/debugger.test.ts | 3 ++- apps/remix-ide-e2e/src/tests/erc721.test.ts | 1 + apps/remix-ide-e2e/src/tests/proxy.test.ts | 1 + apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts | 1 - apps/remix-ide-e2e/src/tests/transactionExecution.test.ts | 2 -- libs/remix-ui/editor/src/lib/remix-ui-editor.tsx | 1 + .../solidity-compiler/src/lib/compiler-container.tsx | 8 +++++--- package.json | 2 +- 12 files changed, 16 insertions(+), 19 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/checkVariableDebug.ts b/apps/remix-ide-e2e/src/commands/checkVariableDebug.ts index 843e1d4571..572c4893f3 100644 --- a/apps/remix-ide-e2e/src/commands/checkVariableDebug.ts +++ b/apps/remix-ide-e2e/src/commands/checkVariableDebug.ts @@ -19,22 +19,20 @@ function checkDebug(browser: NightwatchBrowser, id: string, debugValue: Nightwat // id is soliditylocals or soliditystate let resultOfElement = null let isEqual = false + // waitUntil will run with intervals of 1000ms for 10 seconds until the condition is met browser.waitUntil(() => { browser.execute(function (id: string) { const elem = document.querySelector('#' + id + ' .dropdownrawcontent') as HTMLElement if (elem && elem.innerText) { - console.log(elem.innerText) return elem.innerText } }, [id], (result) => { if (result.value) { - console.log(JSON.parse(result.value)) try { resultOfElement = JSON.parse(result.value) isEqual = deepequal(debugValue, resultOfElement) } catch (e) { browser.assert.fail('cant parse solidity state', e.message, '') - console.log(e) } } }) diff --git a/apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts b/apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts index f1d4786027..af1a7dbb55 100644 --- a/apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts +++ b/apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts @@ -5,9 +5,7 @@ class ClickLaunchIcon extends EventEmitter { command (this: NightwatchBrowser, icon: string): NightwatchBrowser { this.api .waitForElementVisible('#icon-panel div[plugin="' + icon + '"]') - .click('#icon-panel div[plugin="' + icon + '"]', (result) => { - console.log('clicking on ', result.status) - }) + .click('#icon-panel div[plugin="' + icon + '"]') .perform((done) => { done() this.emit('complete') diff --git a/apps/remix-ide-e2e/src/helpers/init.ts b/apps/remix-ide-e2e/src/helpers/init.ts index 3bf46fe460..405aa3337e 100644 --- a/apps/remix-ide-e2e/src/helpers/init.ts +++ b/apps/remix-ide-e2e/src/helpers/init.ts @@ -10,8 +10,7 @@ type LoadPlugin = { export default function (browser: NightwatchBrowser, callback: VoidFunction, url?: string, preloadPlugins = true, loadPlugin?: LoadPlugin): void { browser .url(url || 'http://127.0.0.1:8080') - //.pause(6000) - .switchBrowserTab(0) + //.switchBrowserTab(0) .waitForElementVisible('[id="remixTourSkipbtn"]') .click('[id="remixTourSkipbtn"]') @@ -24,7 +23,6 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url localStorage.setItem('test-plugin-url', loadPlugin.url) }, [loadPlugin]) .refreshPage() - .waitForElementVisible('[data-id="sidePanelSwapitTitle"]') .perform(done()) }) .verifyLoad() diff --git a/apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts b/apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts index 9b9df0be53..9cfcf0ad65 100644 --- a/apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts +++ b/apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts @@ -16,7 +16,7 @@ module.exports = { '@sources': function () { return sources }, - 'Add Ballot #group1 #group2': function (browser: NightwatchBrowser) { + 'Add Ballot': function (browser: NightwatchBrowser) { browser .addFile('Untitled.sol', sources[0]['Untitled.sol']) }, @@ -30,7 +30,7 @@ module.exports = { .verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked') }, - 'Compile Ballot with compiler version 0.4.14 #group1 #group2': function (browser: NightwatchBrowser) { + 'Compile Ballot with compiler version 0.4.14': function (browser: NightwatchBrowser) { browser .testContracts('Untitled.sol', sources[0]['Untitled.sol'], ['Ballot']) }, diff --git a/apps/remix-ide-e2e/src/tests/debugger.test.ts b/apps/remix-ide-e2e/src/tests/debugger.test.ts index 3a1f00e0f9..b9602b4b57 100644 --- a/apps/remix-ide-e2e/src/tests/debugger.test.ts +++ b/apps/remix-ide-e2e/src/tests/debugger.test.ts @@ -15,10 +15,11 @@ module.exports = { 'Should launch debugger #group1': function (browser: NightwatchBrowser) { browser.addFile('blah.sol', sources[0]['blah.sol']) .pause(4000) + // on autocompile sometimes the compiler returns invalid source, so we need to recompile to make sure the source is valid .clickLaunchIcon('solidity').click('*[data-id="compilerContainerCompileBtn"]') .pause(4000) .clickLaunchIcon('udapp') - .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 180000) + .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 60000) .click('*[title="Deploy - transact (not payable)"]') .debugTransaction(0) .waitForElementContainsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER', 60000) diff --git a/apps/remix-ide-e2e/src/tests/erc721.test.ts b/apps/remix-ide-e2e/src/tests/erc721.test.ts index 78c1561474..550508358a 100644 --- a/apps/remix-ide-e2e/src/tests/erc721.test.ts +++ b/apps/remix-ide-e2e/src/tests/erc721.test.ts @@ -28,6 +28,7 @@ module.exports = { .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts/MyToken.sol"]') .openFile('contracts/MyToken.sol') + // because the compilatiom imports are slow and sometimes stop loading (not sure why, it's bug) we need to recompile and check to see if the files are really in de FS .clickLaunchIcon('solidity') .pause(2000) .click('[data-id="compilerContainerCompileBtn"]') diff --git a/apps/remix-ide-e2e/src/tests/proxy.test.ts b/apps/remix-ide-e2e/src/tests/proxy.test.ts index 59aaaef906..29e611b155 100644 --- a/apps/remix-ide-e2e/src/tests/proxy.test.ts +++ b/apps/remix-ide-e2e/src/tests/proxy.test.ts @@ -20,6 +20,7 @@ module.exports = { .addFile('myTokenV1.sol', sources[0]['myTokenV1.sol']) .clickLaunchIcon('solidity') .pause(2000) + // because the compilatiom imports are slow and sometimes stop loading (not sure why, it's bug) we need to recompile and check to see if the files are really in de FS .click('[data-id="compilerContainerCompileBtn"]') .clickLaunchIcon('filePanel') .isVisible({ diff --git a/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts b/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts index 154c81e757..5e7284368a 100644 --- a/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts +++ b/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts @@ -271,7 +271,6 @@ module.exports = { 'Debug tests using debugger #group7': function (browser: NightwatchBrowser) { browser - //.pause() .waitForElementPresent('*[data-id="verticalIconsKindfilePanel"]') .addFile('tests/ballotFailedDebug_test.sol', sources[0]['tests/ballotFailedDebug_test.sol']) .clickLaunchIcon('solidityUnitTesting') diff --git a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts index 7ae06223a0..f22f843e9e 100644 --- a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts +++ b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts @@ -23,8 +23,6 @@ module.exports = { status: 'true Transaction mined and execution succeed', 'decoded output': { 0: 'uint256: 8' } }) - //.pause(5000) - //.checkTerminalFilter('0x12332162e2e31397dc1e07ed0a1cf08f728e9b4487c6f9ed79d2f39410c92782', '') .clickFunction('g - transact (not payable)') .testFunction('last', { diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index f3dacb0436..3a6680db89 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -606,6 +606,7 @@ export const EditorUI = (props: EditorUIProps) => { } return result } + // just for e2e testing const loadedElement = document.createElement('span') loadedElement.setAttribute('data-id', 'editorloaded') document.body.appendChild(loadedElement) 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 e3ea641b87..1745306755 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx @@ -61,7 +61,6 @@ export const CompilerContainer = (props: CompilerContainerProps) => { const [showFilePathInput, setShowFilePathInput] = useState(false) const [toggleExpander, setToggleExpander] = useState(false) const [disableCompileButton, setDisableCompileButton] = useState(false) - const [compilerLoadedVersion, setCompilerLoadedVersion] = useState('') const compileIcon = useRef(null) const promptMessageInput = useRef(null) const configFilePathInput = useRef(null) @@ -187,7 +186,6 @@ export const CompilerContainer = (props: CompilerContainerProps) => { loadingCompiler() break case 'compilerLoaded': - setCompilerLoadedVersion(state.selectedVersion) compilerLoaded(compilerContainer.compiler.args[1]) break case 'compilationFinished': @@ -458,6 +456,11 @@ export const CompilerContainer = (props: CompilerContainerProps) => { // just for e2e // eslint-disable-next-line no-case-declarations + const elements = document.querySelectorAll('[data-id="compilerloaded"]') + // remove elements + for (let i = 0; i < elements.length; i++) { + elements[i].remove() + } const loadedElement = document.createElement('span') loadedElement.setAttribute('data-id', 'compilerloaded') loadedElement.setAttribute('data-version', state.selectedVersion) @@ -858,7 +861,6 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
- {compilerLoadedVersion ? : ''}