Ignite Web Console Build Instructions
=====================================
1. Install locally MongoDB (version >=3.2.x) follow instructions from site http://docs.mongodb.org/manual/installation.
2. Install locally NodeJS (version >=6.5.x) using installer from site https://nodejs.org/en/download/current for your OS.
3. Change directory to '/modules/web-console/backend' and
 run "npm install --no-optional" for download backend dependencies.
4. Change directory to '/modules/web-console/frontend' and
 run "npm install --no-optional" for download frontend dependencies.
5. Build ignite-web-agent module follow instructions from 'modules/web-console/web-agent/README.txt'.
6. Copy ignite-web-agent-<version>.zip from '/modules/web-console/web-agent/target'
 to '/modules/web-console/backend/agent_dists' folder.

Steps 1 - 4 should be executed once.

Ignite Web Console Run In Development Mode
==========================================
1. Configure MongoDB to run as service or in terminal change dir to $MONGO_INSTALL_DIR/server/3.2/bin
  and start MongoDB by executing "mongod".

2. In new terminal change directory to '/modules/web-console/backend'.
   If needed run "npm install --no-optional" (if dependencies changed) and run "npm start" to start backend.

3. In new terminal change directory to '/modules/web-console/frontend'.
  If needed run "npm install --no-optional" (if dependencies changed) and start webpack in development mode "npm run dev".

4. In browser open: http://localhost:9000

How to migrate model:

1. Model will be upgraded on first start.
2. To downgrade model execute in terminal following command: "./node_modules/.bin/migrate down <migration-name> -d <dbConnectionUri>".
   Example: "./node_modules/.bin/migrate down add_index -d mongodb://localhost/console".


Ignite Web Console Direct-Install Maven Build Instructions
==========================================================
To build direct-install archive from sources run following command in Ignite project root folder:
"mvn clean package -pl :ignite-web-agent,:ignite-web-console -am -P web-console -DskipTests=true -DskipClientDocs -Dmaven.javadoc.skip=true"

Assembled archive can be found here: `/modules/web-console/target/ignite-web-console-direct-install-*.zip`.


End-to-end tests
================
E2E tests are performed with TestCafe framework - https://testcafe.devexpress.com/.

To launch tests on your local machine you will need:
1. Install and launch MongoDB.
2. Optionally install Chromium (https://www.chromium.org/getting-involved/download-chromium or https://chromium.woolyss.com).
   You may use any other browser, just set 'BROWSERS' constant in 'modules\web-console\e2e\testcafe.js'.
3. In new terminal change directory to 'modules/web-console/e2e/testcafe' folder and execute: "npm install".
4. To start test environment and tests execute: "npm run test".

During developing tests you may need to run some particular tests without running all suites.
For this case you need to run environment and test separately.
To perform it do the following:
1. Ensure that MongoDB is up and running and all dependencies for backend and frontend are installed.
2. Open directory "modules/web-console/e2e/testcafe" in terminal. Install dependencies for E2E testing with "npm install" command.
3. Execute command "npm run env". This will start backend and frontend environment.
4. Open another terminal window and run command "node testcafe.js" in the same directory. This will run only tests without launching environment.

Please refer to TestCafe documentation at https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#skipping-tests
 upon how to specify which particular test should be run or skipped.

You can modify the following params with environment variables:
- DB_URL - connection string to test MongoDB. Default: mongodb://localhost/console-e2e
- APP_URL - URL for test environment applications. Default: http://localhost:9001
- TEAMCITY - Whether to use TeamCity reporter. Default: false (native Testcafe "spec" reporter is used)

You can run tests in docker:
1. Install docker and docker-compose.
2. Execute in terminal: "docker-compose up --abort-on-container-exit" in directory "modules/web-console/e2e".
3. If you need to cleanup docker container then execute "docker-compose down".
