diff --git a/apps/remix-ide-e2e/src/commands/verifyContracts.ts b/apps/remix-ide-e2e/src/commands/verifyContracts.ts index 88d910374e..02635cea9d 100644 --- a/apps/remix-ide-e2e/src/commands/verifyContracts.ts +++ b/apps/remix-ide-e2e/src/commands/verifyContracts.ts @@ -1,4 +1,4 @@ -import { NightwatchBrowser, NightwatchCallbackResult } from 'nightwatch' +import { NightwatchBrowser } from 'nightwatch' import EventEmitter from 'events' class VerifyContracts extends EventEmitter { @@ -13,7 +13,7 @@ class VerifyContracts extends EventEmitter { } } -function getCompiledContracts (browser: NightwatchBrowser, opts: { wait: number, version?: string }, callback: (result: NightwatchCallbackResult) => void) { +function verifyContracts (browser: NightwatchBrowser, compiledContractNames: string[], opts: { wait: number, version?: string }, callback: VoidFunction) { browser .clickLaunchIcon('solidity') .pause(opts.wait) @@ -29,44 +29,14 @@ function getCompiledContracts (browser: NightwatchBrowser, opts: { wait: number, .assert.containsText('*[data-id="treeViewLicompiler/version"]', `version:\n ${opts.version}`) .modalFooterCancelClick() .perform(done) - } else done() - }) - .execute(function () { - const contracts = document.querySelectorAll('*[data-id="compiledContracts"] option') as NodeListOf - - if (!contracts) { - return null } else { - const ret = [] - - for (let c = 0; c < contracts.length; c++) { - ret.push(contracts[c].value) - } - return ret + compiledContractNames.forEach((name) => { + browser.waitForElementContainsText('[data-id="compiledContracts"]', name, 60000) + }) + done() + callback() } - }, [], function (result) { - callback(result) }) } -function verifyContracts (browser: NightwatchBrowser, compiledContractNames: string[], opts: { wait: number, version?: string }, callback: VoidFunction) { - getCompiledContracts(browser, opts, (result: NightwatchCallbackResult) => { - if (result.value) { - for (const contract in compiledContractNames) { - console.log(' - ' + compiledContractNames[contract], result.value) - if (result.value.indexOf(compiledContractNames[contract]) === -1) { - browser.assert.fail('compiled contract ' + compiledContractNames + ' not found', 'info about error', '') - browser.end() - return - } - } - } else { - browser.assert.fail('compiled contract ' + compiledContractNames + ' not found - none found', 'info about error', '') - browser.end() - } - console.log('contracts all found ' + compiledContractNames) - callback() - }) -} - module.exports = VerifyContracts diff --git a/apps/remix-ide-e2e/src/commands/waitForElementContainsText.ts b/apps/remix-ide-e2e/src/commands/waitForElementContainsText.ts index c41bf09b69..5376da014d 100644 --- a/apps/remix-ide-e2e/src/commands/waitForElementContainsText.ts +++ b/apps/remix-ide-e2e/src/commands/waitForElementContainsText.ts @@ -9,7 +9,7 @@ class WaitForElementContainsText extends EventEmitter { if (typeof result.value === 'string' && result.value.indexOf(value) !== -1) { clearInterval(runid) clearTimeout(waitId) - this.api.assert.ok(true, `WaitForElementContainsText ${id} contains ${value} after ${timeout}`) + this.api.assert.ok(true, `WaitForElementContainsText ${id} contains ${value}`) this.emit('complete') } }) @@ -17,7 +17,7 @@ class WaitForElementContainsText extends EventEmitter { waitId = setTimeout(() => { clearInterval(runid) - this.api.assert.fail(`TimeoutError: An error occurred while running .waitForElementContainsText() command on ${id}`) + this.api.assert.fail(`TimeoutError: An error occurred while running .waitForElementContainsText() command on ${id} after ${timeout} milliseconds`) }, timeout) return this } diff --git a/apps/remix-ide-e2e/src/tests/compiler_api.test.ts b/apps/remix-ide-e2e/src/tests/compiler_api.test.ts index 8281b1fbde..c12c210efb 100644 --- a/apps/remix-ide-e2e/src/tests/compiler_api.test.ts +++ b/apps/remix-ide-e2e/src/tests/compiler_api.test.ts @@ -53,8 +53,7 @@ module.exports = { 'Should produce a stack too deep error': function (browser: NightwatchBrowser) { browser - .clickLaunchIcon('fileExplorers') - .click('li[data-id="treeViewLitreeViewItemREADME.txt"') + .setSolidityCompilerVersion('soljson-v0.8.1+commit.df193b15.js') .addFile('ContractStackLimit.sol', { content: contractStackLimit }) .clickLaunchIcon('solidity') .waitForElementContainsText('*[data-id="compiledErrors"]', 'CompilerError: Stack too deep when compiling inline assembly: Variable headStart is 1 slot(s) too deep inside the stack.', 60000) diff --git a/apps/remix-ide-e2e/src/tests/debugger b/apps/remix-ide-e2e/src/tests/debugger.spec.ts similarity index 98% rename from apps/remix-ide-e2e/src/tests/debugger rename to apps/remix-ide-e2e/src/tests/debugger.spec.ts index eaf195d6de..e9f51d8ce6 100644 --- a/apps/remix-ide-e2e/src/tests/debugger +++ b/apps/remix-ide-e2e/src/tests/debugger.spec.ts @@ -188,8 +188,7 @@ module.exports = { browser .addFile('test_jsGetTrace.js', { content: jsGetTrace }) .executeScript('remix.exeCurrent()') - .pause(5000) - .journalChildIncludes('result { "gas": "0x5863", "return": "0x0000000000000000000000000000000000000000000000000000000000000000", "structLogs":') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'result { "gas": "0x5863", "return": "0x0000000000000000000000000000000000000000000000000000000000000000", "structLogs":', 60000) }, 'Should call the debugger api: debug': function (browser: NightwatchBrowser) { diff --git a/package.json b/package.json index 57279fa5a3..42510cda0e 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "nightwatch_local_firefox": "npm run build:e2e & nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js --env=firefox", "nightwatch_local_chrome": "npm run build:e2e & nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js --env=chrome", "nightwatch_local_ballot": "npm run build:e2e & nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/ballot.test.js --env=chrome", - "nightwatch_local_ballot_0_4_11": "npm run build:e2e & nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/ballot_0_4_11.spec.js --env=firefox", + "nightwatch_local_ballot_0_4_11": "npm run build:e2e & nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/ballot_0_4_11.spec.js --env=chrome", "nightwatch_local_usingWorker": "npm run build:e2e & nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/usingWebWorker.test.js --env=chrome", "nightwatch_local_libraryDeployment": "npm run build:e2e & nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/libraryDeployment.test.js --env=chrome", "nightwatch_local_solidityImport": "npm run build:e2e & nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/solidityImport.test.js --env=chrome",