Constrain UI tests to disposable targets

This commit is contained in:
ms2k 2026-08-07 00:34:48 +09:00
commit 7c4f4ffe0d

View file

@ -6,13 +6,20 @@ if (!baseURL) {
throw new Error('Set OPNSENSE_UI_BASE_URL to the disposable OPNsense WebGUI URL.');
}
const hostname = new URL(baseURL).hostname;
const isLoopback = ['127.0.0.1', '::1', '[::1]', 'localhost'].includes(hostname);
if (!isLoopback && process.env.OPNSENSE_UI_TEST_ALLOW_REMOTE !== '1') {
throw new Error('Set OPNSENSE_UI_TEST_ALLOW_REMOTE=1 to test a remote disposable OPNsense deployment.');
}
module.exports = defineConfig({
testDir: './specs',
timeout: 30000,
workers: 1,
use: {
baseURL,
ignoreHTTPSErrors: true,
ignoreHTTPSErrors: isLoopback,
trace: 'retain-on-failure',
},
});