Add KORAP_HEADLESS env variable
Change-Id: Ic686328636e97291647dcc7d9683a7c3fe2d42fe
diff --git a/Readme.md b/Readme.md
index e2d190e..d492bbe 100644
--- a/Readme.md
+++ b/Readme.md
@@ -31,6 +31,7 @@
| `KORAP_PASSWORD` | `password2` | Password for KorAP login (also accepts legacy `KORAP_PWD`) |
| `KORAP_QUERIES` | `geht, [orth=geht & cmc/pos=VVFIN]` | Comma-separated list of queries to test |
| `KORAP_MIN_TOKENS_IN_CORPUS` | `100000` | Minimum expected number of tokens for corpus statistics test |
+| `KORAP_HEADLESS` | `true` | Set to `false` or `0` to run browser in UI mode (visible window) instead of headless |
| `SLACK_WEBHOOK_URL` | _(none)_ | Slack webhook URL for test failure notifications (text only) |
| `SLACK_TOKEN` | _(none)_ | Slack bot token for uploading failure screenshots |
| `SLACK_CHANNEL_ID` | `C07CM4JS48H` | Slack channel ID for screenshot uploads (e.g., `C1234567890`) |
@@ -45,6 +46,7 @@
- Use `KORAP_USERNAME="" npm test` to skip login and logout tests, e.g. to run tests against Kustvakt-lite
- The tests support both new variable names (`KORAP_USERNAME`, `KORAP_PASSWORD`) and legacy names (`KORAP_LOGIN`, `KORAP_PWD`) for backward compatibility
- Set `LC_ALL=C` for consistent locale-independent test results
+- Use `KORAP_HEADLESS=false npm test` to run with a visible browser window for debugging
## GitLab CI/CD
diff --git a/test/korap-ui.js b/test/korap-ui.js
index f53eae6..ae1d8a4 100644
--- a/test/korap-ui.js
+++ b/test/korap-ui.js
@@ -21,6 +21,7 @@
const KORAP_QUERIES = process.env.KORAP_QUERIES || 'geht, [orth=geht & cmc/pos=VVFIN]'
const KORAP_MIN_TOKENS_IN_CORPUS = parseInt(process.env.KORAP_MIN_TOKENS_IN_CORPUS || "100000", 10);
const NOTIFY_ON_SUCCESS = process.env.NOTIFY_ON_SUCCESS === 'true' || process.env.NOTIFY_ON_SUCCESS === '1';
+const KORAP_HEADLESS = !(process.env.KORAP_HEADLESS === 'false' || process.env.KORAP_HEADLESS === '0');
const korap_rc = require('../lib/korap_rc.js').new(KORAP_URL)
const { sendToNextcloudTalk, ifConditionIt } = require('../lib/utils.js');
@@ -40,7 +41,7 @@
before(async () => {
browser = await puppeteer.launch({
- headless: "shell",
+ headless: KORAP_HEADLESS ? "shell" : false,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',