From d6ebbd42d433b5eb4e23f11294d5aebe5b3a7e6c Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 13 May 2019 08:42:33 +0200 Subject: [PATCH] refactor browser tests --- .babelrc | 24 +-- .circleci/config.yml | 7 - nightwatch.js | 3 +- package.json | 62 +++----- .../debugger/debuggerUI/ButtonNavigator.js | 14 +- src/index.js | 2 +- test-browser/commands/clickFunction.js | 25 +++ test-browser/commands/clickLaunchIcon.js | 12 ++ test-browser/commands/getEditorValue.js | 18 +++ test-browser/commands/modalFooterOKClick.js | 17 +++ test-browser/commands/scrollInto.js | 23 +++ test-browser/commands/setEditorValue.js | 20 +++ test-browser/commands/testEditorValue.js | 14 ++ test-browser/commands/testFunction.js | 54 +++++++ test-browser/helpers/contracts.js | 144 +----------------- test-browser/helpers/init.js | 3 - test-browser/tests/ballot.js | 5 - test-browser/tests/compiling.js | 6 - test-browser/tests/generalTests.js | 7 - test-browser/tests/sharedFolderExplorer.js | 7 - test-browser/tests/staticanalysis.js | 2 - test-browser/tests/units/testRecorder.js | 1 - 22 files changed, 222 insertions(+), 248 deletions(-) create mode 100644 test-browser/commands/clickFunction.js create mode 100644 test-browser/commands/clickLaunchIcon.js create mode 100644 test-browser/commands/getEditorValue.js create mode 100644 test-browser/commands/modalFooterOKClick.js create mode 100644 test-browser/commands/scrollInto.js create mode 100644 test-browser/commands/setEditorValue.js create mode 100644 test-browser/commands/testEditorValue.js create mode 100644 test-browser/commands/testFunction.js diff --git a/.babelrc b/.babelrc index 4278599c5c..1320b9a327 100644 --- a/.babelrc +++ b/.babelrc @@ -1,23 +1,3 @@ { - "plugins": ["fast-async", - "check-es2015-constants", - "transform-es2015-arrow-functions", - "transform-es2015-block-scoped-functions", - "transform-es2015-block-scoping", - "transform-es2015-classes", - "transform-es2015-computed-properties", - "transform-es2015-destructuring", - "transform-object-rest-spread", - "transform-es2015-duplicate-keys", - "transform-es2015-for-of", - "transform-es2015-function-name", - "transform-es2015-literals", - "transform-es2015-object-super", - "transform-es2015-parameters", - "transform-es2015-shorthand-properties", - "transform-es2015-spread", - "transform-es2015-sticky-regex", - "transform-es2015-unicode-regex", - "transform-object-assign", - ] -} \ No newline at end of file + "presets": ["@babel/preset-env"] +} diff --git a/.circleci/config.yml b/.circleci/config.yml index f3f641b110..36ea124078 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,14 +21,7 @@ jobs: steps: - checkout - - restore_cache: - keys: - - dep-bundle-29-{{ checksum "package.json" }} - run: npm install - - save_cache: - key: dep-bundle-29-{{ checksum "package.json" }} - paths: - - ~/repo/node_modules - run: npm run lint && npm run test && npm run make-mock-compiler - run: name: Download Selenium diff --git a/nightwatch.js b/nightwatch.js index 560e55763a..6801c9c5ed 100644 --- a/nightwatch.js +++ b/nightwatch.js @@ -1,9 +1,10 @@ 'use strict' +require('@babel/register')() module.exports = { 'src_folders': ['test-browser/tests'], 'output_folder': 'reports', - 'custom_commands_path': '', + 'custom_commands_path': ['test-browser/commands'], 'custom_assertions_path': '', 'page_objects_path': '', 'globals_path': '', diff --git a/package.json b/package.json index 5f0a27549b..a8203af0ad 100644 --- a/package.json +++ b/package.json @@ -3,22 +3,25 @@ "version": "v0.8.1", "description": "Minimalistic browser-based Solidity IDE", "devDependencies": { + "@babel/core": "^7.4.5", + "@babel/plugin-transform-object-assign": "^7.2.0", + "@babel/polyfill": "^7.4.4", + "@babel/preset-env": "^7.4.5", + "@babel/preset-es2015": "latest", + "@babel/preset-es2017": "latest", + "@babel/preset-stage-0": "^7.0.0", + "@babel/register": "^7.4.4", "@fortawesome/fontawesome-free": "^5.8.1", "@resolver-engine/imports": "^0.3.0", "ace-mode-solidity": "^0.1.0", "async": "^2.1.2", - "babel-eslint": "^7.1.1", - "babel-plugin-transform-modern-regexp": "0.0.6", - "babel-plugin-transform-object-assign": "^6.22.0", + "babel-eslint": "^10.0.0", + "babel-plugin-fast-async": "^6.1.2", "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-plugin-yo-yoify": "^0.3.3", - "babel-polyfill": "^6.22.0", - "babel-preset-env": "^1.6.1", - "babel-preset-es2015": "^6.24.0", - "babel-preset-es2017": "^6.24.1", - "babel-preset-stage-0": "^6.24.1", - "babelify": "^7.3.0", + "babel-plugin-yo-yoify": "^2.0.0", + "babelify": "^10.0.0", "brace": "^0.8.0", + "browserify": "^16.2.3", "browserify-reload": "^1.0.3", "component-type": "^1.2.1", "copy-text-to-clipboard": "^1.0.4", @@ -26,11 +29,11 @@ "csslint": "^1.0.2", "deep-equal": "^1.0.1", "ethereumjs-util": "^5.1.2", - "events": "^3.0.0", "ethers": "^4.0.27", + "events": "^3.0.0", "execr": "^1.0.1", "exorcist": "^0.4.0", - "fast-async": "6.3.1", + "fast-async": "^7.0.6", "fast-levenshtein": "^2.0.6", "gists": "^1.0.1", "javascript-serialize": "^1.6.1", @@ -39,6 +42,7 @@ "js-beautify": "1.6.14", "minixhr": "^3.2.2", "mkdirp": "^0.5.1", + "nanohtml": "^1.6.3", "nightwatch": "^0.9.20", "notify-error": "^1.2.0", "npm-link-local": "^1.1.0", @@ -95,29 +99,6 @@ ], "parser": "babel-eslint" }, - "babel": { - "plugins": [ - "transform-es2015-template-literals", - "transform-es2015-literals", - "transform-es2015-function-name", - "transform-es2015-arrow-functions", - "transform-es2015-block-scoped-functions", - "transform-es2015-classes", - "transform-es2015-object-super", - "transform-es2015-shorthand-properties", - "transform-es2015-duplicate-keys", - "transform-es2015-computed-properties", - "transform-es2015-for-of", - "transform-es2015-sticky-regex", - "transform-es2015-unicode-regex", - "check-es2015-constants", - "transform-es2015-spread", - "transform-es2015-parameters", - "transform-es2015-destructuring", - "transform-es2015-block-scoping", - "transform-modern-regexp" - ] - }, "browserify": { "transform": [ [ @@ -127,7 +108,7 @@ "sourceMaps": true, "plugins": [ [ - "fast-async", + "module:fast-async", { "runtimePattern": null, "compiler": { @@ -139,14 +120,14 @@ } ], [ - "yo-yoify" + "module:babel-plugin-yo-yoify" ], [ - "transform-object-assign" + "module:@babel/plugin-transform-object-assign" ] ], "presets": [ - "es2015" + "@babel/preset-env" ] } ] @@ -193,6 +174,7 @@ "test": "csslint && standard && node test/index.js", "test-browser": "npm-run-all -lpr selenium downloadsolc_root make-mock-compiler serve browsertest", "watch": "watchify src/index.js -dv -p browserify-reload -o build/app.js --exclude solc", - "reinstall": "rm ./node-modules/ -rf; rm package-lock.json; rm ./build/ -rf; npm install; npm run build" + "reinstall": "rm ./node-modules/ -rf; rm package-lock.json; rm ./build/ -rf; npm install; npm run build", + "postinstall": "cd .. && git clone https://github.com/ethereum/remix && cd remix && git checkout 517db1adce48feac758aff7465241c0dd385b906 && npm install && npm run bootstrap && cd .. && cd repo && npm run setupremix" } } diff --git a/src/app/debugger/debuggerUI/ButtonNavigator.js b/src/app/debugger/debuggerUI/ButtonNavigator.js index 7af92c49d8..2f7c8a4029 100644 --- a/src/app/debugger/debuggerUI/ButtonNavigator.js +++ b/src/app/debugger/debuggerUI/ButtonNavigator.js @@ -46,16 +46,16 @@ ButtonNavigator.prototype.render = function () { var self = this var view = yo`
- - - - + + + +
- - - + + +