From 3a6a7d110b30cf7a3c52a662fbd52ce0f662a122 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Fri, 9 Apr 2021 14:35:53 +0100 Subject: [PATCH] Updated remaining test --- .circleci/config.yml | 8 +- .../src/commands/noWorkerErrorFor.ts | 2 +- .../src/tests/publishContract.test.ts | 5 +- apps/remix-ide-e2e/src/tests/recorder.spec.ts | 4 +- apps/remix-ide-e2e/src/tests/remixd.test.ts | 4 +- apps/remix-ide-e2e/src/tests/runAndDeploy.ts | 4 +- .../src/tests/signingMessage.test.ts | 4 +- .../src/tests/solidityImport.spec.ts | 4 +- ...ityUnittests => solidityUnittests.spec.ts} | 77 ++++++++----------- ...cialFunctions => specialFunctions.test.ts} | 4 +- ...{staticAnalysis => staticAnalysis.spec.ts} | 4 +- .../src/tests/{terminal => terminal.test.ts} | 46 +++++------ ...Execution => transactionExecution.spec.ts} | 5 +- .../src/tests/txListener.test.ts | 5 +- .../src/tests/{url => url.spec.ts} | 5 +- ...{usingWebWorker => usingWebWorker.test.ts} | 5 +- ...lIconsPanel => verticalIconsPanel.spec.ts} | 5 +- .../tests/{workspace => workspace.test.ts} | 0 package.json | 12 +-- 19 files changed, 72 insertions(+), 131 deletions(-) rename apps/remix-ide-e2e/src/tests/{solidityUnittests => solidityUnittests.spec.ts} (77%) rename apps/remix-ide-e2e/src/tests/{specialFunctions => specialFunctions.test.ts} (99%) rename apps/remix-ide-e2e/src/tests/{staticAnalysis => staticAnalysis.spec.ts} (97%) rename apps/remix-ide-e2e/src/tests/{terminal => terminal.test.ts} (69%) rename apps/remix-ide-e2e/src/tests/{transactionExecution => transactionExecution.spec.ts} (99%) rename apps/remix-ide-e2e/src/tests/{url => url.spec.ts} (97%) rename apps/remix-ide-e2e/src/tests/{usingWebWorker => usingWebWorker.test.ts} (96%) rename apps/remix-ide-e2e/src/tests/{verticalIconsPanel => verticalIconsPanel.spec.ts} (96%) rename apps/remix-ide-e2e/src/tests/{workspace => workspace.test.ts} (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 159b51afbd..e903625688 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -62,7 +62,7 @@ jobs: - COMMIT_AUTHOR: "Circle CI" working_directory: ~/remix-project - parallelism: 10 + parallelism: 15 steps: - checkout - run: npm install @@ -95,7 +95,7 @@ jobs: - COMMIT_AUTHOR: "Circle CI" working_directory: ~/remix-project - parallelism: 10 + parallelism: 15 steps: - checkout - run: npm install @@ -128,7 +128,7 @@ jobs: - COMMIT_AUTHOR: "Circle CI" working_directory: ~/remix-project - parallelism: 10 + parallelism: 15 steps: - checkout - run: npm install @@ -161,7 +161,7 @@ jobs: - COMMIT_AUTHOR: "Circle CI" working_directory: ~/remix-project - parallelism: 10 + parallelism: 15 steps: - checkout - run: npm install diff --git a/apps/remix-ide-e2e/src/commands/noWorkerErrorFor.ts b/apps/remix-ide-e2e/src/commands/noWorkerErrorFor.ts index bc8abf0146..7a916f34b7 100644 --- a/apps/remix-ide-e2e/src/commands/noWorkerErrorFor.ts +++ b/apps/remix-ide-e2e/src/commands/noWorkerErrorFor.ts @@ -17,7 +17,7 @@ function noWorkerErrorFor (browser: NightwatchBrowser, version: string, callback browser .setSolidityCompilerVersion(version) .click('*[data-id="compilerContainerCompileBtn"]') - .waitForElementPresent('*[data-id="compilationFinishedWith_' + version + '"]', 10000) + .waitForElementPresent('*[data-id="compilationFinishedWith_' + version + '"]', 60000) .notContainsText('*[data-id="compiledErrors"]', 'worker error:undefined') .notContainsText('*[data-id="compiledErrors"]', 'Uncaught RangeError: Maximum call stack size exceeded') .notContainsText('*[data-id="compiledErrors"]', 'RangeError: Maximum call stack size exceeded') diff --git a/apps/remix-ide-e2e/src/tests/publishContract.test.ts b/apps/remix-ide-e2e/src/tests/publishContract.test.ts index 3148f0c346..83cc9dda04 100644 --- a/apps/remix-ide-e2e/src/tests/publishContract.test.ts +++ b/apps/remix-ide-e2e/src/tests/publishContract.test.ts @@ -1,7 +1,6 @@ 'use strict' import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { @@ -68,7 +67,5 @@ module.exports = { .waitForElementPresent('*[data-id="contractDropdownIpfsCheckbox"]') .verify.elementPresent('*[data-id="contractDropdownIpfsCheckbox"]:checked') .end() - }, - - tearDown: sauce + } } diff --git a/apps/remix-ide-e2e/src/tests/recorder.spec.ts b/apps/remix-ide-e2e/src/tests/recorder.spec.ts index 9f8fd57df4..970a1179f9 100644 --- a/apps/remix-ide-e2e/src/tests/recorder.spec.ts +++ b/apps/remix-ide-e2e/src/tests/recorder.spec.ts @@ -1,7 +1,6 @@ 'use strict' import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { @@ -87,8 +86,7 @@ module.exports = { 'decoded input': { 'uint256 _po': { type: 'BigNumber', hex: '0x0a' } } }) .end() - }, - tearDown: sauce + } } const sources = [{ diff --git a/apps/remix-ide-e2e/src/tests/remixd.test.ts b/apps/remix-ide-e2e/src/tests/remixd.test.ts index 4dce35ce1f..b7f00e76cb 100644 --- a/apps/remix-ide-e2e/src/tests/remixd.test.ts +++ b/apps/remix-ide-e2e/src/tests/remixd.test.ts @@ -1,7 +1,6 @@ 'use strict' import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' const assetsTestContract = `import "./contract.sol"; contract Assets { @@ -85,8 +84,7 @@ module.exports = { .clickLaunchIcon('pluginManager') .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_remixd"] button') .end() - }, - tearDown: sauce + } } function runTests (browser: NightwatchBrowser) { diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy.ts index 6b250f5e40..daf86a984c 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy.ts @@ -1,7 +1,6 @@ 'use strict' import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' const passphrase = process.env.account_passphrase const password = process.env.account_password @@ -197,8 +196,7 @@ module.exports = { .pause(2000) .journalLastChildIncludes('[ "0x76a3ABb5a12dcd603B52Ed22195dED17ee82708f" ]') .end() - }, - tearDown: sauce + } } const sources = [ diff --git a/apps/remix-ide-e2e/src/tests/signingMessage.test.ts b/apps/remix-ide-e2e/src/tests/signingMessage.test.ts index 39c0d24ac8..517a19191e 100644 --- a/apps/remix-ide-e2e/src/tests/signingMessage.test.ts +++ b/apps/remix-ide-e2e/src/tests/signingMessage.test.ts @@ -1,7 +1,6 @@ 'use strict' import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { @@ -51,8 +50,7 @@ module.exports = { }) }) .end() - }, - tearDown: sauce + } } const sources = [ diff --git a/apps/remix-ide-e2e/src/tests/solidityImport.spec.ts b/apps/remix-ide-e2e/src/tests/solidityImport.spec.ts index e95519898a..17cf38ff0b 100644 --- a/apps/remix-ide-e2e/src/tests/solidityImport.spec.ts +++ b/apps/remix-ide-e2e/src/tests/solidityImport.spec.ts @@ -1,7 +1,6 @@ 'use strict' import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { @@ -88,8 +87,7 @@ module.exports = { .clickLaunchIcon('fileExplorers') .verifyContracts(['test13', 'ERC20'], { wait: 30000 }) .end() - }, - tearDown: sauce + } } const sources = [ diff --git a/apps/remix-ide-e2e/src/tests/solidityUnittests b/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts similarity index 77% rename from apps/remix-ide-e2e/src/tests/solidityUnittests rename to apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts index 284adb9efa..c55b2f60bb 100644 --- a/apps/remix-ide-e2e/src/tests/solidityUnittests +++ b/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts @@ -2,7 +2,6 @@ import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' module.exports = { @@ -48,15 +47,13 @@ module.exports = { .click('*[data-id="testTabCheckAllTests"]') .clickElementAtPosition('.singleTestLabel', 1) .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 80000) - .pause(5000) - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'MyTest (/tests/simple_storage_test.sol)') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Initial value should be100') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Value is set200') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Should fail for wrong value200') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Passing: 2') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Failing: 1') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'FAIL MyTest (/tests/simple_storage_test.sol)') + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'MyTest (/tests/simple_storage_test.sol)', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Initial value should be100', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Value is set200', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Should fail for wrong value200', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Passing: 2', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Failing: 1', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'FAIL MyTest (/tests/simple_storage_test.sol)', 120000) }, 'Should run advance unit test using natspec and experimental ABIEncoderV2 `ks2b_test.sol` ': function (browser: NightwatchBrowser) { @@ -68,18 +65,15 @@ module.exports = { .click('*[data-id="testTabCheckAllTests"]') .clickElementAtPosition('.singleTestLabel', 2) .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) - .pause(5000) - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '/tests/ks2b_test.sol') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project exists') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong project owner') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong sender') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong value') - .pause(5000) - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project is fundable') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'owner is incorrect') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'wrong sender') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'wrong value') + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', '/tests/ks2b_test.sol', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project exists', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong project owner', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong sender', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong value', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project is fundable', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'owner is incorrect', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'wrong sender', 120000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'wrong value', 120000) }, 'Should stop unit tests during test execution` ': function (browser: NightwatchBrowser) { @@ -90,14 +84,11 @@ module.exports = { .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') .pause(5000) .click('*[data-id="testTabRunTestsTabStopAction"]') - // .pause(1000) - .assert.containsText('*[data-id="testTabRunTestsTabStopAction"]', 'Stopping') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '/tests/ks2b_test.sol') + .waitForElementContainsText('*[data-id="testTabRunTestsTabStopAction"]', 'Stopping', 60000) + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', '/tests/ks2b_test.sol', 120000) .notContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', '/tests/4_Ballot_test.sol') .notContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', '/tests/simple_storage_test.sol') - .pause(7000) - .assert.containsText('*[data-id="testTabTestsExecutionStopped"]', 'The test execution has been stopped') + .waitForElementContainsText('*[data-id="testTabTestsExecutionStopped"]', 'The test execution has been stopped', 60000) }, 'Should fail on compilation': function (browser: NightwatchBrowser) { @@ -109,10 +100,8 @@ module.exports = { .click('*[data-id="testTabCheckAllTests"]') .clickElementAtPosition('.singleTestLabel', 3) .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'SyntaxError: No visibility specified') - .assert.containsText('*[data-id="testTabTestsExecutionStoppedError"]', 'The test execution has been stopped because of error(s) in your test file') + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'SyntaxError: No visibility specified', 120000) + .waitForElementContainsText('*[data-id="testTabTestsExecutionStoppedError"]', 'The test execution has been stopped because of error(s) in your test file', 120000) }, 'Should fail on deploy': function (browser: NightwatchBrowser) { @@ -124,9 +113,7 @@ module.exports = { .click('*[data-id="testTabCheckAllTests"]') .clickElementAtPosition('.singleTestLabel', 4) .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'contract deployment failed after trying twice') + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'contract deployment failed after trying twice', 120000) }, 'Should fail when parameters are to method in test contract': function (browser: NightwatchBrowser) { @@ -138,9 +125,7 @@ module.exports = { .click('*[data-id="testTabCheckAllTests"]') .clickElementAtPosition('.singleTestLabel', 5) .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]') - .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Method \'add\' can not have parameters inside a test contract') + .waitForElementContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Method \'add\' can not have parameters inside a test contract', 120000) }, 'Changing current path': function (browser: NightwatchBrowser) { @@ -152,7 +137,7 @@ module.exports = { .click('*[data-id="testTabGenerateTestFolder"]') .clickElementAtPosition('.singleTestLabel', 0) .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) + .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 60000) .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]') .clearValue('*[data-id="uiPathInput"]') .setValue('*[data-id="uiPathInput"]', 'tests') @@ -161,9 +146,7 @@ module.exports = { 'Solidity Unittests': function (browser: NightwatchBrowser) { runTests(browser) - }, - - tearDown: sauce + } } function runTests (browser: NightwatchBrowser) { @@ -175,11 +158,11 @@ function runTests (browser: NightwatchBrowser) { .clickLaunchIcon('solidityUnitTesting') .pause(500) .scrollAndClick('#runTestsTabRunAction') - .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) - .waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]', 10000) - .assert.containsText('#solidityUnittestsOutput', '/tests/4_Ballot_test.sol') - .assert.containsText('#solidityUnittestsOutput', '✓ Check winning proposal') - .assert.containsText('#solidityUnittestsOutput', '✓ Check winnin proposal with return value') + .waitForElementVisible('*[data-id="testTabSolidityUnitTestsOutputheader"]', 120000) + .waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]', 60000) + .waitForElementContainsText('#solidityUnittestsOutput', '/tests/4_Ballot_test.sol', 60000) + .waitForElementContainsText('#solidityUnittestsOutput', '✓ Check winning proposal', 60000) + .waitForElementContainsText('#solidityUnittestsOutput', '✓ Check winnin proposal with return value', 60000) .end() } diff --git a/apps/remix-ide-e2e/src/tests/specialFunctions b/apps/remix-ide-e2e/src/tests/specialFunctions.test.ts similarity index 99% rename from apps/remix-ide-e2e/src/tests/specialFunctions rename to apps/remix-ide-e2e/src/tests/specialFunctions.test.ts index 7b0975ac24..9056d43a63 100644 --- a/apps/remix-ide-e2e/src/tests/specialFunctions +++ b/apps/remix-ide-e2e/src/tests/specialFunctions.test.ts @@ -1,7 +1,6 @@ 'use strict' import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { @@ -220,8 +219,7 @@ module.exports = { }) }) .end() - }, - tearDown: sauce + } } const sources = [ diff --git a/apps/remix-ide-e2e/src/tests/staticAnalysis b/apps/remix-ide-e2e/src/tests/staticAnalysis.spec.ts similarity index 97% rename from apps/remix-ide-e2e/src/tests/staticAnalysis rename to apps/remix-ide-e2e/src/tests/staticAnalysis.spec.ts index 55f7f04ad6..a68a4a24ce 100644 --- a/apps/remix-ide-e2e/src/tests/staticAnalysis +++ b/apps/remix-ide-e2e/src/tests/staticAnalysis.spec.ts @@ -1,7 +1,6 @@ 'use strict' import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' const sources = [ { @@ -31,8 +30,7 @@ module.exports = { }, 'Static Analysis': function (browser: NightwatchBrowser) { runTests(browser) - }, - tearDown: sauce + } } function runTests (browser: NightwatchBrowser) { diff --git a/apps/remix-ide-e2e/src/tests/terminal b/apps/remix-ide-e2e/src/tests/terminal.test.ts similarity index 69% rename from apps/remix-ide-e2e/src/tests/terminal rename to apps/remix-ide-e2e/src/tests/terminal.test.ts index 3cb9f5351a..448642f4b5 100644 --- a/apps/remix-ide-e2e/src/tests/terminal +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -1,7 +1,6 @@ 'use strict' import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { @@ -12,7 +11,7 @@ module.exports = { browser .waitForElementVisible('*[data-id="terminalCli"]', 10000) .executeScript('console.log(1 + 1)') - .journalLastChild('2') + .waitForElementContainsText('*[data-id="terminalJournal"]', '2', 60000) }, 'Should clear console': function (browser: NightwatchBrowser) { @@ -20,7 +19,7 @@ module.exports = { .waitForElementVisible('*[data-id="terminalCli"]') .journalChildIncludes('Welcome to Remix') .click('#clearConsole') - .assert.containsText('*[data-id="terminalJournal"]', '') + .waitForElementContainsText('*[data-id="terminalJournal"]', '', 60000) }, 'Should display auto-complete menu': function (browser: NightwatchBrowser) { @@ -35,11 +34,11 @@ module.exports = { browser .waitForElementVisible('*[data-id="terminalCli"]') .executeScript('remix.help()') - .journalChildIncludes('remix.loadgist(id)') - .journalChildIncludes('remix.loadurl(url)') - .journalChildIncludes('remix.execute(filepath)') - .journalChildIncludes('remix.exeCurrent()') - .journalChildIncludes('remix.help()') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'remix.loadgist(id)', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'remix.loadurl(url)', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'remix.execute(filepath)', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'remix.exeCurrent()', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'remix.help()', 60000) }, 'Async/Await Script': function (browser: NightwatchBrowser) { @@ -47,9 +46,8 @@ module.exports = { .addFile('asyncAwait.js', { content: asyncAwait }) .openFile('asyncAwait.js') .executeScript('remix.execute(\'asyncAwait.js\')') - .journalLastChild('Waiting Promise') - .pause(5500) - .journalLastChild('result - Promise Resolved') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'Waiting Promise', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', 'result - Promise Resolved', 60000) }, 'Call Remix File Manager from a script': function (browser: NightwatchBrowser) { @@ -58,15 +56,13 @@ module.exports = { .openFile('asyncAwaitWithFileManagerAccess.js') .pause(5000) .executeScript('remix.execute(\'asyncAwaitWithFileManagerAccess.js\')') - .pause(6000) - .journalLastChildIncludes('contract Ballot {') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'contract Ballot {', 60000) }, 'Call web3.eth.getAccounts() using JavaScript VM': function (browser: NightwatchBrowser) { browser .executeScript('web3.eth.getAccounts()') - .pause(2000) - .journalLastChildIncludes('[ "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4", "0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2", "0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db", "0x78731D3Ca6b7E34aC0F824c42a7cC18A495cabaB", "0x617F2E2fD72FD9D5503197092aC168c91465E7f2", "0x17F6AD8Ef982297579C203069C1DbfFE4348c372", "0x5c6B0f7Bf3E7ce046039Bd8FABdfD3f9F5021678", "0x03C6FcED478cBbC9a4FAB34eF9f40767739D1Ff7", "0x1aE0EA34a72D944a8C7603FfB3eC30a6669E454C", "0x0A098Eda01Ce92ff4A4CCb7A4fFFb5A43EBC70DC", "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c", "0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C", "0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB", "0x583031D1113aD414F02576BD6afaBfb302140225", "0xdD870fA1b7C4700F2BD7f44238821C26f7392148" ]') + .waitForElementContainsText('*[data-id="terminalJournal"]', '[ "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4", "0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2", "0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db", "0x78731D3Ca6b7E34aC0F824c42a7cC18A495cabaB", "0x617F2E2fD72FD9D5503197092aC168c91465E7f2", "0x17F6AD8Ef982297579C203069C1DbfFE4348c372", "0x5c6B0f7Bf3E7ce046039Bd8FABdfD3f9F5021678", "0x03C6FcED478cBbC9a4FAB34eF9f40767739D1Ff7", "0x1aE0EA34a72D944a8C7603FfB3eC30a6669E454C", "0x0A098Eda01Ce92ff4A4CCb7A4fFFb5A43EBC70DC", "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c", "0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C", "0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB", "0x583031D1113aD414F02576BD6afaBfb302140225", "0xdD870fA1b7C4700F2BD7f44238821C26f7392148" ]', 60000) }, 'Call web3.eth.getAccounts() using Web3 Provider': function (browser: NightwatchBrowser) { @@ -76,10 +72,9 @@ module.exports = { .click('*[data-id="settingsWeb3Mode"]') .modalFooterOKClick() .executeScript('web3.eth.getAccounts()') - .pause(2000) - .journalLastChildIncludes('[ "') // we check if an array is present, don't need to check for the content - .journalLastChildIncludes('" ]') - .journalLastChildIncludes('", "') + .waitForElementContainsText('*[data-id="terminalJournal"]', '[ "', 60000) // we check if an array is present, don't need to check for the content + .waitForElementContainsText('*[data-id="terminalJournal"]', '" ]', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', '", "', 60000) }, 'Call Remix File Resolver (external URL) from a script': function (browser: NightwatchBrowser) { @@ -89,8 +84,7 @@ module.exports = { .openFile('resolveExternalUrlAndSave.js') .pause(1000) .executeScript('remix.execute(\'resolveExternalUrlAndSave.js\')') - .pause(6000) - .journalLastChildIncludes('Implementation of the {IERC20} interface.') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'Implementation of the {IERC20} interface.', 60000) .openFile('.deps/github/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol') }, @@ -101,8 +95,7 @@ module.exports = { .openFile('resolveUrl.js') .pause(1000) .executeScript('remix.execute(\'resolveUrl.js\')') - .pause(6000) - .journalLastChildIncludes('contract Ballot {') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'contract Ballot {', 60000) }, 'Call Remix File Resolver (internal URL) from a script and specify a path': function (browser: NightwatchBrowser) { @@ -112,13 +105,10 @@ module.exports = { .openFile('resolveExternalUrlAndSaveToaPath.js') .pause(1000) .executeScript('remix.execute(\'resolveExternalUrlAndSaveToaPath.js\')') - .pause(6000) - .journalLastChildIncludes('abstract contract ERC20Burnable') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'abstract contract ERC20Burnable', 60000) .openFile('.deps/github/newFile.sol') .end() - }, - - tearDown: sauce + } } const asyncAwait = ` diff --git a/apps/remix-ide-e2e/src/tests/transactionExecution b/apps/remix-ide-e2e/src/tests/transactionExecution.spec.ts similarity index 99% rename from apps/remix-ide-e2e/src/tests/transactionExecution rename to apps/remix-ide-e2e/src/tests/transactionExecution.spec.ts index 25ea116696..17fb82c644 100644 --- a/apps/remix-ide-e2e/src/tests/transactionExecution +++ b/apps/remix-ide-e2e/src/tests/transactionExecution.spec.ts @@ -1,7 +1,6 @@ 'use strict' import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { @@ -139,9 +138,7 @@ module.exports = { .click('#runTabView button[class^="instanceButton"]') .waitForElementPresent('.instance:nth-of-type(2)') .end() - }, - - tearDown: sauce + } } // @TODO test: bytes8[3][] type as input diff --git a/apps/remix-ide-e2e/src/tests/txListener.test.ts b/apps/remix-ide-e2e/src/tests/txListener.test.ts index 3324649e31..7a7b170d6e 100644 --- a/apps/remix-ide-e2e/src/tests/txListener.test.ts +++ b/apps/remix-ide-e2e/src/tests/txListener.test.ts @@ -1,7 +1,6 @@ 'use strict' import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' import examples from '../examples/example-contracts' const sources = [ @@ -45,7 +44,5 @@ module.exports = { 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } }) .end() - }, - - tearDown: sauce + } } diff --git a/apps/remix-ide-e2e/src/tests/url b/apps/remix-ide-e2e/src/tests/url.spec.ts similarity index 97% rename from apps/remix-ide-e2e/src/tests/url rename to apps/remix-ide-e2e/src/tests/url.spec.ts index f732e53fa1..ec273cab4c 100644 --- a/apps/remix-ide-e2e/src/tests/url +++ b/apps/remix-ide-e2e/src/tests/url.spec.ts @@ -2,7 +2,6 @@ import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' import examples from '../examples/example-contracts' const sources = [ @@ -51,7 +50,5 @@ module.exports = { .click('[for="optimize"') .verify.attributeEquals('#runs', 'value', '200') .end() - }, - - tearDown: sauce + } } diff --git a/apps/remix-ide-e2e/src/tests/usingWebWorker b/apps/remix-ide-e2e/src/tests/usingWebWorker.test.ts similarity index 96% rename from apps/remix-ide-e2e/src/tests/usingWebWorker rename to apps/remix-ide-e2e/src/tests/usingWebWorker.test.ts index b7728bdefc..163fb68af5 100644 --- a/apps/remix-ide-e2e/src/tests/usingWebWorker +++ b/apps/remix-ide-e2e/src/tests/usingWebWorker.test.ts @@ -1,7 +1,6 @@ 'use strict' import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' const sources = [ { @@ -49,7 +48,5 @@ module.exports = { elem.checked = false }) .end() - }, - - tearDown: sauce + } } diff --git a/apps/remix-ide-e2e/src/tests/verticalIconsPanel b/apps/remix-ide-e2e/src/tests/verticalIconsPanel.spec.ts similarity index 96% rename from apps/remix-ide-e2e/src/tests/verticalIconsPanel rename to apps/remix-ide-e2e/src/tests/verticalIconsPanel.spec.ts index a4bbc0dab7..29eaf4a95b 100644 --- a/apps/remix-ide-e2e/src/tests/verticalIconsPanel +++ b/apps/remix-ide-e2e/src/tests/verticalIconsPanel.spec.ts @@ -1,7 +1,6 @@ 'use strict' import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' -import sauce from './sauce' module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { @@ -29,7 +28,5 @@ module.exports = { .click('*[data-id="verticalIconsKindpluginManager"]') .scrollInto('*[data-id="pluginManagerComponentActivateButtondebugger"]') .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]') - }, - - tearDown: sauce + } } diff --git a/apps/remix-ide-e2e/src/tests/workspace b/apps/remix-ide-e2e/src/tests/workspace.test.ts similarity index 100% rename from apps/remix-ide-e2e/src/tests/workspace rename to apps/remix-ide-e2e/src/tests/workspace.test.ts diff --git a/package.json b/package.json index af5dab692f..91ea9b8ccd 100644 --- a/package.json +++ b/package.json @@ -62,14 +62,14 @@ "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.spec.js --env=chrome", "nightwatch_local_recorder": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/recorder.spec.js --env=chrome", - "nightwatch_local_transactionExecution": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/transactionExecution.test.js --env=chrome", - "nightwatch_local_staticAnalysis": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/staticAnalysis.test.js --env=chrome", + "nightwatch_local_transactionExecution": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/transactionExecution.spec.js --env=chrome", + "nightwatch_local_staticAnalysis": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/staticAnalysis.spec.js --env=chrome", "nightwatch_local_signingMessage": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/signingMessage.test.js --env=chrome", "nightwatch_local_specialFunctions": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/specialFunctions.test.js --env=chrome", - "nightwatch_local_solidityUnitTests": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/solidityUnittests.test.js --env=chrome", + "nightwatch_local_solidityUnitTests": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.js --env=chrome", "nightwatch_local_remixd": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/remixd.test.js --env=chrome", "nightwatch_local_terminal": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/terminal.test.js --env=chrome", - "nightwatch_local_gist": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/gist.spec.js --env=firefox", + "nightwatch_local_gist": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/gist.spec.js --env=chrome", "nightwatch_local_workspace": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/workspace.test.js --env=chrome", "nightwatch_local_defaultLayout": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/defaultLayout.test.js --env=chrome", "nightwatch_local_pluginManager": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/pluginManager.spec.js --env=chrome", @@ -82,8 +82,8 @@ "nightwatch_local_txListener": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/txListener.test.js --env=chrome", "nightwatch_local_fileManager": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/fileManager_api.spec.js --env=chrome", "nightwatch_local_runAndDeploy": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/runAndDeploy.js --env=chrome-runAndDeploy", - "nightwatch_local_url": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/url.test.js --env=chrome", - "nightwatch_local_verticalIconscontextmenu": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/verticalIconsPanel.test.js --env=chrome", + "nightwatch_local_url": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/url.spec.js --env=chrome", + "nightwatch_local_verticalIconscontextmenu": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/verticalIconsPanel.spec.js --env=chrome", "onchange": "onchange apps/remix-ide/build/app.js -- npm-run-all lint", "remixd": "nx build remixd && nx serve remixd --folder=./apps/remix-ide/contracts --remixide=http://127.0.0.1:8080", "selenium": "selenium-standalone start",