From: Jason Boyer Date: Tue, 22 Oct 2019 16:51:15 +0000 (-0400) Subject: LP1845693: Test Angular(JS) with modern browsers X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=038227c74fe44a82a9d4e1103daafb842752ab0c;p=evergreen%2Fjoelewis.git LP1845693: Test Angular(JS) with modern browsers 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 Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/karma.conf.js b/Open-ILS/src/eg2/karma.conf.js index 63982de94b..4be36d8d88 100644 --- a/Open-ILS/src/eg2/karma.conf.js +++ b/Open-ILS/src/eg2/karma.conf.js @@ -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', diff --git a/Open-ILS/src/eg2/package.json b/Open-ILS/src/eg2/package.json index c2d9e8e528..2bb3143d07 100644 --- a/Open-ILS/src/eg2/package.json +++ b/Open-ILS/src/eg2/package.json @@ -49,10 +49,10 @@ "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", diff --git a/Open-ILS/src/extras/install/Makefile.debian-buster b/Open-ILS/src/extras/install/Makefile.debian-buster index 8e5aa6d242..f884830ad6 100644 --- a/Open-ILS/src/extras/install/Makefile.debian-buster +++ b/Open-ILS/src/extras/install/Makefile.debian-buster @@ -113,7 +113,9 @@ PGSQL_SERVER_DEBS_96 = \ DEVELOPER_DEBS = \ automake \ autoconf \ - libtool + libtool \ + chromium \ + firefox-esr PACKAGER_DEBS = \ asciidoc \ diff --git a/Open-ILS/src/extras/install/Makefile.debian-jessie b/Open-ILS/src/extras/install/Makefile.debian-jessie index fb6f055a0b..3d4653e590 100644 --- a/Open-ILS/src/extras/install/Makefile.debian-jessie +++ b/Open-ILS/src/extras/install/Makefile.debian-jessie @@ -114,7 +114,9 @@ PGSQL_SERVER_DEBS_96 = \ DEVELOPER_DEBS = \ automake \ autoconf \ - libtool + libtool \ + chromium \ + firefox-esr PACKAGER_DEBS = \ asciidoc \ diff --git a/Open-ILS/src/extras/install/Makefile.debian-stretch b/Open-ILS/src/extras/install/Makefile.debian-stretch index 342d71a94f..18ab5699ea 100644 --- a/Open-ILS/src/extras/install/Makefile.debian-stretch +++ b/Open-ILS/src/extras/install/Makefile.debian-stretch @@ -113,7 +113,9 @@ PGSQL_SERVER_DEBS_96 = \ DEVELOPER_DEBS = \ automake \ autoconf \ - libtool + libtool \ + chromium \ + firefox-esr PACKAGER_DEBS = \ asciidoc \ diff --git a/Open-ILS/src/extras/install/Makefile.ubuntu-bionic b/Open-ILS/src/extras/install/Makefile.ubuntu-bionic index 268502703a..dd22d56fe4 100644 --- a/Open-ILS/src/extras/install/Makefile.ubuntu-bionic +++ b/Open-ILS/src/extras/install/Makefile.ubuntu-bionic @@ -118,7 +118,9 @@ PGSQL_SERVER_DEBS_96 = \ DEVELOPER_DEBS = \ automake \ autoconf \ - libtool + libtool \ + chromium-browser \ + firefox PACKAGER_DEBS = \ asciidoc \ diff --git a/Open-ILS/src/extras/install/Makefile.ubuntu-xenial b/Open-ILS/src/extras/install/Makefile.ubuntu-xenial index aa8bb4449f..a1104e1721 100644 --- a/Open-ILS/src/extras/install/Makefile.ubuntu-xenial +++ b/Open-ILS/src/extras/install/Makefile.ubuntu-xenial @@ -113,7 +113,9 @@ PGSQL_SERVER_DEBS_96 = \ DEVELOPER_DEBS = \ automake \ autoconf \ - libtool + libtool \ + chromium-browser \ + firefox PACKAGER_DEBS = \ asciidoc \ diff --git a/Open-ILS/web/js/ui/default/staff/package.json b/Open-ILS/web/js/ui/default/staff/package.json index 83e9aff063..b516eb1431 100644 --- a/Open-ILS/web/js/ui/default/staff/package.json +++ b/Open-ILS/web/js/ui/default/staff/package.json @@ -11,11 +11,11 @@ "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" }, diff --git a/Open-ILS/web/js/ui/default/staff/test/karma.conf.js b/Open-ILS/web/js/ui/default/staff/test/karma.conf.js index 987d216602..09dcffff15 100644 --- a/Open-ILS/web/js/ui/default/staff/test/karma.conf.js +++ b/Open-ILS/web/js/ui/default/staff/test/karma.conf.js @@ -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, diff --git a/docs/installation/server_installation.adoc b/docs/installation/server_installation.adoc index b28f410136..c703fc1db1 100644 --- a/docs/installation/server_installation.adoc +++ b/docs/installation/server_installation.adoc @@ -87,6 +87,7 @@ make -f Open-ILS/src/extras/Makefile.install 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 -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 -developer packages were installed ++ +[source,sh] +------------------------------------------------------------------------------ +CHROME_BIN=/path/to/chrome npm run test ------------------------------------------------------------------------------ Configuration and compilation instructions