LP1845693: Test Angular(JS) with modern browsers
authorJason Boyer <JBoyer@eoli.info>
Tue, 22 Oct 2019 16:51:15 +0000 (12:51 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Wed, 23 Oct 2019 15:12:40 +0000 (11:12 -0400)
Rather than using PhantomJS to test Angular(JS),
we can use all supported browsers for the web client.
Currently this is Firefox and Chrom(ium).

Because of the number of dependencies this also
requires that testing is removed from the standard
build instructions and only done in specific testing
environments or on developer machines.

Signed-off-by: Jason Boyer <JBoyer@eoli.info>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/karma.conf.js
Open-ILS/src/eg2/package.json
Open-ILS/src/extras/install/Makefile.debian-buster
Open-ILS/src/extras/install/Makefile.debian-jessie
Open-ILS/src/extras/install/Makefile.debian-stretch
Open-ILS/src/extras/install/Makefile.ubuntu-bionic
Open-ILS/src/extras/install/Makefile.ubuntu-xenial
Open-ILS/web/js/ui/default/staff/package.json
Open-ILS/web/js/ui/default/staff/test/karma.conf.js
docs/installation/server_installation.adoc

index 63982de..4be36d8 100644 (file)
@@ -8,7 +8,7 @@ module.exports = function (config) {
     plugins: [
       require('karma-jasmine'),
       require('karma-chrome-launcher'),
-      require('karma-phantomjs-launcher'),
+      require('karma-firefox-launcher'),
       require('karma-jasmine-html-reporter'),
       require('karma-coverage-istanbul-reporter'),
       require('@angular-devkit/build-angular/plugins/karma')
@@ -28,7 +28,15 @@ module.exports = function (config) {
     colors: true,
     logLevel: config.LOG_INFO,
     autoWatch: true,
-    browsers: ['PhantomJS'],
+    browsers: ['ChromeHeadless','FirefoxHeadless'],
+    customLaunchers: {
+        'FirefoxHeadless': {
+            base: 'Firefox',
+            flags: [
+                '-headless',
+            ],
+        }
+    },
     singleRun: true,
     files: [
       '/openils/lib/javascript/md5.js',
index c2d9e8e..2bb3143 100644 (file)
     "jasmine-spec-reporter": "^4.2.1",
     "karma": "^4.4.1",
     "karma-chrome-launcher": "^3.1.0",
+    "karma-firefox-launcher": "^1.2.0",
     "karma-coverage-istanbul-reporter": "^2.1.0",
     "karma-jasmine": "^2.0.1",
     "karma-jasmine-html-reporter": "^1.4.2",
-    "karma-phantomjs-launcher": "^1.0.4",
     "ngx-i18nsupport": "^0.17.1",
     "protractor": "^5.4.2",
     "ts-node": "^8.4.1",
index 8e5aa6d..f884830 100644 (file)
@@ -113,7 +113,9 @@ PGSQL_SERVER_DEBS_96 = \
 DEVELOPER_DEBS = \
        automake \
        autoconf \
-       libtool
+       libtool \
+       chromium \
+       firefox-esr
 
 PACKAGER_DEBS = \
        asciidoc \
index fb6f055..3d4653e 100644 (file)
@@ -114,7 +114,9 @@ PGSQL_SERVER_DEBS_96 = \
 DEVELOPER_DEBS = \
        automake \
        autoconf \
-       libtool
+       libtool \
+       chromium \
+       firefox-esr
 
 PACKAGER_DEBS = \
        asciidoc \
index 342d71a..18ab569 100644 (file)
@@ -113,7 +113,9 @@ PGSQL_SERVER_DEBS_96 = \
 DEVELOPER_DEBS = \
        automake \
        autoconf \
-       libtool
+       libtool \
+       chromium \
+       firefox-esr
 
 PACKAGER_DEBS = \
        asciidoc \
index 2685027..dd22d56 100644 (file)
@@ -118,7 +118,9 @@ PGSQL_SERVER_DEBS_96 = \
 DEVELOPER_DEBS = \
        automake \
        autoconf \
-       libtool
+       libtool \
+       chromium-browser \
+       firefox
 
 PACKAGER_DEBS = \
        asciidoc \
index aa8bb44..a1104e1 100644 (file)
@@ -113,7 +113,9 @@ PGSQL_SERVER_DEBS_96 = \
 DEVELOPER_DEBS = \
        automake \
        autoconf \
-       libtool
+       libtool \
+       chromium-browser \
+       firefox
 
 PACKAGER_DEBS = \
        asciidoc \
index 83e9aff..b516eb1 100644 (file)
     "jasmine-core": "^2.99.1",
     "karma": "^1.7.1",
     "karma-jasmine": "^1.1.1",
-    "karma-phantomjs-launcher": "^1.0.4",
+    "karma-chrome-launcher": "^3.1.0",
+    "karma-firefox-launcher": "^1.2.0",
     "karma-script-launcher": "^1.0.0",
     "karma-spec-reporter": "0.0.32",
     "karma-story-reporter": "^0.3.1",
-    "phantomjs-prebuilt": "^2.1.16",
     "webpack": "^3.10.0",
     "webpack-merge": "^4.1.1"
   },
index 987d216..09dcfff 100644 (file)
@@ -51,7 +51,16 @@ module.exports = function(config){
 
     frameworks: ['jasmine'],
 
-    browsers: ['PhantomJS'],
+    browsers: ['ChromeHeadless','FirefoxHeadless'],
+
+    customLaunchers: {
+        'FirefoxHeadless': {
+            base: 'Firefox',
+            flags: [
+                '-headless',
+            ],
+        }
+    },
 
     // web server port
     port: 9876,
index b28f410..c703fc1 100644 (file)
@@ -87,6 +87,7 @@ make -f Open-ILS/src/extras/Makefile.install <osname>
 3. OPTIONAL: Developer additions
 +
 To perform certain developer tasks from a Git source code checkout, 
+including the testing of the Angular web client components,
 additional packages may be required.  As the *root* Linux account:
 +
  * To install packages needed for retrieving and managing web dependencies,
@@ -158,9 +159,15 @@ npm install   # fetch JS dependencies
 +
 [source,sh]
 ------------------------------------------------------------------------------
-# build, run tests, concat+minify
+# build, concat+minify
 npm run build-prod
-npm run test
+------------------------------------------------------------------------------
++
+4. OPTIONAL: Test web client code if the <osname>-developer packages were installed
++
+[source,sh]
+------------------------------------------------------------------------------
+CHROME_BIN=/path/to/chrome npm run test
 ------------------------------------------------------------------------------
 
 [[install_files_for_angular_web_staff_client]]
@@ -189,7 +196,13 @@ npm install   # fetch JS dependencies
 ------------------------------------------------------------------------------
 # build and run tests
 ng build --prod
-npm run test
+------------------------------------------------------------------------------
++
+4. OPTIONAL: Test eg2 web client code if the <osname>-developer packages were installed
++
+[source,sh]
+------------------------------------------------------------------------------
+CHROME_BIN=/path/to/chrome npm run test
 ------------------------------------------------------------------------------
 
 Configuration and compilation instructions