GUACAMOLE-1765: Switch to firefox browser.

This commit is contained in:
James Muehlner
2023-04-06 22:40:51 +00:00
parent a765e34488
commit bf63964337
6 changed files with 125 additions and 55 deletions

View File

@@ -30,8 +30,8 @@ ARG TOMCAT_JRE=jdk8
# Use official maven image for the build
FROM maven:3-jdk-8 AS builder
# Install chromium browser for sake of JavaScript unit tests
RUN apt-get update && apt-get install -y chromium
# Install firefox browser for sake of JavaScript unit tests
RUN apt-get update && apt-get install -y firefox-esr
# Use args to build radius auth extension such as
# `--build-arg BUILD_PROFILE=lgpl-extensions`

View File

@@ -1,4 +1,5 @@
node/*
node_modules/*
node/
node_modules/
target/
.tmp/
*~

View File

@@ -17,6 +17,10 @@
* under the License.
*/
/**
* A karma configuration intended for use in builds or CI. Runs all discovered
* unit tests under a headless firefox browser and immediately exits.
*/
module.exports = function(config) {
config.set({
@@ -34,17 +38,17 @@ module.exports = function(config) {
// Disable automatic test running on changed files
autoWatch: false,
// Use a headless chromium browser to run the tests
// --no-sandbox required when running in docker build - for more, see
// https://github.com/karma-runner/karma-chrome-launcher/issues/158
// TODON'T: THIS
browsers: ['ChromiumHeadlessNoSandbox'],
// Use a headless firefox browser to run the tests
browsers: ['FirefoxHeadless'],
customLaunchers: {
ChromiumHeadlessNoSandbox: {
base: 'ChromiumHeadless',
flags: ['--no-sandbox']
'FirefoxHeadless': {
base: 'Firefox',
flags: [
'--headless'
]
}
}
})
}
});
};

View File

@@ -6,7 +6,7 @@
"": {
"devDependencies": {
"karma": "^6.4.1",
"karma-chrome-launcher": "^3.1.1",
"karma-firefox-launcher": "^2.1.2",
"karma-jasmine": "^5.1.0"
}
},
@@ -552,20 +552,6 @@
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true
},
"node_modules/fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@@ -736,6 +722,21 @@
"node": ">=8"
}
},
"node_modules/is-docker": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
"dev": true,
"bin": {
"is-docker": "cli.js"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -775,6 +776,18 @@
"node": ">=0.12.0"
}
},
"node_modules/is-wsl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
"dev": true,
"dependencies": {
"is-docker": "^2.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/isbinaryfile": {
"version": "4.0.10",
"resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz",
@@ -846,13 +859,14 @@
"node": ">= 10"
}
},
"node_modules/karma-chrome-launcher": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.1.tgz",
"integrity": "sha512-hsIglcq1vtboGPAN+DGCISCFOxW+ZVnIqhDQcCMqqCp+4dmJ0Qpq5QAjkbA0X2L9Mi6OBkHi2Srrbmm7pUKkzQ==",
"node_modules/karma-firefox-launcher": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-2.1.2.tgz",
"integrity": "sha512-VV9xDQU1QIboTrjtGVD4NCfzIH7n01ZXqy/qpBhnOeGVOkG5JYPEm8kuSd7psHE6WouZaQ9Ool92g8LFweSNMA==",
"dev": true,
"dependencies": {
"which": "^1.2.1"
"is-wsl": "^2.2.0",
"which": "^2.0.1"
}
},
"node_modules/karma-jasmine": {
@@ -1482,15 +1496,18 @@
}
},
"node_modules/which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"dependencies": {
"isexe": "^2.0.0"
},
"bin": {
"which": "bin/which"
"node-which": "bin/node-which"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/wrap-ansi": {
@@ -2002,13 +2019,6 @@
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true
},
"fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"optional": true
},
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@@ -2142,6 +2152,12 @@
"binary-extensions": "^2.0.0"
}
},
"is-docker": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
"dev": true
},
"is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -2169,6 +2185,15 @@
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
"is-wsl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
"dev": true,
"requires": {
"is-docker": "^2.0.0"
}
},
"isbinaryfile": {
"version": "4.0.10",
"resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz",
@@ -2228,13 +2253,14 @@
"yargs": "^16.1.1"
}
},
"karma-chrome-launcher": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.1.tgz",
"integrity": "sha512-hsIglcq1vtboGPAN+DGCISCFOxW+ZVnIqhDQcCMqqCp+4dmJ0Qpq5QAjkbA0X2L9Mi6OBkHi2Srrbmm7pUKkzQ==",
"karma-firefox-launcher": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-2.1.2.tgz",
"integrity": "sha512-VV9xDQU1QIboTrjtGVD4NCfzIH7n01ZXqy/qpBhnOeGVOkG5JYPEm8kuSd7psHE6WouZaQ9Ool92g8LFweSNMA==",
"dev": true,
"requires": {
"which": "^1.2.1"
"is-wsl": "^2.2.0",
"which": "^2.0.1"
}
},
"karma-jasmine": {
@@ -2689,9 +2715,9 @@
"dev": true
},
"which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"requires": {
"isexe": "^2.0.0"

View File

@@ -2,7 +2,7 @@
"description": "Dependencies to be installed by maven for running JS tests",
"devDependencies": {
"karma": "^6.4.1",
"karma-chrome-launcher": "^3.1.1",
"karma-firefox-launcher": "^2.1.2",
"karma-jasmine": "^5.1.0"
}
}

View File

@@ -37,6 +37,17 @@
<relativePath>../</relativePath>
</parent>
<properties>
<!--
The location where temporary files should be stored for communicating
between karma and firefox. The default location, /tmp, does not work
if firefox is installed via snap.
-->
<firefox.temp.dir>${project.basedir}/.tmp</firefox.temp.dir>
</properties>
<description>
The base JavaScript API of the Guacamole project, providing JavaScript
support for the Guacamole stack, including a full client
@@ -114,7 +125,27 @@
</executions>
</plugin>
<!-- Unit test using Jasmin and PhantomJS -->
<!-- Ensure the firefox temp directory exists -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>createFirefoxTempdir</id>
<phase>test-compile</phase>
<configuration>
<tasks>
<mkdir dir="${firefox.temp.dir}"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Unit test using Jasmin and Firefox -->
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
@@ -130,6 +161,11 @@
<!-- The location of the karma config file -->
<karmaConfPath>karma-ci.conf.js</karmaConfPath>
<!-- Tell karma to use the custom temp directory -->
<environmentVariables>
<TMPDIR>${firefox.temp.dir}</TMPDIR>
</environmentVariables>
</configuration>
@@ -138,6 +174,7 @@
<!-- Install node.js and NPM before running tests -->
<execution>
<id>install node and npm</id>
<phase>test-compile</phase>
<goals>
<goal>install-node-and-npm</goal>
</goals>
@@ -146,6 +183,7 @@
<!-- Install test dependencies -->
<execution>
<id>npm install</id>
<phase>test-compile</phase>
<goals>
<goal>npm</goal>
</goals>
@@ -154,6 +192,7 @@
<!-- Run all tests non-interactively -->
<execution>
<id>run tests</id>
<phase>test</phase>
<goals>
<goal>karma</goal>
</goals>