Fix false-positive failures in "has hits" search tests

The search tests sometimes reported failure (and fired notifications) even
though the result page showed matches. Two changes:

- The per-search mocha timeout was a hard 20s, shorter than search()'s own
  internal waits, so a slow total-count computation could trip it before the
  count was read. The timeout is now configurable via KORAP_SEARCH_TIMEOUT
  (default 60s).

- search() no longer relies on a fixed 2s sleep. It waits until the result
  page has settled -- the total is shown, matches are listed, or a "no
  matches" message appears -- and reads the outcome immediately.

Note this slightly relaxes what "has hits" verifies: when glimpse/cutoff is
on, Kalamar lists matches without computing a total, so the test now accepts
the presence of listed matches as proof of hits rather than requiring a
counted total. This keeps the check stable across glimpse states; when
glimpse is off the exact total is still read and asserted.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Change-Id: I92f2004ba668722939e3a70e3ab8aa7eae698b4d
diff --git a/test/korap-ui.js b/test/korap-ui.js
index 621b22f..bec14bd 100644
--- a/test/korap-ui.js
+++ b/test/korap-ui.js
@@ -20,6 +20,7 @@
 const KORAP_PWD = process.env.KORAP_PWD || process.env.KORAP_PASSWORD || "password2";
 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 KORAP_SEARCH_TIMEOUT = parseInt(process.env.KORAP_SEARCH_TIMEOUT || "60000", 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)
@@ -339,7 +340,7 @@
                         await korap_rc.assure_glimpse_off(page)
                         const hits = await korap_rc.search(page, query)
                         hits.should.be.above(0)
-                    })).timeout(20000)
+                    })).timeout(KORAP_SEARCH_TIMEOUT)
             })
         })