From 67a7ed0b5acad0ddb10af70400f7c8b7132209fe Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 6 Mar 2023 13:09:05 +0100 Subject: [PATCH] replace function --- .../src/commands/journalLastChildIncludes.ts | 16 ++++++++-------- .../remix-ide-e2e/src/tests/runAndDeploy.test.ts | 1 - .../src/tests/specialFunctions.test.ts | 8 -------- apps/remix-ide-e2e/src/tests/terminal.test.ts | 1 - .../src/tests/transactionExecution.test.ts | 2 -- 5 files changed, 8 insertions(+), 20 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/journalLastChildIncludes.ts b/apps/remix-ide-e2e/src/commands/journalLastChildIncludes.ts index 7e63d703b6..aab4d34b43 100644 --- a/apps/remix-ide-e2e/src/commands/journalLastChildIncludes.ts +++ b/apps/remix-ide-e2e/src/commands/journalLastChildIncludes.ts @@ -5,14 +5,14 @@ import EventEmitter from 'events' Check if the last log in the console contains a specific text */ class JournalLastChildIncludes extends EventEmitter { - command (this: NightwatchBrowser, val: string): NightwatchBrowser { - this.api - .waitForElementVisible('*[data-id="terminalJournal"]', 10000) - .pause(1000) - .getText('*[data-id="terminalJournal"]', (result) => { - console.log('JournalLastChildIncludes', result.value) - if (typeof result.value === 'string' && result.value.indexOf(val) === -1) return this.api.assert.fail(`wait for ${val} in ${result.value}`) - else this.api.assert.ok(true, `<*[data-id="terminalJournal"]> contains ${val}.`) + command(this: NightwatchBrowser, val: string): NightwatchBrowser { + this.api + .waitForElementPresent({ + selector: `//*[@data-id='terminalJournal' and contains(.,'${val}')]`, + timeout: 10000, + locateStrategy: 'xpath' + }).perform((done) => { + done() this.emit('complete') }) return this diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy.test.ts index 39ba9f3e5c..1b382a4290 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy.test.ts @@ -224,7 +224,6 @@ module.exports = { 'Call web3.eth.getAccounts() using Injected Provider (Metamask)': !function (browser: NightwatchBrowser) { browser .executeScriptInTerminal('web3.eth.getAccounts()') - .pause(2000) .journalLastChildIncludes('[ "0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f" ]') .end() } diff --git a/apps/remix-ide-e2e/src/tests/specialFunctions.test.ts b/apps/remix-ide-e2e/src/tests/specialFunctions.test.ts index ad41980081..65ffb46186 100644 --- a/apps/remix-ide-e2e/src/tests/specialFunctions.test.ts +++ b/apps/remix-ide-e2e/src/tests/specialFunctions.test.ts @@ -29,7 +29,6 @@ module.exports = { .perform((done) => { browser.getAddressAtPosition(0, (address) => { browser.sendLowLevelTx(address, '0', '0xaa') - .pause(1000) .journalLastChildIncludes('to: CheckSpecials.(fallback)') .journalLastChildIncludes('value: 0 wei') .journalLastChildIncludes('data: 0xaa') @@ -67,7 +66,6 @@ module.exports = { browser.perform((done) => { browser.getAddressAtPosition(0, (address) => { browser.sendLowLevelTx(address, '1', '') - .pause(1000) .journalLastChildIncludes('to: CheckSpecials.(receive)') .journalLastChildIncludes('value: 1 wei') .journalLastChildIncludes('data: 0x') @@ -80,7 +78,6 @@ module.exports = { browser.perform((done) => { browser.getAddressAtPosition(0, (address) => { browser.sendLowLevelTx(address, '10', '0xaa') - .pause(1000) .journalLastChildIncludes('to CheckSpecials.(fallback) errored:') .journalLastChildIncludes('The called function should be payable if you send value') .perform(done()) @@ -97,7 +94,6 @@ module.exports = { .perform((done) => { browser.getAddressAtPosition(0, (address) => { browser.sendLowLevelTx(address, '1', '') - .pause(1000) .journalLastChildIncludes('to: CheckSpecials.(receive)') .journalLastChildIncludes('value: 1 wei') .journalLastChildIncludes('data: 0x') @@ -110,7 +106,6 @@ module.exports = { browser.perform((done) => { browser.getAddressAtPosition(0, (address) => { browser.sendLowLevelTx(address, '0', '0xaa') - .pause(1000) .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`) .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, '\'Fallback\' function is not defined') .perform(done()) @@ -127,7 +122,6 @@ module.exports = { .perform((done) => { browser.getAddressAtPosition(0, (address) => { browser.sendLowLevelTx(address, '1', '') - .pause(1000) .journalLastChildIncludes('to: CheckSpecials.(fallback)') .journalLastChildIncludes('value: 1 wei') .journalLastChildIncludes('data: 0x') @@ -140,7 +134,6 @@ module.exports = { browser.perform((done) => { browser.getAddressAtPosition(0, (address) => { browser.sendLowLevelTx(address, '1', '0xaa') - .pause(1000) .journalLastChildIncludes('to: CheckSpecials.(fallback)') .journalLastChildIncludes('value: 1 wei') .journalLastChildIncludes('data: 0xaa') @@ -180,7 +173,6 @@ module.exports = { .perform((done) => { browser.getAddressAtPosition(0, (address) => { browser.sendLowLevelTx(address, '999999998765257135', '0xaa') - .pause(1000) .journalLastChildIncludes('to: CheckSpecials.(fallback)') .journalLastChildIncludes('value: 999999998765257135 wei') .journalLastChildIncludes('data: 0xaa') diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 0ce9c70b7a..5e9b58d499 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -202,7 +202,6 @@ module.exports = { .addFile('scripts/deploy_storage.js', { content: scriptAutoExec.script }) .openFile('contracts/storage.sol') .sendKeys('body', [browser.Keys.CONTROL, browser.Keys.SHIFT, 's']) - .pause(15000) .journalLastChildIncludes('147') }, diff --git a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts index d91ec90bee..543becddc2 100644 --- a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts +++ b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts @@ -141,7 +141,6 @@ module.exports = { .click('.udapp_contractActionsContainerSingle > button') .clickInstance(0) .clickFunction('g - transact (not payable)') - .pause(5000) .journalLastChildIncludes('Error provided by the contract:') .journalLastChildIncludes('CustomError : error description') .journalLastChildIncludes('Parameters:') @@ -182,7 +181,6 @@ module.exports = { .click('.udapp_contractActionsContainerSingle > button') .clickInstance(1) .clickFunction('h - transact (not payable)') - .pause(5000) .journalLastChildIncludes('Error provided by the contract:') .journalLastChildIncludes('CustomError : error description from library') .journalLastChildIncludes('Parameters:')