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(); })();