diff --git a/apps/remix-ide-e2e/.eslintrc b/apps/remix-ide-e2e/.eslintrc new file mode 100644 index 0000000000..8e19d96e54 --- /dev/null +++ b/apps/remix-ide-e2e/.eslintrc @@ -0,0 +1,15 @@ +{ + "rules": {}, + "overrides": [ + { + "files": ["src/plugins/index.js"], + "rules": { + "@typescript-eslint/no-var-requires": "off", + "no-undef": "off" + } + } + ], + "extends": ["../../.eslintrc"], + "ignorePatterns": ["!**/*"] +} + \ No newline at end of file diff --git a/apps/remix-ide-e2e/nightwatch.ts b/apps/remix-ide-e2e/nightwatch.ts new file mode 100644 index 0000000000..19b9fa74e3 --- /dev/null +++ b/apps/remix-ide-e2e/nightwatch.ts @@ -0,0 +1,83 @@ +import * as fs from 'fs' + +const crxFile = fs.readFileSync('apps/remix-ide/test-browser/extensions/chrome/metamask.crx') +const metamaskExtension = Buffer.from(crxFile).toString('base64') + +module.exports = { + 'src_folders': ['apps/remix-ide-e2e/src/tests'], + 'output_folder': 'apps/remix-ide-e2e/src/reports', + 'custom_commands_path': ['apps/remix-ide-e2e/src/commands'], + 'custom_assertions_path': '', + 'page_objects_path': '', + 'globals_path': '', + + 'test_settings': { + 'default': { + 'selenium_port': 4444, + 'selenium_host': 'localhost', + 'globals': { + 'waitForConditionTimeout': 10000, + 'asyncHookTimeout': 100000 + }, + 'screenshots': { + 'enabled': true, + 'path': 'apps/remix-ide-e2e/reports/screenshots', + 'on_failure': true, + 'on_error': true + }, + 'desiredCapabilities': { + 'browserName': 'firefox', + 'javascriptEnabled': true, + 'acceptSslCerts': true + }, + 'exclude': ['apps/remix-ide-e2e/test-browser/tests/runAndDeploy.js'] + }, + + 'chrome': { + 'desiredCapabilities': { + 'browserName': 'chrome', + 'javascriptEnabled': true, + 'acceptSslCerts': true, + 'goog:chromeOptions': { + 'args': ['window-size=2560,1440', 'start-fullscreen'] + } + } + }, + + 'chrome-runAndDeploy': { + 'desiredCapabilities': { + 'browserName': 'chrome', + 'javascriptEnabled': true, + 'acceptSslCerts': true, + 'goog:chromeOptions': { + 'args': ['window-size=2560,1440', 'start-fullscreen'], + 'extensions': [metamaskExtension] + } + } + }, + + 'safari': { + 'desiredCapabilities': { + 'browserName': 'safari', + 'javascriptEnabled': true, + 'acceptSslCerts': true + } + }, + + 'ie': { + 'desiredCapabilities': { + 'browserName': 'internet explorer', + 'javascriptEnabled': true, + 'acceptSslCerts': true + } + }, + + 'firefox': { + 'desiredCapabilities': { + 'browserName': 'firefox', + 'javascriptEnabled': true, + 'acceptSslCerts': true + } + } + } +} diff --git a/apps/remix-ide-e2e/src/reports/sample.test.xml b/apps/remix-ide-e2e/src/reports/sample.test.xml new file mode 100644 index 0000000000..6a9cec62fc --- /dev/null +++ b/apps/remix-ide-e2e/src/reports/sample.test.xml @@ -0,0 +1,38 @@ + + + + + + + + + Error: An error occurred while retrieving a new session: "Connection refused to 127.0.0.1:4444". If the Webdriver/Selenium service is managed by Nightwatch, check if "start_process" is set to "true". + at HttpRequest.EventEmitter.emit (domain.js:448:20) + at ClientRequest.EventEmitter.emit (domain.js:448:20) + at Socket.socketErrorListener (_http_client.js:392:9) + at Socket.EventEmitter.emit (domain.js:448:20) + + + + + + + + + diff --git a/apps/remix-ide-e2e/src/tests/sample.test.js b/apps/remix-ide-e2e/src/tests/sample.test.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/apps/remix-ide-e2e/tsconfig.e2e.json b/apps/remix-ide-e2e/tsconfig.e2e.json new file mode 100644 index 0000000000..789079fe7c --- /dev/null +++ b/apps/remix-ide-e2e/tsconfig.e2e.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "sourceMap": false, + "outDir": "../../dist/out-tsc", + "allowJs": true + }, + "include": ["src/**/*.ts", "src/**/*.js"] +} \ No newline at end of file diff --git a/apps/remix-ide-e2e/tsconfig.json b/apps/remix-ide-e2e/tsconfig.json new file mode 100644 index 0000000000..6be416ea65 --- /dev/null +++ b/apps/remix-ide-e2e/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "types": ["node"] + }, + "include": ["**/*.ts", "**/*.js"] +} + \ No newline at end of file diff --git a/nx.json b/nx.json index c6af465a6b..95b079d8fe 100644 --- a/nx.json +++ b/nx.json @@ -59,6 +59,10 @@ "remix-solidity", "remix-tests" ] + }, + "remix-ide-e2e": { + "tags": [], + "implicitDependencies": ["remix-ide"] } } } diff --git a/package.json b/package.json index 845c4cf666..f6f95f4d4b 100644 --- a/package.json +++ b/package.json @@ -239,7 +239,7 @@ "tap-spec": "^5.0.0", "tape": "^4.13.3", "ts-jest": "25.2.1", - "ts-node": "~7.0.0", + "ts-node": "^7.0.1", "tslint": "~6.0.0", "typescript": "~3.8.3", "uglify-js": "^2.8.16", diff --git a/workspace.json b/workspace.json index fb933f7285..c73618321d 100644 --- a/workspace.json +++ b/workspace.json @@ -91,6 +91,31 @@ } } }, + "remix-ide-e2e": { + "root": "apps/remix-ide-e2e", + "sourceRoot": "apps/remix-ide-e2e/src", + "projectType": "application", + "architect": { + "e2e": { + "builder": "@nrwl/workspace:run-commands", + "options": { + "commands": [ + { + "command": "node_modules/.bin/ts-node node_modules/.bin/nightwatch --config apps/remix-ide-e2e/nightwatch.ts apps/remix-ide-e2e/src/tests/sample.test.js --env chrome" + } + ] + } + }, + "lint": { + "builder": "@nrwl/linter:lint", + "options": { + "linter": "eslint", + "tsConfig": ["apps/remix-ide-e2e/tsconfig.e2e.json"], + "exclude": ["**/node_modules/**", "!apps/remix-ide-e2e/**/*"] + } + } + } + }, "remix-analyzer": { "root": "libs/remix-analyzer", "sourceRoot": "libs/remix-analyzer/src",