http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/e2e/testcafe/package.json ---------------------------------------------------------------------- diff --git a/modules/web-console/e2e/testcafe/package.json b/modules/web-console/e2e/testcafe/package.json index 2501102..bfa3239 100644 --- a/modules/web-console/e2e/testcafe/package.json +++ b/modules/web-console/e2e/testcafe/package.json @@ -3,25 +3,19 @@ "version": "1.0.0", "description": "E2E tests for Apache Ignite Web console", "private": true, + "main": "index.js", "scripts": { - "env": "node envtools.js start", - "test": "node testcafe.js --env=true" + "env": "node environment/launch-env.js", + "test": "node index.js --env=true" }, - "author": "", - "contributors": [ - { - "name": "", - "email": "" - } - ], "license": "Apache-2.0", "keywords": [ "Apache Ignite Web console" ], "homepage": "https://ignite.apache.org/", "engines": { - "npm": "3.x.x", - "node": "4.x.x" + "npm": ">=5.x.x", + "node": ">=8.x.x <10.x.x" }, "os": [ "darwin",
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/e2e/testcafe/roles.js ---------------------------------------------------------------------- diff --git a/modules/web-console/e2e/testcafe/roles.js b/modules/web-console/e2e/testcafe/roles.js index 3089e97..ae5a6a5 100644 --- a/modules/web-console/e2e/testcafe/roles.js +++ b/modules/web-console/e2e/testcafe/roles.js @@ -15,12 +15,12 @@ * limitations under the License. */ -const { Role, t } = require('testcafe'); -import { resolveUrl } from './envtools'; +import { Role, t } from 'testcafe'; +import { resolveUrl } from './environment/envtools'; import {pageSignin as page} from './page-models/pageSignin'; export const createRegularUser = () => { - return new Role(resolveUrl('/signin'), async() => { + return Role(resolveUrl('/signin'), async() => { await t.eval(() => window.localStorage.clear()); // Disable "Getting started" modal. http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/e2e/testcafe/testcafe-runner.js ---------------------------------------------------------------------- diff --git a/modules/web-console/e2e/testcafe/testcafe-runner.js b/modules/web-console/e2e/testcafe/testcafe-runner.js new file mode 100644 index 0000000..681ee2e --- /dev/null +++ b/modules/web-console/e2e/testcafe/testcafe-runner.js @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const { startEnv, dropTestDB, insertTestUser } = require('./environment/envtools'); + +const createTestCafe = require('testcafe'); + +let testcafe = null; + +const startTestcafe = (config) => { + return createTestCafe('localhost', 1337, 1338) + .then(async(tc) => { + try { + if (config.enableEnvironment) + await startEnv(); + + await dropTestDB(); + await insertTestUser(); + + testcafe = tc; + + const runner = testcafe.createRunner(); + + console.log('Start E2E testing!'); + + return runner + .src(config.fixturesPathsArray) + .browsers(config.browsers) + .reporter(config.reporter) + .run({ skipJsErrors: true }); + } catch (err) { + console.log(err); + + process.exit(1); + } + }) + .then(async(failedCount) => { + console.log('Cleaning after tests...'); + + testcafe.close(); + + await dropTestDB(); + + console.log('Tests failed: ' + failedCount); + }); +}; + +module.exports = { startTestcafe }; http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/e2e/testcafe/testcafe.js ---------------------------------------------------------------------- diff --git a/modules/web-console/e2e/testcafe/testcafe.js b/modules/web-console/e2e/testcafe/testcafe.js deleted file mode 100644 index 3d6cc02..0000000 --- a/modules/web-console/e2e/testcafe/testcafe.js +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -const glob = require('glob'); -const path = require('path'); - -require('app-module-path').addPath(path.join(__dirname, 'node_modules')); -require('app-module-path').addPath(__dirname); - -const argv = require('minimist')(process.argv.slice(2)); -const envEnabled = argv.env; - -const { startEnv, dropTestDB } = require('./envtools'); - -const createTestCafe = require('testcafe'); - -// See all supported browsers at http://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/browsers/browser-support.html#locally-installed-browsers -const BROWSERS = ['chromium:headless --no-sandbox']; // For example: ['chrome', 'firefox']; - -let testcafe = null; - -const resolveFixturesPaths = () => { - let fixturesPaths = glob.sync(' ./fixtures/**/*.js'); - - if (process.env.IGNITE_MODULES) { - const igniteModulesTestcafe = path.join(process.env.IGNITE_MODULES, 'e2e/testcafe'); - const additionalFixturesPaths = glob.sync(path.join(igniteModulesTestcafe, 'fixtures', '**/*.js')); - const relativePaths = new Set(additionalFixturesPaths.map((fixturePath) => path.relative(igniteModulesTestcafe, fixturePath))); - - fixturesPaths = fixturesPaths.filter((fixturePath) => !relativePaths.has(path.relative(process.cwd(), fixturePath))).concat(additionalFixturesPaths); - } - - return fixturesPaths; -}; - -createTestCafe('localhost', 1337, 1338) - .then(async(tc) => { - try { - if (envEnabled) - await startEnv(); - - await dropTestDB(); - - testcafe = tc; - - const runner = testcafe.createRunner(); - const reporter = process.env.TEAMCITY ? 'teamcity' : 'spec'; - - console.log('Start E2E testing!'); - - return runner - .src(resolveFixturesPaths()) - .browsers(BROWSERS) - .reporter(reporter) - .run({ skipJsErrors: true, quarantineMode: process.env.QUARANTINE_MODE || false }); - } catch (err) { - console.log(err); - - process.exit(1); - } - }) - .then(async(failedCount) => { - console.log('Cleaning after tests...'); - - testcafe.close(); - - if (envEnabled) - await dropTestDB(); - - console.log('Tests failed: ' + failedCount); - - process.exit(0); - }); http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/e2e/testenv/Dockerfile ---------------------------------------------------------------------- diff --git a/modules/web-console/e2e/testenv/Dockerfile b/modules/web-console/e2e/testenv/Dockerfile index 9192e1f..8cb01fe 100644 --- a/modules/web-console/e2e/testenv/Dockerfile +++ b/modules/web-console/e2e/testenv/Dockerfile @@ -15,72 +15,37 @@ # limitations under the License. # -FROM ubuntu:14.04 +FROM node:8-alpine -ENV NPM_CONFIG_LOGLEVEL info -ENV NODE_VERSION 8.11.1 - -# Before package list update. -RUN set -ex && \ - for key in \ - 9554F04D7259F04124DE6B476D5A82AC7E37093B \ - 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ - FD3A5288F042B6850C66B31F09FE44734EB7990E \ - 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ - DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ - B9AE9905FFD7803F25714661B63B535A4C206CA9 \ - C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ - 56730D5401028683275BD23C23EFEFE93C4CFFFE \ - ; do \ - gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \ - gpg --keyserver pgp.mit.edu --recv-keys "$key" || \ - gpg --keyserver keyserver.pgp.com --recv-keys "$key" ; \ - done +ENV NPM_CONFIG_LOGLEVEL error # Update package list & install. -RUN apt-get update && \ - apt-get install -y nginx-light curl xz-utils git dos2unix - -# Install Node JS. -RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" && \ - curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" && \ - gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc && \ - grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - && \ - tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 && \ - rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt - -ENV NPM_CONFIG_LOGLEVEL warn +RUN apk add --no-cache nginx # Install global node packages. RUN npm install -g pm2 -# Install frontend & backend apps. -RUN mkdir -p /opt/web-console +# Copy nginx config. +COPY e2e/testenv/nginx/nginx.conf /etc/nginx/nginx.conf +COPY e2e/testenv/nginx/web-console.conf /etc/nginx/web-console.conf -# Copy source. WORKDIR /opt/web-console -COPY frontend ./frontend -COPY backend ./backend +# Install node modules for frontend and backend modules. +COPY backend/package*.json backend/ +RUN (cd backend && npm install --no-optional --production) -# Install node modules. -RUN cd /opt/web-console/frontend && npm install --no-optional --prod && npm run build -RUN cd /opt/web-console/backend && npm install --only=production --no-optional +COPY frontend/package*.json frontend/ +RUN (cd frontend && npm install --no-optional) -# Returns to base path. -WORKDIR /opt/web-console - -# Copy nginx config. -COPY ./e2e/testenv/nginx/nginx.conf /etc/nginx/nginx.conf -COPY ./e2e/testenv/nginx/web-console.conf /etc/nginx/web-console.conf - -# Setup entrypoint. -COPY ./e2e/testenv/entrypoint.sh . -RUN chmod 755 /opt/web-console/entrypoint.sh && dos2unix /opt/web-console/entrypoint.sh +# Copy source. +COPY backend backend +COPY frontend frontend -# Clean up. -RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN (cd frontend && npm run build) EXPOSE 9001 -ENTRYPOINT ["/opt/web-console/entrypoint.sh"] +WORKDIR /opt/web-console/backend + +CMD nginx && pm2-runtime index.js -n web-console-backend http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/e2e/testenv/entrypoint.sh ---------------------------------------------------------------------- diff --git a/modules/web-console/e2e/testenv/entrypoint.sh b/modules/web-console/e2e/testenv/entrypoint.sh deleted file mode 100644 index f6107a4..0000000 --- a/modules/web-console/e2e/testenv/entrypoint.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -service nginx start - -cd /opt/web-console/backend && pm2 start ./index.js --no-daemon http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/e2e/testenv/nginx/nginx.conf ---------------------------------------------------------------------- diff --git a/modules/web-console/e2e/testenv/nginx/nginx.conf b/modules/web-console/e2e/testenv/nginx/nginx.conf index dbc79d7..169b334 100644 --- a/modules/web-console/e2e/testenv/nginx/nginx.conf +++ b/modules/web-console/e2e/testenv/nginx/nginx.conf @@ -15,41 +15,41 @@ # limitations under the License. # -user www-data; -worker_processes 1; +user nginx; +worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { - worker_connections 128; + worker_connections 128; } http { - server_tokens off; - sendfile on; - tcp_nopush on; - - keepalive_timeout 60; - tcp_nodelay on; - - client_max_body_size 100m; - - #access log - log_format main '$http_host $remote_addr - $remote_user [$time_local] ' - '"$request" $status $bytes_sent ' - '"$http_referer" "$http_user_agent" ' - '"$gzip_ratio"'; - - include /etc/nginx/mime.types; - default_type application/octet-stream; - gzip on; - gzip_disable "msie6"; - gzip_types text/plain text/css text/xml text/javascript application/json application/x-javascript application/xml application/xml+rss application/javascript; - gzip_vary on; - gzip_comp_level 5; - - access_log /var/log/nginx/access.log main; - #conf.d - include web-console.conf ; + server_tokens off; + sendfile on; + tcp_nopush on; + + keepalive_timeout 60; + tcp_nodelay on; + + client_max_body_size 100m; + + #access log + log_format main '$http_host $remote_addr - $remote_user [$time_local] ' + '"$request" $status $bytes_sent ' + '"$http_referer" "$http_user_agent" ' + '"$gzip_ratio"'; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + gzip on; + gzip_disable "msie6"; + gzip_types text/plain text/css text/xml text/javascript application/json application/x-javascript application/xml application/xml+rss application/javascript; + gzip_vary on; + gzip_comp_level 5; + + access_log /var/log/nginx/access.log main; + #conf.d + include web-console.conf ; } http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/frontend/.gitignore ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/.gitignore b/modules/web-console/frontend/.gitignore index 60d2029..7fe0d3f 100644 --- a/modules/web-console/frontend/.gitignore +++ b/modules/web-console/frontend/.gitignore @@ -1,8 +1,5 @@ -*.idea -*.log *.log.* .npmrc -build/* -node_modules public/stylesheets/*.css - +build/ +node_modules/ http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/frontend/app/app.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js index a748822..1ffc367 100644 --- a/modules/web-console/frontend/app/app.js +++ b/modules/web-console/frontend/app/app.js @@ -152,13 +152,10 @@ import igniteServices from './services'; import uiAceJava from './directives/ui-ace-java'; import uiAceSpring from './directives/ui-ace-spring'; -// Inject external modules. -import IgniteModules from 'IgniteModules/index'; - import baseTemplate from 'views/base.pug'; import * as icons from '../public/images/icons'; -angular.module('ignite-console', [ +export default angular.module('ignite-console', [ // Optional AngularJS modules. 'ngAnimate', 'ngSanitize', @@ -248,9 +245,7 @@ angular.module('ignite-console', [ breadcrumbs.name, passwordVisibility.name, progressLine.name, - formField.name, - // Ignite modules. - IgniteModules.name + formField.name ]) .service($exceptionHandler.name, $exceptionHandler) // Directives. http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.style.scss ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.style.scss b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.style.scss index f5759fd..5df29cc 100644 --- a/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.style.scss +++ b/modules/web-console/frontend/app/components/list-editable/components/list-editable-cols/cols.style.scss @@ -34,7 +34,7 @@ } [ignite-icon='info'] { - @import 'public/stylesheets/variables'; + @import '../../../../../public/stylesheets/variables'; margin-left: 5px; color: $ignite-brand-success; @@ -44,7 +44,7 @@ .ignite-form-field__label { display: none; } - + .le-row-item-view:nth-last-child(2) { display: none; } http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/frontend/app/components/user-notifications/style.scss ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/user-notifications/style.scss b/modules/web-console/frontend/app/components/user-notifications/style.scss index 748a963..e4fa39e 100644 --- a/modules/web-console/frontend/app/components/user-notifications/style.scss +++ b/modules/web-console/frontend/app/components/user-notifications/style.scss @@ -15,7 +15,7 @@ * limitations under the License. */ -@import 'public/stylesheets/variables'; +@import '../../../public/stylesheets/variables'; $disabled-color: #c5c5c5; http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/frontend/app/primitives/switcher/index.scss ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/primitives/switcher/index.scss b/modules/web-console/frontend/app/primitives/switcher/index.scss index fb2fd1b..9430f71 100644 --- a/modules/web-console/frontend/app/primitives/switcher/index.scss +++ b/modules/web-console/frontend/app/primitives/switcher/index.scss @@ -15,7 +15,7 @@ * limitations under the License. */ -@import 'public/stylesheets/variables'; +@import '../../../public/stylesheets/variables'; label.switcher--ignite { $width: 34px; http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/frontend/ignite_modules/README.txt ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/ignite_modules/README.txt b/modules/web-console/frontend/ignite_modules/README.txt deleted file mode 100644 index 365abc7..0000000 --- a/modules/web-console/frontend/ignite_modules/README.txt +++ /dev/null @@ -1,6 +0,0 @@ -Ignite Web Console Modules -====================================== - -If you are are planning to create or use custom modules you need to copy them in this folder before build. - -This is default folder for user modules. http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/frontend/ignite_modules/index.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/ignite_modules/index.js b/modules/web-console/frontend/ignite_modules/index.js deleted file mode 100644 index 21ccf6a..0000000 --- a/modules/web-console/frontend/ignite_modules/index.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import angular from 'angular'; - -export default angular -.module('ignite-console.modules', [ -]); http://git-wip-us.apache.org/repos/asf/ignite/blob/4c295f8f/modules/web-console/frontend/index.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/index.js b/modules/web-console/frontend/index.js new file mode 100644 index 0000000..c18afc3 --- /dev/null +++ b/modules/web-console/frontend/index.js @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import angular from 'angular'; + +import igniteConsole from './app/app'; + +angular.bootstrap(document, [igniteConsole.name], {strictDi: true});