diff --git a/lib/korap_rc.js b/lib/korap_rc.js
new file mode 100644
index 0000000..c5356b8
--- /dev/null
+++ b/lib/korap_rc.js
@@ -0,0 +1,73 @@
+var chai = require('chai');
+var should = chai.should();
+var assert = chai.assert;
+
+class KorAPRC {
+    korap_url = ""
+
+    constructor(korap_url) {
+        this.korap_url = korap_url
+    }
+
+    static new(korap_url) {
+        return new KorAPRC(korap_url)
+    }
+
+    async login(page, username, password) {
+        await page.goto(this.korap_url, { waitUntil: 'networkidle0' });
+        const username_field = await page.$("body > aside > div > fieldset > form > input[type=text]")
+
+        if (username_field != null) {
+            await username_field.type(username);
+            await page.keyboard.press("Tab")
+            await page.keyboard.type(password)
+            await page.keyboard.press("Enter")
+        }
+
+        await page.waitForNavigation({ waitUntil: 'networkidle2' });
+        const logout = await page.$("body > header > div > a[class=logout]")
+        if (logout == null) {
+            return false
+        }
+
+        let value = await page.evaluate(logout => logout.textContent, logout)
+        if (!value.match(/(Abmelden|Logout)/)) {
+            return false
+        }
+        return true
+    }
+
+    async search(page, query) {
+        const query_field = await page.$("body > header > form > div > input[name=q]")
+        assert.notEqual(query_field, null)
+        await query_field.type(query)
+        await page.keyboard.press("Enter")
+        await page.waitForNavigation();
+        const total_results = await page.$("#total-results")
+        assert.notEqual(total_results, null, "cannot find total results")
+        const hits = Number(await page.evaluate(total_results => total_results.textContent, total_results))
+        return hits
+    }
+
+    async logout(page) {
+        const logout_button = await page.$("a[class=logout]")
+        if (logout_button == null) {
+            return false
+        }
+        await page.click("a[class=logout]")
+        const username_field = await page.$("body > aside > div > fieldset > form > input[type=text]")
+        assert.notEqual(username_field, null)
+        return true
+    }
+
+    async assure_glimpse_off(page) {
+        const glimpse = await page.$("input[name=cutoff]")
+        const glimpse_value = await (await glimpse.getProperty('checked')).jsonValue()
+        if (glimpse_value) {
+            await page.click("#glimpse")
+        }
+
+    }
+}
+
+module.exports = KorAPRC
diff --git a/package.json b/package.json
index 0da6382..63c30e4 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,8 @@
   "description": "Performs end-to-end tests on a KorAP instance",
   "main": "mocha",
   "directories": {
-    "test": "test"
+    "test": "test",
+    "lib": "lib"
   },
   "scripts": {
     "test": "mocha"
@@ -12,6 +13,7 @@
   "author": "Marc Kupietz",
   "license": "BSD-2-Clause",
   "dependencies": {
+    "KorAPRC": "file:./lib/korap_rc.ts",
     "mocha": "^10.1.0",
     "should": "^13.2.3"
   },
diff --git a/test/korap-ui.js b/test/korap-ui.js
index 3f27386..8d5a819 100644
--- a/test/korap-ui.js
+++ b/test/korap-ui.js
@@ -8,54 +8,7 @@
 const KORAP_LOGIN =  process.env.KORAP_LOGIN || "user2";
 const KORAP_PWD = process.env.KORAP_PWD || "password2";
 const KORAP_QUERIES = "geht"
-// const korap_rc = require('../lib/korap_rc.js');
-
-async function KorAPlogin(page, username, password) {
-    await page.goto(KORAP_URL, { waitUntil: 'networkidle0' });
-    const username_field = await page.$("body > aside > div > fieldset > form > input[type=text]")
-
-    if (username_field != null) {
-        await username_field.type(username);
-        await page.keyboard.press("Tab")
-        await page.keyboard.type(password)
-        await page.keyboard.press("Enter")
-    }
-
-    await page.waitForNavigation({ waitUntil: 'networkidle2' });
-    logout = await page.$("body > header > div > a[class=logout]")
-    if (logout == null) {
-        return false
-    }
-
-    let value = await page.evaluate(logout => logout.textContent, logout)
-    if (!value.match(/(Abmelden|Logout)/)) {
-        return false
-    }
-    return true
-}
-
-async function KorAPlogout(page) {
-    const logout_button = await page.$("a[class=logout]")
-    if (logout_button == null) {
-        return false
-    }
-    await page.click("a[class=logout]")
-    const username_field = await page.$("body > aside > div > fieldset > form > input[type=text]")
-    assert.notEqual(username_field, null)
-    return true
-}
-
-async function search(page, query) {
-    const query_field = await page.$("body > header > form > div > input[name=q]")
-    assert.notEqual(query_field, null)
-    await query_field.type(query)
-    await page.keyboard.press("Enter")
-    await page.waitForNavigation();
-    const total_results = await page.$("#total-results")
-    assert.notEqual(total_results, null, "cannot find total results")
-    const hits = Number(await page.evaluate(total_results => total_results.textContent, total_results))
-    return hits
-}
+const korap_rc = require('../lib/korap_rc.js').new(KORAP_URL);
 
 describe('Running KorAP UI tests on ' + KORAP_URL, () => {
     const screenshot = 'screenshot.png'
@@ -71,13 +24,13 @@
 
     it('Login into KorAP with incorrect credentials fails',
         (async () => {
-            const login_result = await KorAPlogin(page, KORAP_LOGIN, KORAP_PWD + "*")
+            const login_result = await  korap_rc.login(page, KORAP_LOGIN, KORAP_PWD + "*")
             login_result.should.be.false
         })).timeout(10000)
 
     it('Login into KorAP with correct credentials succeeds',
         (async () => {
-            const login_result = await KorAPlogin(page, KORAP_LOGIN, KORAP_PWD)
+            const login_result = await korap_rc.login(page, KORAP_LOGIN, KORAP_PWD)
             login_result.should.be.true
         })).timeout(10000)
 
@@ -85,20 +38,15 @@
 
     it('Search for "' + KORAP_QUERIES + '" has approx. ' + expected_hits + ' hits',
         (async () => {
-            glimpse = await page.$("input[name=cutoff]")
-            glimpse_value = await (await glimpse.getProperty('checked')).jsonValue()
-            if (glimpse_value) {
-                glimpse = await page.$("input[name=cutoff]")
-                await page.click("#glimpse")
-            }
-            const hits = await search(page, KORAP_QUERIES)
+            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)
 
     it('Logout works',
         (async () => {
-            const logout_result = await KorAPlogout(page)
+            const logout_result = await korap_rc.logout(page)
             logout_result.should.be.true
         })).timeout(10000)
 
