From 0d47af4c4788fd7285f278371168392f9e299354 Mon Sep 17 00:00:00 2001 From: kkalev Date: Sun, 26 Nov 2023 13:21:23 +0200 Subject: [PATCH] add support for simple-cas --- README.md | 3 +++ login.js | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 239e898..5dadee7 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,9 @@ console.log(url[0]); * Environment variables - `CAS_USER`: Username (default `gunetdemo`) - `CAS_PASSWORD`: Password (default `gunetdemo`) + - `CAS_TYPE`: The CAS type. Can be one of: + * `cas`: If using Apereo CAS (the default) + * `simple-cas`: If using the gunet/simpleidentity `simple-cas` Docker container * Show module version: `docker run --rm ghcr.io/gunet/puppeteer npm list` * General Run: `docker run -it --cap-add=SYS_ADMIN --rm ghcr.io/gunet/puppeteer node --unhandled-rejections=strict ` * Specific scenarios: diff --git a/login.js b/login.js index ae94e45..dd69908 100644 --- a/login.js +++ b/login.js @@ -11,6 +11,11 @@ console.log(url[0]); await gunet.loginWith(page, `${process.env.CAS_USER}`, `${process.env.CAS_PASSWORD}`); await gunet.assertTicketGrantingCookie(page); await page.waitForTimeout(2000) - await gunet.assertInnerText(page, '#content div h2', "Επιτυχής Σύνδεση"); + if (process.env.CAS_TYPE === 'cas') { + await gunet.assertInnerText(page, '#content div h2', "Επιτυχής Σύνδεση"); + } + else if (process.env.CAS_TYPE === 'simple-cas') { + await gunet.assertInnerText(page, '#content div h2', "Log In Successful"); + } await browser.close(); })();