From 1d0e1015a464a1a5be8908d93ff50cccbd8bb7eb Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 18 Feb 2020 04:00:57 +0000 Subject: [PATCH] Nightwatch config for running tests in parallel Added drivers path for chrome and firefox Changed firefox port Installed geckodriver Changed firefox config cli_args config Fixed linting error Modified config Revert nightwatch config Fixed linting error Set drivers path Fixed linting error point driver path to new location Set marionette to false Removed cli_args option Set parallel command in ci Retry firefox in pipeline Retry firefox in ci pipeline Remove cli_args from nightwatch config Retry ci pipeline Load gecko in circleci Debug circleci Debug circleci Retry pipeline Retry pipeline Debug pipeline Debug pipeline Debug pipeline Debug pipeline Debug pipeline Debug pipeline Retry pipeline Retry pipeline Retry pipeline Retry pipeline Debug pipeline Debug pipeline Debug pipeline Debug pipeline Debug pipeline Debug pipeline Debug pipeline Changed CI selenium-server-standalone to selenium-standalone Fixed linting error Set marionette to false Add download of old firefox to ci build Set marionette to true Set permission Rearranged steps Fix ci error Remove gecko driver Use node_modules selenium standalone Change build steps Change firefox version Update firefox version Renamed firefox start step Test yml changes Test yml changes Test yml changes Test yml changes Setup workflows for running firefox and chrome tests in parallel Setup workflows for running firefox and chrome tests in parallel Setup workflows for running firefox and chrome tests in parallel Setup workflows for running firefox and chrome tests in parallel Use selenium-standalone Use selenium-standalone Set selenium-server version Added selenium config Fixed liniting error Fixed Build error path Fixed Selenium config error path Changed selenium server version Test for chrome Added config for chrome Test firefox and chrome in parallel Add firefox config to seleniumConfig Downgrade firefox driver version Download firefox browser Test circleci parallelism Test circleci parallelism Remove parallelism Added delay to ZoKrates test to fix failing test Fixed failing gist tests for firefox Disabled remixd tests for firefox browser Fix linting error Fixed failing terminal test Remove gecko driver dependency Disable remixd test for firefox Fixed failing solidity unit tests switch to .keys() to .sendKeys() since it is supported by both chrome and firefox --- .circleci/config.yml | 12 +- ci/browser_tests.sh | 2 +- package-lock.json | 143 ++++++++++++++++++++++++ package.json | 3 +- seleniumConfig.js | 11 ++ test-browser/commands/executeScript.js | 10 +- test-browser/tests/gist.js | 6 +- test-browser/tests/remixd.js | 10 +- test-browser/tests/solidityUnittests.js | 1 + test-browser/tests/terminal.js | 2 +- 10 files changed, 185 insertions(+), 15 deletions(-) create mode 100644 seleniumConfig.js diff --git a/.circleci/config.yml b/.circleci/config.yml index df86ca62aa..9b20ee1945 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,11 +25,17 @@ jobs: - run: npm run lint && npm run test && npm run make-mock-compiler - run: name: Download Selenium - command: wget http://selenium-release.storage.googleapis.com/3.5/selenium-server-standalone-3.5.3.jar + command: ./node_modules/.bin/selenium-standalone install --config=../remix-ide/seleniumConfig.js - run: name: Start Selenium - command: java -jar selenium-server-standalone-3.5.3.jar + command: ./node_modules/.bin/selenium-standalone start --config=../remix-ide/seleniumConfig.js background: true + - run: + name: Download Latest Firefox + command: sudo apt-get purge -y firefox && wget https://sourceforge.net/projects/ubuntuzilla/files/mozilla/apt/pool/main/f/firefox-mozilla-build/firefox-mozilla-build_73.0.1-0ubuntu1_amd64.deb + - run: + name: Install Firefox + command: sudo dpkg -i firefox-mozilla-build_73.0.1-0ubuntu1_amd64.deb - run: ./ci/browser_tests.sh - run: name: Deploy @@ -50,4 +56,4 @@ workflows: version: 2 build_all: jobs: - - remix-ide + - remix-ide \ No newline at end of file diff --git a/ci/browser_tests.sh b/ci/browser_tests.sh index a30a4afa61..d09efa27ba 100755 --- a/ci/browser_tests.sh +++ b/ci/browser_tests.sh @@ -21,7 +21,7 @@ setupRemixd sleep 5 -npm run nightwatch_local_chrome || TEST_EXITCODE=1 +npm run nightwatch_parallel || TEST_EXITCODE=1 echo "$TEST_EXITCODE" if [ "$TEST_EXITCODE" -eq 1 ] diff --git a/package-lock.json b/package-lock.json index 8b592ae785..04e126887e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2020,6 +2020,12 @@ "resolved": "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz", "integrity": "sha1-anmQQ3ynNtXhKI25K9MmbV9csqo=" }, + "adm-zip": { + "version": "0.4.11", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.11.tgz", + "integrity": "sha512-L8vcjDTCOIJk7wFvmlEUN7AsSb8T+2JrdP7KINBjzr24TJ5Mwj590sLu3BC7zNZowvJWa/JtPmD8eJCzdtDWjA==", + "dev": true + }, "aes-js": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", @@ -5082,6 +5088,21 @@ "event-emitter": "~0.3.5" } }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "dev": true + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "dev": true, + "requires": { + "es6-promise": "^4.0.3" + } + }, "es6-set": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", @@ -7922,6 +7943,112 @@ } } }, + "geckodriver": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/geckodriver/-/geckodriver-1.19.1.tgz", + "integrity": "sha512-xWL/+eEhQ6+t98rc1c+xVM3hshDJibXtZf9WJA3sshxq4k5L1PBwfmswyBmmlKUfBr4xuC256gLVC2RxFhiCsQ==", + "dev": true, + "requires": { + "adm-zip": "0.4.11", + "bluebird": "3.4.6", + "got": "5.6.0", + "https-proxy-agent": "3.0.0", + "tar": "4.4.2" + }, + "dependencies": { + "agent-base": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "bluebird": { + "version": "3.4.6", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.6.tgz", + "integrity": "sha1-AdqNgh2HgT0ViWfnQ9X+bGLPjA8=", + "dev": true + }, + "got": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-5.6.0.tgz", + "integrity": "sha1-ux1+4WO3gIK7yOuDbz85UATqb78=", + "dev": true, + "requires": { + "create-error-class": "^3.0.1", + "duplexer2": "^0.1.4", + "is-plain-obj": "^1.0.0", + "is-redirect": "^1.0.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "lowercase-keys": "^1.0.0", + "node-status-codes": "^1.0.0", + "object-assign": "^4.0.1", + "parse-json": "^2.1.0", + "pinkie-promise": "^2.0.0", + "read-all-stream": "^3.0.0", + "readable-stream": "^2.0.5", + "timed-out": "^2.0.0", + "unzip-response": "^1.0.0", + "url-parse-lax": "^1.0.0" + } + }, + "https-proxy-agent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-3.0.0.tgz", + "integrity": "sha512-y4jAxNEihqvBI5F3SaO2rtsjIOnnNA8sEbuiP+UhJZJHeM2NRm6c09ax2tgqme+SgUUvjao2fJXF4h3D6Cb2HQ==", + "dev": true, + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "tar": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.2.tgz", + "integrity": "sha512-BfkE9CciGGgDsATqkikUHrQrraBCO+ke/1f6SFAEMnxyyfN9lxC+nW1NFWMpqH865DhHIy9vQi682gk1X7friw==", + "dev": true, + "requires": { + "chownr": "^1.0.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.2.4", + "minizlib": "^1.1.0", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.2" + } + }, + "timed-out": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-2.0.0.tgz", + "integrity": "sha1-84sK6B03R9YoAB9B2vxlKs5nHAo=", + "dev": true + }, + "unzip-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-1.0.2.tgz", + "integrity": "sha1-uYTwh3/AqJwsdzzB73tbIytbBv4=", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } + } + }, "generate-function": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", @@ -11031,6 +11158,12 @@ "semver": "^6.3.0" } }, + "node-status-codes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-status-codes/-/node-status-codes-1.0.0.tgz", + "integrity": "sha1-WuVUHQJGRdMqWPzdyc7s6nrjrC8=", + "dev": true + }, "nodent": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/nodent/-/nodent-3.2.11.tgz", @@ -13788,6 +13921,16 @@ "integrity": "sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==", "dev": true }, + "read-all-stream": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/read-all-stream/-/read-all-stream-3.1.0.tgz", + "integrity": "sha1-NcPhd/IHjveJ7kv6+kNzB06u9Po=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0", + "readable-stream": "^2.0.0" + } + }, "read-cmd-shim": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/read-cmd-shim/-/read-cmd-shim-1.0.5.tgz", diff --git a/package.json b/package.json index b861a6d6b5..11c39272d4 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "remixd": "0.1.8-alpha.10", "request": "^2.83.0", "rimraf": "^2.6.1", - "selenium-standalone": "^6.0.1", + "selenium-standalone": "^6.17.0", "semver": "^6.1.2", "solc": "^0.6.0", "swarmgw": "^0.3.1", @@ -162,6 +162,7 @@ "lint": "standard | notify-error", "make-mock-compiler": "node ci/makeMockCompiler.js", "minify": "uglifyjs --in-source-map inline --source-map-inline -c warnings=false", + "nightwatch_parallel": "nightwatch -e chrome,firefox --config nightwatch.js", "nightwatch_local_firefox": "nightwatch --config nightwatch.js --env firefox", "nightwatch_local_chrome": "nightwatch --config nightwatch.js --env chrome", "nightwatch_local_ballot": "nightwatch ./test-browser/tests/ballot.js --config nightwatch.js --env chrome ", diff --git a/seleniumConfig.js b/seleniumConfig.js new file mode 100644 index 0000000000..210c9b6fa6 --- /dev/null +++ b/seleniumConfig.js @@ -0,0 +1,11 @@ +module.exports = { + version: '3.8.1', + baseURL: 'https://selenium-release.storage.googleapis.com', + drivers: { + chrome: { + version: '2.39', + arch: process.arch, + baseURL: 'https://chromedriver.storage.googleapis.com' + } + } +} diff --git a/test-browser/commands/executeScript.js b/test-browser/commands/executeScript.js index cfa8d9b562..f3bf5b09e4 100644 --- a/test-browser/commands/executeScript.js +++ b/test-browser/commands/executeScript.js @@ -3,11 +3,11 @@ const EventEmitter = require('events') class ExecuteScript extends EventEmitter { command (script) { this.api - .clearValue('span[data-id="terminalCliInput"]') - .click('div[data-id="terminalCli"]') - .keys(script) - .keys(this.api.Keys.ENTER) - .keys(this.api.Keys.ENTER) // that's a bug... sometimes we need to press 2 times to execute a command + .clearValue('*[data-id="terminalCliInput"]') + .click('*[data-id="terminalCli"]') + .sendKeys('*[data-id="terminalCliInput"]', script) + .sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER) + .sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER) .perform(() => { this.emit('complete') }) diff --git a/test-browser/tests/gist.js b/test-browser/tests/gist.js index 6284a17958..d68e83809b 100644 --- a/test-browser/tests/gist.js +++ b/test-browser/tests/gist.js @@ -19,6 +19,8 @@ module.exports = { - switch to a file in the new gist */ console.log('token', process.env.gist_token) + const runtimeBrowser = browser.capabilities.browserName + browser .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .clickLaunchIcon('fileExplorers') @@ -35,8 +37,8 @@ module.exports = { browser .modalFooterCancelClick() .executeScript(`remix.loadgist('${gistid}')`) - .switchFile('browser/gists') - .switchFile(`browser/gists/${gistid}`) + if (runtimeBrowser === 'chrome') browser.switchFile('browser/gists') + browser.switchFile(`browser/gists/${gistid}`) .switchFile(`browser/gists/${gistid}/1_Storage.sol`) .perform(done) } diff --git a/test-browser/tests/remixd.js b/test-browser/tests/remixd.js index e53fa4f432..01fef89601 100644 --- a/test-browser/tests/remixd.js +++ b/test-browser/tests/remixd.js @@ -52,15 +52,20 @@ module.exports = { when a relative import is used (i.e import "openzeppelin-solidity/contracts/math/SafeMath.sol") remix (as well as truffle) try to resolve it against the node_modules and installed_contracts folder. */ - browser + const browserName = browser.options.desiredCapabilities.browserName + + return browserName === 'chrome' ? browser .waitForElementVisible('#icon-panel', 2000) .clickLaunchIcon('fileExplorers') .addFile('test_import_node_modules.sol', sources[3]['browser/test_import_node_modules.sol']) .clickLaunchIcon('solidity') .testContracts('test_import_node_modules.sol', sources[3]['browser/test_import_node_modules.sol'], ['SafeMath']) + : '' }, 'Import from node_modules and reference a github import': function (browser) { - browser + const browserName = browser.options.desiredCapabilities.browserName + + return browserName === 'chrome' ? browser .waitForElementVisible('#icon-panel', 2000) .clickLaunchIcon('fileExplorers') .addFile('test_import_node_modules_with_github_import.sol', sources[4]['browser/test_import_node_modules_with_github_import.sol']) @@ -70,6 +75,7 @@ module.exports = { .clickLaunchIcon('pluginManager') .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_remixd"] button') .end() + : '' }, tearDown: sauce } diff --git a/test-browser/tests/solidityUnittests.js b/test-browser/tests/solidityUnittests.js index 8de6f15f2c..e9a94424c8 100644 --- a/test-browser/tests/solidityUnittests.js +++ b/test-browser/tests/solidityUnittests.js @@ -26,6 +26,7 @@ function runTests (browser) { .switchFile('browser/3_Ballot.sol') .clickLaunchIcon('solidityUnitTesting') .scrollAndClick('#runTestsTabRunAction') + .pause(5000) .waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]') .pause(10000) .assert.containsText('#solidityUnittestsOutput', 'browser/4_Ballot_test.sol (BallotTest)') diff --git a/test-browser/tests/terminal.js b/test-browser/tests/terminal.js index 7e16e04426..3c896a8135 100644 --- a/test-browser/tests/terminal.js +++ b/test-browser/tests/terminal.js @@ -26,7 +26,7 @@ module.exports = { browser .waitForElementVisible('*[data-id="terminalCli"]') .click('*[data-id="terminalCli"]') - .keys('remix.') + .sendKeys('*[data-id="terminalCliInput"]', 'remix.') .assert.visible('*[data-id="autoCompletePopUpAutoCompleteItem"]') },