Flexible timeout for tests.

This commit is contained in:
Aiosa 2024-10-18 14:56:05 +02:00
parent 0cd17abafd
commit b3cdeabf02

View File

@ -4,10 +4,17 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>OpenSeadragon QUnit</title> <title>OpenSeadragon QUnit</title>
<script type="text/javascript"> <script type="text/javascript">
function isInteractiveMode() {
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
const isHeadless = typeof navigator !== 'undefined' && navigator.webdriver;
return isBrowser && !isHeadless;
}
window.QUnit = { window.QUnit = {
config: { config: {
//one minute per test timeout //five seconds timeout due to problems with untrusted events (e.g. auto zoom) for non-interactive runs
testTimeout: 5000 //there is timeWatcher property but sometimes tests do not respect it, or they get stuck due to bugs
testTimeout: isInteractiveMode() ? 30000 : 5000
} }
}; };
</script> </script>