iterate over queries
Change-Id: Ic01725d35a14d1ff414ae7cafa1e630fe979f417
diff --git a/test/korap-ui.js b/test/korap-ui.js
index 8d5a819..467bb04 100644
--- a/test/korap-ui.js
+++ b/test/korap-ui.js
@@ -4,13 +4,13 @@
var chai = require('chai');
var should = chai.should();
var assert = chai.assert;
-const KORAP_URL = process.env.KORAP_URL || "http://localhost:64543";
-const KORAP_LOGIN = process.env.KORAP_LOGIN || "user2";
+const KORAP_URL = process.env.KORAP_URL || "http://localhost:64543";
+const KORAP_LOGIN = process.env.KORAP_LOGIN || "user2";
const KORAP_PWD = process.env.KORAP_PWD || "password2";
-const KORAP_QUERIES = "geht"
+const KORAP_QUERIES = 'geht, [orth=geht & cmc/pos=VVFIN]'
const korap_rc = require('../lib/korap_rc.js').new(KORAP_URL);
-describe('Running KorAP UI tests on ' + KORAP_URL, () => {
+describe('Running KorAP UI end-to-end tests on ' + KORAP_URL, () => {
const screenshot = 'screenshot.png'
before(async () => {
@@ -24,7 +24,7 @@
it('Login into KorAP with incorrect credentials fails',
(async () => {
- const login_result = await korap_rc.login(page, KORAP_LOGIN, KORAP_PWD + "*")
+ const login_result = await korap_rc.login(page, KORAP_LOGIN, KORAP_PWD + "*")
login_result.should.be.false
})).timeout(10000)
@@ -34,16 +34,22 @@
login_result.should.be.true
})).timeout(10000)
- const expected_hits = 724
-
- it('Search for "' + KORAP_QUERIES + '" has approx. ' + expected_hits + ' hits',
+ it('Can turn glimpse off',
(async () => {
await korap_rc.assure_glimpse_off(page)
- const hits = await korap_rc.search(page, KORAP_QUERIES)
- await page.screenshot({ path: screenshot })
- hits.should.be.approximately(expected_hits, 10)
- })).timeout(20000)
+ })).timeout(10000)
+ const expected_hits = 724
+ describe('Running searches that should have hits', () => {
+ KORAP_QUERIES.split(/[;,] */).forEach((query, i) => {
+ it('Search for "' + query + '" has hits',
+ (async () => {
+ await korap_rc.assure_glimpse_off(page)
+ const hits = await korap_rc.search(page, query)
+ hits.should.be.above(0)
+ })).timeout(20000)
+ })
+ })
it('Logout works',
(async () => {
const logout_result = await korap_rc.logout(page)