METRON-1672 Add metron-alerts's UI unit tests to travis build process 
(justinleet) closes apache/metron#1106


Project: http://git-wip-us.apache.org/repos/asf/metron/repo
Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/aceca469
Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/aceca469
Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/aceca469

Branch: refs/heads/feature/METRON-1554-pcap-query-panel
Commit: aceca469a83d17c033ea7a47ff82c61962319b3a
Parents: 52bd310
Author: justinleet <justinjl...@gmail.com>
Authored: Thu Jul 19 09:30:59 2018 -0400
Committer: leet <l...@apache.org>
Committed: Thu Jul 19 09:30:59 2018 -0400

----------------------------------------------------------------------
 .travis.yml                                  | 14 +++++++++++---
 metron-interface/metron-alerts/karma.conf.js | 15 ++++++++++++++-
 metron-interface/metron-alerts/package.json  |  3 ++-
 metron-interface/metron-alerts/pom.xml       | 14 ++++++++++++--
 4 files changed, 39 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/metron/blob/aceca469/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 71d7165..3a73d7e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,9 +16,14 @@
 
 dist: trusty
 sudo: required
+addons:
+  chrome: stable
 
 env:
-  - TEST_TYPE=default
+  - SCRIPT="mvn surefire:test@unit-tests -T 2C"
+  - SCRIPT="mvn surefire:test@integration-tests"
+  - SCRIPT="mvn test --projects 
metron-interface/metron-config,metron-interface/metron-alerts"
+  - SCRIPT="./dev-utilities/build-utils/verify_licenses.sh"
 
 install: true
 language: java
@@ -33,10 +38,13 @@ before_install:
   - npm config set prefix $HOME/.npm-prefix --global
 
 install:
-  - time mvn -q -T 2C -DskipTests clean install
+  - time mvn install -T 2C -q -DskipTests=true -Dmaven.javadoc.skip=true -B -V
 
 script:
-  - time mvn -q -T 2C surefire:test@unit-tests && time mvn -q 
surefire:test@integration-tests && time mvn -q test --projects 
metron-interface/metron-config && time 
dev-utilities/build-utils/verify_licenses.sh
+  - time $SCRIPT
+
+matrix:
+  fast_finish: true
 
 before_cache:
   - rm -rf $HOME/.m2/repository/org/apache/metron

http://git-wip-us.apache.org/repos/asf/metron/blob/aceca469/metron-interface/metron-alerts/karma.conf.js
----------------------------------------------------------------------
diff --git a/metron-interface/metron-alerts/karma.conf.js 
b/metron-interface/metron-alerts/karma.conf.js
index f245e1d..7f29c92 100644
--- a/metron-interface/metron-alerts/karma.conf.js
+++ b/metron-interface/metron-alerts/karma.conf.js
@@ -18,6 +18,8 @@
 // Karma configuration file, see link for more information
 // https://karma-runner.github.io/0.13/config/configuration-file.html
 
+process.env.CHROME_BIN = require('puppeteer').executablePath()
+
 module.exports = function (config) {
   config.set({
     basePath: '',
@@ -55,7 +57,18 @@ module.exports = function (config) {
     colors: true,
     logLevel: config.LOG_INFO,
     autoWatch: true,
-    browsers: ['Chrome'],
+    browsers: ['Chrome','ChromeHeadless'],
+    customLaunchers: {
+      ChromeHeadless: {
+        base: 'Chrome',
+        flags: [
+          '--no-sandbox',
+          '--headless',
+          '--disable-gpu',
+          '--remote-debugging-port=9222'
+        ]
+      }
+    },
     singleRun: false
   });
 };

http://git-wip-us.apache.org/repos/asf/metron/blob/aceca469/metron-interface/metron-alerts/package.json
----------------------------------------------------------------------
diff --git a/metron-interface/metron-alerts/package.json 
b/metron-interface/metron-alerts/package.json
index 0a40f0d..9cfc09f 100644
--- a/metron-interface/metron-alerts/package.json
+++ b/metron-interface/metron-alerts/package.json
@@ -7,7 +7,7 @@
     "build": "./node_modules/@angular/cli/bin/ng build -prod",
     "start": "ng serve",
     "lint": "tslint \"src/**/*.ts\"",
-    "test": "./node_modules/@angular/cli/bin/ng test --watch=false",
+    "test": "karma start --single-run --browsers ChromeHeadless karma.conf.js",
     "pree2e": "webdriver-manager update",
     "e2e": "protractor-flake --protractor-path=./node_modules/.bin/protractor 
--max-attempts=3 -- ./protractor.conf.js"
   },
@@ -58,6 +58,7 @@
     "optimist": "0.6.1",
     "protractor": "5.3.0",
     "protractor-flake": "^3.3.0",
+    "puppeteer": "^1.6.0",
     "serve-favicon": "2.4.2",
     "serve-static": "1.12.1",
     "ssh2": "^0.5.5",

http://git-wip-us.apache.org/repos/asf/metron/blob/aceca469/metron-interface/metron-alerts/pom.xml
----------------------------------------------------------------------
diff --git a/metron-interface/metron-alerts/pom.xml 
b/metron-interface/metron-alerts/pom.xml
index e7706b3..996f473 100644
--- a/metron-interface/metron-alerts/pom.xml
+++ b/metron-interface/metron-alerts/pom.xml
@@ -25,8 +25,8 @@
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-        <node.version>v7.10.0</node.version>
-        <npm.version>4.2.0</npm.version>
+        <node.version>v9.11.1</node.version>
+        <npm.version>5.8.0</npm.version>
     </properties>
     <dependencies>
     </dependencies>
@@ -70,6 +70,16 @@
                             <arguments>run build</arguments>
                         </configuration>
                     </execution>
+                    <execution>
+                        <phase>test</phase>
+                        <id>npm test</id>
+                        <goals>
+                            <goal>npm</goal>
+                        </goals>
+                        <configuration>
+                            <arguments>test</arguments>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
             <plugin>

Reply via email to