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 # Use official maven image for the build
FROM maven:3-jdk-8 AS builder FROM maven:3-jdk-8 AS builder
# Install chromium browser for sake of JavaScript unit tests # Install firefox browser for sake of JavaScript unit tests
RUN apt-get update && apt-get install -y chromium RUN apt-get update && apt-get install -y firefox-esr
# Use args to build radius auth extension such as # Use args to build radius auth extension such as
# `--build-arg BUILD_PROFILE=lgpl-extensions` # `--build-arg BUILD_PROFILE=lgpl-extensions`

View File

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

View File

@@ -17,6 +17,10 @@
* under the License. * 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) { module.exports = function(config) {
config.set({ config.set({
@@ -34,17 +38,17 @@ module.exports = function(config) {
// Disable automatic test running on changed files // Disable automatic test running on changed files
autoWatch: false, autoWatch: false,
// Use a headless chromium browser to run the tests // Use a headless firefox browser to run the tests
// --no-sandbox required when running in docker build - for more, see browsers: ['FirefoxHeadless'],
// https://github.com/karma-runner/karma-chrome-launcher/issues/158
// TODON'T: THIS
browsers: ['ChromiumHeadlessNoSandbox'],
customLaunchers: { customLaunchers: {
ChromiumHeadlessNoSandbox: { 'FirefoxHeadless': {
base: 'ChromiumHeadless', base: 'Firefox',
flags: ['--no-sandbox'] flags: [
'--headless'
]
} }
} }
}) });
}
};

View File

@@ -6,7 +6,7 @@
"": { "": {
"devDependencies": { "devDependencies": {
"karma": "^6.4.1", "karma": "^6.4.1",
"karma-chrome-launcher": "^3.1.1", "karma-firefox-launcher": "^2.1.2",
"karma-jasmine": "^5.1.0" "karma-jasmine": "^5.1.0"
} }
}, },
@@ -552,20 +552,6 @@
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true "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": { "node_modules/function-bind": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@@ -736,6 +722,21 @@
"node": ">=8" "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": { "node_modules/is-extglob": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -775,6 +776,18 @@
"node": ">=0.12.0" "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": { "node_modules/isbinaryfile": {
"version": "4.0.10", "version": "4.0.10",
"resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz", "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz",
@@ -846,13 +859,14 @@
"node": ">= 10" "node": ">= 10"
} }
}, },
"node_modules/karma-chrome-launcher": { "node_modules/karma-firefox-launcher": {
"version": "3.1.1", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.1.tgz", "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-2.1.2.tgz",
"integrity": "sha512-hsIglcq1vtboGPAN+DGCISCFOxW+ZVnIqhDQcCMqqCp+4dmJ0Qpq5QAjkbA0X2L9Mi6OBkHi2Srrbmm7pUKkzQ==", "integrity": "sha512-VV9xDQU1QIboTrjtGVD4NCfzIH7n01ZXqy/qpBhnOeGVOkG5JYPEm8kuSd7psHE6WouZaQ9Ool92g8LFweSNMA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"which": "^1.2.1" "is-wsl": "^2.2.0",
"which": "^2.0.1"
} }
}, },
"node_modules/karma-jasmine": { "node_modules/karma-jasmine": {
@@ -1482,15 +1496,18 @@
} }
}, },
"node_modules/which": { "node_modules/which": {
"version": "1.3.1", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"isexe": "^2.0.0" "isexe": "^2.0.0"
}, },
"bin": { "bin": {
"which": "bin/which" "node-which": "bin/node-which"
},
"engines": {
"node": ">= 8"
} }
}, },
"node_modules/wrap-ansi": { "node_modules/wrap-ansi": {
@@ -2002,13 +2019,6 @@
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true "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": { "function-bind": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@@ -2142,6 +2152,12 @@
"binary-extensions": "^2.0.0" "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": { "is-extglob": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -2169,6 +2185,15 @@
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true "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": { "isbinaryfile": {
"version": "4.0.10", "version": "4.0.10",
"resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz", "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz",
@@ -2228,13 +2253,14 @@
"yargs": "^16.1.1" "yargs": "^16.1.1"
} }
}, },
"karma-chrome-launcher": { "karma-firefox-launcher": {
"version": "3.1.1", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.1.tgz", "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-2.1.2.tgz",
"integrity": "sha512-hsIglcq1vtboGPAN+DGCISCFOxW+ZVnIqhDQcCMqqCp+4dmJ0Qpq5QAjkbA0X2L9Mi6OBkHi2Srrbmm7pUKkzQ==", "integrity": "sha512-VV9xDQU1QIboTrjtGVD4NCfzIH7n01ZXqy/qpBhnOeGVOkG5JYPEm8kuSd7psHE6WouZaQ9Ool92g8LFweSNMA==",
"dev": true, "dev": true,
"requires": { "requires": {
"which": "^1.2.1" "is-wsl": "^2.2.0",
"which": "^2.0.1"
} }
}, },
"karma-jasmine": { "karma-jasmine": {
@@ -2689,9 +2715,9 @@
"dev": true "dev": true
}, },
"which": { "which": {
"version": "1.3.1", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true, "dev": true,
"requires": { "requires": {
"isexe": "^2.0.0" "isexe": "^2.0.0"

View File

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

View File

@@ -37,6 +37,17 @@
<relativePath>../</relativePath> <relativePath>../</relativePath>
</parent> </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> <description>
The base JavaScript API of the Guacamole project, providing JavaScript The base JavaScript API of the Guacamole project, providing JavaScript
support for the Guacamole stack, including a full client support for the Guacamole stack, including a full client
@@ -114,7 +125,27 @@
</executions> </executions>
</plugin> </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> <plugin>
<groupId>com.github.eirslett</groupId> <groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId> <artifactId>frontend-maven-plugin</artifactId>
@@ -131,6 +162,11 @@
<!-- The location of the karma config file --> <!-- The location of the karma config file -->
<karmaConfPath>karma-ci.conf.js</karmaConfPath> <karmaConfPath>karma-ci.conf.js</karmaConfPath>
<!-- Tell karma to use the custom temp directory -->
<environmentVariables>
<TMPDIR>${firefox.temp.dir}</TMPDIR>
</environmentVariables>
</configuration> </configuration>
<executions> <executions>
@@ -138,6 +174,7 @@
<!-- Install node.js and NPM before running tests --> <!-- Install node.js and NPM before running tests -->
<execution> <execution>
<id>install node and npm</id> <id>install node and npm</id>
<phase>test-compile</phase>
<goals> <goals>
<goal>install-node-and-npm</goal> <goal>install-node-and-npm</goal>
</goals> </goals>
@@ -146,6 +183,7 @@
<!-- Install test dependencies --> <!-- Install test dependencies -->
<execution> <execution>
<id>npm install</id> <id>npm install</id>
<phase>test-compile</phase>
<goals> <goals>
<goal>npm</goal> <goal>npm</goal>
</goals> </goals>
@@ -154,6 +192,7 @@
<!-- Run all tests non-interactively --> <!-- Run all tests non-interactively -->
<execution> <execution>
<id>run tests</id> <id>run tests</id>
<phase>test</phase>
<goals> <goals>
<goal>karma</goal> <goal>karma</goal>
</goals> </goals>